@openfin/core 30.73.28 → 30.74.6
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/LICENSE.md +4 -0
- package/package.json +2 -2
- package/src/OpenFin.d.ts +1726 -189
- package/src/OpenFin.js +3 -2
- package/src/api/api-exposer/api-consumer.d.ts +28 -0
- package/src/api/api-exposer/api-consumer.js +28 -0
- package/src/api/api-exposer/api-exposer.d.ts +35 -0
- package/src/api/api-exposer/api-exposer.js +38 -0
- package/src/api/api-exposer/decorators.d.ts +10 -0
- package/src/api/api-exposer/decorators.js +18 -0
- package/src/api/api-exposer/index.d.ts +4 -0
- package/src/api/api-exposer/index.js +20 -0
- package/src/api/api-exposer/strategies/index.d.ts +1 -0
- package/src/api/api-exposer/strategies/index.js +17 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
- package/src/api/application/Factory.d.ts +1 -0
- package/src/api/application/Factory.js +1 -0
- package/src/api/application/Instance.d.ts +2 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/base.d.ts +2 -2
- package/src/api/clipboard/index.d.ts +1 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/base.d.ts +0 -3
- package/src/api/events/platform.d.ts +4 -5
- package/src/api/events/system.d.ts +5 -6
- package/src/api/events/view.d.ts +6 -3
- package/src/api/events/webcontents.d.ts +25 -3
- package/src/api/events/window.d.ts +21 -13
- package/src/api/external-application/Instance.d.ts +1 -1
- package/src/api/fin.d.ts +1 -1
- package/src/api/frame/Instance.d.ts +1 -1
- package/src/api/global-hotkey/index.d.ts +1 -1
- package/src/api/interappbus/channel/channel.d.ts +1 -1
- package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
- package/src/api/interappbus/channel/channels-docs.js +7 -0
- package/src/api/interappbus/channel/client.d.ts +3 -2
- package/src/api/interappbus/channel/client.js +12 -5
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
- package/src/api/interappbus/channel/index.d.ts +1 -1
- package/src/api/interappbus/channel/index.js +6 -8
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
- package/src/api/interappbus/channel/provider.d.ts +1 -1
- package/src/api/interappbus/index.d.ts +1 -1
- package/src/api/interop/Factory.d.ts +1 -2
- package/src/api/interop/Factory.js +20 -4
- package/src/api/interop/InteropBroker.d.ts +15 -47
- package/src/api/interop/InteropBroker.js +38 -46
- package/src/api/interop/InteropClient.d.ts +10 -9
- package/src/api/interop/InteropClient.js +9 -8
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -0
- package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +15 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
- package/src/api/interop/fdc3/fdc3-1.2.js +27 -12
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +13 -12
- package/src/api/interop/fdc3/fdc3-2.0.js +33 -26
- package/src/api/interop/fdc3/fdc3.d.ts +4 -5
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +1 -1
- package/src/api/interop/fdc3/utils.d.ts +17 -0
- package/src/api/interop/fdc3/utils.js +52 -18
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/me.d.ts +1 -1
- package/src/api/platform/Factory.d.ts +6 -1
- package/src/api/platform/Factory.js +5 -0
- package/src/api/platform/Instance.d.ts +5 -3
- package/src/api/platform/Instance.js +5 -3
- package/src/api/platform/layout/Factory.d.ts +4 -0
- package/src/api/platform/layout/Factory.js +15 -3
- package/src/api/platform/layout/Instance.d.ts +7 -1
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
- package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
- package/src/api/platform/layout/entities/layout-entities.js +216 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +3 -0
- package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +1 -0
- package/src/api/snapshot-source/Factory.js +1 -0
- package/src/api/snapshot-source/Instance.d.ts +1 -1
- package/src/api/system/index.d.ts +1 -471
- package/src/api/system/index.js +6 -476
- package/src/api/view/Instance.d.ts +24 -5
- package/src/api/view/Instance.js +53 -8
- package/src/api/webcontents/main.d.ts +18 -4
- package/src/api/window/Instance.d.ts +26 -1
- package/src/api/window/Instance.js +25 -0
- package/src/browser.js +1 -1
- package/src/mock.js +1 -1
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/transport/fin_store.d.ts +1 -1
- package/src/transport/transport-errors.d.ts +6 -1
- package/src/transport/transport-errors.js +1 -2
- package/src/transport/transport.d.ts +9 -6
- package/src/transport/transport.js +11 -2
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +37 -0
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
|
@@ -11,7 +11,15 @@ class PrivateChannelProvider {
|
|
|
11
11
|
this.contextByContextType = new Map();
|
|
12
12
|
this.lastContext = undefined;
|
|
13
13
|
this.provider.onConnection((clientIdentity) => this.registerNewClient(clientIdentity));
|
|
14
|
-
this.provider.onDisconnection((clientIdentity) =>
|
|
14
|
+
this.provider.onDisconnection(async (clientIdentity) => {
|
|
15
|
+
const { endpointId } = clientIdentity;
|
|
16
|
+
if (this.clients.has(endpointId)) {
|
|
17
|
+
await this.handleClientDisconnecting(clientIdentity);
|
|
18
|
+
}
|
|
19
|
+
if ((await this.provider.getAllClientInfo()).length === 0) {
|
|
20
|
+
this.provider.destroy();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
15
23
|
}
|
|
16
24
|
getClientState(id) {
|
|
17
25
|
return this.clients.get(id.endpointId);
|
|
@@ -25,7 +33,9 @@ class PrivateChannelProvider {
|
|
|
25
33
|
this.provider.register('onAddContextHandlerAdded', this.onAddContextHandlerAdded.bind(this));
|
|
26
34
|
this.provider.register('onDisconnectHandlerAdded', this.onDisconnectHandlerAdded.bind(this));
|
|
27
35
|
this.provider.register('onUnsubscribeHandlerAdded', this.onUnsubscribeHandlerAdded.bind(this));
|
|
28
|
-
this.provider.register('clientDisconnecting',
|
|
36
|
+
this.provider.register('clientDisconnecting', (payload, clientIdentity) => {
|
|
37
|
+
this.handleClientDisconnecting(clientIdentity);
|
|
38
|
+
});
|
|
29
39
|
}
|
|
30
40
|
broadcast(payload, broadcasterClientIdentity) {
|
|
31
41
|
const { context } = payload;
|
|
@@ -110,17 +120,18 @@ class PrivateChannelProvider {
|
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
// getting only valid client connections here, it is possible we haven't removed a disconnected client from the map yet
|
|
124
|
+
// so we need to ensure we don't dispatch to any disconnected client
|
|
125
|
+
// TODO: Take a look at our client disconnection logic and see if we can handle client disconnection cleanly
|
|
126
|
+
const clientsToDispatchTo = await this.getConnectedClients();
|
|
127
|
+
const dispatchPromises = clientsToDispatchTo.map(async (otherClientState) => {
|
|
128
|
+
const { clientIdentity, clientIdentity: { endpointId }, onUnsubscribeHandlerId } = otherClientState;
|
|
129
|
+
if (endpointId !== removingClientIdentity.endpointId && onUnsubscribeHandlerId) {
|
|
130
|
+
await this.provider.dispatch(clientIdentity, onUnsubscribeHandlerId, contextType);
|
|
120
131
|
}
|
|
121
|
-
}
|
|
132
|
+
});
|
|
122
133
|
try {
|
|
123
|
-
await Promise.all(
|
|
134
|
+
await Promise.all(dispatchPromises);
|
|
124
135
|
}
|
|
125
136
|
catch (error) {
|
|
126
137
|
console.error(`Problem when attempting to dispatch to onUnsubscribeHandlers. Error: ${error} Removing Client: ${handlerId}. uuid: ${removingClientIdentity.uuid}. name: ${removingClientIdentity.name}. endpointId: ${removingClientIdentity.endpointId}`);
|
|
@@ -181,32 +192,68 @@ class PrivateChannelProvider {
|
|
|
181
192
|
}
|
|
182
193
|
clientState.onUnsubscribeHandlerId = handlerId;
|
|
183
194
|
}
|
|
184
|
-
|
|
195
|
+
removeClient(disconnectingClientIdentity) {
|
|
185
196
|
const disconnectingClientState = this.getClientState(disconnectingClientIdentity);
|
|
186
197
|
if (!disconnectingClientState) {
|
|
187
198
|
throw new Error(`Client with Identity: ${disconnectingClientIdentity.uuid} ${disconnectingClientIdentity.name}, tried to call disconnect, is not connected to this Private Channel`);
|
|
188
199
|
}
|
|
189
200
|
disconnectingClientState.handlerIdsByContextTypes.clear();
|
|
190
201
|
this.clients.delete(disconnectingClientIdentity.endpointId);
|
|
191
|
-
|
|
202
|
+
}
|
|
203
|
+
async fireOnDisconnectForOtherClients(disconnectingClientIdentity) {
|
|
192
204
|
// TODO: call onDisconnect Handler of the other client only.
|
|
193
205
|
// CURRENTLY, just calling the onDisconnect handler for all the other clients. Once we limit it to just one other client, we can eliminate all the iteration code.
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
const { endpointId } = disconnectingClientIdentity;
|
|
207
|
+
// getting only valid client connections here, it is possible we haven't removed a disconnected client from the map yet
|
|
208
|
+
// so we need to ensure we don't dispatch to any disconnected client
|
|
209
|
+
// TODO: Take a look at our client disconnection logic and see if we can handle client disconnection cleanly
|
|
210
|
+
const clientsToDispatchTo = await this.getConnectedClients();
|
|
211
|
+
const dispatchPromises = clientsToDispatchTo.map(async (otherClientState) => {
|
|
212
|
+
const { clientIdentity: { endpointId: otherClientEndpointId }, onDisconnectHandlerId } = otherClientState;
|
|
213
|
+
if (otherClientEndpointId !== endpointId && onDisconnectHandlerId) {
|
|
214
|
+
await this.provider.dispatch(otherClientState.clientIdentity, onDisconnectHandlerId);
|
|
200
215
|
}
|
|
201
|
-
}
|
|
216
|
+
});
|
|
202
217
|
try {
|
|
203
|
-
await Promise.all(
|
|
218
|
+
await Promise.all(dispatchPromises);
|
|
204
219
|
}
|
|
205
220
|
catch (error) {
|
|
206
221
|
console.error(`Problem when attempting to dispatch to onDisconnectHandlers. Error: ${error} Disconnecting Client: uuid: ${disconnectingClientIdentity.uuid}. name: ${disconnectingClientIdentity.name}. endpointId: ${disconnectingClientIdentity.endpointId}`);
|
|
207
222
|
throw new Error(error);
|
|
208
223
|
}
|
|
209
224
|
}
|
|
225
|
+
async unsubscribeAll(clientIdentity) {
|
|
226
|
+
const { endpointId } = clientIdentity;
|
|
227
|
+
const state = this.clients.get(endpointId);
|
|
228
|
+
if (state) {
|
|
229
|
+
const contextTypeHandlerIds = Array.from(state.handlerIdsByContextTypes.values()).flat();
|
|
230
|
+
const globalHandlerId = state.globalHandler;
|
|
231
|
+
if (contextTypeHandlerIds.length > 0) {
|
|
232
|
+
const unsubPromises = contextTypeHandlerIds.map(async (handlerId) => {
|
|
233
|
+
return this.contextHandlerRemoved({ handlerId }, clientIdentity);
|
|
234
|
+
});
|
|
235
|
+
try {
|
|
236
|
+
await Promise.all(unsubPromises);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
console.error(error.message);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (globalHandlerId) {
|
|
243
|
+
try {
|
|
244
|
+
await this.contextHandlerRemoved({ handlerId: globalHandlerId }, clientIdentity);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
console.error(error.message);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
async handleClientDisconnecting(disconnectingClientIdentity) {
|
|
253
|
+
await this.unsubscribeAll(disconnectingClientIdentity);
|
|
254
|
+
this.removeClient(disconnectingClientIdentity);
|
|
255
|
+
await this.fireOnDisconnectForOtherClients(disconnectingClientIdentity);
|
|
256
|
+
}
|
|
210
257
|
registerNewClient(clientIdentity) {
|
|
211
258
|
if (!this.clients.has(clientIdentity.endpointId)) {
|
|
212
259
|
const clientSubscriptionState = {
|
|
@@ -220,5 +267,17 @@ class PrivateChannelProvider {
|
|
|
220
267
|
this.clients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
221
268
|
}
|
|
222
269
|
}
|
|
270
|
+
async getConnectedClients() {
|
|
271
|
+
const allClientInfo = await this.provider.getAllClientInfo();
|
|
272
|
+
return Array.from(this.clients.values()).filter((clientState) => {
|
|
273
|
+
const { uuid, name } = clientState.clientIdentity;
|
|
274
|
+
return allClientInfo.some(clientInfo => {
|
|
275
|
+
return name === clientInfo.name && uuid === clientInfo.uuid;
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
static init(channelProvider, id) {
|
|
280
|
+
return new PrivateChannelProvider(channelProvider, id);
|
|
281
|
+
}
|
|
223
282
|
}
|
|
224
283
|
exports.PrivateChannelProvider = PrivateChannelProvider;
|
|
@@ -130,7 +130,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
130
130
|
this.wire.sendAction('fdc3-broadcast').catch((e) => {
|
|
131
131
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
132
132
|
});
|
|
133
|
-
this.fin.me.interop.setContext(context);
|
|
133
|
+
return this.fin.me.interop.setContext(context);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
|
@@ -165,15 +165,19 @@ class Fdc3Module extends base_1.Base {
|
|
|
165
165
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
166
166
|
});
|
|
167
167
|
try {
|
|
168
|
-
await this.fin.me.interop.joinContextGroup(channelId);
|
|
168
|
+
return await this.fin.me.interop.joinContextGroup(channelId);
|
|
169
169
|
}
|
|
170
170
|
catch (error) {
|
|
171
171
|
if (error.message === utils_2.BROKER_ERRORS.joinSessionContextGroupWithJoinContextGroup) {
|
|
172
|
-
|
|
172
|
+
console.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.');
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
|
|
175
|
+
console.error(error.message);
|
|
176
176
|
}
|
|
177
|
+
if (error.message.startsWith('Attempting to join a context group that does not exist')) {
|
|
178
|
+
throw new Error(utils_1.ChannelError.NoChannelFound);
|
|
179
|
+
}
|
|
180
|
+
throw new Error(utils_1.ChannelError.AccessDenied);
|
|
177
181
|
}
|
|
178
182
|
}
|
|
179
183
|
/**
|
|
@@ -187,7 +191,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
187
191
|
this.wire.sendAction('fdc3-leave-current-channel').catch((e) => {
|
|
188
192
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
189
193
|
});
|
|
190
|
-
this.fin.me.interop.removeFromContextGroup();
|
|
194
|
+
return this.fin.me.interop.removeFromContextGroup();
|
|
191
195
|
}
|
|
192
196
|
/**
|
|
193
197
|
* Adds a listener for incoming Intents.
|
|
@@ -232,7 +236,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
232
236
|
return await this.fin.me.interop.fireIntent(intentObj);
|
|
233
237
|
}
|
|
234
238
|
catch (error) {
|
|
235
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
|
|
239
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
|
236
240
|
throw new Error(errorToThrow);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
@@ -266,7 +270,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
266
270
|
return await this.fin.me.interop.getInfoForIntent({ name: intent, context });
|
|
267
271
|
}
|
|
268
272
|
catch (error) {
|
|
269
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error;
|
|
273
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
|
|
270
274
|
throw new Error(errorToThrow);
|
|
271
275
|
}
|
|
272
276
|
}
|
|
@@ -284,7 +288,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
284
288
|
return await this.fin.me.interop.getInfoForIntentsByContext(context);
|
|
285
289
|
}
|
|
286
290
|
catch (error) {
|
|
287
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
|
|
291
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
|
|
288
292
|
throw new Error(errorToThrow);
|
|
289
293
|
}
|
|
290
294
|
}
|
|
@@ -303,7 +307,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
303
307
|
return await this.fin.me.interop.fireIntentForContext({ ...context, metadata: { target: app } });
|
|
304
308
|
}
|
|
305
309
|
catch (error) {
|
|
306
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error;
|
|
310
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fireIntentForContext ? 'ResolverUnavailable' : error.message;
|
|
307
311
|
throw new Error(errorToThrow);
|
|
308
312
|
}
|
|
309
313
|
}
|
|
@@ -317,8 +321,19 @@ class Fdc3Module extends base_1.Base {
|
|
|
317
321
|
this.wire.sendAction('fdc3-get-or-create-channel').catch((e) => {
|
|
318
322
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
319
323
|
});
|
|
320
|
-
const
|
|
321
|
-
|
|
324
|
+
const systemChannels = await this.getSystemChannels();
|
|
325
|
+
const userChannel = systemChannels.find((channel) => channel.id === channelId);
|
|
326
|
+
if (userChannel) {
|
|
327
|
+
return { ...userChannel, type: 'system', ...(0, utils_1.getUnsupportedChannelApis)() };
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
const sessionContextGroup = await this.fin.me.interop.joinSessionContextGroup(channelId);
|
|
331
|
+
return (0, utils_1.buildAppChannelObject)(sessionContextGroup);
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
console.error(error.message);
|
|
335
|
+
throw new Error(utils_1.ChannelError.CreationFailed);
|
|
336
|
+
}
|
|
322
337
|
}
|
|
323
338
|
/**
|
|
324
339
|
* Returns metadata relating to the FDC3 object and its provider, including the supported version of the FDC3 specification and the name of the provider of the implementation.
|
|
@@ -354,7 +369,7 @@ class Fdc3Module extends base_1.Base {
|
|
|
354
369
|
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3Open', { app, context });
|
|
355
370
|
}
|
|
356
371
|
catch (error) {
|
|
357
|
-
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error;
|
|
372
|
+
const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error.message;
|
|
358
373
|
throw new Error(errorToThrow);
|
|
359
374
|
}
|
|
360
375
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as FDC3v1 from './shapes/fdc3v1';
|
|
2
2
|
import type * as FDC3v2 from './shapes/fdc3v2';
|
|
3
3
|
import { Base } from '../../base';
|
|
4
|
-
import Transport from '../../../transport/transport';
|
|
4
|
+
import { Transport } from '../../../transport/transport';
|
|
5
5
|
/**
|
|
6
6
|
* @typedef { object } AppIdentifier
|
|
7
7
|
* @summary Identifies an application, or instance of an application, and is used to target FDC3 API calls at specific applications.
|
|
@@ -171,14 +171,14 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
171
171
|
* Find all the available instances for a particular application.
|
|
172
172
|
* @param { AppIdentifier } app
|
|
173
173
|
* @returns { Promise<Array<AppIdentifier>> }
|
|
174
|
-
* @tutorial findInstances
|
|
174
|
+
* @tutorial fdc3v2.findInstances
|
|
175
175
|
*/
|
|
176
176
|
findInstances(app: FDC3v2.AppIdentifier): Promise<Array<FDC3v2.AppIdentifier>>;
|
|
177
177
|
/**
|
|
178
178
|
* Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.
|
|
179
179
|
* @param { AppIdentifier } app
|
|
180
180
|
* @returns { Promise<AppMetadata(2)> }
|
|
181
|
-
* @tutorial getAppMetadata
|
|
181
|
+
* @tutorial fdc3v2.getAppMetadata
|
|
182
182
|
*/
|
|
183
183
|
getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3v2.AppMetadata>;
|
|
184
184
|
/**
|
|
@@ -210,7 +210,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
210
210
|
* @param { Context } context
|
|
211
211
|
* @param { string } [resultType] The type of result returned for any intent specified during resolution.
|
|
212
212
|
* @returns { Promise<Array<AppIntent(2)>> }
|
|
213
|
-
* @tutorial findIntentsByContext
|
|
213
|
+
* @tutorial fdc3v2.findIntentsByContext
|
|
214
214
|
*/
|
|
215
215
|
findIntentsByContext(context: FDC3v2.Context, resultType?: string): Promise<Array<FDC3v2.AppIntent>>;
|
|
216
216
|
/**
|
|
@@ -219,7 +219,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
219
219
|
* @param { Context } context Context associated with the Intent
|
|
220
220
|
* @param { AppIdentifier | TargetApp } [app]
|
|
221
221
|
* @returns { Promise<IntentResolution(2)> }
|
|
222
|
-
* @tutorial raiseIntent
|
|
222
|
+
* @tutorial fdc3v2.raiseIntent
|
|
223
223
|
*/
|
|
224
224
|
raiseIntent(intent: string, context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
|
|
225
225
|
/**
|
|
@@ -227,7 +227,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
227
227
|
* @param { Context } context Context associated with the Intent
|
|
228
228
|
* @param { AppIdentifier | TargetApp } [app]
|
|
229
229
|
* @returns { Promise<IntentResolution(2)> }
|
|
230
|
-
* @tutorial raiseIntentForContext
|
|
230
|
+
* @tutorial fdc3v2.raiseIntentForContext
|
|
231
231
|
*/
|
|
232
232
|
raiseIntentForContext(context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
|
|
233
233
|
/**
|
|
@@ -244,17 +244,17 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
244
244
|
* @returns { Promise<Channel> }
|
|
245
245
|
* @tutorial fdc3.getOrCreateChannel
|
|
246
246
|
*/
|
|
247
|
-
getOrCreateChannel(channelId: string): Promise<
|
|
247
|
+
getOrCreateChannel(channelId: string): Promise<FDC3v2.Channel>;
|
|
248
248
|
/**
|
|
249
249
|
* Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
|
|
250
250
|
* @returns { Promise<PrivateChannel> }
|
|
251
|
-
* @tutorial createPrivateChannel
|
|
251
|
+
* @tutorial fdc3v2.createPrivateChannel
|
|
252
252
|
*/
|
|
253
253
|
createPrivateChannel(): Promise<FDC3v2.PrivateChannel>;
|
|
254
254
|
/**
|
|
255
255
|
* Retrieves a list of the User Channels available for the app to join.
|
|
256
256
|
* @returns { Promise<Channel[]>}
|
|
257
|
-
* @tutorial getUserChannels
|
|
257
|
+
* @tutorial fdc3v2.getUserChannels
|
|
258
258
|
*/
|
|
259
259
|
getUserChannels(): Promise<Array<FDC3v1.SystemChannel>>;
|
|
260
260
|
/**
|
|
@@ -268,7 +268,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
268
268
|
* Join an app to a specified User channel.
|
|
269
269
|
* @param { string } channelId Channel name
|
|
270
270
|
* @returns { Promise<void> }
|
|
271
|
-
* @tutorial joinUserChannel
|
|
271
|
+
* @tutorial fdc3v2.joinUserChannel
|
|
272
272
|
*/
|
|
273
273
|
joinUserChannel(channelId: string): Promise<void>;
|
|
274
274
|
/**
|
|
@@ -282,8 +282,9 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
282
282
|
/**
|
|
283
283
|
* Returns the Channel object for the current User channel membership
|
|
284
284
|
* @returns { Promise<FDC3.Channel | null> }
|
|
285
|
+
* @tutorial fdc3.getCurrentChannel
|
|
285
286
|
*/
|
|
286
|
-
getCurrentChannel(): Promise<
|
|
287
|
+
getCurrentChannel(): Promise<FDC3v2.Channel | null>;
|
|
287
288
|
/**
|
|
288
289
|
* Removes the app from any User channel membership.
|
|
289
290
|
* @returns { Promise<void> }
|
|
@@ -294,7 +295,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
294
295
|
* 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.
|
|
295
296
|
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
296
297
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
297
|
-
* @tutorial getInfo
|
|
298
|
+
* @tutorial fdc3v2.getInfo
|
|
298
299
|
*/
|
|
299
300
|
getInfo(): Promise<FDC3v2.ImplementationMetadata>;
|
|
300
301
|
}
|
|
@@ -6,7 +6,6 @@ const InteropClient_1 = require("../InteropClient");
|
|
|
6
6
|
const utils_2 = require("./utils");
|
|
7
7
|
const fdc3_1_2_1 = require("./fdc3-1.2");
|
|
8
8
|
const PrivateChannelClient_1 = require("./PrivateChannelClient");
|
|
9
|
-
const PrivateChannelProvider_1 = require("./PrivateChannelProvider");
|
|
10
9
|
/**
|
|
11
10
|
* @typedef { object } AppIdentifier
|
|
12
11
|
* @summary Identifies an application, or instance of an application, and is used to target FDC3 API calls at specific applications.
|
|
@@ -181,7 +180,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
181
180
|
* Find all the available instances for a particular application.
|
|
182
181
|
* @param { AppIdentifier } app
|
|
183
182
|
* @returns { Promise<Array<AppIdentifier>> }
|
|
184
|
-
* @tutorial findInstances
|
|
183
|
+
* @tutorial fdc3v2.findInstances
|
|
185
184
|
*/
|
|
186
185
|
async findInstances(app) {
|
|
187
186
|
this.wire.sendAction('fdc3-find-instances').catch((e) => {
|
|
@@ -191,7 +190,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
191
190
|
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3FindInstances', app);
|
|
192
191
|
}
|
|
193
192
|
catch (error) {
|
|
194
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error;
|
|
193
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error.message;
|
|
195
194
|
throw new Error(errorToThrow);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
@@ -199,7 +198,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
199
198
|
* Retrieves the AppMetadata for an AppIdentifier, which provides additional metadata (such as icons, a title and description) from the App Directory record for the application, that may be used for display purposes.
|
|
200
199
|
* @param { AppIdentifier } app
|
|
201
200
|
* @returns { Promise<AppMetadata(2)> }
|
|
202
|
-
* @tutorial getAppMetadata
|
|
201
|
+
* @tutorial fdc3v2.getAppMetadata
|
|
203
202
|
*/
|
|
204
203
|
async getAppMetadata(app) {
|
|
205
204
|
this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
|
|
@@ -209,7 +208,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
209
208
|
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3GetAppMetadata', app);
|
|
210
209
|
}
|
|
211
210
|
catch (error) {
|
|
212
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error;
|
|
211
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error.message;
|
|
213
212
|
throw new Error(errorToThrow);
|
|
214
213
|
}
|
|
215
214
|
}
|
|
@@ -268,7 +267,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
268
267
|
return await this.fin.me.interop.getInfoForIntent({ name: intent, context, metadata: { resultType } });
|
|
269
268
|
}
|
|
270
269
|
catch (error) {
|
|
271
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error;
|
|
270
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntent ? 'ResolverUnavailable' : error.message;
|
|
272
271
|
throw new Error(errorToThrow);
|
|
273
272
|
}
|
|
274
273
|
}
|
|
@@ -277,7 +276,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
277
276
|
* @param { Context } context
|
|
278
277
|
* @param { string } [resultType] The type of result returned for any intent specified during resolution.
|
|
279
278
|
* @returns { Promise<Array<AppIntent(2)>> }
|
|
280
|
-
* @tutorial findIntentsByContext
|
|
279
|
+
* @tutorial fdc3v2.findIntentsByContext
|
|
281
280
|
*/
|
|
282
281
|
async findIntentsByContext(context, resultType) {
|
|
283
282
|
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
|
@@ -288,7 +287,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
288
287
|
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
|
|
289
288
|
}
|
|
290
289
|
catch (error) {
|
|
291
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
|
|
290
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error.message;
|
|
292
291
|
throw new Error(errorToThrow);
|
|
293
292
|
}
|
|
294
293
|
}
|
|
@@ -298,7 +297,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
298
297
|
* @param { Context } context Context associated with the Intent
|
|
299
298
|
* @param { AppIdentifier | TargetApp } [app]
|
|
300
299
|
* @returns { Promise<IntentResolution(2)> }
|
|
301
|
-
* @tutorial raiseIntent
|
|
300
|
+
* @tutorial fdc3v2.raiseIntent
|
|
302
301
|
*/
|
|
303
302
|
async raiseIntent(intent, context, app) {
|
|
304
303
|
this.wire.sendAction('fdc3-raise-intent').catch((e) => {
|
|
@@ -308,7 +307,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
308
307
|
return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app, intent);
|
|
309
308
|
}
|
|
310
309
|
catch (error) {
|
|
311
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
|
|
310
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
|
312
311
|
throw new Error(errorToThrow);
|
|
313
312
|
}
|
|
314
313
|
}
|
|
@@ -317,7 +316,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
317
316
|
* @param { Context } context Context associated with the Intent
|
|
318
317
|
* @param { AppIdentifier | TargetApp } [app]
|
|
319
318
|
* @returns { Promise<IntentResolution(2)> }
|
|
320
|
-
* @tutorial raiseIntentForContext
|
|
319
|
+
* @tutorial fdc3v2.raiseIntentForContext
|
|
321
320
|
*/
|
|
322
321
|
async raiseIntentForContext(context, app) {
|
|
323
322
|
// TODO: We have to do the same thing we do for raiseIntent here as well.
|
|
@@ -328,7 +327,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
328
327
|
return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app);
|
|
329
328
|
}
|
|
330
329
|
catch (error) {
|
|
331
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
|
|
330
|
+
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error.message;
|
|
332
331
|
throw new Error(errorToThrow);
|
|
333
332
|
}
|
|
334
333
|
}
|
|
@@ -349,27 +348,27 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
349
348
|
// The FDC3 Intenter handler only expects the context and contextMetadata to be passed to the handler,
|
|
350
349
|
// so we wrap it here and only pass those paramaters.
|
|
351
350
|
const contextHandler = async (raisedIntent) => {
|
|
351
|
+
let intentResult;
|
|
352
|
+
let intentResultToSend;
|
|
352
353
|
const { context, metadata: intentMetadata } = raisedIntent;
|
|
353
354
|
const { contextMetadata, metadata, ...rest } = context;
|
|
354
|
-
|
|
355
|
+
const intentResolutionResultId = (intentMetadata === null || intentMetadata === void 0 ? void 0 : intentMetadata.intentResolutionResultId) || (metadata === null || metadata === void 0 ? void 0 : metadata.intentResolutionResultId);
|
|
355
356
|
try {
|
|
356
357
|
const newContext = metadata ? { metadata, ...rest } : { ...rest };
|
|
357
358
|
intentResult = await handler(newContext, contextMetadata);
|
|
359
|
+
intentResultToSend = intentResult;
|
|
358
360
|
}
|
|
359
361
|
catch (error) {
|
|
360
362
|
intentResult = error;
|
|
363
|
+
intentResultToSend = { error: true };
|
|
361
364
|
}
|
|
362
|
-
const intentResolutionResultId = (intentMetadata === null || intentMetadata === void 0 ? void 0 : intentMetadata.intentResolutionResultId) || (metadata === null || metadata === void 0 ? void 0 : metadata.intentResolutionResultId);
|
|
363
365
|
if (intentResolutionResultId) {
|
|
364
|
-
|
|
365
|
-
this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResult);
|
|
366
|
+
this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResultToSend);
|
|
366
367
|
}
|
|
367
368
|
if (intentResult instanceof Error) {
|
|
368
369
|
throw new Error(intentResult.message);
|
|
369
370
|
}
|
|
370
|
-
|
|
371
|
-
return intentResult;
|
|
372
|
-
}
|
|
371
|
+
return intentResult;
|
|
373
372
|
};
|
|
374
373
|
return this.fin.me.interop.registerIntentHandler(contextHandler, intent, { fdc3Version: '2.0' });
|
|
375
374
|
}
|
|
@@ -385,12 +384,11 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
385
384
|
/**
|
|
386
385
|
* Returns a Channel with an auto-generated identity that is intended for private communication between applications. Primarily used to create channels that will be returned to other applications via an IntentResolution for a raised intent.
|
|
387
386
|
* @returns { Promise<PrivateChannel> }
|
|
388
|
-
* @tutorial createPrivateChannel
|
|
387
|
+
* @tutorial fdc3v2.createPrivateChannel
|
|
389
388
|
*/
|
|
390
389
|
async createPrivateChannel() {
|
|
391
390
|
const channelId = (0, utils_1.generateId)();
|
|
392
|
-
|
|
393
|
-
const newPrivateChannelProvider = new PrivateChannelProvider_1.PrivateChannelProvider(channelProvider, channelId);
|
|
391
|
+
await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'createPrivateChannelProvider', { channelId });
|
|
394
392
|
const channelClient = await this.fin.InterApplicationBus.Channel.connect(channelId);
|
|
395
393
|
const newPrivateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
|
396
394
|
return (0, utils_2.buildPrivateChannelObject)(newPrivateChannelClient);
|
|
@@ -398,7 +396,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
398
396
|
/**
|
|
399
397
|
* Retrieves a list of the User Channels available for the app to join.
|
|
400
398
|
* @returns { Promise<Channel[]>}
|
|
401
|
-
* @tutorial getUserChannels
|
|
399
|
+
* @tutorial fdc3v2.getUserChannels
|
|
402
400
|
*/
|
|
403
401
|
async getUserChannels() {
|
|
404
402
|
const channels = await this.fin.me.interop.getContextGroups();
|
|
@@ -422,7 +420,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
422
420
|
* Join an app to a specified User channel.
|
|
423
421
|
* @param { string } channelId Channel name
|
|
424
422
|
* @returns { Promise<void> }
|
|
425
|
-
* @tutorial joinUserChannel
|
|
423
|
+
* @tutorial fdc3v2.joinUserChannel
|
|
426
424
|
*/
|
|
427
425
|
async joinUserChannel(channelId) {
|
|
428
426
|
return this.fdc3Module.joinChannel(channelId);
|
|
@@ -441,9 +439,18 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
441
439
|
/**
|
|
442
440
|
* Returns the Channel object for the current User channel membership
|
|
443
441
|
* @returns { Promise<FDC3.Channel | null> }
|
|
442
|
+
* @tutorial fdc3.getCurrentChannel
|
|
444
443
|
*/
|
|
445
444
|
async getCurrentChannel() {
|
|
446
|
-
|
|
445
|
+
const currentChannel = await this.fdc3Module.getCurrentChannel();
|
|
446
|
+
if (!currentChannel) {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
return {
|
|
450
|
+
...currentChannel,
|
|
451
|
+
type: 'user',
|
|
452
|
+
broadcast: this.broadcast.bind(this)
|
|
453
|
+
};
|
|
447
454
|
}
|
|
448
455
|
/**
|
|
449
456
|
* Removes the app from any User channel membership.
|
|
@@ -457,7 +464,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
457
464
|
* 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
465
|
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
459
466
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
460
|
-
* @tutorial getInfo
|
|
467
|
+
* @tutorial fdc3v2.getInfo
|
|
461
468
|
*/
|
|
462
469
|
async getInfo() {
|
|
463
470
|
return InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import Fdc3Module from './fdc3-1.2';
|
|
2
2
|
import Fdc3Module2 from './fdc3-2.0';
|
|
3
|
-
import type Transport from '../../../transport/transport';
|
|
3
|
+
import type { Transport } from '../../../transport/transport';
|
|
4
|
+
import { Fdc3Version } from './versions';
|
|
4
5
|
declare global {
|
|
5
6
|
interface Window {
|
|
6
7
|
fdc3: Fdc3Module | Fdc3Module2;
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
declare
|
|
10
|
-
export declare const versionMap: Record<Fdc3Versions, typeof Fdc3Module | typeof Fdc3Module2>;
|
|
10
|
+
export declare const versionMap: Record<Fdc3Version, typeof Fdc3Module | typeof Fdc3Module2>;
|
|
11
11
|
export declare function registerFdc3Shim(version: string, transport: Transport): void;
|
|
12
|
-
export declare function getFdc3(transport: Transport, version?:
|
|
13
|
-
export {};
|
|
12
|
+
export declare function getFdc3(transport: Transport, version?: Fdc3Version): Fdc3Module | Fdc3Module2;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as OpenFin from '../../../OpenFin';
|
|
2
|
+
import { Fdc3Version } from './versions';
|
|
3
|
+
export declare function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }: Awaited<ReturnType<OpenFin.Application['getInfo']>>): Fdc3Version | undefined;
|
|
4
|
+
export declare function overrideCheck(overriddenBroker: OpenFin.InteropBroker, fdc3InteropApi?: Fdc3Version): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overrideCheck = exports.getDefaultViewFdc3VersionFromAppInfo = void 0;
|
|
4
|
+
const InteropBroker_1 = require("../InteropBroker");
|
|
5
|
+
function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
const setVersion = (_c = (_b = (_a = manifest.platform) === null || _a === void 0 ? void 0 : _a.defaultViewOptions) === null || _b === void 0 ? void 0 : _b.fdc3InteropApi) !== null && _c !== void 0 ? _c : (_d = initialOptions.defaultViewOptions) === null || _d === void 0 ? void 0 : _d.fdc3InteropApi;
|
|
8
|
+
return ['1.2', '2.0'].includes(setVersion !== null && setVersion !== void 0 ? setVersion : '') ? setVersion : undefined;
|
|
9
|
+
}
|
|
10
|
+
exports.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
|
|
11
|
+
// TODO: Unit test this
|
|
12
|
+
function overrideCheck(overriddenBroker, fdc3InteropApi) {
|
|
13
|
+
if (fdc3InteropApi && fdc3InteropApi === '2.0') {
|
|
14
|
+
const mustOverrideAPIs = [
|
|
15
|
+
'fdc3HandleFindInstances',
|
|
16
|
+
'handleInfoForIntent',
|
|
17
|
+
'handleInfoForIntentsByContext',
|
|
18
|
+
'fdc3HandleGetAppMetadata',
|
|
19
|
+
'fdc3HandleGetInfo',
|
|
20
|
+
'fdc3HandleOpen',
|
|
21
|
+
'handleFiredIntent',
|
|
22
|
+
'handleFiredIntentForContext'
|
|
23
|
+
];
|
|
24
|
+
const notOverridden = mustOverrideAPIs.filter((api) => {
|
|
25
|
+
return overriddenBroker[api] === InteropBroker_1.InteropBroker.prototype[api];
|
|
26
|
+
});
|
|
27
|
+
if (notOverridden.length > 0) {
|
|
28
|
+
console.warn(`WARNING: FDC3 2.0 has been set as a default option for Views in this Platform, but the required InteropBroker APIs for FDC3 2.0 compliance have not all been overridden.\nThe following APIs need to be overridden:\n${notOverridden.join('\n')}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.overrideCheck = overrideCheck;
|
|
@@ -64,7 +64,7 @@ export interface DesktopAgent {
|
|
|
64
64
|
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
|
|
65
65
|
getUserChannels(): Promise<Array<SystemChannel>>;
|
|
66
66
|
joinUserChannel(channelId: string): Promise<void>;
|
|
67
|
-
getOrCreateChannel(channelId: string): Promise<
|
|
67
|
+
getOrCreateChannel(channelId: string): Promise<Channel>;
|
|
68
68
|
createPrivateChannel(): Promise<PrivateChannel>;
|
|
69
69
|
getCurrentChannel(): Promise<ChannelV1 | null>;
|
|
70
70
|
leaveCurrentChannel(): Promise<void>;
|