@openfin/core 29.73.1 → 29.73.3
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 +6 -0
- package/package.json +1 -1
- package/src/api/interappbus/channel/channels-docs.d.ts +15 -0
- package/src/api/interappbus/channel/channels-docs.js +15 -0
- package/src/api/interappbus/channel/index.js +15 -1
- package/src/api/interappbus/channel/provider.d.ts +5 -2
- package/src/api/interappbus/channel/provider.js +6 -0
- package/src/api/interop/InteropBroker.d.ts +9 -0
- package/src/api/interop/InteropBroker.js +12 -0
- package/src/api/interop/fdc3/fdc3-1.2.js +1 -12
- package/src/api/interop/fdc3/fdc3-2.0.js +8 -1
- package/src/api/interop/fdc3/utils.d.ts +8 -1
- package/src/api/interop/fdc3/utils.js +17 -3
- package/src/api/system/index.d.ts +1 -0
- package/src/api/system/index.js +1 -0
package/OpenFin.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ declare namespace OpenFin {
|
|
|
34
34
|
isLocalEndpointId: boolean; // If true, this connection is from a legacy client.
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
+
export type ClientInfo = Omit<ClientIdentity, 'isLocalEndpointId'> & {
|
|
38
|
+
entityType: EntityType;
|
|
39
|
+
connectionUrl: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
37
42
|
export type ClientIdentityMultiRuntime = ClientIdentity & {
|
|
38
43
|
runtimeUuid: string;
|
|
39
44
|
};
|
|
@@ -1229,6 +1234,7 @@ declare namespace OpenFin {
|
|
|
1229
1234
|
uuid: string;
|
|
1230
1235
|
entityType: EntityType;
|
|
1231
1236
|
parent: Identity;
|
|
1237
|
+
url: string;
|
|
1232
1238
|
};
|
|
1233
1239
|
|
|
1234
1240
|
export type ExternalApplicationInfo = {
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ declare const InterApplicationBus: any;
|
|
|
18
18
|
* ##### Asynchronous Methods
|
|
19
19
|
* * {@link Channel#ChannelProvider#destroy destroy()}
|
|
20
20
|
* * {@link Channel#ChannelProvider#dispatch dispatch(to, action, payload)}
|
|
21
|
+
* * {@link Channel#ChannelProvider#getAllClientInfo getAllClientInfo()}
|
|
21
22
|
*
|
|
22
23
|
* ##### Middleware
|
|
23
24
|
* Middleware functions receive the following arguments: (action, payload, senderId).
|
|
@@ -131,6 +132,11 @@ declare class ChannelProvider {
|
|
|
131
132
|
* @tutorial ChannelMiddleware.setDefaultAction
|
|
132
133
|
*/
|
|
133
134
|
setDefaultAction(): void;
|
|
135
|
+
/** Returns an array with info on every Client connected to the Provider
|
|
136
|
+
* @returns { Promise<Array<ClientInfo>> }
|
|
137
|
+
* @tutorial Channel.getAllClientInfo
|
|
138
|
+
*/
|
|
139
|
+
getAllClientInfo(): void;
|
|
134
140
|
}
|
|
135
141
|
/**
|
|
136
142
|
* Instance created to enable use of a channel as a client. Allows for communication with the
|
|
@@ -316,3 +322,12 @@ declare class ChannelClient {
|
|
|
316
322
|
* @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
|
|
317
323
|
*
|
|
318
324
|
*/
|
|
325
|
+
/**
|
|
326
|
+
* Extended Client Information
|
|
327
|
+
* @typedef {object} InterApplicationBus.Channel~ClientInfo
|
|
328
|
+
* @property {string} uuid - Channel client uuid
|
|
329
|
+
* @property {string} name - Channel client name
|
|
330
|
+
* @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
|
|
331
|
+
* @property {string} entityType - Indicates if the client belongs to a Window or View
|
|
332
|
+
* @property {string} connectionUrl - URL of the View or Window at the time of connection to the Channel Provider.
|
|
333
|
+
*/
|
|
@@ -76,6 +76,7 @@ InterApplicationBus.Channel.onChannelDisconnect = function () { };
|
|
|
76
76
|
* ##### Asynchronous Methods
|
|
77
77
|
* * {@link Channel#ChannelProvider#destroy destroy()}
|
|
78
78
|
* * {@link Channel#ChannelProvider#dispatch dispatch(to, action, payload)}
|
|
79
|
+
* * {@link Channel#ChannelProvider#getAllClientInfo getAllClientInfo()}
|
|
79
80
|
*
|
|
80
81
|
* ##### Middleware
|
|
81
82
|
* Middleware functions receive the following arguments: (action, payload, senderId).
|
|
@@ -189,6 +190,11 @@ class ChannelProvider {
|
|
|
189
190
|
* @tutorial ChannelMiddleware.setDefaultAction
|
|
190
191
|
*/
|
|
191
192
|
setDefaultAction() { }
|
|
193
|
+
/** Returns an array with info on every Client connected to the Provider
|
|
194
|
+
* @returns { Promise<Array<ClientInfo>> }
|
|
195
|
+
* @tutorial Channel.getAllClientInfo
|
|
196
|
+
*/
|
|
197
|
+
getAllClientInfo() { }
|
|
192
198
|
}
|
|
193
199
|
/**
|
|
194
200
|
* Instance created to enable use of a channel as a client. Allows for communication with the
|
|
@@ -374,3 +380,12 @@ class ChannelClient {
|
|
|
374
380
|
* @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
|
|
375
381
|
*
|
|
376
382
|
*/
|
|
383
|
+
/**
|
|
384
|
+
* Extended Client Information
|
|
385
|
+
* @typedef {object} InterApplicationBus.Channel~ClientInfo
|
|
386
|
+
* @property {string} uuid - Channel client uuid
|
|
387
|
+
* @property {string} name - Channel client name
|
|
388
|
+
* @property {string} endpointId - Unique identifier for a client, because there can be multiple clients at one name/uuid entity.
|
|
389
|
+
* @property {string} entityType - Indicates if the client belongs to a Window or View
|
|
390
|
+
* @property {string} connectionUrl - URL of the View or Window at the time of connection to the Channel Provider.
|
|
391
|
+
*/
|
|
@@ -54,7 +54,21 @@ class Channel extends base_1.EmitterBase {
|
|
|
54
54
|
});
|
|
55
55
|
try {
|
|
56
56
|
const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientOffer(opts);
|
|
57
|
-
|
|
57
|
+
let connectionUrl;
|
|
58
|
+
const entityType = this.wire.environment.getCurrentEntityType();
|
|
59
|
+
if (entityType === 'iframe') {
|
|
60
|
+
const frame = fin.Frame.getCurrentSync();
|
|
61
|
+
connectionUrl = (await frame.getInfo()).url;
|
|
62
|
+
}
|
|
63
|
+
else if (entityType === 'window' || entityType === 'view') {
|
|
64
|
+
connectionUrl = (await fin.me.getInfo()).url;
|
|
65
|
+
}
|
|
66
|
+
const res = await this.wire.sendAction('connect-to-channel', {
|
|
67
|
+
channelName,
|
|
68
|
+
...opts,
|
|
69
|
+
offer,
|
|
70
|
+
connectionUrl
|
|
71
|
+
});
|
|
58
72
|
const { payload: { data: routingInfo } } = res;
|
|
59
73
|
// If there isn't a matching channel, the above sendAction call will error out and go to catch, skipping the logic below.
|
|
60
74
|
if (resolver) {
|
|
@@ -5,22 +5,24 @@ import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
|
5
5
|
import ClientIdentity = OpenFin.ClientIdentity;
|
|
6
6
|
export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
|
|
7
7
|
export declare type DisconnectionListener = (identity: ClientIdentity) => any;
|
|
8
|
+
declare type ClientConnectionPayload = OpenFin.ClientIdentity & OpenFin.ClientInfo;
|
|
8
9
|
export declare class ChannelProvider extends ChannelBase {
|
|
9
10
|
#private;
|
|
10
11
|
private static removalMap;
|
|
11
12
|
private connectListener;
|
|
12
13
|
private disconnectListener;
|
|
13
|
-
get connections():
|
|
14
|
+
get connections(): ClientConnectionPayload[];
|
|
14
15
|
static handleClientDisconnection(channel: ChannelProvider, payload: any): void;
|
|
15
16
|
static setProviderRemoval(provider: ChannelProvider, remove: Function): void;
|
|
16
17
|
constructor(providerIdentity: ProviderIdentity, wire: Transport, strategy: AnyStrategy);
|
|
17
18
|
dispatch(to: OpenFin.ClientIdentity | OpenFin.Identity, action: string, payload?: any): Promise<any>;
|
|
18
19
|
protected processAction: (action: string, payload: any, senderIdentity: OpenFin.ClientIdentity | OpenFin.ClientIdentityMultiRuntime) => Promise<any>;
|
|
19
|
-
processConnection(senderId:
|
|
20
|
+
processConnection(senderId: ClientConnectionPayload, payload: any): Promise<any>;
|
|
20
21
|
publish(action: string, payload: any): Promise<any>[];
|
|
21
22
|
onConnection(listener: ConnectionListener): void;
|
|
22
23
|
onDisconnection(listener: DisconnectionListener): void;
|
|
23
24
|
destroy(): Promise<void>;
|
|
25
|
+
getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
|
|
24
26
|
private checkForClientConnection;
|
|
25
27
|
private isClientConnected;
|
|
26
28
|
private isLegacyClientConnected;
|
|
@@ -29,3 +31,4 @@ export declare class ChannelProvider extends ChannelBase {
|
|
|
29
31
|
private static clientIdentityIncludesEndpointId;
|
|
30
32
|
private static clientIsMultiRuntime;
|
|
31
33
|
}
|
|
34
|
+
export {};
|
|
@@ -98,6 +98,12 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
98
98
|
await protectedObj.wire.sendAction('destroy-channel', { channelName });
|
|
99
99
|
__classPrivateFieldGet(this, _ChannelProvider_close, "f").call(this);
|
|
100
100
|
}
|
|
101
|
+
async getAllClientInfo() {
|
|
102
|
+
return this.connections.map((clientInfo) => {
|
|
103
|
+
const { uuid, name, endpointId, entityType, connectionUrl } = clientInfo;
|
|
104
|
+
return { uuid, name, endpointId, entityType, connectionUrl };
|
|
105
|
+
});
|
|
106
|
+
}
|
|
101
107
|
checkForClientConnection(clientIdentity) {
|
|
102
108
|
if (!this.isClientConnected(clientIdentity)) {
|
|
103
109
|
throw new Error(`This action was sent from a client that is not connected to the provider.
|
|
@@ -378,6 +378,15 @@ export declare class InteropBroker extends Base {
|
|
|
378
378
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
379
379
|
*/
|
|
380
380
|
fdc3HandleGetInfo(clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
381
|
+
/**
|
|
382
|
+
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
383
|
+
*
|
|
384
|
+
* FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
|
|
385
|
+
* an AppIdentifier.
|
|
386
|
+
* @return { Promise<Array<ClientInfo>> }
|
|
387
|
+
* @tutorial interop.getAllClientInfo()
|
|
388
|
+
*/
|
|
389
|
+
getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
|
|
381
390
|
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
|
|
382
391
|
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
|
|
383
392
|
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
|
|
@@ -700,6 +700,18 @@ class InteropBroker extends base_1.Base {
|
|
|
700
700
|
console.warn(warning);
|
|
701
701
|
throw new Error(utils_1.BROKER_ERRORS.fdc3GetInfo);
|
|
702
702
|
}
|
|
703
|
+
/**
|
|
704
|
+
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
705
|
+
*
|
|
706
|
+
* FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
|
|
707
|
+
* an AppIdentifier.
|
|
708
|
+
* @return { Promise<Array<ClientInfo>> }
|
|
709
|
+
* @tutorial interop.getAllClientInfo()
|
|
710
|
+
*/
|
|
711
|
+
async getAllClientInfo() {
|
|
712
|
+
const provider = await this.getProvider();
|
|
713
|
+
return provider.getAllClientInfo();
|
|
714
|
+
}
|
|
703
715
|
/*
|
|
704
716
|
Snapshot APIs
|
|
705
717
|
*/
|
|
@@ -143,21 +143,10 @@ class Fdc3Module extends base_1.Base {
|
|
|
143
143
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
144
144
|
});
|
|
145
145
|
const channels = await this.fin.me.interop.getContextGroups();
|
|
146
|
-
const unsupportedChannelApis = {
|
|
147
|
-
addContextListener: () => {
|
|
148
|
-
throw new utils_1.UnsupportedChannelApiError('Channel.addContextListener');
|
|
149
|
-
},
|
|
150
|
-
broadcast: () => {
|
|
151
|
-
throw new utils_1.UnsupportedChannelApiError('Channel.broadcast');
|
|
152
|
-
},
|
|
153
|
-
getCurrentChannel: () => {
|
|
154
|
-
throw new utils_1.UnsupportedChannelApiError('Channel.getCurrentChannel');
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
146
|
// fdc3 implementation of getSystemChannels returns on array of channels, have to decorate over
|
|
158
147
|
// this so people know that these APIs are not supported
|
|
159
148
|
return channels.map((channel) => {
|
|
160
|
-
return { ...channel, type: 'system', ...
|
|
149
|
+
return { ...channel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
|
161
150
|
});
|
|
162
151
|
}
|
|
163
152
|
/**
|
|
@@ -401,7 +401,12 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
401
401
|
* @tutorial fdc3v2.getUserChannels
|
|
402
402
|
*/
|
|
403
403
|
async getUserChannels() {
|
|
404
|
-
|
|
404
|
+
const channels = await this.fin.me.interop.getContextGroups();
|
|
405
|
+
// fdc3 implementation of getUserChannels returns on array of channels, have to decorate over
|
|
406
|
+
// this so people know that these APIs are not supported
|
|
407
|
+
return channels.map((channel) => {
|
|
408
|
+
return { ...channel, type: 'user', ...(0, utils_2.getUnsupportedChannelApis)('User') };
|
|
409
|
+
});
|
|
405
410
|
}
|
|
406
411
|
/**
|
|
407
412
|
* Retrieves a list of the User Channels available for the app to join.
|
|
@@ -410,6 +415,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
410
415
|
* @tutorial fdc3.getSystemChannels
|
|
411
416
|
*/
|
|
412
417
|
async getSystemChannels() {
|
|
418
|
+
console.warn('This API has been deprecated. Please use fdc3.getUserChannels instead.');
|
|
413
419
|
return this.fdc3Module.getSystemChannels();
|
|
414
420
|
}
|
|
415
421
|
/**
|
|
@@ -429,6 +435,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
429
435
|
* @tutorial fdc3.joinChannel
|
|
430
436
|
*/
|
|
431
437
|
async joinChannel(channelId) {
|
|
438
|
+
console.warn('This API has been deprecated. Please use fdc3.joinUserChannel instead.');
|
|
432
439
|
return this.fdc3Module.joinChannel(channelId);
|
|
433
440
|
}
|
|
434
441
|
/**
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { PrivateChannelClient } from './PrivateChannelClient';
|
|
2
|
+
interface UnsupportedChannelApis {
|
|
3
|
+
addContextListener(): Error;
|
|
4
|
+
broadcast(): Error;
|
|
5
|
+
getCurrentChannel(): Error;
|
|
6
|
+
}
|
|
7
|
+
export declare const getUnsupportedChannelApis: (channelType?: string) => UnsupportedChannelApis;
|
|
2
8
|
export declare class UnsupportedChannelApiError extends Error {
|
|
3
|
-
constructor(apiName: string);
|
|
9
|
+
constructor(apiName: string, channelType?: string);
|
|
4
10
|
}
|
|
5
11
|
export declare enum ResultError {
|
|
6
12
|
/** Returned if the `IntentHandler` exited without returning a Promise or that
|
|
@@ -16,3 +22,4 @@ export declare const buildPrivateChannelObject: (privateChannelClient: PrivateCh
|
|
|
16
22
|
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) => FDC3.Channel;
|
|
17
23
|
export declare const connectPrivateChannel: (channelId: string) => Promise<FDC3v2.PrivateChannel>;
|
|
18
24
|
export declare const getIntentResolution: (interopModule: OpenFin.InteropClient, context: OpenFin.Context, app?: FDC3v2.AppIdentifier | FDC3.TargetApp, intent?: string) => Promise<FDC3v2.IntentResolution>;
|
|
25
|
+
export {};
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIntentResolution = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ResultError = exports.UnsupportedChannelApiError = void 0;
|
|
3
|
+
exports.getIntentResolution = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const PrivateChannelClient_1 = require("./PrivateChannelClient");
|
|
6
|
+
const getUnsupportedChannelApis = (channelType) => {
|
|
7
|
+
return {
|
|
8
|
+
addContextListener: () => {
|
|
9
|
+
throw new UnsupportedChannelApiError('Channel.addContextListener', channelType);
|
|
10
|
+
},
|
|
11
|
+
broadcast: () => {
|
|
12
|
+
throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
|
|
13
|
+
},
|
|
14
|
+
getCurrentChannel: () => {
|
|
15
|
+
throw new UnsupportedChannelApiError('Channel.getCurrentChannel', channelType);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.getUnsupportedChannelApis = getUnsupportedChannelApis;
|
|
6
20
|
class UnsupportedChannelApiError extends Error {
|
|
7
|
-
constructor(apiName) {
|
|
21
|
+
constructor(apiName, channelType = 'System') {
|
|
8
22
|
super(apiName);
|
|
9
|
-
this.message = `Calling ${apiName} on an instance of a
|
|
23
|
+
this.message = `Calling ${apiName} on an instance of a ${channelType} Channel returned by fdc3.get${channelType}Channels is not supported. If you would like to use a ${channelType} Channel, please use fdc3.joinChannel, fdc3.addContextListener, and fdc3.broadcast instead.`;
|
|
10
24
|
}
|
|
11
25
|
}
|
|
12
26
|
exports.UnsupportedChannelApiError = UnsupportedChannelApiError;
|
|
@@ -147,6 +147,7 @@ import PrinterInfo = OpenFin.PrinterInfo;
|
|
|
147
147
|
* @property { string } uuid The uuid of the frame
|
|
148
148
|
* @property { EntityType } entityType The entity type, could be 'window', 'iframe', 'external connection' or 'unknown'
|
|
149
149
|
* @property { Identity } parent The parent identity
|
|
150
|
+
* @property { string } url URL
|
|
150
151
|
*/
|
|
151
152
|
/**
|
|
152
153
|
* GetLogRequestType interface
|
package/src/api/system/index.js
CHANGED
|
@@ -136,6 +136,7 @@ const window_1 = require("../window");
|
|
|
136
136
|
* @property { string } uuid The uuid of the frame
|
|
137
137
|
* @property { EntityType } entityType The entity type, could be 'window', 'iframe', 'external connection' or 'unknown'
|
|
138
138
|
* @property { Identity } parent The parent identity
|
|
139
|
+
* @property { string } url URL
|
|
139
140
|
*/
|
|
140
141
|
/**
|
|
141
142
|
* GetLogRequestType interface
|