@openfin/core 29.73.3 → 29.73.5
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 +79 -1
- package/package.json +1 -1
- package/src/OpenFin.d.ts +1452 -0
- package/src/OpenFin.js +4 -0
- package/src/api/events/system.d.ts +18 -3
- package/src/api/events/typedEventEmitter.d.ts +13 -0
- package/src/api/events/typedEventEmitter.js +2 -0
- package/src/api/interop/Factory.js +1 -1
- package/src/api/interop/InteropBroker.d.ts +36 -5
- package/src/api/interop/InteropBroker.js +56 -8
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +8 -7
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
- package/src/api/interop/fdc3/fdc3-2.0.js +11 -18
- package/src/api/interop/fdc3/fdc3.d.ts +13 -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 +74 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
- package/src/api/interop/fdc3/utils.d.ts +7 -5
- package/src/api/interop/fdc3/utils.js +2 -2
- package/src/api/interop/utils.d.ts +1 -0
- package/src/api/interop/utils.js +9 -1
- package/src/api/platform/Instance.d.ts +12 -0
- package/src/api/platform/Instance.js +15 -0
- package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
- package/src/api/platform/layout/utils/bounds-observer.js +2 -2
- package/src/api/system/index.d.ts +1 -470
- package/src/api/system/index.js +52 -472
- package/src/api/view/Instance.d.ts +8 -0
- package/src/api/view/Instance.js +16 -0
- package/src/fdc3.d.ts +3 -0
- package/src/shapes/protocol.d.ts +3 -1
package/src/OpenFin.js
ADDED
|
@@ -10,13 +10,28 @@ export declare type MonitorEvent<Topic, Type> = OpenFin.MonitorInfo & BaseEvent<
|
|
|
10
10
|
export interface SessionChangedEvent<Topic, Type> extends BaseEvent<Topic, Type> {
|
|
11
11
|
reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export declare type SystemEventMapping<Topic = string, Type = string> = BaseEventMap & {
|
|
14
14
|
'application-created': ApplicationEvent<Topic, Type>;
|
|
15
15
|
'desktop-icon-clicked': ApplicationEvent<Topic, Type>;
|
|
16
16
|
'idle-state-changed': IdleEvent<Topic, Type>;
|
|
17
17
|
'monitor-info-changed': MonitorEvent<Topic, Type>;
|
|
18
18
|
'session-changed': SessionChangedEvent<Topic, Type>;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
export declare type WithId<T extends AppVersionEventNames> = `${T}.${string}`;
|
|
21
|
+
export declare type WithoutId<T extends string> = T extends WithId<infer U> ? U : never;
|
|
22
|
+
declare type AppVersionEventNames = OpenFin.AppVersionEvents['type'];
|
|
23
|
+
declare type IdEventNames = WithId<AppVersionEventNames>;
|
|
24
|
+
export declare type AppVersionTypeFromIdEvent<T extends IdEventNames> = Extract<OpenFin.AppVersionEvents, {
|
|
25
|
+
type: WithoutId<T>;
|
|
26
|
+
}>;
|
|
27
|
+
export declare type AppVersionEventsWithId = {
|
|
28
|
+
[key in IdEventNames]: Omit<AppVersionTypeFromIdEvent<key>, 'type'> & {
|
|
29
|
+
type: key;
|
|
30
|
+
topic: 'system';
|
|
31
|
+
appVersionId: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
20
34
|
export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & PropagatedViewEvents<'system'> & {
|
|
21
35
|
[Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
|
|
22
|
-
};
|
|
36
|
+
} & AppVersionEventsWithId;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type Listener<T extends {
|
|
2
|
+
type: string;
|
|
3
|
+
}> = (payload: T) => void;
|
|
4
|
+
export interface TypedEventEmitter<Events extends {
|
|
5
|
+
type: string;
|
|
6
|
+
}> {
|
|
7
|
+
on<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
|
|
8
|
+
once<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
|
|
9
|
+
addListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
|
|
10
|
+
removeListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
|
|
11
|
+
removeAllListeners<Event extends Events>(event?: Event['type']): this;
|
|
12
|
+
emit<Event extends Events>(event: Event['type'], payload: Event): boolean;
|
|
13
|
+
}
|
|
@@ -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.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TargetApp } from './fdc3/shapes/fdc3v1';
|
|
2
|
+
import { AppIdentifier } from './fdc3/shapes/fdc3v2';
|
|
1
3
|
import { Base } from '../base';
|
|
2
4
|
import type Transport from '../../transport/transport';
|
|
3
5
|
import Identity = OpenFin.Identity;
|
|
@@ -46,6 +48,32 @@ import Identity = OpenFin.Identity;
|
|
|
46
48
|
* }
|
|
47
49
|
* ```
|
|
48
50
|
*
|
|
51
|
+
* By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
|
|
52
|
+
* ```js
|
|
53
|
+
* {
|
|
54
|
+
* "runtime": {
|
|
55
|
+
* "arguments": "--v=1 --inspect",
|
|
56
|
+
* "version": "alpha-v19"
|
|
57
|
+
* },
|
|
58
|
+
* "platform": {
|
|
59
|
+
* "uuid": "platform_customization_local",
|
|
60
|
+
* "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
|
|
61
|
+
* "autoShow": false,
|
|
62
|
+
* "providerUrl": "http://localhost:5555/provider.html",
|
|
63
|
+
* "interopBrokerConfiguration": {
|
|
64
|
+
* "logging": {
|
|
65
|
+
* "beforeAction": {
|
|
66
|
+
* "enabled": false
|
|
67
|
+
* },
|
|
68
|
+
* "afterAction": {
|
|
69
|
+
* "enabled": false
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
49
77
|
* ---
|
|
50
78
|
* **2. Overriding**
|
|
51
79
|
*
|
|
@@ -131,6 +159,7 @@ export declare class InteropBroker extends Base {
|
|
|
131
159
|
private lastContextMap;
|
|
132
160
|
private sessionContextGroupMap;
|
|
133
161
|
private channel;
|
|
162
|
+
private logging;
|
|
134
163
|
constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
|
|
135
164
|
/**
|
|
136
165
|
* SetContextOptions interface
|
|
@@ -329,23 +358,23 @@ export declare class InteropBroker extends Base {
|
|
|
329
358
|
* @param { ClientIdentity } clientIdentity Identity of the Client making the request.
|
|
330
359
|
*/
|
|
331
360
|
fdc3HandleOpen({ app, context }: {
|
|
332
|
-
app:
|
|
361
|
+
app: TargetApp | AppIdentifier;
|
|
333
362
|
context: OpenFin.Context;
|
|
334
|
-
}, clientIdentity: OpenFin.ClientIdentity): Promise<void |
|
|
363
|
+
}, clientIdentity: OpenFin.ClientIdentity): Promise<void | AppIdentifier>;
|
|
335
364
|
/**
|
|
336
365
|
* Responsible for resolving the fdc3.findInstances call.
|
|
337
366
|
* Must be overridden
|
|
338
367
|
* @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.findInstances
|
|
339
368
|
* @param { ClientIdentity } clientIdentity Identity of the Client making the request.
|
|
340
369
|
*/
|
|
341
|
-
fdc3HandleFindInstances(app:
|
|
370
|
+
fdc3HandleFindInstances(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
342
371
|
/**
|
|
343
372
|
* Responsible for resolving the fdc3.getAppMetadata call.
|
|
344
373
|
* Must be overridden
|
|
345
374
|
* @param { AppIdentifier(2) } app AppIdentifier that was passed to fdc3.getAppMetadata
|
|
346
375
|
* @param { ClientIdentity } clientIdentity Identity of the Client making the request.
|
|
347
376
|
*/
|
|
348
|
-
fdc3HandleGetAppMetadata(app:
|
|
377
|
+
fdc3HandleGetAppMetadata(app: AppIdentifier, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
349
378
|
/**
|
|
350
379
|
* This function is called by the Interop Broker whenever a Context handler would fire.
|
|
351
380
|
* For FDC3 2.0 you would need to override this function and add the contextMetadata as
|
|
@@ -377,7 +406,9 @@ export declare class InteropBroker extends Base {
|
|
|
377
406
|
* @param clientIdentity
|
|
378
407
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
379
408
|
*/
|
|
380
|
-
fdc3HandleGetInfo(
|
|
409
|
+
fdc3HandleGetInfo(payload: {
|
|
410
|
+
fdc3Version: string;
|
|
411
|
+
}, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
|
|
381
412
|
/**
|
|
382
413
|
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
383
414
|
*
|
|
@@ -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,21 @@ 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
|
+
};
|
|
702
742
|
}
|
|
703
743
|
/**
|
|
704
744
|
* Returns an array of info for each Interop Client connected to the Interop Broker.
|
|
@@ -986,12 +1026,20 @@ class InteropBroker extends base_1.Base {
|
|
|
986
1026
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
987
1027
|
// @ts-ignore
|
|
988
1028
|
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
1029
|
+
var _a, _b;
|
|
989
1030
|
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
990
1031
|
throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
991
1032
|
}
|
|
992
|
-
|
|
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
|
+
}
|
|
993
1042
|
});
|
|
994
|
-
channel.afterAction(console.log);
|
|
995
1043
|
// Client functions
|
|
996
1044
|
channel.register('setContext', this.setContext.bind(this));
|
|
997
1045
|
channel.register('fireIntent', this.handleFiredIntent.bind(this));
|
|
@@ -1016,7 +1064,7 @@ class InteropBroker extends base_1.Base {
|
|
|
1016
1064
|
channel.register('fdc3FindInstances', this.fdc3HandleFindInstances.bind(this));
|
|
1017
1065
|
channel.register('fdc3GetAppMetadata', this.fdc3HandleGetAppMetadata.bind(this));
|
|
1018
1066
|
channel.register('fdc3v2GetInfo', async (payload, clientIdentity) => {
|
|
1019
|
-
return this.fdc3HandleGetInfo.bind(this)(clientIdentity);
|
|
1067
|
+
return this.fdc3HandleGetInfo.bind(this)(payload, clientIdentity);
|
|
1020
1068
|
});
|
|
1021
1069
|
}
|
|
1022
1070
|
/**
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import type { Listener, Context, ContextHandler } from './shapes/fdc3v2';
|
|
1
2
|
declare type HandlerId = string;
|
|
2
3
|
export declare class PrivateChannelClient {
|
|
3
4
|
id: string;
|
|
4
5
|
client: OpenFin.ChannelClient;
|
|
5
|
-
listeners: Map<HandlerId,
|
|
6
|
+
listeners: Map<HandlerId, Listener>;
|
|
6
7
|
constructor(client: OpenFin.ChannelClient, id: string);
|
|
7
|
-
broadcast(context:
|
|
8
|
-
getCurrentContext(contextType?: string): Promise<
|
|
9
|
-
addContextListener(contextType: string | null, handler:
|
|
8
|
+
broadcast(context: Context): Promise<void>;
|
|
9
|
+
getCurrentContext(contextType?: string): Promise<Context | null>;
|
|
10
|
+
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
|
|
10
11
|
private createNonStandardUnsubscribeCb;
|
|
11
12
|
private createContextUnsubscribeCb;
|
|
12
|
-
onAddContextListener(handler: (contextType?: string) => void):
|
|
13
|
-
onDisconnect(handler: () => void):
|
|
14
|
-
onUnsubscribe(handler: (contextType?: string) => void):
|
|
13
|
+
onAddContextListener(handler: (contextType?: string) => void): Listener;
|
|
14
|
+
onDisconnect(handler: () => void): Listener;
|
|
15
|
+
onUnsubscribe(handler: (contextType?: string) => void): Listener;
|
|
15
16
|
disconnect(): Promise<void>;
|
|
16
17
|
}
|
|
17
18
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as FDC3v1 from './shapes/fdc3v1';
|
|
1
2
|
import { Base } from '../../base';
|
|
2
3
|
/**
|
|
3
4
|
* @typedef { object } Listener
|
|
@@ -88,7 +89,7 @@ import { Base } from '../../base';
|
|
|
88
89
|
* }
|
|
89
90
|
* ```
|
|
90
91
|
*/
|
|
91
|
-
export default class Fdc3Module extends Base implements
|
|
92
|
+
export default class Fdc3Module extends Base implements FDC3v1.DesktopAgent {
|
|
92
93
|
/**
|
|
93
94
|
* 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.
|
|
94
95
|
* @param { string | null } contextType - The type of context you wish to handle.
|
|
@@ -97,7 +98,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
97
98
|
* @tutorial fdc3.addContextListener
|
|
98
99
|
* @static
|
|
99
100
|
*/
|
|
100
|
-
addContextListener(contextType: string | null, handler:
|
|
101
|
+
addContextListener(contextType: string | null, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
|
|
101
102
|
/**
|
|
102
103
|
* Broadcasts a context for the channel of the current entity.
|
|
103
104
|
* @param { Context } context - New context to set.
|
|
@@ -105,14 +106,14 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
105
106
|
* @tutorial fdc3.broadcast
|
|
106
107
|
* @static
|
|
107
108
|
*/
|
|
108
|
-
broadcast(context:
|
|
109
|
+
broadcast(context: FDC3v1.Context): Promise<void>;
|
|
109
110
|
/**
|
|
110
111
|
* Returns the Interop-Broker-defined context groups available for an entity to join.
|
|
111
112
|
* @returns { Promise<Channel[]>}
|
|
112
113
|
* @tutorial fdc3.getSystemChannels
|
|
113
114
|
* @static
|
|
114
115
|
*/
|
|
115
|
-
getSystemChannels(): Promise<
|
|
116
|
+
getSystemChannels(): Promise<FDC3v1.SystemChannel[]>;
|
|
116
117
|
/**
|
|
117
118
|
* Join all Interop Clients at the given identity to context group `contextGroupId`.
|
|
118
119
|
* If no target is specified, it adds the sender to the context group.
|
|
@@ -141,7 +142,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
141
142
|
* @tutorial fdc3.addIntentListener
|
|
142
143
|
* @static
|
|
143
144
|
*/
|
|
144
|
-
addIntentListener(intent: string, handler:
|
|
145
|
+
addIntentListener(intent: string, handler: FDC3v1.ContextHandler): FDC3v1.Listener & Promise<FDC3v1.Listener>;
|
|
145
146
|
/**
|
|
146
147
|
* Raises a specific intent.
|
|
147
148
|
* @param { string } intent Name of the Intent.
|
|
@@ -151,13 +152,13 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
151
152
|
* @tutorial fdc3.raiseIntent
|
|
152
153
|
* @static
|
|
153
154
|
*/
|
|
154
|
-
raiseIntent(intent: string, context:
|
|
155
|
+
raiseIntent(intent: string, context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
|
|
155
156
|
/**
|
|
156
157
|
* Returns the Channel that the entity is subscribed to. Returns null if not joined to a channel.
|
|
157
158
|
* @returns { Channel | null }
|
|
158
159
|
* @tutorial fdc3.getCurrentChannel
|
|
159
160
|
*/
|
|
160
|
-
getCurrentChannel(): Promise<
|
|
161
|
+
getCurrentChannel(): Promise<FDC3v1.Channel | null>;
|
|
161
162
|
/**
|
|
162
163
|
* Find out more information about a particular intent by passing its name, and optionally its context.
|
|
163
164
|
* @param { string } intent Name of the Intent
|
|
@@ -165,14 +166,14 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
165
166
|
* @return { Promise<AppIntent> }
|
|
166
167
|
* @tutorial fdc3.findIntent
|
|
167
168
|
*/
|
|
168
|
-
findIntent(intent: string, context?:
|
|
169
|
+
findIntent(intent: string, context?: FDC3v1.Context): Promise<FDC3v1.AppIntent>;
|
|
169
170
|
/**
|
|
170
171
|
* Find all the available intents for a particular context.
|
|
171
172
|
* @param { Context } context
|
|
172
173
|
* @return { Promise<Array<AppIntent>> }
|
|
173
174
|
* @tutorial fdc3.findIntentsByContext
|
|
174
175
|
*/
|
|
175
|
-
findIntentsByContext(context:
|
|
176
|
+
findIntentsByContext(context: FDC3v1.Context): Promise<Array<FDC3v1.AppIntent>>;
|
|
176
177
|
/**
|
|
177
178
|
* Finds and raises an intent against a target app based purely on context data.
|
|
178
179
|
* @param { Context } context
|
|
@@ -180,20 +181,20 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
180
181
|
* @return { Promise<IntentResolution> }
|
|
181
182
|
* @tutorial fdc3.raiseIntentForContext
|
|
182
183
|
*/
|
|
183
|
-
raiseIntentForContext(context:
|
|
184
|
+
raiseIntentForContext(context: FDC3v1.Context, app?: FDC3v1.TargetApp): Promise<FDC3v1.IntentResolution>;
|
|
184
185
|
/**
|
|
185
186
|
* Returns a Channel object for the specified channel, creating it as an App Channel if it does not exist.
|
|
186
187
|
* @param channelId
|
|
187
188
|
* @returns { Promise<Channel> }
|
|
188
189
|
* @tutorial fdc3.getOrCreateChannel
|
|
189
190
|
*/
|
|
190
|
-
getOrCreateChannel(channelId: string): Promise<
|
|
191
|
+
getOrCreateChannel(channelId: string): Promise<FDC3v1.Channel>;
|
|
191
192
|
/**
|
|
192
193
|
* 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.
|
|
193
194
|
* @return { Promise<ImplementationMetadata> }
|
|
194
195
|
* @tutorial fdc3.getInfo
|
|
195
196
|
*/
|
|
196
|
-
getInfo():
|
|
197
|
+
getInfo(): FDC3v1.ImplementationMetadata;
|
|
197
198
|
/**
|
|
198
199
|
* Launches an app with target information, which can either be a string or an AppMetadata object.
|
|
199
200
|
* @param { TargetApp } app
|
|
@@ -201,7 +202,7 @@ export default class Fdc3Module extends Base implements FDC3.DesktopAgent {
|
|
|
201
202
|
* @return { Promise<void> }
|
|
202
203
|
* @tutorial fdc3.open
|
|
203
204
|
*/
|
|
204
|
-
open(app:
|
|
205
|
+
open(app: FDC3v1.TargetApp, context?: FDC3v1.Context): Promise<void>;
|
|
205
206
|
private getCurrentContextGroupInfo;
|
|
206
207
|
private buildChannelObject;
|
|
207
208
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as FDC3v1 from './shapes/fdc3v1';
|
|
2
|
+
import * 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,7 +181,7 @@ 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) => {
|
|
@@ -199,7 +199,7 @@ 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) => {
|
|
@@ -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) => {
|
|
@@ -298,7 +298,7 @@ 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) => {
|
|
@@ -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.
|
|
@@ -385,7 +385,7 @@ 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
391
|
const channelId = (0, utils_1.generateId)();
|
|
@@ -398,7 +398,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
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();
|
|
@@ -422,7 +422,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
422
422
|
* Join an app to a specified User channel.
|
|
423
423
|
* @param { string } channelId Channel name
|
|
424
424
|
* @returns { Promise<void> }
|
|
425
|
-
* @tutorial
|
|
425
|
+
* @tutorial joinUserChannel
|
|
426
426
|
*/
|
|
427
427
|
async joinUserChannel(channelId) {
|
|
428
428
|
return this.fdc3Module.joinChannel(channelId);
|
|
@@ -455,19 +455,12 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
455
455
|
}
|
|
456
456
|
/**
|
|
457
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.
|
|
458
459
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
459
|
-
* @tutorial
|
|
460
|
+
* @tutorial getInfo
|
|
460
461
|
*/
|
|
461
462
|
async getInfo() {
|
|
462
|
-
|
|
463
|
-
const result = await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', {});
|
|
464
|
-
const partialInfo = this.fdc3Module.getInfo();
|
|
465
|
-
return { ...partialInfo, ...result };
|
|
466
|
-
}
|
|
467
|
-
catch (error) {
|
|
468
|
-
const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetInfo ? 'ResolverUnavailable' : error;
|
|
469
|
-
throw new Error(errorToThrow);
|
|
470
|
-
}
|
|
463
|
+
return InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
|
471
464
|
}
|
|
472
465
|
}
|
|
473
466
|
exports.default = Fdc3Module2;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Fdc3Module from './fdc3-1.2';
|
|
2
|
+
import Fdc3Module2 from './fdc3-2.0';
|
|
3
|
+
import type Transport from '../../../transport/transport';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
fdc3: Fdc3Module | Fdc3Module2;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
declare type Fdc3Versions = '1.2' | '2.0';
|
|
10
|
+
export declare const versionMap: Record<Fdc3Versions, typeof Fdc3Module | typeof Fdc3Module2>;
|
|
11
|
+
export declare function registerFdc3Shim(version: string, transport: Transport): void;
|
|
12
|
+
export declare function getFdc3(transport: Transport, version?: Fdc3Versions): Fdc3Module | Fdc3Module2;
|
|
13
|
+
export {};
|