@openfin/core 28.71.16 → 28.71.19
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 +10 -0
- package/package.json +1 -1
- package/src/api/interop/InteropBroker.d.ts +7 -0
- package/src/api/interop/InteropBroker.js +15 -0
- package/src/api/interop/InteropClient.d.ts +8 -0
- package/src/api/interop/InteropClient.js +17 -0
- package/src/api/interop/fdc3/fdc3-1.2.js +11 -1
- package/src/api/interop/utils.d.ts +1 -0
- package/src/api/interop/utils.js +2 -1
package/OpenFin.d.ts
CHANGED
|
@@ -1708,4 +1708,14 @@ declare namespace OpenFin {
|
|
|
1708
1708
|
| 'navigateForward'
|
|
1709
1709
|
| 'navigateBack'
|
|
1710
1710
|
| 'print';
|
|
1711
|
+
|
|
1712
|
+
export type InteropBrokerDisconnectionEvent = {
|
|
1713
|
+
type: string;
|
|
1714
|
+
topic: string;
|
|
1715
|
+
brokerName: string;
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1718
|
+
export type InteropClientOnDisconnectionListener = (
|
|
1719
|
+
InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent
|
|
1720
|
+
) => any;
|
|
1711
1721
|
}
|
package/package.json
CHANGED
|
@@ -315,6 +315,13 @@ export declare class InteropBroker extends Base {
|
|
|
315
315
|
* @experimental
|
|
316
316
|
*/
|
|
317
317
|
handleFiredIntentForContext(contextForIntent: OpenFin.ContextForIntent, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
318
|
+
/**
|
|
319
|
+
* Provides the identity of any Interop Client that disconnects from the Interop Broker. It is meant to be overriden.
|
|
320
|
+
* @param clientIdentity
|
|
321
|
+
* @return { Promise<void> }
|
|
322
|
+
* @tutorial interop.clientDisconnected
|
|
323
|
+
*/
|
|
324
|
+
clientDisconnected(clientIdentity: OpenFin.ClientIdentity): Promise<void>;
|
|
318
325
|
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
|
|
319
326
|
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
|
|
320
327
|
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
|
|
@@ -315,6 +315,9 @@ class InteropBroker extends base_1.Base {
|
|
|
315
315
|
this.wire.sendAction('interop-broker-join-context-group').catch((e) => {
|
|
316
316
|
// don't expose, analytics-only call
|
|
317
317
|
});
|
|
318
|
+
if (this.sessionContextGroupMap.has(contextGroupId)) {
|
|
319
|
+
throw new Error(utils_1.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup);
|
|
320
|
+
}
|
|
318
321
|
if (target) {
|
|
319
322
|
// If an endpointId is provided, use that. This will likely be used by external adapters.
|
|
320
323
|
if (InteropBroker.hasEndpointId(target)) {
|
|
@@ -602,6 +605,17 @@ class InteropBroker extends base_1.Base {
|
|
|
602
605
|
console.warn(warning);
|
|
603
606
|
throw new Error(utils_1.BROKER_ERRORS.fireIntentForContext);
|
|
604
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Provides the identity of any Interop Client that disconnects from the Interop Broker. It is meant to be overriden.
|
|
610
|
+
* @param clientIdentity
|
|
611
|
+
* @return { Promise<void> }
|
|
612
|
+
* @tutorial interop.clientDisconnected
|
|
613
|
+
*/
|
|
614
|
+
// eslint-disable-next-line class-methods-use-this
|
|
615
|
+
async clientDisconnected(clientIdentity) {
|
|
616
|
+
// This function is called in channel.onDisconnection.
|
|
617
|
+
// It is meant to be overridden to inform when an Interop Client has been disconnected.
|
|
618
|
+
}
|
|
605
619
|
/*
|
|
606
620
|
Snapshot APIs
|
|
607
621
|
*/
|
|
@@ -879,6 +893,7 @@ class InteropBroker extends base_1.Base {
|
|
|
879
893
|
this.sessionContextGroupMap.forEach((sessionContextGroup) => {
|
|
880
894
|
sessionContextGroup.onDisconnection(clientIdentity);
|
|
881
895
|
});
|
|
896
|
+
this.clientDisconnected(clientIdentity);
|
|
882
897
|
});
|
|
883
898
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
884
899
|
// @ts-ignore
|
|
@@ -264,4 +264,12 @@ export declare class InteropClient extends Base {
|
|
|
264
264
|
* @experimental
|
|
265
265
|
*/
|
|
266
266
|
joinSessionContextGroup(sessionContextGroupId: string): Promise<OpenFin.SessionContextGroup>;
|
|
267
|
+
/**
|
|
268
|
+
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
|
|
269
|
+
* Only one listener per Interop Client can be set.
|
|
270
|
+
* @param listener
|
|
271
|
+
* @return { Promise<void> }
|
|
272
|
+
* @tutorial interop.onDisconnection
|
|
273
|
+
*/
|
|
274
|
+
onDisconnection(listener: OpenFin.InteropClientOnDisconnectionListener): Promise<void>;
|
|
267
275
|
}
|
|
@@ -433,6 +433,23 @@ class InteropClient extends base_1.Base {
|
|
|
433
433
|
throw error;
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Register a listener that is called when the Interop Client has been disconnected from the Interop Broker.
|
|
438
|
+
* Only one listener per Interop Client can be set.
|
|
439
|
+
* @param listener
|
|
440
|
+
* @return { Promise<void> }
|
|
441
|
+
* @tutorial interop.onDisconnection
|
|
442
|
+
*/
|
|
443
|
+
async onDisconnection(listener) {
|
|
444
|
+
this.wire.sendAction('interop-client-add-ondisconnection-listener').catch((e) => {
|
|
445
|
+
// don't expose, analytics-only call
|
|
446
|
+
});
|
|
447
|
+
const client = await __classPrivateFieldGet(this, _clientPromise);
|
|
448
|
+
return client.onDisconnection((event) => {
|
|
449
|
+
const { uuid } = event;
|
|
450
|
+
listener({ type: 'interop-broker', topic: 'disconnected', brokerName: uuid });
|
|
451
|
+
});
|
|
452
|
+
}
|
|
436
453
|
}
|
|
437
454
|
exports.InteropClient = InteropClient;
|
|
438
455
|
_clientPromise = new WeakMap(), _sessionContextGroups = new WeakMap();
|
|
@@ -160,7 +160,17 @@ class Fdc3Module extends base_1.Base {
|
|
|
160
160
|
this.wire.sendAction('fdc3-join-channel').catch((e) => {
|
|
161
161
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
162
162
|
});
|
|
163
|
-
|
|
163
|
+
try {
|
|
164
|
+
await this.fin.me.interop.joinContextGroup(channelId);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (error.message === utils_2.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
|
|
168
|
+
throw new Error('The Channel you have tried to join is an App Channel. Custom Channels can only be defined by the Interop Broker through code or manifest configuration. Please use getOrCreateChannel.');
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
throw new Error(error.message);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
164
174
|
}
|
|
165
175
|
/**
|
|
166
176
|
* Removes the specified target from a context group.
|
|
@@ -8,5 +8,6 @@ export declare const BROKER_ERRORS: {
|
|
|
8
8
|
fireIntentForContext: string;
|
|
9
9
|
getInfoForIntent: string;
|
|
10
10
|
getInfoForIntentsByContext: string;
|
|
11
|
+
joinSessionContextGroupWithJoinContextGroup: string;
|
|
11
12
|
};
|
|
12
13
|
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
package/src/api/interop/utils.js
CHANGED
|
@@ -32,7 +32,8 @@ exports.BROKER_ERRORS = {
|
|
|
32
32
|
fireIntent: exports.generateOverrideError('fireIntent', 'handleFiredIntent'),
|
|
33
33
|
fireIntentForContext: exports.generateOverrideError('fireIntentForContext', 'handleFiredIntentForContext'),
|
|
34
34
|
getInfoForIntent: exports.generateOverrideError('getInfoForIntent', 'handleInfoForIntent'),
|
|
35
|
-
getInfoForIntentsByContext: exports.generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext')
|
|
35
|
+
getInfoForIntentsByContext: exports.generateOverrideError('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
|
|
36
|
+
joinSessionContextGroupWithJoinContextGroup: 'The Context Group you have tried to join is a Session Context Group. Custom Context Groups can only be defined by the Interop Broker through code or manifest configuration. Please use joinSessionContextGroup.'
|
|
36
37
|
};
|
|
37
38
|
exports.wrapIntentHandler = (handler, handlerId) => {
|
|
38
39
|
return async (intent) => {
|