@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.
Files changed (224) hide show
  1. package/dist/dts/auth/auth.d.ts.map +1 -1
  2. package/dist/dts/connect/connect.d.ts +11 -1
  3. package/dist/dts/connect/connect.d.ts.map +1 -1
  4. package/dist/dts/connect/connect.events.d.ts +173 -0
  5. package/dist/dts/connect/connect.events.d.ts.map +1 -0
  6. package/dist/dts/connect/http.connect.d.ts +1 -0
  7. package/dist/dts/connect/http.connect.d.ts.map +1 -1
  8. package/dist/dts/connect/index.d.ts +2 -0
  9. package/dist/dts/connect/index.d.ts.map +1 -1
  10. package/dist/dts/connect/message.d.ts +51 -0
  11. package/dist/dts/connect/message.d.ts.map +1 -1
  12. package/dist/dts/connect/socket.d.ts +72 -8
  13. package/dist/dts/connect/socket.d.ts.map +1 -1
  14. package/dist/dts/connect/socket.status.d.ts +79 -0
  15. package/dist/dts/connect/socket.status.d.ts.map +1 -0
  16. package/dist/dts/datasource/datasource.d.ts +9 -0
  17. package/dist/dts/datasource/datasource.d.ts.map +1 -1
  18. package/dist/dts/fdc3/fdc3.d.ts +17 -1
  19. package/dist/dts/fdc3/fdc3.d.ts.map +1 -1
  20. package/dist/dts/index.d.ts +1 -0
  21. package/dist/dts/index.d.ts.map +1 -1
  22. package/dist/dts/networkMonitor/config.d.ts +56 -0
  23. package/dist/dts/networkMonitor/config.d.ts.map +1 -0
  24. package/dist/dts/networkMonitor/index.d.ts +4 -0
  25. package/dist/dts/networkMonitor/index.d.ts.map +1 -0
  26. package/dist/dts/networkMonitor/service.d.ts +193 -0
  27. package/dist/dts/networkMonitor/service.d.ts.map +1 -0
  28. package/dist/dts/networkMonitor/types.d.ts +133 -0
  29. package/dist/dts/networkMonitor/types.d.ts.map +1 -0
  30. package/dist/dts/testing/mocks/connect/connect.d.ts +1 -0
  31. package/dist/dts/testing/mocks/connect/connect.d.ts.map +1 -1
  32. package/dist/dts/testing/mocks/connect/socket.d.ts +5 -1
  33. package/dist/dts/testing/mocks/connect/socket.d.ts.map +1 -1
  34. package/dist/dts/testing/mocks/datasource/datasource.d.ts +1 -0
  35. package/dist/dts/testing/mocks/datasource/datasource.d.ts.map +1 -1
  36. package/dist/dts/user/user.d.ts +15 -0
  37. package/dist/dts/user/user.d.ts.map +1 -1
  38. package/dist/esm/auth/auth.js +5 -2
  39. package/dist/esm/connect/connect.events.js +113 -0
  40. package/dist/esm/connect/connect.js +30 -8
  41. package/dist/esm/connect/http.connect.js +6 -0
  42. package/dist/esm/connect/index.js +2 -0
  43. package/dist/esm/connect/message.js +25 -4
  44. package/dist/esm/connect/socket.js +113 -44
  45. package/dist/esm/connect/socket.status.js +119 -0
  46. package/dist/esm/datasource/datasource.js +18 -8
  47. package/dist/esm/fdc3/fdc3.js +4 -4
  48. package/dist/esm/index.js +1 -0
  49. package/dist/esm/networkMonitor/config.js +46 -0
  50. package/dist/esm/networkMonitor/index.js +3 -0
  51. package/dist/esm/networkMonitor/service.js +432 -0
  52. package/dist/esm/networkMonitor/types.js +5 -0
  53. package/dist/esm/testing/mocks/connect/connect.js +3 -0
  54. package/dist/esm/testing/mocks/connect/socket.js +1 -1
  55. package/dist/esm/testing/mocks/datasource/datasource.js +1 -0
  56. package/dist/esm/user/user.js +22 -1
  57. package/dist/foundation-comms.api.json +14711 -8166
  58. package/dist/foundation-comms.d.ts +841 -13
  59. package/docs/api/foundation-comms.commitevent.md +14 -0
  60. package/docs/api/foundation-comms.commiteventdetail.md +17 -0
  61. package/docs/api/foundation-comms.commiteventtype.md +12 -0
  62. package/docs/api/foundation-comms.connect.getmorecolumns.md +26 -0
  63. package/docs/api/foundation-comms.connect.md +1 -0
  64. package/docs/api/foundation-comms.connectevents.addcommitlistener.md +24 -0
  65. package/docs/api/foundation-comms.connectevents.addmetadatalistener.md +24 -0
  66. package/docs/api/foundation-comms.connectevents.addstreamlistener.md +25 -0
  67. package/docs/api/foundation-comms.connectevents.md +22 -0
  68. package/docs/api/foundation-comms.connecteventsemitter.md +24 -0
  69. package/docs/api/foundation-comms.connecteventsemitter.oncommitevent.md +25 -0
  70. package/docs/api/foundation-comms.connecteventsemitter.onmetadataevent.md +26 -0
  71. package/docs/api/foundation-comms.connecteventsemitter.onstreamcompleteevent.md +24 -0
  72. package/docs/api/foundation-comms.connecteventsemitter.onstreamevent.md +27 -0
  73. package/docs/api/foundation-comms.currentuser.md +2 -0
  74. package/docs/api/foundation-comms.currentuser.set.md +22 -0
  75. package/docs/api/foundation-comms.currentuser.unset.md +15 -0
  76. package/docs/api/foundation-comms.datasource.destroy.md +17 -0
  77. package/docs/api/foundation-comms.datasource.md +1 -0
  78. package/docs/api/foundation-comms.defaultconnect._constructor_.md +2 -1
  79. package/docs/api/foundation-comms.defaultconnect.getmorecolumns.md +22 -0
  80. package/docs/api/foundation-comms.defaultconnect.md +2 -1
  81. package/docs/api/foundation-comms.defaultconnectevents.addcommitlistener.md +24 -0
  82. package/docs/api/foundation-comms.defaultconnectevents.addmetadatalistener.md +24 -0
  83. package/docs/api/foundation-comms.defaultconnectevents.addstreamlistener.md +25 -0
  84. package/docs/api/foundation-comms.defaultconnectevents.md +27 -0
  85. package/docs/api/foundation-comms.defaultconnectevents.oncommitevent.md +25 -0
  86. package/docs/api/foundation-comms.defaultconnectevents.onmetadataevent.md +26 -0
  87. package/docs/api/foundation-comms.defaultconnectevents.onstreamcompleteevent.md +24 -0
  88. package/docs/api/foundation-comms.defaultconnectevents.onstreamevent.md +27 -0
  89. package/docs/api/foundation-comms.defaultdatasource.destroy.md +17 -0
  90. package/docs/api/foundation-comms.defaultdatasource.md +1 -0
  91. package/docs/api/foundation-comms.defaulthttpconnect.getmorecolumns.md +22 -0
  92. package/docs/api/foundation-comms.defaulthttpconnect.md +1 -0
  93. package/docs/api/foundation-comms.defaultmessagebuilder._constructor_.md +21 -0
  94. package/docs/api/foundation-comms.defaultmessagebuilder.createchangepasswordmessage.md +24 -0
  95. package/docs/api/foundation-comms.defaultmessagebuilder.createcommitmessage.md +23 -0
  96. package/docs/api/foundation-comms.defaultmessagebuilder.createdatalogoffmessage.md +22 -0
  97. package/docs/api/foundation-comms.defaultmessagebuilder.createdatalogonmessage.md +23 -0
  98. package/docs/api/foundation-comms.defaultmessagebuilder.createforgotpasswordmessage.md +24 -0
  99. package/docs/api/foundation-comms.defaultmessagebuilder.createforgotpasswordtokenmessage.md +25 -0
  100. package/docs/api/foundation-comms.defaultmessagebuilder.createhttpheadersfrommessage.md +23 -0
  101. package/docs/api/foundation-comms.defaultmessagebuilder.createloginmessage.md +22 -0
  102. package/docs/api/foundation-comms.defaultmessagebuilder.createlogoutmessage.md +22 -0
  103. package/docs/api/foundation-comms.defaultmessagebuilder.createmetarequestmessage.md +23 -0
  104. package/docs/api/foundation-comms.defaultmessagebuilder.createmorecolumnsmessage.md +22 -0
  105. package/docs/api/foundation-comms.defaultmessagebuilder.createmorerowsmessage.md +22 -0
  106. package/docs/api/foundation-comms.defaultmessagebuilder.createrefreshtokenmessage.md +15 -0
  107. package/docs/api/foundation-comms.defaultmessagebuilder.createrequestmessage.md +23 -0
  108. package/docs/api/foundation-comms.defaultmessagebuilder.createresourcesmessage.md +22 -0
  109. package/docs/api/foundation-comms.defaultmessagebuilder.md +41 -0
  110. package/docs/api/foundation-comms.defaultnetworkmonitor.addresource.md +23 -0
  111. package/docs/api/foundation-comms.defaultnetworkmonitor.create.md +16 -0
  112. package/docs/api/foundation-comms.defaultnetworkmonitor.destroy.md +16 -0
  113. package/docs/api/foundation-comms.defaultnetworkmonitor.md +31 -0
  114. package/docs/api/foundation-comms.defaultnetworkmonitor.removeresource.md +22 -0
  115. package/docs/api/foundation-comms.defaultnetworkmonitor.runallchecks.md +11 -0
  116. package/docs/api/foundation-comms.defaultnetworkmonitor.status.md +12 -0
  117. package/docs/api/foundation-comms.defaultnetworkmonitorconfig.md +13 -0
  118. package/docs/api/foundation-comms.defaultsocket._constructor_.md +24 -0
  119. package/docs/api/foundation-comms.defaultsocket.connect.md +24 -0
  120. package/docs/api/foundation-comms.defaultsocket.hasvalidsession.md +13 -0
  121. package/docs/api/foundation-comms.defaultsocket.isconfigured.md +11 -0
  122. package/docs/api/foundation-comms.defaultsocket.isconnected.md +11 -0
  123. package/docs/api/foundation-comms.defaultsocket.isconnectedsubject.md +11 -0
  124. package/docs/api/foundation-comms.defaultsocket.isconnecting.md +11 -0
  125. package/docs/api/foundation-comms.defaultsocket.isdisconnected.md +11 -0
  126. package/docs/api/foundation-comms.defaultsocket.isdisconnectedbyserver.md +11 -0
  127. package/docs/api/foundation-comms.defaultsocket.isreconnecting.md +11 -0
  128. package/docs/api/foundation-comms.defaultsocket.md +44 -0
  129. package/docs/api/foundation-comms.defaultsocket.reset.md +15 -0
  130. package/docs/api/foundation-comms.defaultsocket.send.md +23 -0
  131. package/docs/api/foundation-comms.defaultsocket.sendforstream.md +25 -0
  132. package/docs/api/foundation-comms.defaultsocket.socketmessages.md +11 -0
  133. package/docs/api/foundation-comms.defaultsocketstatus.closedclean.md +11 -0
  134. package/docs/api/foundation-comms.defaultsocketstatus.closedcode.md +11 -0
  135. package/docs/api/foundation-comms.defaultsocketstatus.closedreason.md +11 -0
  136. package/docs/api/foundation-comms.defaultsocketstatus.hasvalidsession.md +11 -0
  137. package/docs/api/foundation-comms.defaultsocketstatus.isconfigured.md +11 -0
  138. package/docs/api/foundation-comms.defaultsocketstatus.isconnected.md +11 -0
  139. package/docs/api/foundation-comms.defaultsocketstatus.isconnectedchanged.md +15 -0
  140. package/docs/api/foundation-comms.defaultsocketstatus.isconnectedsubject.md +11 -0
  141. package/docs/api/foundation-comms.defaultsocketstatus.isconnecting.md +11 -0
  142. package/docs/api/foundation-comms.defaultsocketstatus.isdisconnected.md +11 -0
  143. package/docs/api/foundation-comms.defaultsocketstatus.isdisconnectedbyserver.md +11 -0
  144. package/docs/api/foundation-comms.defaultsocketstatus.isreconnecting.md +11 -0
  145. package/docs/api/foundation-comms.defaultsocketstatus.isreconnectingchanged.md +15 -0
  146. package/docs/api/foundation-comms.defaultsocketstatus.md +42 -0
  147. package/docs/api/foundation-comms.defaultsocketstatus.onclose.md +22 -0
  148. package/docs/api/foundation-comms.defaultsocketstatus.reconnectionlimitreached.md +11 -0
  149. package/docs/api/foundation-comms.defaultsocketstatus.resetclosedstate.md +15 -0
  150. package/docs/api/foundation-comms.defaultsocketstatus.serialize.md +15 -0
  151. package/docs/api/foundation-comms.genesisconnectevents.md +18 -0
  152. package/docs/api/foundation-comms.getnetworkmonitor.md +30 -0
  153. package/docs/api/foundation-comms.getsocket.md +30 -0
  154. package/docs/api/foundation-comms.getsocketstatus.md +30 -0
  155. package/docs/api/foundation-comms.md +39 -0
  156. package/docs/api/foundation-comms.messagebuilder.createmorecolumnsmessage.md +30 -0
  157. package/docs/api/foundation-comms.messagebuilder.md +1 -0
  158. package/docs/api/foundation-comms.messagehaserrorcode.md +13 -0
  159. package/docs/api/foundation-comms.messagetype.md +2 -0
  160. package/docs/api/foundation-comms.metadataevent.md +14 -0
  161. package/docs/api/foundation-comms.metadataeventdetail.md +18 -0
  162. package/docs/api/foundation-comms.metadataeventtype.md +12 -0
  163. package/docs/api/foundation-comms.monitoredresource.md +15 -0
  164. package/docs/api/foundation-comms.monitoredresourcechecks.md +15 -0
  165. package/docs/api/foundation-comms.monitoredresourcechecksresult.isconnected.md +11 -0
  166. package/docs/api/foundation-comms.monitoredresourcechecksresult.lastmessage.md +11 -0
  167. package/docs/api/foundation-comms.monitoredresourcechecksresult.lastupdated.md +11 -0
  168. package/docs/api/foundation-comms.monitoredresourcechecksresult.md +23 -0
  169. package/docs/api/foundation-comms.monitoredresourcechecksresult.timeout.md +11 -0
  170. package/docs/api/foundation-comms.monitoredresourcedatalogon.md +15 -0
  171. package/docs/api/foundation-comms.monitoredresourcemetadata.md +15 -0
  172. package/docs/api/foundation-comms.networklogger.md +12 -0
  173. package/docs/api/foundation-comms.networkmonitor.addresource.md +23 -0
  174. package/docs/api/foundation-comms.networkmonitor.create.md +15 -0
  175. package/docs/api/foundation-comms.networkmonitor.destroy.md +15 -0
  176. package/docs/api/foundation-comms.networkmonitor.md +34 -0
  177. package/docs/api/foundation-comms.networkmonitor.removeresource.md +22 -0
  178. package/docs/api/foundation-comms.networkmonitor.runallchecks.md +23 -0
  179. package/docs/api/foundation-comms.networkmonitor.status.md +11 -0
  180. package/docs/api/foundation-comms.networkmonitorconfig.checkinterval.md +13 -0
  181. package/docs/api/foundation-comms.networkmonitorconfig.checktimeout.md +13 -0
  182. package/docs/api/foundation-comms.networkmonitorconfig.documentevents.md +13 -0
  183. package/docs/api/foundation-comms.networkmonitorconfig.eventemitter.md +13 -0
  184. package/docs/api/foundation-comms.networkmonitorconfig.genesisconnectevents.md +13 -0
  185. package/docs/api/foundation-comms.networkmonitorconfig.md +27 -0
  186. package/docs/api/foundation-comms.networkmonitorconfig.resourcechecks.md +13 -0
  187. package/docs/api/foundation-comms.networkmonitorconfig.resourcedatalogon.md +18 -0
  188. package/docs/api/foundation-comms.networkmonitorconfig.windowevents.md +13 -0
  189. package/docs/api/foundation-comms.resourcehealth.md +19 -0
  190. package/docs/api/foundation-comms.serializedsocketstatus.closedclean.md +11 -0
  191. package/docs/api/foundation-comms.serializedsocketstatus.closedcode.md +11 -0
  192. package/docs/api/foundation-comms.serializedsocketstatus.closedreason.md +11 -0
  193. package/docs/api/foundation-comms.serializedsocketstatus.hasvalidsession.md +11 -0
  194. package/docs/api/foundation-comms.serializedsocketstatus.isconfigured.md +13 -0
  195. package/docs/api/foundation-comms.serializedsocketstatus.isconnected.md +11 -0
  196. package/docs/api/foundation-comms.serializedsocketstatus.isconnecting.md +11 -0
  197. package/docs/api/foundation-comms.serializedsocketstatus.isdisconnected.md +11 -0
  198. package/docs/api/foundation-comms.serializedsocketstatus.isdisconnectedbyserver.md +11 -0
  199. package/docs/api/foundation-comms.serializedsocketstatus.isreconnecting.md +11 -0
  200. package/docs/api/foundation-comms.serializedsocketstatus.md +30 -0
  201. package/docs/api/foundation-comms.serializedsocketstatus.reconnectionlimitreached.md +11 -0
  202. package/docs/api/foundation-comms.socket.md +3 -11
  203. package/docs/api/foundation-comms.socket.sendforstream.md +2 -1
  204. package/docs/api/{foundation-comms.socket.isconnectedsubject.md → foundation-comms.socketstatus.isconnectedsubject.md} +2 -2
  205. package/docs/api/foundation-comms.socketstatus.md +28 -0
  206. package/docs/api/foundation-comms.socketstatus.onclose.md +22 -0
  207. package/docs/api/foundation-comms.socketstatus.serialize.md +15 -0
  208. package/docs/api/foundation-comms.streamcompleteevent.md +14 -0
  209. package/docs/api/foundation-comms.streamcompleteeventtype.md +12 -0
  210. package/docs/api/foundation-comms.streamevent.md +14 -0
  211. package/docs/api/foundation-comms.streameventdetail.md +19 -0
  212. package/docs/api/foundation-comms.streameventfunctions.md +19 -0
  213. package/docs/api/foundation-comms.streameventtype.md +12 -0
  214. package/docs/api/foundation-comms.systemhealthchanged.md +13 -0
  215. package/docs/api/foundation-comms.systemhealthchangedevent.md +15 -0
  216. package/docs/api/foundation-comms.systemhealthstatus.md +29 -0
  217. package/docs/api/foundation-comms.user.md +2 -0
  218. package/docs/api/foundation-comms.user.set.md +22 -0
  219. package/docs/api/foundation-comms.user.unset.md +15 -0
  220. package/docs/api-report.md +520 -16
  221. package/package.json +13 -11
  222. package/docs/api/foundation-comms.socket.hasvalidsession.md +0 -11
  223. package/docs/api/foundation-comms.socket.isconnected.md +0 -11
  224. 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, volatile } from '@microsoft/fast-element';
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 ${this.options.resourceName} Datasource`);
65
+ logger.debug(`Initializing ${resourceName} Datasource`);
65
66
  const meta = yield this.connect
66
- .getMetadata(this.options.resourceName)
67
- .catch((e) => logger.error(`Metadata Fetch failed for ${options.resourceName}:`, e));
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 ${this.options.resourceName} is ready`);
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 = undefined;
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
- volatile
194
- ], DefaultDatasource.prototype, "stream", null);
203
+ observable
204
+ ], DefaultDatasource.prototype, "_stream", void 0);
195
205
  DefaultDatasource = __decorate([
196
206
  __param(0, Connect),
197
207
  __param(1, Auth),
@@ -10,7 +10,7 @@ import { logger } from '../utils';
10
10
  * The FDC3 implementation.
11
11
  * @internal
12
12
  */
13
- class FDC3Service {
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
- ], FDC3Service.prototype, "isReady", void 0);
74
+ ], DefaultFDC3.prototype, "isReady", void 0);
75
75
  /**
76
- * The DI token for the FDC3Service interface.
76
+ * The DI token for the FDC3 interface.
77
77
  * @internal
78
78
  */
79
- export const FDC3 = DI.createInterface((x) => x.singleton(FDC3Service));
79
+ export const FDC3 = DI.createInterface((x) => x.singleton(DefaultFDC3));
package/dist/esm/index.js CHANGED
@@ -5,6 +5,7 @@ export * from './credentialManager';
5
5
  export * from './datasource';
6
6
  export * from './fdc3';
7
7
  export * from './metadata';
8
+ export * from './networkMonitor';
8
9
  export * from './session';
9
10
  export * from './storage';
10
11
  export * from './testing';
@@ -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));
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export * from './config';
3
+ export * from './service';