@openfin/core 29.73.2 → 29.73.4
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 +37 -1
- 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/Factory.js +1 -1
- package/src/api/interop/InteropBroker.d.ts +39 -1
- package/src/api/interop/InteropBroker.js +68 -8
- package/src/api/interop/fdc3/fdc3-1.2.js +1 -12
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +1 -0
- package/src/api/interop/fdc3/fdc3-2.0.js +10 -10
- package/src/api/interop/fdc3/utils.d.ts +8 -1
- package/src/api/interop/fdc3/utils.js +17 -3
- package/src/api/interop/utils.d.ts +1 -0
- package/src/api/interop/utils.js +9 -1
- package/src/api/system/index.d.ts +2 -1
- package/src/api/system/index.js +2 -1
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
|
};
|
|
@@ -100,6 +105,7 @@ declare namespace OpenFin {
|
|
|
100
105
|
|
|
101
106
|
type InteropBrokerOptions = {
|
|
102
107
|
contextGroups?: ContextGroupInfo;
|
|
108
|
+
logging?: InteropLoggingOptions;
|
|
103
109
|
};
|
|
104
110
|
|
|
105
111
|
export type ContextGroupInfo = {
|
|
@@ -610,9 +616,28 @@ declare namespace OpenFin {
|
|
|
610
616
|
setFileDownloadLocation: boolean;
|
|
611
617
|
};
|
|
612
618
|
|
|
619
|
+
export type LaunchExternalProcessRule = {
|
|
620
|
+
behavior: 'allow' | 'block';
|
|
621
|
+
match: string[]; // could be url match or path match
|
|
622
|
+
};
|
|
623
|
+
|
|
613
624
|
export type SystemPermissions = {
|
|
614
625
|
getAllExternalWindows: boolean;
|
|
615
|
-
launchExternalProcess:
|
|
626
|
+
launchExternalProcess:
|
|
627
|
+
| boolean
|
|
628
|
+
| {
|
|
629
|
+
assets: {
|
|
630
|
+
enabled: boolean;
|
|
631
|
+
srcRules?: LaunchExternalProcessRule[];
|
|
632
|
+
};
|
|
633
|
+
downloads: {
|
|
634
|
+
enabled: boolean;
|
|
635
|
+
};
|
|
636
|
+
executables: {
|
|
637
|
+
enabled: boolean;
|
|
638
|
+
pathRules?: LaunchExternalProcessRule[];
|
|
639
|
+
};
|
|
640
|
+
};
|
|
616
641
|
readRegistryValue:
|
|
617
642
|
| boolean
|
|
618
643
|
| {
|
|
@@ -723,6 +748,7 @@ declare namespace OpenFin {
|
|
|
723
748
|
forwardErrorReports?: boolean;
|
|
724
749
|
enableErrorReporting?: boolean;
|
|
725
750
|
};
|
|
751
|
+
interopBrokerConfiguration: InteropBrokerOptions;
|
|
726
752
|
};
|
|
727
753
|
|
|
728
754
|
export type LayoutContent = (LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent)[];
|
|
@@ -1229,6 +1255,7 @@ declare namespace OpenFin {
|
|
|
1229
1255
|
uuid: string;
|
|
1230
1256
|
entityType: EntityType;
|
|
1231
1257
|
parent: Identity;
|
|
1258
|
+
url: string;
|
|
1232
1259
|
};
|
|
1233
1260
|
|
|
1234
1261
|
export type ExternalApplicationInfo = {
|
|
@@ -1248,6 +1275,7 @@ declare namespace OpenFin {
|
|
|
1248
1275
|
lifetime?: string;
|
|
1249
1276
|
certificate?: CertificationInfo;
|
|
1250
1277
|
uuid?: string;
|
|
1278
|
+
fileUuid?: string;
|
|
1251
1279
|
initialWindowState?: string;
|
|
1252
1280
|
cwd?: string;
|
|
1253
1281
|
};
|
|
@@ -1743,4 +1771,12 @@ declare namespace OpenFin {
|
|
|
1743
1771
|
export type InteropClientOnDisconnectionListener = (
|
|
1744
1772
|
InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent
|
|
1745
1773
|
) => any;
|
|
1774
|
+
|
|
1775
|
+
export interface InteropActionLoggingOption {
|
|
1776
|
+
enabled: boolean;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
export type InteropLoggingActions = 'beforeAction' | 'afterAction';
|
|
1780
|
+
|
|
1781
|
+
export type InteropLoggingOptions = Record<InteropLoggingActions, InteropActionLoggingOption>;
|
|
1746
1782
|
}
|
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.
|
|
@@ -38,7 +38,7 @@ class InteropModule extends base_1.Base {
|
|
|
38
38
|
}
|
|
39
39
|
return provider;
|
|
40
40
|
};
|
|
41
|
-
return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration
|
|
41
|
+
return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
|
|
@@ -46,6 +46,32 @@ import Identity = OpenFin.Identity;
|
|
|
46
46
|
* }
|
|
47
47
|
* ```
|
|
48
48
|
*
|
|
49
|
+
* By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
|
|
50
|
+
* ```js
|
|
51
|
+
* {
|
|
52
|
+
* "runtime": {
|
|
53
|
+
* "arguments": "--v=1 --inspect",
|
|
54
|
+
* "version": "alpha-v19"
|
|
55
|
+
* },
|
|
56
|
+
* "platform": {
|
|
57
|
+
* "uuid": "platform_customization_local",
|
|
58
|
+
* "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
|
|
59
|
+
* "autoShow": false,
|
|
60
|
+
* "providerUrl": "http://localhost:5555/provider.html",
|
|
61
|
+
* "interopBrokerConfiguration": {
|
|
62
|
+
* "logging": {
|
|
63
|
+
* "beforeAction": {
|
|
64
|
+
* "enabled": false
|
|
65
|
+
* },
|
|
66
|
+
* "afterAction": {
|
|
67
|
+
* "enabled": false
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
49
75
|
* ---
|
|
50
76
|
* **2. Overriding**
|
|
51
77
|
*
|
|
@@ -131,6 +157,7 @@ export declare class InteropBroker extends Base {
|
|
|
131
157
|
private lastContextMap;
|
|
132
158
|
private sessionContextGroupMap;
|
|
133
159
|
private channel;
|
|
160
|
+
private logging;
|
|
134
161
|
constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
|
|
135
162
|
/**
|
|
136
163
|
* SetContextOptions interface
|
|
@@ -377,7 +404,18 @@ export declare class InteropBroker extends Base {
|
|
|
377
404
|
* @param clientIdentity
|
|
378
405
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
379
406
|
*/
|
|
380
|
-
fdc3HandleGetInfo(
|
|
407
|
+
fdc3HandleGetInfo(payload: {
|
|
408
|
+
fdc3Version: string;
|
|
409
|
+
}, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
410
|
+
/**
|
|
411
|
+
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
412
|
+
*
|
|
413
|
+
* FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
|
|
414
|
+
* an AppIdentifier.
|
|
415
|
+
* @return { Promise<Array<ClientInfo>> }
|
|
416
|
+
* @tutorial interop.getAllClientInfo()
|
|
417
|
+
*/
|
|
418
|
+
getAllClientInfo(): Promise<Array<OpenFin.ClientInfo>>;
|
|
381
419
|
decorateSnapshot(snapshot: OpenFin.Snapshot): OpenFin.Snapshot;
|
|
382
420
|
applySnapshot(snapshot: OpenFin.Snapshot, options: OpenFin.ApplySnapshotOptions): void;
|
|
383
421
|
updateExistingClients(contextGroupStates: OpenFin.ContextGroupStates): void;
|
|
@@ -93,6 +93,32 @@ let contextGroups = [
|
|
|
93
93
|
* }
|
|
94
94
|
* ```
|
|
95
95
|
*
|
|
96
|
+
* By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
|
|
97
|
+
* ```js
|
|
98
|
+
* {
|
|
99
|
+
* "runtime": {
|
|
100
|
+
* "arguments": "--v=1 --inspect",
|
|
101
|
+
* "version": "alpha-v19"
|
|
102
|
+
* },
|
|
103
|
+
* "platform": {
|
|
104
|
+
* "uuid": "platform_customization_local",
|
|
105
|
+
* "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
|
|
106
|
+
* "autoShow": false,
|
|
107
|
+
* "providerUrl": "http://localhost:5555/provider.html",
|
|
108
|
+
* "interopBrokerConfiguration": {
|
|
109
|
+
* "logging": {
|
|
110
|
+
* "beforeAction": {
|
|
111
|
+
* "enabled": false
|
|
112
|
+
* },
|
|
113
|
+
* "afterAction": {
|
|
114
|
+
* "enabled": false
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
96
122
|
* ---
|
|
97
123
|
* **2. Overriding**
|
|
98
124
|
*
|
|
@@ -176,9 +202,12 @@ class InteropBroker extends base_1.Base {
|
|
|
176
202
|
this.getProvider = getProvider;
|
|
177
203
|
this.interopClients = new Map();
|
|
178
204
|
this.contextGroupsById = new Map();
|
|
179
|
-
if (options.contextGroups) {
|
|
205
|
+
if (options === null || options === void 0 ? void 0 : options.contextGroups) {
|
|
180
206
|
contextGroups = options.contextGroups;
|
|
181
207
|
}
|
|
208
|
+
if (options === null || options === void 0 ? void 0 : options.logging) {
|
|
209
|
+
this.logging = options.logging;
|
|
210
|
+
}
|
|
182
211
|
this.intentClientMap = new Map();
|
|
183
212
|
this.lastContextMap = new Map();
|
|
184
213
|
this.sessionContextGroupMap = new Map();
|
|
@@ -695,10 +724,33 @@ class InteropBroker extends base_1.Base {
|
|
|
695
724
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
696
725
|
*/
|
|
697
726
|
// eslint-disable-next-line class-methods-use-this
|
|
698
|
-
async fdc3HandleGetInfo(clientIdentity) {
|
|
699
|
-
const
|
|
700
|
-
|
|
701
|
-
|
|
727
|
+
async fdc3HandleGetInfo(payload, clientIdentity) {
|
|
728
|
+
const { fdc3Version } = payload;
|
|
729
|
+
return {
|
|
730
|
+
fdc3Version,
|
|
731
|
+
provider: 'OpenFin',
|
|
732
|
+
providerVersion: await fin.System.getVersion(),
|
|
733
|
+
optionalFeatures: {
|
|
734
|
+
OriginatingAppMetadata: false,
|
|
735
|
+
UserChannelMembershipAPIs: true
|
|
736
|
+
},
|
|
737
|
+
appMetadata: {
|
|
738
|
+
appId: '',
|
|
739
|
+
instanceId: ''
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
745
|
+
*
|
|
746
|
+
* FDC3 2.0: Use the endpointId in the ClientInfo as the instanceId when generating
|
|
747
|
+
* an AppIdentifier.
|
|
748
|
+
* @return { Promise<Array<ClientInfo>> }
|
|
749
|
+
* @tutorial interop.getAllClientInfo()
|
|
750
|
+
*/
|
|
751
|
+
async getAllClientInfo() {
|
|
752
|
+
const provider = await this.getProvider();
|
|
753
|
+
return provider.getAllClientInfo();
|
|
702
754
|
}
|
|
703
755
|
/*
|
|
704
756
|
Snapshot APIs
|
|
@@ -974,12 +1026,20 @@ class InteropBroker extends base_1.Base {
|
|
|
974
1026
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
975
1027
|
// @ts-ignore
|
|
976
1028
|
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
1029
|
+
var _a, _b;
|
|
977
1030
|
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
978
1031
|
throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
979
1032
|
}
|
|
980
|
-
|
|
1033
|
+
if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.beforeAction) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
1034
|
+
console.log(action, payload, clientIdentity);
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
channel.afterAction((action, payload, clientIdentity) => {
|
|
1038
|
+
var _a, _b;
|
|
1039
|
+
if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
1040
|
+
console.log(action, payload, clientIdentity);
|
|
1041
|
+
}
|
|
981
1042
|
});
|
|
982
|
-
channel.afterAction(console.log);
|
|
983
1043
|
// Client functions
|
|
984
1044
|
channel.register('setContext', this.setContext.bind(this));
|
|
985
1045
|
channel.register('fireIntent', this.handleFiredIntent.bind(this));
|
|
@@ -1004,7 +1064,7 @@ class InteropBroker extends base_1.Base {
|
|
|
1004
1064
|
channel.register('fdc3FindInstances', this.fdc3HandleFindInstances.bind(this));
|
|
1005
1065
|
channel.register('fdc3GetAppMetadata', this.fdc3HandleGetAppMetadata.bind(this));
|
|
1006
1066
|
channel.register('fdc3v2GetInfo', async (payload, clientIdentity) => {
|
|
1007
|
-
return this.fdc3HandleGetInfo.bind(this)(clientIdentity);
|
|
1067
|
+
return this.fdc3HandleGetInfo.bind(this)(payload, clientIdentity);
|
|
1008
1068
|
});
|
|
1009
1069
|
}
|
|
1010
1070
|
/**
|
|
@@ -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
|
/**
|
|
@@ -290,6 +290,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
290
290
|
leaveCurrentChannel(): Promise<void>;
|
|
291
291
|
/**
|
|
292
292
|
* Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
|
|
293
|
+
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
293
294
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
294
295
|
* @tutorial fdc3v2.getInfo
|
|
295
296
|
*/
|
|
@@ -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
|
/**
|
|
@@ -448,19 +455,12 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
448
455
|
}
|
|
449
456
|
/**
|
|
450
457
|
* Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
|
|
458
|
+
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
451
459
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
452
460
|
* @tutorial fdc3v2.getInfo
|
|
453
461
|
*/
|
|
454
462
|
async getInfo() {
|
|
455
|
-
|
|
456
|
-
const result = await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', {});
|
|
457
|
-
const partialInfo = this.fdc3Module.getInfo();
|
|
458
|
-
return { ...partialInfo, ...result };
|
|
459
|
-
}
|
|
460
|
-
catch (error) {
|
|
461
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetInfo ? 'ResolverUnavailable' : error;
|
|
462
|
-
throw new Error(errorToThrow);
|
|
463
|
-
}
|
|
463
|
+
return InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
exports.default = Fdc3Module2;
|
|
@@ -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;
|
|
@@ -15,3 +15,4 @@ export declare const BROKER_ERRORS: {
|
|
|
15
15
|
fdc3GetInfo: string;
|
|
16
16
|
};
|
|
17
17
|
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
|
18
|
+
export declare const generateDefaultLoggingOptions: () => OpenFin.InteropLoggingOptions;
|
package/src/api/interop/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
|
|
3
|
+
exports.generateDefaultLoggingOptions = exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
|
|
4
4
|
const generateId = () => `${Math.random()}${Date.now()}`;
|
|
5
5
|
exports.generateId = generateId;
|
|
6
6
|
const wrapInTryCatch = (f, prefix) => (...args) => {
|
|
@@ -59,3 +59,11 @@ const wrapIntentHandler = (handler, handlerId) => {
|
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
exports.wrapIntentHandler = wrapIntentHandler;
|
|
62
|
+
const generateDefaultLoggingOptions = () => {
|
|
63
|
+
const loggingActions = ['beforeAction', 'afterAction'];
|
|
64
|
+
const options = loggingActions.reduce((accumulator, loggingOption) => {
|
|
65
|
+
return { ...accumulator, [loggingOption]: { enabled: true } };
|
|
66
|
+
}, {});
|
|
67
|
+
return options;
|
|
68
|
+
};
|
|
69
|
+
exports.generateDefaultLoggingOptions = generateDefaultLoggingOptions;
|
|
@@ -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
|
|
@@ -769,7 +770,7 @@ export default class System extends EmitterBase<SystemEvents> {
|
|
|
769
770
|
* Runs an executable or batch file. A path to the file must be included in options.
|
|
770
771
|
* <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
|
|
771
772
|
* <br> Note: This method is restricted by default and must be enabled via
|
|
772
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
773
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
|
|
773
774
|
* @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
|
|
774
775
|
* @return {Promise.<Identity>}
|
|
775
776
|
* @tutorial System.launchExternalProcess
|
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
|
|
@@ -890,7 +891,7 @@ class System extends base_1.EmitterBase {
|
|
|
890
891
|
* Runs an executable or batch file. A path to the file must be included in options.
|
|
891
892
|
* <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
|
|
892
893
|
* <br> Note: This method is restricted by default and must be enabled via
|
|
893
|
-
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
894
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
|
|
894
895
|
* @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
|
|
895
896
|
* @return {Promise.<Identity>}
|
|
896
897
|
* @tutorial System.launchExternalProcess
|