@openfin/cloud-interop-core-api 0.0.1-alpha.ca42c10 → 0.0.1-alpha.ec59187
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/index.cjs +9 -0
- package/dist/index.mjs +9 -0
- package/dist/interfaces.d.ts +7 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ class CloudInteropAPI {
|
|
|
31
31
|
#sessionDetails;
|
|
32
32
|
#mqttClient;
|
|
33
33
|
#reconnectRetryLimit = 30;
|
|
34
|
+
#keepAliveIntervalSeconds = 30;
|
|
34
35
|
#logger = (level, message) => {
|
|
35
36
|
console[level](message);
|
|
36
37
|
};
|
|
@@ -60,6 +61,7 @@ class CloudInteropAPI {
|
|
|
60
61
|
this.#validateConnectParams(parameters);
|
|
61
62
|
this.#connectionParams = parameters;
|
|
62
63
|
this.#reconnectRetryLimit = parameters.reconnectRetryLimit || this.#reconnectRetryLimit;
|
|
64
|
+
this.#keepAliveIntervalSeconds = parameters.keepAliveIntervalSeconds || this.#keepAliveIntervalSeconds;
|
|
63
65
|
this.#logger = parameters.logger || this.#logger;
|
|
64
66
|
const { sourceId, platformId } = this.#connectionParams;
|
|
65
67
|
try {
|
|
@@ -75,6 +77,7 @@ class CloudInteropAPI {
|
|
|
75
77
|
this.#sessionDetails = createSessionResponse.data;
|
|
76
78
|
const sessionRootTopic = this.#sessionDetails.sessionRootTopic;
|
|
77
79
|
const clientOptions = {
|
|
80
|
+
keepalive: this.#keepAliveIntervalSeconds,
|
|
78
81
|
clientId: this.#sessionDetails.sessionId,
|
|
79
82
|
clean: true,
|
|
80
83
|
protocolVersion: 5,
|
|
@@ -253,6 +256,12 @@ class CloudInteropAPI {
|
|
|
253
256
|
if (!parameters) {
|
|
254
257
|
throw new Error('Connect parameters must be provided');
|
|
255
258
|
}
|
|
259
|
+
if (!parameters.sourceId) {
|
|
260
|
+
throw new Error('sourceId must be provided');
|
|
261
|
+
}
|
|
262
|
+
if (!parameters.platformId) {
|
|
263
|
+
throw new Error('platformId must be provided');
|
|
264
|
+
}
|
|
256
265
|
if (parameters.authenticationType === 'jwt' &&
|
|
257
266
|
(!parameters.jwtAuthenticationParameters?.jwtRequestCallback || !parameters.jwtAuthenticationParameters?.authenticationId)) {
|
|
258
267
|
throw new Error('jwtAuthenticationParameters must be provided when using jwt authentication');
|
package/dist/index.mjs
CHANGED
|
@@ -3795,6 +3795,7 @@ class CloudInteropAPI {
|
|
|
3795
3795
|
#sessionDetails;
|
|
3796
3796
|
#mqttClient;
|
|
3797
3797
|
#reconnectRetryLimit = 30;
|
|
3798
|
+
#keepAliveIntervalSeconds = 30;
|
|
3798
3799
|
#logger = (level, message) => {
|
|
3799
3800
|
console[level](message);
|
|
3800
3801
|
};
|
|
@@ -3824,6 +3825,7 @@ class CloudInteropAPI {
|
|
|
3824
3825
|
this.#validateConnectParams(parameters);
|
|
3825
3826
|
this.#connectionParams = parameters;
|
|
3826
3827
|
this.#reconnectRetryLimit = parameters.reconnectRetryLimit || this.#reconnectRetryLimit;
|
|
3828
|
+
this.#keepAliveIntervalSeconds = parameters.keepAliveIntervalSeconds || this.#keepAliveIntervalSeconds;
|
|
3827
3829
|
this.#logger = parameters.logger || this.#logger;
|
|
3828
3830
|
const { sourceId, platformId } = this.#connectionParams;
|
|
3829
3831
|
try {
|
|
@@ -3839,6 +3841,7 @@ class CloudInteropAPI {
|
|
|
3839
3841
|
this.#sessionDetails = createSessionResponse.data;
|
|
3840
3842
|
const sessionRootTopic = this.#sessionDetails.sessionRootTopic;
|
|
3841
3843
|
const clientOptions = {
|
|
3844
|
+
keepalive: this.#keepAliveIntervalSeconds,
|
|
3842
3845
|
clientId: this.#sessionDetails.sessionId,
|
|
3843
3846
|
clean: true,
|
|
3844
3847
|
protocolVersion: 5,
|
|
@@ -4017,6 +4020,12 @@ class CloudInteropAPI {
|
|
|
4017
4020
|
if (!parameters) {
|
|
4018
4021
|
throw new Error('Connect parameters must be provided');
|
|
4019
4022
|
}
|
|
4023
|
+
if (!parameters.sourceId) {
|
|
4024
|
+
throw new Error('sourceId must be provided');
|
|
4025
|
+
}
|
|
4026
|
+
if (!parameters.platformId) {
|
|
4027
|
+
throw new Error('platformId must be provided');
|
|
4028
|
+
}
|
|
4020
4029
|
if (parameters.authenticationType === 'jwt' &&
|
|
4021
4030
|
(!parameters.jwtAuthenticationParameters?.jwtRequestCallback || !parameters.jwtAuthenticationParameters?.authenticationId)) {
|
|
4022
4031
|
throw new Error('jwtAuthenticationParameters must be provided when using jwt authentication');
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -9,27 +9,27 @@ export type CloudInteropLogger = (level: LogLevel, message: string) => void;
|
|
|
9
9
|
export type ConnectParameters = {
|
|
10
10
|
/**
|
|
11
11
|
* ID for a group of shared applications.
|
|
12
|
+
* This acts as a namespace for the interop messages that allows separation of messages between different groups of applications for the same user
|
|
12
13
|
*/
|
|
13
14
|
platformId: string;
|
|
14
15
|
/**
|
|
15
16
|
* An identifier for the source environment e.g. a hostname, a browser name etc.
|
|
16
17
|
*/
|
|
17
|
-
sourceId
|
|
18
|
+
sourceId: string;
|
|
18
19
|
/**
|
|
19
20
|
* A display name for the source environment e.g. Andys Mobile
|
|
20
21
|
*/
|
|
21
22
|
sourceDisplayName?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Specifies an optional extra divider to use that allows separation of interop messages for the
|
|
24
|
-
* same user
|
|
25
|
-
* defaults to "default"
|
|
26
|
-
*/
|
|
27
|
-
realm?: string;
|
|
28
23
|
/**
|
|
29
24
|
* The maximum number of times to retry connecting to the cloud interop service when the connection is dropped
|
|
30
25
|
* defaults to 30
|
|
31
26
|
*/
|
|
32
27
|
reconnectRetryLimit?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies how often keep alive messages should be sent to the cloud interop service in seconds
|
|
30
|
+
* defaults to 30
|
|
31
|
+
*/
|
|
32
|
+
keepAliveIntervalSeconds?: number;
|
|
33
33
|
/**
|
|
34
34
|
* Optional function to call with any logging messages to allow integration with the host application's logging
|
|
35
35
|
*
|