@openfin/core 30.73.5 → 30.73.7
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 +1 -1729
- package/fin.d.ts +3 -4
- package/package.json +1 -1
- package/src/GlobalOpenFin.d.ts +4 -0
- package/src/OpenFin.d.ts +2938 -0
- package/src/OpenFin.js +4 -0
- package/src/api/application/Factory.d.ts +2 -0
- package/src/api/application/Factory.js +4 -3
- package/src/api/application/Instance.d.ts +3 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/application/index.js +7 -3
- package/src/api/base.d.ts +19 -15
- package/src/api/base.js +20 -22
- package/src/api/clipboard/index.d.ts +2 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/application.d.ts +66 -56
- package/src/api/events/base.d.ts +33 -15
- package/src/api/events/channel.d.ts +13 -8
- package/src/api/events/eventAggregator.js +1 -9
- package/src/api/events/externalApplication.d.ts +10 -5
- package/src/api/events/frame.d.ts +13 -7
- package/src/api/events/globalHotkey.d.ts +11 -10
- package/src/api/events/platform.d.ts +10 -16
- package/src/api/events/system.d.ts +48 -18
- package/src/api/events/typedEventEmitter.d.ts +20 -0
- package/src/api/events/typedEventEmitter.js +2 -0
- package/src/api/events/view.d.ts +38 -54
- package/src/api/events/webcontents.d.ts +55 -28
- package/src/api/events/window.d.ts +148 -134
- package/src/api/external-application/Factory.d.ts +1 -0
- package/src/api/external-application/Instance.d.ts +2 -1
- package/src/api/external-application/index.js +7 -3
- package/src/api/fin.d.ts +3 -1
- package/src/api/fin.js +2 -2
- package/src/api/frame/Factory.d.ts +1 -0
- package/src/api/frame/Factory.js +2 -2
- package/src/api/frame/Instance.d.ts +3 -1
- package/src/api/frame/index.js +7 -3
- package/src/api/global-hotkey/index.d.ts +2 -2
- package/src/api/global-hotkey/index.js +6 -0
- package/src/api/interappbus/channel/channel.d.ts +6 -4
- package/src/api/interappbus/channel/channels-docs.d.ts +22 -0
- package/src/api/interappbus/channel/channels-docs.js +22 -0
- package/src/api/interappbus/channel/client.d.ts +2 -1
- package/src/api/interappbus/channel/client.js +24 -26
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
- package/src/api/interappbus/channel/connection-manager.js +30 -28
- package/src/api/interappbus/channel/index.d.ts +6 -4
- package/src/api/interappbus/channel/index.js +34 -19
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
- package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +25 -27
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
- package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -1
- package/src/api/interappbus/channel/provider.d.ts +8 -4
- package/src/api/interappbus/channel/provider.js +140 -139
- package/src/api/interappbus/index.js +1 -1
- package/src/api/interop/Factory.d.ts +2 -0
- package/src/api/interop/Factory.js +20 -2
- package/src/api/interop/InteropBroker.d.ts +62 -39
- package/src/api/interop/InteropBroker.js +114 -55
- package/src/api/interop/InteropClient.d.ts +9 -0
- package/src/api/interop/InteropClient.js +46 -40
- package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
- package/src/api/interop/SessionContextGroupClient.js +22 -24
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +9 -7
- package/src/api/interop/fdc3/PrivateChannelClient.js +6 -6
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
- package/src/api/interop/fdc3/fdc3-1.2.js +3 -14
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
- package/src/api/interop/fdc3/fdc3-2.0.js +27 -27
- package/src/api/interop/fdc3/fdc3.d.ts +12 -0
- 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/fdc3v1.d.ts +53 -0
- package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +75 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
- package/src/api/interop/fdc3/utils.d.ts +15 -5
- package/src/api/interop/fdc3/utils.js +29 -11
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/interop/index.js +7 -3
- package/src/api/interop/utils.d.ts +2 -0
- package/src/api/interop/utils.js +29 -15
- package/src/api/me.d.ts +3 -1
- package/src/api/platform/Factory.d.ts +6 -0
- package/src/api/platform/Factory.js +14 -5
- package/src/api/platform/Instance.d.ts +18 -3
- package/src/api/platform/Instance.js +30 -13
- package/src/api/platform/common-utils.d.ts +2 -1
- package/src/api/platform/index.js +7 -3
- package/src/api/platform/layout/Factory.d.ts +7 -1
- package/src/api/platform/layout/Factory.js +22 -20
- package/src/api/platform/layout/Instance.d.ts +6 -4
- package/src/api/platform/layout/Instance.js +2 -3
- package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
- package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
- package/src/api/platform/layout/controllers/tab-drag-controller.js +1 -1
- package/src/api/platform/layout/index.js +7 -3
- package/src/api/platform/layout/shapes.d.ts +3 -1
- package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
- package/src/api/platform/layout/utils/bounds-observer.js +7 -5
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
- 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 +2 -0
- package/src/api/snapshot-source/Factory.js +2 -1
- package/src/api/snapshot-source/Instance.d.ts +1 -0
- package/src/api/snapshot-source/Instance.js +33 -35
- package/src/api/snapshot-source/index.js +7 -3
- package/src/api/snapshot-source/utils.d.ts +1 -0
- package/src/api/snapshot-source/utils.js +2 -1
- package/src/api/system/index.d.ts +76 -16
- package/src/api/system/index.js +127 -3
- package/src/api/view/Factory.d.ts +1 -0
- package/src/api/view/Factory.js +2 -2
- package/src/api/view/Instance.d.ts +17 -3
- package/src/api/view/Instance.js +20 -0
- package/src/api/view/index.js +7 -3
- package/src/api/webcontents/main.d.ts +20 -5
- package/src/api/webcontents/main.js +10 -0
- package/src/api/window/Factory.d.ts +1 -0
- package/src/api/window/Factory.js +2 -2
- package/src/api/window/Instance.d.ts +26 -3
- package/src/api/window/Instance.js +26 -1
- package/src/api/window/index.js +7 -3
- package/src/browser.d.ts +4 -4
- package/src/environment/browser.d.ts +3 -1
- package/src/environment/environment.d.ts +3 -1
- package/src/environment/node-env.d.ts +3 -1
- package/src/environment/node-env.js +2 -2
- package/src/environment/openfin-env.d.ts +3 -1
- package/src/environment/openfin-env.js +15 -17
- package/src/fdc3.d.ts +3 -0
- package/src/fdc3.js +1 -1
- package/src/mock.d.ts +2 -2
- package/src/mock.js +3 -3
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/shapes/WebOptions.d.ts +1 -0
- package/src/shapes/WindowOptions.d.ts +1 -0
- package/src/shapes/protocol.d.ts +34 -26
- package/src/transport/transport.d.ts +6 -5
- package/src/transport/transport.js +26 -28
- package/src/transport/wire.d.ts +9 -7
- package/src/util/http.d.ts +1 -1
- package/src/util/http.js +16 -11
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/normalize-config.js +5 -5
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type * as FDC3v1 from './shapes/fdc3v1';
|
|
2
|
+
import type * as FDC3v2 from './shapes/fdc3v2';
|
|
1
3
|
import { Base } from '../../base';
|
|
2
4
|
import Transport from '../../../transport/transport';
|
|
3
5
|
/**
|
|
@@ -164,19 +166,19 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
164
166
|
* @returns { Promise<AppIdentifier> }
|
|
165
167
|
* @tutorial fdc3.open
|
|
166
168
|
*/
|
|
167
|
-
open(app: FDC3v2.AppIdentifier |
|
|
169
|
+
open(app: FDC3v2.AppIdentifier | FDC3v1.TargetApp, context?: FDC3v2.Context): Promise<FDC3v2.AppIdentifier>;
|
|
168
170
|
/**
|
|
169
171
|
* Find all the available instances for a particular application.
|
|
170
172
|
* @param { AppIdentifier } app
|
|
171
173
|
* @returns { Promise<Array<AppIdentifier>> }
|
|
172
|
-
* @tutorial
|
|
174
|
+
* @tutorial findInstances
|
|
173
175
|
*/
|
|
174
176
|
findInstances(app: FDC3v2.AppIdentifier): Promise<Array<FDC3v2.AppIdentifier>>;
|
|
175
177
|
/**
|
|
176
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.
|
|
177
179
|
* @param { AppIdentifier } app
|
|
178
180
|
* @returns { Promise<AppMetadata(2)> }
|
|
179
|
-
* @tutorial
|
|
181
|
+
* @tutorial getAppMetadata
|
|
180
182
|
*/
|
|
181
183
|
getAppMetadata(app: FDC3v2.AppIdentifier): Promise<FDC3v2.AppMetadata>;
|
|
182
184
|
/**
|
|
@@ -185,7 +187,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
185
187
|
* @returns { Promise<void> }
|
|
186
188
|
* @tutorial fdc3.broadcast
|
|
187
189
|
*/
|
|
188
|
-
broadcast(context:
|
|
190
|
+
broadcast(context: FDC3v2.Context): Promise<void>;
|
|
189
191
|
/**
|
|
190
192
|
* Add a context handler for incoming context. If an entity is part of a context group, and then sets its context handler, it will receive all of its declared contexts. If you wish to listen for all incoming contexts, pass `null` for the contextType argument.
|
|
191
193
|
* @param { string | null } contextType
|
|
@@ -193,7 +195,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
193
195
|
* @returns { Listener }
|
|
194
196
|
* @tutorial fdc3.addContextListener
|
|
195
197
|
*/
|
|
196
|
-
addContextListener(contextType: string | null, handler: FDC3v2.ContextHandler): Promise<
|
|
198
|
+
addContextListener(contextType: string | null, handler: FDC3v2.ContextHandler): Promise<FDC3v2.Listener>;
|
|
197
199
|
/**
|
|
198
200
|
* Find out more information about a particular intent by passing its name, and optionally its context and resultType.
|
|
199
201
|
* @param { string } intent Name of the Intent
|
|
@@ -202,32 +204,32 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
202
204
|
* @returns { Promise<AppIntent(2)> }
|
|
203
205
|
* @tutorial fdc3.findIntent
|
|
204
206
|
*/
|
|
205
|
-
findIntent(intent: string, context?:
|
|
207
|
+
findIntent(intent: string, context?: FDC3v2.Context, resultType?: string): Promise<FDC3v2.AppIntent>;
|
|
206
208
|
/**
|
|
207
209
|
* Find all the available intents for a particular context.
|
|
208
210
|
* @param { Context } context
|
|
209
211
|
* @param { string } [resultType] The type of result returned for any intent specified during resolution.
|
|
210
212
|
* @returns { Promise<Array<AppIntent(2)>> }
|
|
211
|
-
* @tutorial
|
|
213
|
+
* @tutorial findIntentsByContext
|
|
212
214
|
*/
|
|
213
|
-
findIntentsByContext(context:
|
|
215
|
+
findIntentsByContext(context: FDC3v2.Context, resultType?: string): Promise<Array<FDC3v2.AppIntent>>;
|
|
214
216
|
/**
|
|
215
217
|
* Raises a specific intent for resolution against apps registered with the desktop agent.
|
|
216
218
|
* @param { string } intent Name of the Intent
|
|
217
219
|
* @param { Context } context Context associated with the Intent
|
|
218
220
|
* @param { AppIdentifier | TargetApp } [app]
|
|
219
221
|
* @returns { Promise<IntentResolution(2)> }
|
|
220
|
-
* @tutorial
|
|
222
|
+
* @tutorial raiseIntent
|
|
221
223
|
*/
|
|
222
|
-
raiseIntent(intent: string, context:
|
|
224
|
+
raiseIntent(intent: string, context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
|
|
223
225
|
/**
|
|
224
226
|
* Finds and raises an intent against apps registered with the desktop agent based purely on the type of the context data.
|
|
225
227
|
* @param { Context } context Context associated with the Intent
|
|
226
228
|
* @param { AppIdentifier | TargetApp } [app]
|
|
227
229
|
* @returns { Promise<IntentResolution(2)> }
|
|
228
|
-
* @tutorial
|
|
230
|
+
* @tutorial raiseIntentForContext
|
|
229
231
|
*/
|
|
230
|
-
raiseIntentForContext(context:
|
|
232
|
+
raiseIntentForContext(context: FDC3v2.Context, app?: FDC3v2.AppIdentifier | FDC3v1.TargetApp): Promise<FDC3v2.IntentResolution>;
|
|
231
233
|
/**
|
|
232
234
|
* Adds a listener for incoming intents.
|
|
233
235
|
* @param { string } intent Name of the Intent
|
|
@@ -235,38 +237,38 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
235
237
|
* @returns { Promise<Listener> }
|
|
236
238
|
* @tutorial fdc3.addIntentListener
|
|
237
239
|
*/
|
|
238
|
-
addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<
|
|
240
|
+
addIntentListener(intent: string, handler: FDC3v2.IntentHandler): Promise<FDC3v1.Listener>;
|
|
239
241
|
/**
|
|
240
242
|
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
|
241
243
|
* @param channelId
|
|
242
244
|
* @returns { Promise<Channel> }
|
|
243
245
|
* @tutorial fdc3.getOrCreateChannel
|
|
244
246
|
*/
|
|
245
|
-
getOrCreateChannel(channelId: string): Promise<
|
|
247
|
+
getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
|
|
246
248
|
/**
|
|
247
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.
|
|
248
250
|
* @returns { Promise<PrivateChannel> }
|
|
249
|
-
* @tutorial
|
|
251
|
+
* @tutorial createPrivateChannel
|
|
250
252
|
*/
|
|
251
253
|
createPrivateChannel(): Promise<FDC3v2.PrivateChannel>;
|
|
252
254
|
/**
|
|
253
255
|
* Retrieves a list of the User Channels available for the app to join.
|
|
254
256
|
* @returns { Promise<Channel[]>}
|
|
255
|
-
* @tutorial
|
|
257
|
+
* @tutorial getUserChannels
|
|
256
258
|
*/
|
|
257
|
-
getUserChannels(): Promise<Array<
|
|
259
|
+
getUserChannels(): Promise<Array<FDC3v1.SystemChannel>>;
|
|
258
260
|
/**
|
|
259
261
|
* Retrieves a list of the User Channels available for the app to join.
|
|
260
262
|
* @returns { Promise<Channel[]>}
|
|
261
263
|
* @deprecated Please use {@link fdc3.getUserChannels fdc3.getUserChannels} instead
|
|
262
264
|
* @tutorial fdc3.getSystemChannels
|
|
263
265
|
*/
|
|
264
|
-
getSystemChannels(): Promise<Array<
|
|
266
|
+
getSystemChannels(): Promise<Array<FDC3v1.SystemChannel>>;
|
|
265
267
|
/**
|
|
266
268
|
* Join an app to a specified User channel.
|
|
267
269
|
* @param { string } channelId Channel name
|
|
268
270
|
* @returns { Promise<void> }
|
|
269
|
-
* @tutorial
|
|
271
|
+
* @tutorial joinUserChannel
|
|
270
272
|
*/
|
|
271
273
|
joinUserChannel(channelId: string): Promise<void>;
|
|
272
274
|
/**
|
|
@@ -281,7 +283,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
281
283
|
* Returns the Channel object for the current User channel membership
|
|
282
284
|
* @returns { Promise<FDC3.Channel | null> }
|
|
283
285
|
*/
|
|
284
|
-
getCurrentChannel(): Promise<
|
|
286
|
+
getCurrentChannel(): Promise<FDC3v1.Channel | null>;
|
|
285
287
|
/**
|
|
286
288
|
* Removes the app from any User channel membership.
|
|
287
289
|
* @returns { Promise<void> }
|
|
@@ -290,8 +292,9 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
|
|
|
290
292
|
leaveCurrentChannel(): Promise<void>;
|
|
291
293
|
/**
|
|
292
294
|
* 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
|
+
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
293
296
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
294
|
-
* @tutorial
|
|
297
|
+
* @tutorial getInfo
|
|
295
298
|
*/
|
|
296
299
|
getInfo(): Promise<FDC3v2.ImplementationMetadata>;
|
|
297
300
|
}
|
|
@@ -181,14 +181,14 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
181
181
|
* Find all the available instances for a particular application.
|
|
182
182
|
* @param { AppIdentifier } app
|
|
183
183
|
* @returns { Promise<Array<AppIdentifier>> }
|
|
184
|
-
* @tutorial
|
|
184
|
+
* @tutorial findInstances
|
|
185
185
|
*/
|
|
186
186
|
async findInstances(app) {
|
|
187
187
|
this.wire.sendAction('fdc3-find-instances').catch((e) => {
|
|
188
188
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
189
189
|
});
|
|
190
190
|
try {
|
|
191
|
-
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3FindInstances', app);
|
|
191
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3FindInstances', app);
|
|
192
192
|
}
|
|
193
193
|
catch (error) {
|
|
194
194
|
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error;
|
|
@@ -199,14 +199,14 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
199
199
|
* 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
200
|
* @param { AppIdentifier } app
|
|
201
201
|
* @returns { Promise<AppMetadata(2)> }
|
|
202
|
-
* @tutorial
|
|
202
|
+
* @tutorial getAppMetadata
|
|
203
203
|
*/
|
|
204
204
|
async getAppMetadata(app) {
|
|
205
205
|
this.wire.sendAction('fdc3-get-app-metadata').catch((e) => {
|
|
206
206
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
207
207
|
});
|
|
208
208
|
try {
|
|
209
|
-
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3GetAppMetadata', app);
|
|
209
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3GetAppMetadata', app);
|
|
210
210
|
}
|
|
211
211
|
catch (error) {
|
|
212
212
|
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error;
|
|
@@ -277,7 +277,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
277
277
|
* @param { Context } context
|
|
278
278
|
* @param { string } [resultType] The type of result returned for any intent specified during resolution.
|
|
279
279
|
* @returns { Promise<Array<AppIntent(2)>> }
|
|
280
|
-
* @tutorial
|
|
280
|
+
* @tutorial findIntentsByContext
|
|
281
281
|
*/
|
|
282
282
|
async findIntentsByContext(context, resultType) {
|
|
283
283
|
this.wire.sendAction('fdc3-find-intents-by-context').catch((e) => {
|
|
@@ -285,7 +285,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
285
285
|
});
|
|
286
286
|
const payload = resultType ? { context, metadata: { resultType } } : context;
|
|
287
287
|
try {
|
|
288
|
-
return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
|
|
288
|
+
return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
|
|
289
289
|
}
|
|
290
290
|
catch (error) {
|
|
291
291
|
const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
|
|
@@ -298,14 +298,14 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
298
298
|
* @param { Context } context Context associated with the Intent
|
|
299
299
|
* @param { AppIdentifier | TargetApp } [app]
|
|
300
300
|
* @returns { Promise<IntentResolution(2)> }
|
|
301
|
-
* @tutorial
|
|
301
|
+
* @tutorial raiseIntent
|
|
302
302
|
*/
|
|
303
303
|
async raiseIntent(intent, context, app) {
|
|
304
304
|
this.wire.sendAction('fdc3-raise-intent').catch((e) => {
|
|
305
305
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
306
306
|
});
|
|
307
307
|
try {
|
|
308
|
-
return utils_2.getIntentResolution(this.fin.me.interop, context, app, intent);
|
|
308
|
+
return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app, intent);
|
|
309
309
|
}
|
|
310
310
|
catch (error) {
|
|
311
311
|
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
|
|
@@ -317,7 +317,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
317
317
|
* @param { Context } context Context associated with the Intent
|
|
318
318
|
* @param { AppIdentifier | TargetApp } [app]
|
|
319
319
|
* @returns { Promise<IntentResolution(2)> }
|
|
320
|
-
* @tutorial
|
|
320
|
+
* @tutorial raiseIntentForContext
|
|
321
321
|
*/
|
|
322
322
|
async raiseIntentForContext(context, app) {
|
|
323
323
|
// TODO: We have to do the same thing we do for raiseIntent here as well.
|
|
@@ -325,7 +325,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
325
325
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
326
326
|
});
|
|
327
327
|
try {
|
|
328
|
-
return utils_2.getIntentResolution(this.fin.me.interop, context, app);
|
|
328
|
+
return (0, utils_2.getIntentResolution)(this.fin.me.interop, context, app);
|
|
329
329
|
}
|
|
330
330
|
catch (error) {
|
|
331
331
|
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fireIntent ? 'ResolverUnavailable' : error;
|
|
@@ -362,7 +362,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
362
362
|
const intentResolutionResultId = (intentMetadata === null || intentMetadata === void 0 ? void 0 : intentMetadata.intentResolutionResultId) || (metadata === null || metadata === void 0 ? void 0 : metadata.intentResolutionResultId);
|
|
363
363
|
if (intentResolutionResultId) {
|
|
364
364
|
// Send whatever the result is.
|
|
365
|
-
fin.InterApplicationBus.publish(intentResolutionResultId, intentResult);
|
|
365
|
+
this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResult);
|
|
366
366
|
}
|
|
367
367
|
if (intentResult instanceof Error) {
|
|
368
368
|
throw new Error(intentResult.message);
|
|
@@ -385,23 +385,28 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
385
385
|
/**
|
|
386
386
|
* 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
387
|
* @returns { Promise<PrivateChannel> }
|
|
388
|
-
* @tutorial
|
|
388
|
+
* @tutorial createPrivateChannel
|
|
389
389
|
*/
|
|
390
390
|
async createPrivateChannel() {
|
|
391
|
-
const channelId = utils_1.generateId();
|
|
391
|
+
const channelId = (0, utils_1.generateId)();
|
|
392
392
|
const channelProvider = await this.fin.InterApplicationBus.Channel.create(channelId);
|
|
393
393
|
const newPrivateChannelProvider = new PrivateChannelProvider_1.PrivateChannelProvider(channelProvider, channelId);
|
|
394
394
|
const channelClient = await this.fin.InterApplicationBus.Channel.connect(channelId);
|
|
395
395
|
const newPrivateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
|
396
|
-
return utils_2.buildPrivateChannelObject(newPrivateChannelClient);
|
|
396
|
+
return (0, utils_2.buildPrivateChannelObject)(newPrivateChannelClient);
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* Retrieves a list of the User Channels available for the app to join.
|
|
400
400
|
* @returns { Promise<Channel[]>}
|
|
401
|
-
* @tutorial
|
|
401
|
+
* @tutorial 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,13 +415,14 @@ 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
|
/**
|
|
416
422
|
* Join an app to a specified User channel.
|
|
417
423
|
* @param { string } channelId Channel name
|
|
418
424
|
* @returns { Promise<void> }
|
|
419
|
-
* @tutorial
|
|
425
|
+
* @tutorial joinUserChannel
|
|
420
426
|
*/
|
|
421
427
|
async joinUserChannel(channelId) {
|
|
422
428
|
return this.fdc3Module.joinChannel(channelId);
|
|
@@ -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
|
-
* @tutorial
|
|
460
|
+
* @tutorial 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(this.fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
exports.default = Fdc3Module2;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Fdc3Module from './fdc3-1.2';
|
|
2
|
+
import Fdc3Module2 from './fdc3-2.0';
|
|
3
|
+
import type Transport from '../../../transport/transport';
|
|
4
|
+
import { Fdc3Version } from './versions';
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
fdc3: Fdc3Module | Fdc3Module2;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare const versionMap: Record<Fdc3Version, typeof Fdc3Module | typeof Fdc3Module2>;
|
|
11
|
+
export declare function registerFdc3Shim(version: string, transport: Transport): void;
|
|
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;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DisplayMetadata } from 'fdc3v1/src/api/DisplayMetadata';
|
|
2
|
+
import type { Listener } from 'fdc3v1/src/api/Listener';
|
|
3
|
+
import type { AppMetadata } from 'fdc3v1/src/api/AppMetadata';
|
|
4
|
+
import type { AppIntent } from 'fdc3v1/src/api/AppIntent';
|
|
5
|
+
import type { ImplementationMetadata } from 'fdc3v1/src/api/ImplementationMetadata';
|
|
6
|
+
export type { DisplayMetadata } from 'fdc3v1/src/api/DisplayMetadata';
|
|
7
|
+
export type { Listener } from 'fdc3v1/src/api/Listener';
|
|
8
|
+
export type { AppMetadata } from 'fdc3v1/src/api/AppMetadata';
|
|
9
|
+
export type { AppIntent } from 'fdc3v1/src/api/AppIntent';
|
|
10
|
+
export type { ImplementationMetadata } from 'fdc3v1/src/api/ImplementationMetadata';
|
|
11
|
+
export declare type ContextHandler = (context: Context) => void;
|
|
12
|
+
export declare type TargetApp = string | AppMetadata;
|
|
13
|
+
export interface Context {
|
|
14
|
+
id?: {
|
|
15
|
+
[key: string]: string;
|
|
16
|
+
};
|
|
17
|
+
name?: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IntentResolution {
|
|
21
|
+
source: TargetApp;
|
|
22
|
+
data?: object;
|
|
23
|
+
version: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Channel {
|
|
26
|
+
id: string;
|
|
27
|
+
type: string;
|
|
28
|
+
displayMetadata?: DisplayMetadata;
|
|
29
|
+
broadcast(context: Context): void;
|
|
30
|
+
getCurrentContext(contextType?: string): Promise<Context | null>;
|
|
31
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
|
|
32
|
+
}
|
|
33
|
+
export declare type SystemChannel = Omit<Channel, 'addContextListener' | 'broadcast' | 'getCurrentContext'> & {
|
|
34
|
+
addContextListener(): Error;
|
|
35
|
+
broadcast(): Error;
|
|
36
|
+
getCurrentContext(): Error;
|
|
37
|
+
};
|
|
38
|
+
export interface DesktopAgent {
|
|
39
|
+
open(app: TargetApp, context?: Context): Promise<void>;
|
|
40
|
+
findIntent(intent: string, context?: Context): Promise<AppIntent>;
|
|
41
|
+
findIntentsByContext(context: Context): Promise<Array<AppIntent>>;
|
|
42
|
+
broadcast(context: Context): void;
|
|
43
|
+
raiseIntent(intent: string, context: Context, app?: TargetApp): Promise<IntentResolution>;
|
|
44
|
+
raiseIntentForContext(context: Context, app?: TargetApp): Promise<IntentResolution>;
|
|
45
|
+
addIntentListener(intent: string, handler: ContextHandler): Listener;
|
|
46
|
+
joinChannel(channelId: string): Promise<void>;
|
|
47
|
+
leaveCurrentChannel(): Promise<void>;
|
|
48
|
+
getInfo(): ImplementationMetadata;
|
|
49
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
|
|
50
|
+
getOrCreateChannel(channelId: string): Promise<Channel>;
|
|
51
|
+
getSystemChannels(): Promise<SystemChannel[]>;
|
|
52
|
+
getCurrentChannel(): Promise<Channel | null>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as OpenFin from '../../../../OpenFin';
|
|
2
|
+
import { Channel as ChannelV1, SystemChannel } from './fdc3v1';
|
|
3
|
+
import type { Listener } from 'fdc3v2/src/api/Listener';
|
|
4
|
+
import type { AppIntent } from 'fdc3v2/src/api/AppIntent';
|
|
5
|
+
import type { ImplementationMetadata } from 'fdc3v2/src/api/ImplementationMetadata';
|
|
6
|
+
import type { ContextMetadata } from 'fdc3v2/src/api/ContextMetadata';
|
|
7
|
+
import type { AppIdentifier } from 'fdc3v2/src/api/AppIdentifier';
|
|
8
|
+
import type { AppMetadata } from 'fdc3v2/src/api/AppMetadata';
|
|
9
|
+
import type { DisplayMetadata } from 'fdc3v2/src/api/DisplayMetadata';
|
|
10
|
+
export type { Listener } from 'fdc3v2/src/api/Listener';
|
|
11
|
+
export type { AppIntent } from 'fdc3v2/src/api/AppIntent';
|
|
12
|
+
export type { ImplementationMetadata } from 'fdc3v2/src/api/ImplementationMetadata';
|
|
13
|
+
export type { ContextMetadata } from 'fdc3v2/src/api/ContextMetadata';
|
|
14
|
+
export type { AppIdentifier } from 'fdc3v2/src/api/AppIdentifier';
|
|
15
|
+
export type { AppMetadata } from 'fdc3v2/src/api/AppMetadata';
|
|
16
|
+
export type { DisplayMetadata } from 'fdc3v2/src/api/DisplayMetadata';
|
|
17
|
+
export declare type ContextHandler = (context: Context, metadata?: ContextMetadata) => void;
|
|
18
|
+
export declare type IntentHandler = (context: Context, metadata?: ContextMetadata) => Promise<IntentResult> | void;
|
|
19
|
+
export declare type IntentResult = Context | Channel | PrivateChannel;
|
|
20
|
+
export interface Context {
|
|
21
|
+
id?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
name?: string;
|
|
25
|
+
type: string;
|
|
26
|
+
contextMetadata?: ContextMetadata;
|
|
27
|
+
metadata?: any;
|
|
28
|
+
}
|
|
29
|
+
export interface Intent {
|
|
30
|
+
name: string;
|
|
31
|
+
context: Context;
|
|
32
|
+
metadata: OpenFin.IntentMetadata;
|
|
33
|
+
}
|
|
34
|
+
export interface IntentResolution {
|
|
35
|
+
source: AppIdentifier;
|
|
36
|
+
intent: string;
|
|
37
|
+
version?: string;
|
|
38
|
+
getResult(): Promise<IntentResult>;
|
|
39
|
+
}
|
|
40
|
+
export interface Channel {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly type: 'user' | 'app' | 'private';
|
|
43
|
+
readonly displayMetadata?: DisplayMetadata;
|
|
44
|
+
broadcast(context: Context): Promise<void>;
|
|
45
|
+
getCurrentContext(contextType?: string): Promise<Context | null>;
|
|
46
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
|
|
47
|
+
}
|
|
48
|
+
export declare type PrivateChannel = Omit<Channel, 'addContextListener'> & {
|
|
49
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
|
|
50
|
+
onAddContextListener(handler: (contextType?: string) => void): Listener;
|
|
51
|
+
onUnsubscribe(handler: (contextType?: string) => void): Listener;
|
|
52
|
+
onDisconnect(handler: () => void): Listener;
|
|
53
|
+
disconnect(): void;
|
|
54
|
+
};
|
|
55
|
+
export interface DesktopAgent {
|
|
56
|
+
open(app: AppIdentifier, context?: Context): Promise<AppIdentifier>;
|
|
57
|
+
findIntent(intent: string, context?: Context, resultType?: string): Promise<AppIntent>;
|
|
58
|
+
findIntentsByContext(context: Context, resultType?: string): Promise<Array<AppIntent>>;
|
|
59
|
+
findInstances(app: AppIdentifier): Promise<Array<AppIdentifier>>;
|
|
60
|
+
broadcast(context: Context): Promise<void>;
|
|
61
|
+
raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise<IntentResolution>;
|
|
62
|
+
raiseIntentForContext(context: Context, app?: AppIdentifier): Promise<IntentResolution>;
|
|
63
|
+
addIntentListener(intent: string, handler: IntentHandler): Promise<Listener>;
|
|
64
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
|
|
65
|
+
getUserChannels(): Promise<Array<SystemChannel>>;
|
|
66
|
+
joinUserChannel(channelId: string): Promise<void>;
|
|
67
|
+
getOrCreateChannel(channelId: string): Promise<ChannelV1>;
|
|
68
|
+
createPrivateChannel(): Promise<PrivateChannel>;
|
|
69
|
+
getCurrentChannel(): Promise<ChannelV1 | null>;
|
|
70
|
+
leaveCurrentChannel(): Promise<void>;
|
|
71
|
+
getInfo(): Promise<ImplementationMetadata>;
|
|
72
|
+
getAppMetadata(app: AppIdentifier): Promise<AppMetadata>;
|
|
73
|
+
getSystemChannels(): Promise<Array<SystemChannel>>;
|
|
74
|
+
joinChannel(channelId: string): Promise<void>;
|
|
75
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import type { TargetApp } from './shapes/fdc3v1';
|
|
2
|
+
import type { AppIdentifier, IntentResolution, Channel, PrivateChannel, Context } from './shapes/fdc3v2';
|
|
3
|
+
import type * as OpenFin from '../../../OpenFin';
|
|
1
4
|
import { PrivateChannelClient } from './PrivateChannelClient';
|
|
5
|
+
interface UnsupportedChannelApis {
|
|
6
|
+
addContextListener(): Error;
|
|
7
|
+
broadcast(): Error;
|
|
8
|
+
getCurrentContext(): Error;
|
|
9
|
+
}
|
|
10
|
+
export declare const getUnsupportedChannelApis: (channelType?: string) => UnsupportedChannelApis;
|
|
2
11
|
export declare class UnsupportedChannelApiError extends Error {
|
|
3
|
-
constructor(apiName: string);
|
|
12
|
+
constructor(apiName: string, channelType?: string);
|
|
4
13
|
}
|
|
5
14
|
export declare enum ResultError {
|
|
6
15
|
/** Returned if the `IntentHandler` exited without returning a Promise or that
|
|
@@ -12,7 +21,8 @@ export declare enum ResultError {
|
|
|
12
21
|
*/
|
|
13
22
|
IntentHandlerRejected = "IntentHandlerRejected"
|
|
14
23
|
}
|
|
15
|
-
export declare const buildPrivateChannelObject: (privateChannelClient: PrivateChannelClient) =>
|
|
16
|
-
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) =>
|
|
17
|
-
export declare const connectPrivateChannel: (channelId: string) => Promise<
|
|
18
|
-
export declare const getIntentResolution: (interopModule: OpenFin.InteropClient, context:
|
|
24
|
+
export declare const buildPrivateChannelObject: (privateChannelClient: PrivateChannelClient) => PrivateChannel;
|
|
25
|
+
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) => Channel;
|
|
26
|
+
export declare const connectPrivateChannel: (channelId: string) => Promise<PrivateChannel>;
|
|
27
|
+
export declare const getIntentResolution: (interopModule: OpenFin.InteropClient, context: Context, app?: AppIdentifier | TargetApp, intent?: string) => Promise<IntentResolution>;
|
|
28
|
+
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
|
+
getCurrentContext: () => {
|
|
15
|
+
throw new UnsupportedChannelApiError('Channel.getCurrentContext', 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;
|
|
@@ -21,7 +35,7 @@ var ResultError;
|
|
|
21
35
|
*/
|
|
22
36
|
ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
|
|
23
37
|
})(ResultError = exports.ResultError || (exports.ResultError = {}));
|
|
24
|
-
|
|
38
|
+
const buildPrivateChannelObject = (privateChannelClient) => {
|
|
25
39
|
let clientDisconnected = false;
|
|
26
40
|
const checkIfClientDisconnected = () => {
|
|
27
41
|
if (clientDisconnected) {
|
|
@@ -70,7 +84,8 @@ exports.buildPrivateChannelObject = (privateChannelClient) => {
|
|
|
70
84
|
}
|
|
71
85
|
};
|
|
72
86
|
};
|
|
73
|
-
exports.
|
|
87
|
+
exports.buildPrivateChannelObject = buildPrivateChannelObject;
|
|
88
|
+
const buildAppChannelObject = (sessionContextGroup) => {
|
|
74
89
|
return {
|
|
75
90
|
id: sessionContextGroup.id,
|
|
76
91
|
type: 'app',
|
|
@@ -95,20 +110,22 @@ exports.buildAppChannelObject = (sessionContextGroup) => {
|
|
|
95
110
|
}
|
|
96
111
|
};
|
|
97
112
|
};
|
|
98
|
-
exports.
|
|
113
|
+
exports.buildAppChannelObject = buildAppChannelObject;
|
|
114
|
+
const connectPrivateChannel = async (channelId) => {
|
|
99
115
|
try {
|
|
100
116
|
const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
|
|
101
117
|
const privateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
|
102
|
-
return exports.buildPrivateChannelObject(privateChannelClient);
|
|
118
|
+
return (0, exports.buildPrivateChannelObject)(privateChannelClient);
|
|
103
119
|
}
|
|
104
120
|
catch (error) {
|
|
105
121
|
throw new Error(`Private Channel with id: ${channelId} doesn't exist`);
|
|
106
122
|
}
|
|
107
123
|
};
|
|
108
|
-
exports.
|
|
124
|
+
exports.connectPrivateChannel = connectPrivateChannel;
|
|
125
|
+
const getIntentResolution = async (interopModule, context, app, intent) => {
|
|
109
126
|
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
110
127
|
// The broker will then setContext on that session context group later with our Intent Result,
|
|
111
|
-
const guid = utils_1.generateId();
|
|
128
|
+
const guid = (0, utils_1.generateId)();
|
|
112
129
|
// Promise we'll use in getResult
|
|
113
130
|
const getResultPromise = new Promise((resolve) => {
|
|
114
131
|
fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
|
|
@@ -132,12 +149,12 @@ exports.getIntentResolution = async (interopModule, context, app, intent) => {
|
|
|
132
149
|
if (type && id && typeof id === 'string') {
|
|
133
150
|
switch (type) {
|
|
134
151
|
case 'private': {
|
|
135
|
-
intentResult = await exports.connectPrivateChannel(id);
|
|
152
|
+
intentResult = await (0, exports.connectPrivateChannel)(id);
|
|
136
153
|
break;
|
|
137
154
|
}
|
|
138
155
|
case 'app': {
|
|
139
156
|
const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
|
|
140
|
-
intentResult = exports.buildAppChannelObject(sessionContextGroup);
|
|
157
|
+
intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
|
|
141
158
|
break;
|
|
142
159
|
}
|
|
143
160
|
default: {
|
|
@@ -165,3 +182,4 @@ exports.getIntentResolution = async (interopModule, context, app, intent) => {
|
|
|
165
182
|
}
|
|
166
183
|
return { ...intentResolutionInfoFromBroker, getResult };
|
|
167
184
|
};
|
|
185
|
+
exports.getIntentResolution = getIntentResolution;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Fdc3Version = '1.2' | '2.0';
|