@openfin/core 30.73.20 → 30.73.21
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/package.json +1 -1
- package/src/OpenFin.d.ts +61 -27
- package/src/OpenFin.js +2 -0
- package/src/api/events/system.d.ts +18 -3
- package/src/api/events/typedEventEmitter.d.ts +13 -0
- package/{fdc3.js → src/api/events/typedEventEmitter.js} +0 -0
- package/src/api/frame/Instance.d.ts +2 -1
- package/src/api/global-hotkey/index.d.ts +2 -1
- package/src/api/interop/InteropBroker.d.ts +6 -5
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +8 -8
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -15
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +23 -23
- package/src/api/interop/fdc3/fdc3-2.0.js +9 -9
- 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 +75 -0
- package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
- package/src/api/interop/fdc3/utils.d.ts +7 -6
- package/src/api/interop/fdc3/utils.js +2 -2
- package/src/api/platform/Instance.d.ts +2 -1
- 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 +15 -483
- package/src/api/system/index.js +51 -471
- package/src/api/view/Instance.d.ts +11 -2
- package/src/api/view/Instance.js +16 -0
- package/src/api/window/Instance.d.ts +2 -1
- package/src/fdc3.d.ts +3 -0
- package/src/mock.d.ts +1 -1
- package/src/shapes/protocol.d.ts +3 -1
- package/fdc3.ts +0 -264
|
@@ -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);
|
|
@@ -457,7 +457,7 @@ class Fdc3Module2 extends base_1.Base {
|
|
|
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
458
|
* fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
|
|
459
459
|
* @returns { Promise<ImplementationMetadata(2)> }
|
|
460
|
-
* @tutorial
|
|
460
|
+
* @tutorial getInfo
|
|
461
461
|
*/
|
|
462
462
|
async getInfo() {
|
|
463
463
|
return InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
|
|
@@ -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 {};
|
|
@@ -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,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TargetApp } from './shapes/fdc3v1';
|
|
2
|
+
import { AppIdentifier, IntentResolution, Channel, PrivateChannel, Context } from './shapes/fdc3v2';
|
|
2
3
|
import * as OpenFin from '../../../OpenFin';
|
|
3
4
|
import { PrivateChannelClient } from './PrivateChannelClient';
|
|
4
5
|
interface UnsupportedChannelApis {
|
|
5
6
|
addContextListener(): Error;
|
|
6
7
|
broadcast(): Error;
|
|
7
|
-
|
|
8
|
+
getCurrentContext(): Error;
|
|
8
9
|
}
|
|
9
10
|
export declare const getUnsupportedChannelApis: (channelType?: string) => UnsupportedChannelApis;
|
|
10
11
|
export declare class UnsupportedChannelApiError extends Error {
|
|
@@ -20,8 +21,8 @@ export declare enum ResultError {
|
|
|
20
21
|
*/
|
|
21
22
|
IntentHandlerRejected = "IntentHandlerRejected"
|
|
22
23
|
}
|
|
23
|
-
export declare const buildPrivateChannelObject: (privateChannelClient: PrivateChannelClient) =>
|
|
24
|
-
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) =>
|
|
25
|
-
export declare const connectPrivateChannel: (channelId: string) => Promise<
|
|
26
|
-
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>;
|
|
27
28
|
export {};
|
|
@@ -11,8 +11,8 @@ const getUnsupportedChannelApis = (channelType) => {
|
|
|
11
11
|
broadcast: () => {
|
|
12
12
|
throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
throw new UnsupportedChannelApiError('Channel.
|
|
14
|
+
getCurrentContext: () => {
|
|
15
|
+
throw new UnsupportedChannelApiError('Channel.getCurrentContext', channelType);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -4,7 +4,7 @@ import { EmitterBase } from '../base';
|
|
|
4
4
|
import { Channel } from '../interappbus/channel/index';
|
|
5
5
|
import ChannelClient from '../interappbus/channel/client';
|
|
6
6
|
import { LayoutModule } from './layout';
|
|
7
|
-
|
|
7
|
+
declare type PlatformEvents = OpenFin.PlatformEvents;
|
|
8
8
|
/** Manages the life cycle of windows and views in the application.
|
|
9
9
|
*
|
|
10
10
|
* Enables taking snapshots of itself and applying them to restore a previous configuration
|
|
@@ -133,3 +133,4 @@ export declare class Platform extends EmitterBase<PlatformEvents> {
|
|
|
133
133
|
skipBeforeUnload: boolean;
|
|
134
134
|
}): Promise<void>;
|
|
135
135
|
}
|
|
136
|
+
export {};
|
|
@@ -16,4 +16,4 @@ export declare const isDomRectEqual: (a: DOMRect, b: DOMRect) => boolean;
|
|
|
16
16
|
* @returns Function which disposes the observers when invoked.
|
|
17
17
|
* @ignore
|
|
18
18
|
*/
|
|
19
|
-
export declare const observeBounds: (element: Element, onChange: (bounds: DOMRect) => void) => (() => void);
|
|
19
|
+
export declare const observeBounds: (element: Element, onChange: (bounds: DOMRect) => Promise<void> | void) => (() => void);
|
|
@@ -32,11 +32,11 @@ exports.isDomRectEqual = isDomRectEqual;
|
|
|
32
32
|
*/
|
|
33
33
|
const observeBounds = (element, onChange) => {
|
|
34
34
|
let lastBounds;
|
|
35
|
-
const checkBounds = () => {
|
|
35
|
+
const checkBounds = async () => {
|
|
36
36
|
const currentBounds = element.getBoundingClientRect();
|
|
37
37
|
if (!lastBounds || !(0, exports.isDomRectEqual)(lastBounds, currentBounds)) {
|
|
38
38
|
lastBounds = currentBounds;
|
|
39
|
-
onChange(element.getBoundingClientRect());
|
|
39
|
+
await onChange(element.getBoundingClientRect());
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const resizeObserver = new ResizeObserver(() => checkBounds());
|