@openfin/core 29.72.18 → 29.73.1
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/OpenFin.d.ts +40 -23
- package/package.json +1 -1
- package/src/api/application/Factory.js +3 -3
- package/src/api/application/index.js +7 -3
- package/src/api/base.js +18 -20
- package/src/api/external-application/index.js +7 -3
- package/src/api/fin.js +2 -2
- package/src/api/frame/Factory.js +2 -2
- package/src/api/frame/index.js +7 -3
- package/src/api/interappbus/channel/client.js +24 -26
- package/src/api/interappbus/channel/connection-manager.js +24 -26
- package/src/api/interappbus/channel/index.js +16 -18
- package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +24 -26
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
- package/src/api/interappbus/channel/provider.js +134 -139
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/InteropBroker.js +9 -9
- package/src/api/interop/InteropClient.js +38 -40
- package/src/api/interop/SessionContextGroupClient.js +22 -24
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +17 -0
- package/src/api/interop/fdc3/PrivateChannelClient.js +82 -0
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +40 -0
- package/src/api/interop/fdc3/PrivateChannelProvider.js +224 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -1
- package/src/api/interop/fdc3/fdc3-1.2.js +1 -27
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +20 -1
- package/src/api/interop/fdc3/fdc3-2.0.js +29 -4
- package/src/api/interop/fdc3/utils.d.ts +4 -0
- package/src/api/interop/fdc3/utils.js +112 -4
- package/src/api/interop/index.js +7 -3
- package/src/api/interop/utils.js +20 -14
- package/src/api/platform/Factory.js +5 -5
- package/src/api/platform/Instance.js +11 -12
- package/src/api/platform/index.js +7 -3
- package/src/api/platform/layout/Factory.js +18 -20
- package/src/api/platform/layout/Instance.d.ts +1 -1
- package/src/api/platform/layout/Instance.js +2 -2
- package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +17 -8
- package/src/api/platform/layout/controllers/tab-drag-controller.js +44 -22
- package/src/api/platform/layout/index.js +7 -3
- package/src/api/platform/layout/utils/bounds-observer.js +5 -3
- package/src/api/snapshot-source/Factory.js +1 -1
- package/src/api/snapshot-source/Instance.js +33 -35
- package/src/api/snapshot-source/index.js +7 -3
- package/src/api/snapshot-source/utils.js +2 -1
- package/src/api/view/Factory.js +2 -2
- package/src/api/view/Instance.d.ts +31 -1
- package/src/api/view/Instance.js +31 -1
- package/src/api/view/index.js +7 -3
- package/src/api/window/Factory.js +2 -2
- package/src/api/window/Instance.d.ts +3 -0
- package/src/api/window/Instance.js +3 -0
- package/src/api/window/index.js +7 -3
- package/src/environment/node-env.js +2 -2
- package/src/environment/openfin-env.js +15 -17
- package/src/fdc3.js +1 -1
- package/src/mock.js +1 -2
- package/src/transport/transport.js +26 -28
- package/src/transport/wire.d.ts +9 -7
- package/src/util/http.d.ts +1 -1
- package/src/util/http.js +16 -11
- package/src/util/normalize-config.js +5 -5
|
@@ -513,7 +513,7 @@ class InteropBroker extends base_1.Base {
|
|
|
513
513
|
*/
|
|
514
514
|
// eslint-disable-next-line class-methods-use-this
|
|
515
515
|
async handleFiredIntent(intent, clientIdentity) {
|
|
516
|
-
const warning = utils_1.generateOverrideWarning('fdc3.raiseIntent', 'InteropBroker.handleFiredIntent', clientIdentity, 'interopClient.fireIntent');
|
|
516
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.raiseIntent', 'InteropBroker.handleFiredIntent', clientIdentity, 'interopClient.fireIntent');
|
|
517
517
|
console.warn(warning);
|
|
518
518
|
throw new Error(utils_1.BROKER_ERRORS.fireIntent);
|
|
519
519
|
}
|
|
@@ -571,7 +571,7 @@ class InteropBroker extends base_1.Base {
|
|
|
571
571
|
*/
|
|
572
572
|
// eslint-disable-next-line class-methods-use-this
|
|
573
573
|
async handleInfoForIntent(options, clientIdentity) {
|
|
574
|
-
const warning = utils_1.generateOverrideWarning('fdc3.findIntent', 'InteropBroker.handleInfoForIntent', clientIdentity, 'interopClient.getInfoForIntent');
|
|
574
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.findIntent', 'InteropBroker.handleInfoForIntent', clientIdentity, 'interopClient.getInfoForIntent');
|
|
575
575
|
console.warn(warning);
|
|
576
576
|
throw new Error(utils_1.BROKER_ERRORS.getInfoForIntent);
|
|
577
577
|
}
|
|
@@ -586,7 +586,7 @@ class InteropBroker extends base_1.Base {
|
|
|
586
586
|
*/
|
|
587
587
|
// eslint-disable-next-line class-methods-use-this
|
|
588
588
|
async handleInfoForIntentsByContext(context, clientIdentity) {
|
|
589
|
-
const warning = utils_1.generateOverrideWarning('fdc3.findIntentsByContext', 'InteropBroker.handleInfoForIntentsByContext', clientIdentity, 'interopClient.getInfoForIntentsByContext');
|
|
589
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.findIntentsByContext', 'InteropBroker.handleInfoForIntentsByContext', clientIdentity, 'interopClient.getInfoForIntentsByContext');
|
|
590
590
|
console.warn(warning);
|
|
591
591
|
throw new Error(utils_1.BROKER_ERRORS.getInfoForIntentsByContext);
|
|
592
592
|
}
|
|
@@ -601,7 +601,7 @@ class InteropBroker extends base_1.Base {
|
|
|
601
601
|
*/
|
|
602
602
|
// eslint-disable-next-line class-methods-use-this
|
|
603
603
|
async handleFiredIntentForContext(contextForIntent, clientIdentity) {
|
|
604
|
-
const warning = utils_1.generateOverrideWarning('fdc3.raiseIntentForContext', 'InteropBroker.handleFiredIntentForContext', clientIdentity, 'interopClient.fireIntentForContext');
|
|
604
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.raiseIntentForContext', 'InteropBroker.handleFiredIntentForContext', clientIdentity, 'interopClient.fireIntentForContext');
|
|
605
605
|
console.warn(warning);
|
|
606
606
|
throw new Error(utils_1.BROKER_ERRORS.fireIntentForContext);
|
|
607
607
|
}
|
|
@@ -624,7 +624,7 @@ class InteropBroker extends base_1.Base {
|
|
|
624
624
|
*/
|
|
625
625
|
// eslint-disable-next-line class-methods-use-this
|
|
626
626
|
async fdc3HandleOpen({ app, context }, clientIdentity) {
|
|
627
|
-
const warning = utils_1.generateOverrideWarning('fdc3.open', 'InteropBroker.fdc3HandleOpen', clientIdentity);
|
|
627
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.open', 'InteropBroker.fdc3HandleOpen', clientIdentity);
|
|
628
628
|
console.warn(warning);
|
|
629
629
|
throw new Error(utils_1.BROKER_ERRORS.fdc3Open);
|
|
630
630
|
}
|
|
@@ -636,7 +636,7 @@ class InteropBroker extends base_1.Base {
|
|
|
636
636
|
*/
|
|
637
637
|
// eslint-disable-next-line class-methods-use-this
|
|
638
638
|
async fdc3HandleFindInstances(app, clientIdentity) {
|
|
639
|
-
const warning = utils_1.generateOverrideWarning('fdc3.open', 'InteropBroker.fdc3HandleFindInstances', clientIdentity);
|
|
639
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.open', 'InteropBroker.fdc3HandleFindInstances', clientIdentity);
|
|
640
640
|
console.warn(warning);
|
|
641
641
|
throw new Error(utils_1.BROKER_ERRORS.fdc3FindInstances);
|
|
642
642
|
}
|
|
@@ -648,7 +648,7 @@ class InteropBroker extends base_1.Base {
|
|
|
648
648
|
*/
|
|
649
649
|
// eslint-disable-next-line class-methods-use-this
|
|
650
650
|
async fdc3HandleGetAppMetadata(app, clientIdentity) {
|
|
651
|
-
const warning = utils_1.generateOverrideWarning('fdc3.getAppMetadata', 'InteropBroker.fdc3HandleGetAppMetadata', clientIdentity);
|
|
651
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.getAppMetadata', 'InteropBroker.fdc3HandleGetAppMetadata', clientIdentity);
|
|
652
652
|
console.warn(warning);
|
|
653
653
|
throw new Error(utils_1.BROKER_ERRORS.fdc3GetAppMetadata);
|
|
654
654
|
}
|
|
@@ -696,7 +696,7 @@ class InteropBroker extends base_1.Base {
|
|
|
696
696
|
*/
|
|
697
697
|
// eslint-disable-next-line class-methods-use-this
|
|
698
698
|
async fdc3HandleGetInfo(clientIdentity) {
|
|
699
|
-
const warning = utils_1.generateOverrideWarning('fdc3.getInfo', 'InteropBroker.fdc3GetInfo', clientIdentity);
|
|
699
|
+
const warning = (0, utils_1.generateOverrideWarning)('fdc3.getInfo', 'InteropBroker.fdc3GetInfo', clientIdentity);
|
|
700
700
|
console.warn(warning);
|
|
701
701
|
throw new Error(utils_1.BROKER_ERRORS.fdc3GetInfo);
|
|
702
702
|
}
|
|
@@ -971,7 +971,7 @@ class InteropBroker extends base_1.Base {
|
|
|
971
971
|
});
|
|
972
972
|
this.clientDisconnected(clientIdentity);
|
|
973
973
|
});
|
|
974
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-
|
|
974
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
975
975
|
// @ts-ignore
|
|
976
976
|
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
977
977
|
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _InteropClient_clientPromise, _InteropClient_sessionContextGroups;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
exports.InteropClient = void 0;
|
|
18
16
|
const base_1 = require("../base");
|
|
@@ -157,14 +155,14 @@ const utils_1 = require("./utils");
|
|
|
157
155
|
class InteropClient extends base_1.Base {
|
|
158
156
|
constructor(wire, name, interopConfig = {}) {
|
|
159
157
|
super(wire);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
__classPrivateFieldSet(this,
|
|
163
|
-
__classPrivateFieldSet(this,
|
|
158
|
+
_InteropClient_clientPromise.set(this, void 0);
|
|
159
|
+
_InteropClient_sessionContextGroups.set(this, void 0);
|
|
160
|
+
__classPrivateFieldSet(this, _InteropClient_sessionContextGroups, new Map(), "f");
|
|
161
|
+
__classPrivateFieldSet(this, _InteropClient_clientPromise, this.wire.environment.whenReady().then(() => {
|
|
164
162
|
return this.fin.InterApplicationBus.Channel.connect(`interop-broker-${name}`, {
|
|
165
163
|
payload: interopConfig
|
|
166
164
|
});
|
|
167
|
-
}));
|
|
165
|
+
}), "f");
|
|
168
166
|
}
|
|
169
167
|
/*
|
|
170
168
|
Client APIs
|
|
@@ -179,7 +177,7 @@ class InteropClient extends base_1.Base {
|
|
|
179
177
|
this.wire.sendAction('interop-client-set-context').catch((e) => {
|
|
180
178
|
// don't expose, analytics-only call
|
|
181
179
|
});
|
|
182
|
-
const client = await __classPrivateFieldGet(this,
|
|
180
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
183
181
|
return client.dispatch('setContext', { context });
|
|
184
182
|
}
|
|
185
183
|
/**
|
|
@@ -196,16 +194,16 @@ class InteropClient extends base_1.Base {
|
|
|
196
194
|
if (typeof handler !== 'function') {
|
|
197
195
|
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
198
196
|
}
|
|
199
|
-
const client = await __classPrivateFieldGet(this,
|
|
197
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
200
198
|
let handlerId;
|
|
201
199
|
if (contextType) {
|
|
202
|
-
handlerId = `invokeContextHandler-${contextType}-${utils_1.generateId()}`;
|
|
200
|
+
handlerId = `invokeContextHandler-${contextType}-${(0, utils_1.generateId)()}`;
|
|
203
201
|
console.warn(`Warning: By providing a contextType (${contextType}), you are using the experimental addContextHandler. To avoid issues, make sure you are adding your context handlers at the top level in your application.`);
|
|
204
202
|
}
|
|
205
203
|
else {
|
|
206
204
|
handlerId = 'invokeContextHandler';
|
|
207
205
|
}
|
|
208
|
-
const wrappedHandler = utils_1.wrapContextHandler(handler, handlerId);
|
|
206
|
+
const wrappedHandler = (0, utils_1.wrapContextHandler)(handler, handlerId);
|
|
209
207
|
client.register(handlerId, wrappedHandler);
|
|
210
208
|
await client.dispatch('contextHandlerRegistered', { handlerId, contextType });
|
|
211
209
|
return {
|
|
@@ -228,7 +226,7 @@ class InteropClient extends base_1.Base {
|
|
|
228
226
|
this.wire.sendAction('interop-client-get-context-groups').catch((e) => {
|
|
229
227
|
// don't expose, analytics-only call
|
|
230
228
|
});
|
|
231
|
-
const client = await __classPrivateFieldGet(this,
|
|
229
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
232
230
|
return client.dispatch('getContextGroups');
|
|
233
231
|
}
|
|
234
232
|
/**
|
|
@@ -247,7 +245,7 @@ class InteropClient extends base_1.Base {
|
|
|
247
245
|
this.wire.sendAction('interop-client-join-context-group').catch((e) => {
|
|
248
246
|
// don't expose, analytics-only call
|
|
249
247
|
});
|
|
250
|
-
const client = await __classPrivateFieldGet(this,
|
|
248
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
251
249
|
if (!contextGroupId) {
|
|
252
250
|
throw new Error('No contextGroupId specified for joinContextGroup.');
|
|
253
251
|
}
|
|
@@ -265,7 +263,7 @@ class InteropClient extends base_1.Base {
|
|
|
265
263
|
this.wire.sendAction('interop-client-remove-from-context-group').catch((e) => {
|
|
266
264
|
// don't expose, analytics-only call
|
|
267
265
|
});
|
|
268
|
-
const client = await __classPrivateFieldGet(this,
|
|
266
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
269
267
|
return client.dispatch('removeFromContextGroup', { target });
|
|
270
268
|
}
|
|
271
269
|
/**
|
|
@@ -279,7 +277,7 @@ class InteropClient extends base_1.Base {
|
|
|
279
277
|
this.wire.sendAction('interop-client-get-all-clients-in-context-group').catch((e) => {
|
|
280
278
|
// don't expose, analytics-only call
|
|
281
279
|
});
|
|
282
|
-
const client = await __classPrivateFieldGet(this,
|
|
280
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
283
281
|
if (!contextGroupId) {
|
|
284
282
|
throw new Error('No contextGroupId specified for getAllClientsInContextGroup.');
|
|
285
283
|
}
|
|
@@ -296,7 +294,7 @@ class InteropClient extends base_1.Base {
|
|
|
296
294
|
this.wire.sendAction('interop-client-get-info-for-context-group').catch((e) => {
|
|
297
295
|
// don't expose, analytics-only call
|
|
298
296
|
});
|
|
299
|
-
const client = await __classPrivateFieldGet(this,
|
|
297
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
300
298
|
if (!contextGroupId) {
|
|
301
299
|
throw new Error('No contextGroupId specified for getInfoForContextGroup.');
|
|
302
300
|
}
|
|
@@ -313,7 +311,7 @@ class InteropClient extends base_1.Base {
|
|
|
313
311
|
this.wire.sendAction('interop-client-fire-intent').catch((e) => {
|
|
314
312
|
// don't expose, this is only for api analytics purposes
|
|
315
313
|
});
|
|
316
|
-
const client = await __classPrivateFieldGet(this,
|
|
314
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
317
315
|
return client.dispatch('fireIntent', intent);
|
|
318
316
|
}
|
|
319
317
|
/**
|
|
@@ -328,9 +326,9 @@ class InteropClient extends base_1.Base {
|
|
|
328
326
|
this.wire.sendAction('interop-client-register-intent-handler').catch((e) => {
|
|
329
327
|
// don't expose, this is only for api analytics purposes
|
|
330
328
|
});
|
|
331
|
-
const client = await __classPrivateFieldGet(this,
|
|
329
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
332
330
|
const handlerId = `intent-handler-${intentName}`;
|
|
333
|
-
const wrappedHandler = utils_1.wrapIntentHandler(handler, handlerId);
|
|
331
|
+
const wrappedHandler = (0, utils_1.wrapIntentHandler)(handler, handlerId);
|
|
334
332
|
try {
|
|
335
333
|
await client.register(handlerId, wrappedHandler);
|
|
336
334
|
await client.dispatch('intentHandlerRegistered', { handlerId, ...options });
|
|
@@ -356,7 +354,7 @@ class InteropClient extends base_1.Base {
|
|
|
356
354
|
this.wire.sendAction('interop-client-get-current-context').catch((e) => {
|
|
357
355
|
// don't expose, analytics-only call
|
|
358
356
|
});
|
|
359
|
-
const client = await __classPrivateFieldGet(this,
|
|
357
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
360
358
|
return client.dispatch('getCurrentContext', { contextType });
|
|
361
359
|
}
|
|
362
360
|
/**
|
|
@@ -370,7 +368,7 @@ class InteropClient extends base_1.Base {
|
|
|
370
368
|
this.wire.sendAction('interop-client-get-info-for-intent').catch((e) => {
|
|
371
369
|
// don't expose, analytics-only call
|
|
372
370
|
});
|
|
373
|
-
const client = await __classPrivateFieldGet(this,
|
|
371
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
374
372
|
return client.dispatch('getInfoForIntent', options);
|
|
375
373
|
}
|
|
376
374
|
/**
|
|
@@ -384,7 +382,7 @@ class InteropClient extends base_1.Base {
|
|
|
384
382
|
this.wire.sendAction('interop-client-get-info-for-intents-by-context').catch((e) => {
|
|
385
383
|
// don't expose, analytics-only call
|
|
386
384
|
});
|
|
387
|
-
const client = await __classPrivateFieldGet(this,
|
|
385
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
388
386
|
return client.dispatch('getInfoForIntentsByContext', context);
|
|
389
387
|
}
|
|
390
388
|
/**
|
|
@@ -399,7 +397,7 @@ class InteropClient extends base_1.Base {
|
|
|
399
397
|
this.wire.sendAction('interop-client-fire-intent-for-context').catch((e) => {
|
|
400
398
|
// don't expose, analytics-only call
|
|
401
399
|
});
|
|
402
|
-
const client = await __classPrivateFieldGet(this,
|
|
400
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
403
401
|
return client.dispatch('fireIntentForContext', context);
|
|
404
402
|
}
|
|
405
403
|
/**
|
|
@@ -413,19 +411,19 @@ class InteropClient extends base_1.Base {
|
|
|
413
411
|
*/
|
|
414
412
|
async joinSessionContextGroup(sessionContextGroupId) {
|
|
415
413
|
try {
|
|
416
|
-
const currentSessionContextGroup = __classPrivateFieldGet(this,
|
|
414
|
+
const currentSessionContextGroup = __classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").get(sessionContextGroupId);
|
|
417
415
|
if (currentSessionContextGroup) {
|
|
418
416
|
return currentSessionContextGroup.getUserInstance();
|
|
419
417
|
}
|
|
420
|
-
const client = await __classPrivateFieldGet(this,
|
|
418
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
421
419
|
const { hasConflict } = await client.dispatch('sessionContextGroup:createIfNeeded', {
|
|
422
420
|
sessionContextGroupId
|
|
423
421
|
});
|
|
424
422
|
if (hasConflict) {
|
|
425
423
|
console.warn(`A (non-session) context group with the name "${sessionContextGroupId}" already exists. If you are trying to join a Context Group, call joinContextGroup instead.`);
|
|
426
424
|
}
|
|
427
|
-
const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet(this,
|
|
428
|
-
__classPrivateFieldGet(this,
|
|
425
|
+
const newSessionContextGroup = new SessionContextGroupClient_1.default(this.wire, __classPrivateFieldGet(this, _InteropClient_clientPromise, "f"), sessionContextGroupId);
|
|
426
|
+
__classPrivateFieldGet(this, _InteropClient_sessionContextGroups, "f").set(sessionContextGroupId, newSessionContextGroup);
|
|
429
427
|
return newSessionContextGroup.getUserInstance();
|
|
430
428
|
}
|
|
431
429
|
catch (error) {
|
|
@@ -444,7 +442,7 @@ class InteropClient extends base_1.Base {
|
|
|
444
442
|
this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
|
|
445
443
|
// don't expose, analytics-only call
|
|
446
444
|
});
|
|
447
|
-
const client = await __classPrivateFieldGet(this,
|
|
445
|
+
const client = await __classPrivateFieldGet(this, _InteropClient_clientPromise, "f");
|
|
448
446
|
return client.onDisconnection((event) => {
|
|
449
447
|
const { uuid } = event;
|
|
450
448
|
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
|
@@ -452,9 +450,9 @@ class InteropClient extends base_1.Base {
|
|
|
452
450
|
}
|
|
453
451
|
// used to ferry fdc3-only calls from the fdc3 shim to the Interop Broker
|
|
454
452
|
static async ferryFdc3Call(interopClient, action, payload) {
|
|
455
|
-
const client = await __classPrivateFieldGet(interopClient,
|
|
453
|
+
const client = await __classPrivateFieldGet(interopClient, _InteropClient_clientPromise, "f");
|
|
456
454
|
return client.dispatch(action, payload || null);
|
|
457
455
|
}
|
|
458
456
|
}
|
|
459
457
|
exports.InteropClient = InteropClient;
|
|
460
|
-
|
|
458
|
+
_InteropClient_clientPromise = new WeakMap(), _InteropClient_sessionContextGroups = new WeakMap();
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver,
|
|
3
|
-
if (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return value;
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
8
7
|
};
|
|
9
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver,
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return privateMap.get(receiver);
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
12
|
};
|
|
15
|
-
var
|
|
13
|
+
var _SessionContextGroupClient_clientPromise;
|
|
16
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
15
|
const base_1 = require("../base");
|
|
18
16
|
const utils_1 = require("./utils");
|
|
19
17
|
class SessionContextGroupClient extends base_1.Base {
|
|
20
18
|
constructor(wire, client, id) {
|
|
21
19
|
super(wire);
|
|
22
|
-
|
|
20
|
+
_SessionContextGroupClient_clientPromise.set(this, void 0);
|
|
23
21
|
this.id = id;
|
|
24
|
-
__classPrivateFieldSet(this,
|
|
22
|
+
__classPrivateFieldSet(this, _SessionContextGroupClient_clientPromise, client, "f");
|
|
25
23
|
}
|
|
26
24
|
/**
|
|
27
25
|
* Sets a context for the session context group.
|
|
@@ -33,7 +31,7 @@ class SessionContextGroupClient extends base_1.Base {
|
|
|
33
31
|
this.wire.sendAction('interop-session-context-group-set-context').catch((e) => {
|
|
34
32
|
// don't expose, analytics-only call
|
|
35
33
|
});
|
|
36
|
-
const client = await __classPrivateFieldGet(this,
|
|
34
|
+
const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
|
|
37
35
|
return client.dispatch(`sessionContextGroup:setContext-${this.id}`, {
|
|
38
36
|
sessionContextGroupId: this.id,
|
|
39
37
|
context
|
|
@@ -43,7 +41,7 @@ class SessionContextGroupClient extends base_1.Base {
|
|
|
43
41
|
this.wire.sendAction('interop-session-context-group-get-context').catch((e) => {
|
|
44
42
|
// don't expose, analytics-only call
|
|
45
43
|
});
|
|
46
|
-
const client = await __classPrivateFieldGet(this,
|
|
44
|
+
const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
|
|
47
45
|
return client.dispatch(`sessionContextGroup:getContext-${this.id}`, {
|
|
48
46
|
sessionContextGroupId: this.id,
|
|
49
47
|
type
|
|
@@ -56,20 +54,20 @@ class SessionContextGroupClient extends base_1.Base {
|
|
|
56
54
|
if (typeof contextHandler !== 'function') {
|
|
57
55
|
throw new Error("Non-function argument passed to the first parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
58
56
|
}
|
|
59
|
-
const client = await __classPrivateFieldGet(this,
|
|
57
|
+
const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
|
|
60
58
|
let handlerId;
|
|
61
59
|
if (contextType) {
|
|
62
|
-
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${utils_1.generateId()}`;
|
|
60
|
+
handlerId = `sessionContextHandler:invoke-${this.id}-${contextType}-${(0, utils_1.generateId)()}`;
|
|
63
61
|
}
|
|
64
62
|
else {
|
|
65
63
|
handlerId = `sessionContextHandler:invoke-${this.id}`;
|
|
66
64
|
}
|
|
67
|
-
client.register(handlerId, utils_1.wrapContextHandler(contextHandler, handlerId));
|
|
65
|
+
client.register(handlerId, (0, utils_1.wrapContextHandler)(contextHandler, handlerId));
|
|
68
66
|
client.dispatch(`sessionContextGroup:handlerAdded-${this.id}`, { handlerId, contextType });
|
|
69
67
|
return { unsubscribe: await this.createUnsubscribeCb(handlerId) };
|
|
70
68
|
}
|
|
71
69
|
async createUnsubscribeCb(handlerId) {
|
|
72
|
-
const client = await __classPrivateFieldGet(this,
|
|
70
|
+
const client = await __classPrivateFieldGet(this, _SessionContextGroupClient_clientPromise, "f");
|
|
73
71
|
return async () => {
|
|
74
72
|
client.remove(handlerId);
|
|
75
73
|
await client.dispatch(`sessionContextGroup:handlerRemoved-${this.id}`, { handlerId });
|
|
@@ -78,11 +76,11 @@ class SessionContextGroupClient extends base_1.Base {
|
|
|
78
76
|
getUserInstance() {
|
|
79
77
|
return {
|
|
80
78
|
id: this.id,
|
|
81
|
-
setContext: utils_1.wrapInTryCatch(this.setContext.bind(this), 'Failed to set context: '),
|
|
82
|
-
getCurrentContext: utils_1.wrapInTryCatch(this.getCurrentContext.bind(this), 'Failed to get context: '),
|
|
83
|
-
addContextHandler: utils_1.wrapInTryCatch(this.addContextHandler.bind(this), 'Failed to add context handler: ')
|
|
79
|
+
setContext: (0, utils_1.wrapInTryCatch)(this.setContext.bind(this), 'Failed to set context: '),
|
|
80
|
+
getCurrentContext: (0, utils_1.wrapInTryCatch)(this.getCurrentContext.bind(this), 'Failed to get context: '),
|
|
81
|
+
addContextHandler: (0, utils_1.wrapInTryCatch)(this.addContextHandler.bind(this), 'Failed to add context handler: ')
|
|
84
82
|
};
|
|
85
83
|
}
|
|
86
84
|
}
|
|
87
85
|
exports.default = SessionContextGroupClient;
|
|
88
|
-
|
|
86
|
+
_SessionContextGroupClient_clientPromise = new WeakMap();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type HandlerId = string;
|
|
2
|
+
export declare class PrivateChannelClient {
|
|
3
|
+
id: string;
|
|
4
|
+
client: OpenFin.ChannelClient;
|
|
5
|
+
listeners: Map<HandlerId, FDC3v2.Listener>;
|
|
6
|
+
constructor(client: OpenFin.ChannelClient, id: string);
|
|
7
|
+
broadcast(context: OpenFin.Context): Promise<void>;
|
|
8
|
+
getCurrentContext(contextType?: string): Promise<OpenFin.Context | null>;
|
|
9
|
+
addContextListener(contextType: string | null, handler: OpenFin.ContextHandler): Promise<FDC3v2.Listener>;
|
|
10
|
+
private createNonStandardUnsubscribeCb;
|
|
11
|
+
private createContextUnsubscribeCb;
|
|
12
|
+
onAddContextListener(handler: (contextType?: string) => void): FDC3v2.Listener;
|
|
13
|
+
onDisconnect(handler: () => void): FDC3v2.Listener;
|
|
14
|
+
onUnsubscribe(handler: (contextType?: string) => void): FDC3v2.Listener;
|
|
15
|
+
disconnect(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrivateChannelClient = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
class PrivateChannelClient {
|
|
6
|
+
constructor(client, id) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
this.client = client;
|
|
9
|
+
this.listeners = new Map();
|
|
10
|
+
}
|
|
11
|
+
async broadcast(context) {
|
|
12
|
+
return this.client.dispatch('broadcast', { context });
|
|
13
|
+
}
|
|
14
|
+
async getCurrentContext(contextType) {
|
|
15
|
+
return this.client.dispatch('getCurrentContext', { contextType });
|
|
16
|
+
}
|
|
17
|
+
async addContextListener(contextType, handler) {
|
|
18
|
+
if (typeof handler !== 'function') {
|
|
19
|
+
throw new Error("Non-function argument passed to the second parameter 'handler'. Be aware that the argument order does not match the FDC3 standard.");
|
|
20
|
+
}
|
|
21
|
+
let handlerId;
|
|
22
|
+
if (contextType) {
|
|
23
|
+
handlerId = `contextHandler:invoke-${this.id}-${contextType}-${(0, utils_1.generateId)()}`;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
handlerId = `contextHandler:invoke-${this.id}-${(0, utils_1.generateId)()}`;
|
|
27
|
+
}
|
|
28
|
+
this.client.register(handlerId, (0, utils_1.wrapContextHandler)(handler, handlerId));
|
|
29
|
+
const listener = { unsubscribe: await this.createContextUnsubscribeCb(handlerId) };
|
|
30
|
+
this.listeners.set(handlerId, listener);
|
|
31
|
+
await this.client.dispatch(`contextHandlerAdded`, { handlerId, contextType });
|
|
32
|
+
return listener;
|
|
33
|
+
}
|
|
34
|
+
createNonStandardUnsubscribeCb(handlerId) {
|
|
35
|
+
return async () => {
|
|
36
|
+
this.client.remove(handlerId);
|
|
37
|
+
this.listeners.delete(handlerId);
|
|
38
|
+
await this.client.dispatch('nonStandardHandlerRemoved', { handlerId });
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
createContextUnsubscribeCb(handlerId) {
|
|
42
|
+
return async () => {
|
|
43
|
+
this.client.remove(handlerId);
|
|
44
|
+
this.listeners.delete(handlerId);
|
|
45
|
+
await this.client.dispatch('contextHandlerRemoved', { handlerId });
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
onAddContextListener(handler) {
|
|
49
|
+
const handlerId = `onContextHandlerAdded:invoke-${this.id}-${(0, utils_1.generateId)()}`;
|
|
50
|
+
this.client.register(handlerId, handler);
|
|
51
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
|
52
|
+
this.listeners.set(handlerId, listener);
|
|
53
|
+
this.client.dispatch(`onAddContextHandlerAdded`, { handlerId });
|
|
54
|
+
return listener;
|
|
55
|
+
}
|
|
56
|
+
onDisconnect(handler) {
|
|
57
|
+
const handlerId = `onDisconnect:invoke-${this.id}-${(0, utils_1.generateId)()}`;
|
|
58
|
+
this.client.register(handlerId, handler);
|
|
59
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
|
60
|
+
this.listeners.set(handlerId, listener);
|
|
61
|
+
this.client.dispatch(`onDisconnectHandlerAdded`, { handlerId });
|
|
62
|
+
return listener;
|
|
63
|
+
}
|
|
64
|
+
onUnsubscribe(handler) {
|
|
65
|
+
const handlerId = `onUnsubscribe:invoke-${this.id}-${(0, utils_1.generateId)()}`;
|
|
66
|
+
this.client.register(handlerId, handler);
|
|
67
|
+
const listener = { unsubscribe: this.createNonStandardUnsubscribeCb(handlerId) };
|
|
68
|
+
this.listeners.set(handlerId, listener);
|
|
69
|
+
this.client.dispatch(`onUnsubscribeHandlerAdded`, { handlerId });
|
|
70
|
+
return listener;
|
|
71
|
+
}
|
|
72
|
+
async disconnect() {
|
|
73
|
+
const listenerUnsubscribers = Array.from(this.listeners.values());
|
|
74
|
+
const promises = listenerUnsubscribers.map(async (listenerUnsubscriber) => {
|
|
75
|
+
await listenerUnsubscriber.unsubscribe();
|
|
76
|
+
});
|
|
77
|
+
await Promise.all(promises);
|
|
78
|
+
await this.client.dispatch('clientDisconnecting');
|
|
79
|
+
await this.client.disconnect();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.PrivateChannelClient = PrivateChannelClient;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChannelProvider } from '../../interappbus/channel/provider';
|
|
2
|
+
declare type HandlerId = string;
|
|
3
|
+
export declare class PrivateChannelProvider {
|
|
4
|
+
id: string;
|
|
5
|
+
private provider;
|
|
6
|
+
private clients;
|
|
7
|
+
private contextByContextType;
|
|
8
|
+
private lastContext;
|
|
9
|
+
constructor(provider: ChannelProvider, id: string);
|
|
10
|
+
private getClientState;
|
|
11
|
+
registerListeners(): void;
|
|
12
|
+
broadcast(payload: {
|
|
13
|
+
context: OpenFin.Context;
|
|
14
|
+
}, broadcasterClientIdentity: OpenFin.ClientIdentity): void;
|
|
15
|
+
getCurrentContext(payload: {
|
|
16
|
+
contextType?: string;
|
|
17
|
+
}, senderClientIdentity: OpenFin.ClientIdentity): OpenFin.Context | null;
|
|
18
|
+
contextHandlerAdded(payload: {
|
|
19
|
+
handlerId: HandlerId;
|
|
20
|
+
contextType?: string;
|
|
21
|
+
}, senderClientIdentity: OpenFin.ClientIdentity): void;
|
|
22
|
+
contextHandlerRemoved(payload: {
|
|
23
|
+
handlerId: HandlerId;
|
|
24
|
+
}, removingClientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
25
|
+
nonStandardHandlerRemoved(payload: {
|
|
26
|
+
handlerId: HandlerId;
|
|
27
|
+
}, id: OpenFin.ClientIdentity): void;
|
|
28
|
+
onAddContextHandlerAdded(payload: {
|
|
29
|
+
handlerId: HandlerId;
|
|
30
|
+
}, senderClientIdentity: OpenFin.ClientIdentity): void;
|
|
31
|
+
onDisconnectHandlerAdded(payload: {
|
|
32
|
+
handlerId: HandlerId;
|
|
33
|
+
}, id: OpenFin.ClientIdentity): void;
|
|
34
|
+
onUnsubscribeHandlerAdded(payload: {
|
|
35
|
+
handlerId: HandlerId;
|
|
36
|
+
}, id: OpenFin.ClientIdentity): void;
|
|
37
|
+
clientDisconnecting(payload: {}, disconnectingClientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
38
|
+
registerNewClient(clientIdentity: OpenFin.ClientIdentity): void;
|
|
39
|
+
}
|
|
40
|
+
export {};
|