@openfin/cloud-interop 0.2.0 → 0.4.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/README.md +10 -4
- package/dist/index.js +4 -5
- package/dist/interfaces.d.ts +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -6,6 +6,10 @@ Overrides are passed to `fin.Platform.init` when initializing a platform or to `
|
|
6
6
|
|
7
7
|
Once overriden the `InteropBroker` will connect to Cloud Interop. `Context` will be sent to the Cloud Interop server and the broker will receive `Context` updates from other any other connected brokers in the shared session.
|
8
8
|
|
9
|
+
## Auth
|
10
|
+
|
11
|
+
Using the service currently requires user credentials provided by OpenFin, please contact support@openfin.co.
|
12
|
+
|
9
13
|
## Usage
|
10
14
|
|
11
15
|
In a Platform:
|
@@ -15,8 +19,9 @@ import { cloudInteropOverride } from "@openfin/cloud-interop";
|
|
15
19
|
import { ExampleOverride } from "./example";
|
16
20
|
|
17
21
|
const cloudConfig = {
|
18
|
-
userId: "andy",
|
19
|
-
|
22
|
+
userId: "andy", // Credentials provided by OpenFin
|
23
|
+
password: "asdf1234", // Credentials provided by OpenFin
|
24
|
+
platformId: "8cef8205-d5a8-41c4-b368-47475b32c019", // Shared identifier for apps that should communicate
|
20
25
|
url: "<CLOUD_INTEROP_SERVER_URL>",
|
21
26
|
sourceId: fin.me.identity.uuid,
|
22
27
|
source: "Desktop",
|
@@ -36,8 +41,9 @@ When creating an `InteropBroker` directly:
|
|
36
41
|
import { cloudInteropOverride } from "@openfin/cloud-interop";
|
37
42
|
|
38
43
|
const cloudConfig = {
|
39
|
-
userId: "andy",
|
40
|
-
|
44
|
+
userId: "andy", // Credentials provided by OpenFin
|
45
|
+
password: "asdf1234", // Credentials provided by OpenFin
|
46
|
+
platformId: "8cef8205-d5a8-41c4-b368-47475b32c019", // Shared identifier for apps that should communicate
|
41
47
|
url: "<CLOUD_INTEROP_SERVER_URL>",
|
42
48
|
sourceId: fin.me.identity.uuid,
|
43
49
|
source: "Desktop",
|
package/dist/index.js
CHANGED
@@ -3279,7 +3279,7 @@ class CloudInteropAPI {
|
|
3279
3279
|
return this._mqttClient;
|
3280
3280
|
}
|
3281
3281
|
async connect(params) {
|
3282
|
-
const { userId, sourceId, platformId } = params;
|
3282
|
+
const { userId, password, sourceId, platformId } = params;
|
3283
3283
|
let connectResponse;
|
3284
3284
|
try {
|
3285
3285
|
connectResponse = await axios.post(`${this.connectParams.url}/sessions`, {
|
@@ -3307,10 +3307,9 @@ class CloudInteropAPI {
|
|
3307
3307
|
qos: 0,
|
3308
3308
|
retain: false
|
3309
3309
|
},
|
3310
|
+
username: userId,
|
3311
|
+
password
|
3310
3312
|
};
|
3311
|
-
if (connectResponse.data.mqttToken) {
|
3312
|
-
clientOptions.username = connectResponse.data.mqttToken;
|
3313
|
-
}
|
3314
3313
|
this._mqttClient = await mqtt.connectAsync(connectResponse.data.mqttUrl, clientOptions);
|
3315
3314
|
this._sessionDetails = connectResponse.data;
|
3316
3315
|
console.log(`Cloud Interop successfully connected to ${this.connectParams.url}`);
|
@@ -3424,7 +3423,7 @@ async function cloudInteropOverride(config) {
|
|
3424
3423
|
// @ts-expect-error
|
3425
3424
|
const version = await fin.System.getVersion();
|
3426
3425
|
const [major, chromium, api, build] = version.split('.').map((v) => parseInt(v));
|
3427
|
-
if (major < 37 || build < 38) {
|
3426
|
+
if (major < 37 || major === 37 && (chromium < 122 && build < 38)) {
|
3428
3427
|
throw new Error(`Cloud Interop requires runtime version 37.121.80.38+ when running in OpenFin.`);
|
3429
3428
|
}
|
3430
3429
|
}
|
package/dist/interfaces.d.ts
CHANGED
@@ -7,12 +7,15 @@ export interface ConnectParams {
|
|
7
7
|
*/
|
8
8
|
url: string;
|
9
9
|
/**
|
10
|
-
* The user
|
11
|
-
* Note: Might be the sub from a openid JWT
|
10
|
+
* The user to connect as. Credentials provided by OpenFin.
|
12
11
|
*/
|
13
12
|
userId: string;
|
14
13
|
/**
|
15
|
-
*
|
14
|
+
* Password for the user. Credentials provided by OpenFin.
|
15
|
+
*/
|
16
|
+
password: string;
|
17
|
+
/**
|
18
|
+
* ID for a group of shared applications.
|
16
19
|
*/
|
17
20
|
platformId: string;
|
18
21
|
/**
|