@openfin/core 33.76.36 → 33.77.1
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 -1
- package/README.md +29 -4
- package/fin.d.ts +2 -2
- package/{src → out}/GlobalOpenFin.d.ts +1 -1
- package/out/mock-alpha.d.ts +16112 -0
- package/out/mock-beta.d.ts +16112 -0
- package/out/mock-public.d.ts +16112 -0
- package/out/mock.d.ts +16797 -0
- package/out/mock.js +17111 -0
- package/package.json +30 -23
- package/LICENSE +0 -13
- package/NOTICE +0 -16
- package/openfin-core-33.76.36.tgz +0 -0
- package/src/OpenFin.d.ts +0 -3091
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +0 -28
- package/src/api/api-exposer/api-consumer.js +0 -28
- package/src/api/api-exposer/api-exposer.d.ts +0 -35
- package/src/api/api-exposer/api-exposer.js +0 -38
- package/src/api/api-exposer/decorators.d.ts +0 -10
- package/src/api/api-exposer/decorators.js +0 -18
- package/src/api/api-exposer/index.d.ts +0 -4
- package/src/api/api-exposer/index.js +0 -20
- package/src/api/api-exposer/strategies/index.d.ts +0 -1
- package/src/api/api-exposer/strategies/index.js +0 -17
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +0 -14
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +0 -20
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +0 -23
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +0 -2
- package/src/api/api-exposer/strategies/openfin-channels/index.js +0 -18
- package/src/api/application/Factory.d.ts +0 -196
- package/src/api/application/Factory.js +0 -278
- package/src/api/application/Instance.d.ts +0 -692
- package/src/api/application/Instance.js +0 -821
- package/src/api/application/index.d.ts +0 -12
- package/src/api/application/index.js +0 -28
- package/src/api/base.d.ts +0 -117
- package/src/api/base.js +0 -246
- package/src/api/clipboard/index.d.ts +0 -172
- package/src/api/clipboard/index.js +0 -200
- package/src/api/events/application.d.ts +0 -158
- package/src/api/events/application.js +0 -14
- package/src/api/events/base.d.ts +0 -42
- package/src/api/events/base.js +0 -2
- package/src/api/events/channel.d.ts +0 -35
- package/src/api/events/channel.js +0 -7
- package/src/api/events/emitterMap.d.ts +0 -11
- package/src/api/events/emitterMap.js +0 -35
- package/src/api/events/eventAggregator.d.ts +0 -5
- package/src/api/events/eventAggregator.js +0 -35
- package/src/api/events/externalApplication.d.ts +0 -24
- package/src/api/events/externalApplication.js +0 -7
- package/src/api/events/frame.d.ts +0 -35
- package/src/api/events/frame.js +0 -2
- package/src/api/events/globalHotkey.d.ts +0 -25
- package/src/api/events/globalHotkey.js +0 -2
- package/src/api/events/platform.d.ts +0 -34
- package/src/api/events/platform.js +0 -10
- package/src/api/events/system.d.ts +0 -126
- package/src/api/events/system.js +0 -15
- package/src/api/events/typedEventEmitter.d.ts +0 -20
- package/src/api/events/typedEventEmitter.js +0 -2
- package/src/api/events/view.d.ts +0 -92
- package/src/api/events/view.js +0 -12
- package/src/api/events/webcontents.d.ts +0 -277
- package/src/api/events/webcontents.js +0 -13
- package/src/api/events/window.d.ts +0 -421
- package/src/api/events/window.js +0 -12
- package/src/api/external-application/Factory.d.ts +0 -34
- package/src/api/external-application/Factory.js +0 -47
- package/src/api/external-application/Instance.d.ts +0 -110
- package/src/api/external-application/Instance.js +0 -117
- package/src/api/external-application/index.d.ts +0 -12
- package/src/api/external-application/index.js +0 -28
- package/src/api/fin.d.ts +0 -54
- package/src/api/fin.js +0 -45
- package/src/api/frame/Factory.d.ts +0 -54
- package/src/api/frame/Factory.js +0 -86
- package/src/api/frame/Instance.d.ts +0 -136
- package/src/api/frame/Instance.js +0 -143
- package/src/api/frame/index.d.ts +0 -14
- package/src/api/frame/index.js +0 -30
- package/src/api/global-hotkey/index.d.ts +0 -106
- package/src/api/global-hotkey/index.js +0 -132
- package/src/api/interappbus/channel/channel.d.ts +0 -285
- package/src/api/interappbus/channel/channel.js +0 -334
- package/src/api/interappbus/channel/channels-docs.d.ts +0 -342
- package/src/api/interappbus/channel/channels-docs.js +0 -401
- package/src/api/interappbus/channel/client.d.ts +0 -117
- package/src/api/interappbus/channel/client.js +0 -181
- package/src/api/interappbus/channel/connection-manager.d.ts +0 -29
- package/src/api/interappbus/channel/connection-manager.js +0 -246
- package/src/api/interappbus/channel/index.d.ts +0 -189
- package/src/api/interappbus/channel/index.js +0 -333
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/classic/message-receiver.js +0 -73
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/classic/strategy.js +0 -101
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +0 -20
- package/src/api/interappbus/channel/protocols/combined/strategy.js +0 -58
- package/src/api/interappbus/channel/protocols/index.d.ts +0 -47
- package/src/api/interappbus/channel/protocols/index.js +0 -2
- package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +0 -10
- package/src/api/interappbus/channel/protocols/protocol-manager.js +0 -43
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +0 -25
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +0 -141
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +0 -30
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -130
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +0 -24
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +0 -85
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +0 -13
- package/src/api/interappbus/channel/protocols/strategy-types.js +0 -2
- package/src/api/interappbus/channel/protocols/strategy.d.ts +0 -17
- package/src/api/interappbus/channel/protocols/strategy.js +0 -2
- package/src/api/interappbus/channel/provider.d.ts +0 -206
- package/src/api/interappbus/channel/provider.js +0 -338
- package/src/api/interappbus/index.d.ts +0 -120
- package/src/api/interappbus/index.js +0 -210
- package/src/api/interop/Factory.d.ts +0 -57
- package/src/api/interop/Factory.js +0 -96
- package/src/api/interop/InteropBroker.d.ts +0 -665
- package/src/api/interop/InteropBroker.js +0 -1313
- package/src/api/interop/InteropClient.d.ts +0 -502
- package/src/api/interop/InteropClient.js +0 -683
- package/src/api/interop/SessionContextGroupBroker.d.ts +0 -27
- package/src/api/interop/SessionContextGroupBroker.js +0 -108
- package/src/api/interop/SessionContextGroupClient.d.ts +0 -21
- package/src/api/interop/SessionContextGroupClient.js +0 -86
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +0 -20
- package/src/api/interop/fdc3/PrivateChannelClient.js +0 -90
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +0 -55
- package/src/api/interop/fdc3/PrivateChannelProvider.js +0 -276
- package/src/api/interop/fdc3/documentationStub.d.ts +0 -14
- package/src/api/interop/fdc3/documentationStub.js +0 -17
- package/src/api/interop/fdc3/fdc3-1.2.d.ts +0 -205
- package/src/api/interop/fdc3/fdc3-1.2.js +0 -435
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +0 -298
- package/src/api/interop/fdc3/fdc3-2.0.js +0 -479
- package/src/api/interop/fdc3/fdc3.d.ts +0 -12
- package/src/api/interop/fdc3/fdc3.js +0 -35
- package/src/api/interop/fdc3/overrideCheck.d.ts +0 -4
- package/src/api/interop/fdc3/overrideCheck.js +0 -32
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +0 -53
- package/src/api/interop/fdc3/shapes/fdc3v1.js +0 -4
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +0 -75
- package/src/api/interop/fdc3/shapes/fdc3v2.js +0 -2
- package/src/api/interop/fdc3/utils.d.ts +0 -45
- package/src/api/interop/fdc3/utils.js +0 -239
- package/src/api/interop/fdc3/versions.d.ts +0 -1
- package/src/api/interop/fdc3/versions.js +0 -2
- package/src/api/interop/index.d.ts +0 -12
- package/src/api/interop/index.js +0 -28
- package/src/api/interop/utils.d.ts +0 -18
- package/src/api/interop/utils.js +0 -61
- package/src/api/me.d.ts +0 -40
- package/src/api/me.js +0 -134
- package/src/api/platform/Factory.d.ts +0 -171
- package/src/api/platform/Factory.js +0 -240
- package/src/api/platform/Instance.d.ts +0 -653
- package/src/api/platform/Instance.js +0 -834
- package/src/api/platform/common-utils.d.ts +0 -7
- package/src/api/platform/common-utils.js +0 -16
- package/src/api/platform/index.d.ts +0 -12
- package/src/api/platform/index.js +0 -28
- package/src/api/platform/layout/Factory.d.ts +0 -91
- package/src/api/platform/layout/Factory.js +0 -151
- package/src/api/platform/layout/Instance.d.ts +0 -192
- package/src/api/platform/layout/Instance.js +0 -224
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +0 -9
- package/src/api/platform/layout/controllers/layout-content-cache.js +0 -54
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +0 -119
- package/src/api/platform/layout/controllers/layout-entities-controller.js +0 -287
- package/src/api/platform/layout/entities/layout-entities.d.ts +0 -427
- package/src/api/platform/layout/entities/layout-entities.js +0 -504
- package/src/api/platform/layout/entities/shapes.d.ts +0 -6
- package/src/api/platform/layout/entities/shapes.js +0 -2
- package/src/api/platform/layout/index.d.ts +0 -11
- package/src/api/platform/layout/index.js +0 -27
- package/src/api/platform/layout/layout.constants.d.ts +0 -1
- package/src/api/platform/layout/layout.constants.js +0 -4
- package/src/api/platform/layout/shapes.d.ts +0 -16
- package/src/api/platform/layout/shapes.js +0 -2
- package/src/api/platform/layout/utils/layout-traversal.d.ts +0 -4
- package/src/api/platform/layout/utils/layout-traversal.js +0 -65
- package/src/api/platform/provider.d.ts +0 -510
- package/src/api/platform/provider.js +0 -2
- package/src/api/snapshot-source/Factory.d.ts +0 -53
- package/src/api/snapshot-source/Factory.js +0 -81
- package/src/api/snapshot-source/Instance.d.ts +0 -53
- package/src/api/snapshot-source/Instance.js +0 -154
- package/src/api/snapshot-source/index.d.ts +0 -12
- package/src/api/snapshot-source/index.js +0 -28
- package/src/api/snapshot-source/utils.d.ts +0 -2
- package/src/api/snapshot-source/utils.js +0 -6
- package/src/api/system/index.d.ts +0 -1468
- package/src/api/system/index.js +0 -1851
- package/src/api/view/Factory.d.ts +0 -88
- package/src/api/view/Factory.js +0 -141
- package/src/api/view/Instance.d.ts +0 -601
- package/src/api/view/Instance.js +0 -671
- package/src/api/view/index.d.ts +0 -12
- package/src/api/view/index.js +0 -28
- package/src/api/webcontents/main.d.ts +0 -922
- package/src/api/webcontents/main.js +0 -1046
- package/src/api/window/Factory.d.ts +0 -96
- package/src/api/window/Factory.js +0 -142
- package/src/api/window/Instance.d.ts +0 -1598
- package/src/api/window/Instance.js +0 -1851
- package/src/api/window/index.d.ts +0 -14
- package/src/api/window/index.js +0 -30
- package/src/browser.d.ts +0 -10
- package/src/browser.js +0 -36
- package/src/environment/browser.d.ts +0 -29
- package/src/environment/browser.js +0 -60
- package/src/environment/environment.d.ts +0 -33
- package/src/environment/environment.js +0 -4
- package/src/environment/mockEnvironment.d.ts +0 -27
- package/src/environment/mockEnvironment.js +0 -61
- package/src/environment/node-env.d.ts +0 -29
- package/src/environment/node-env.js +0 -72
- package/src/fdc3.d.ts +0 -3
- package/src/fdc3.js +0 -9
- package/src/mock.d.ts +0 -3
- package/src/mock.js +0 -18
- package/src/namespaces.d.ts +0 -22
- package/src/namespaces.js +0 -26
- package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -1
- package/src/shapes/ERROR_BOX_TYPES.js +0 -2
- package/src/shapes/WebOptions.d.ts +0 -13
- package/src/shapes/WebOptions.js +0 -2
- package/src/shapes/WindowOptions.d.ts +0 -43
- package/src/shapes/WindowOptions.js +0 -2
- package/src/shapes/protocol.d.ts +0 -204
- package/src/shapes/protocol.js +0 -2
- package/src/transport/mockWire.d.ts +0 -11
- package/src/transport/mockWire.js +0 -26
- package/src/transport/transport-errors.d.ts +0 -31
- package/src/transport/transport-errors.js +0 -79
- package/src/transport/transport.d.ts +0 -73
- package/src/transport/transport.js +0 -219
- package/src/transport/wire.d.ts +0 -77
- package/src/transport/wire.js +0 -36
- package/src/util/asyncFilter.d.ts +0 -1
- package/src/util/asyncFilter.js +0 -7
- package/src/util/channel-api-relay.d.ts +0 -13
- package/src/util/channel-api-relay.js +0 -47
- package/src/util/errors.d.ts +0 -10
- package/src/util/errors.js +0 -12
- package/src/util/exhaustive.d.ts +0 -1
- package/src/util/exhaustive.js +0 -7
- package/src/util/http.d.ts +0 -11
- package/src/util/http.js +0 -90
- package/src/util/inaccessibleObject.d.ts +0 -2
- package/src/util/inaccessibleObject.js +0 -49
- package/src/util/lazy.d.ts +0 -34
- package/src/util/lazy.js +0 -54
- package/src/util/normalize-config.d.ts +0 -3
- package/src/util/normalize-config.js +0 -52
- package/src/util/promises.d.ts +0 -5
- package/src/util/promises.js +0 -27
- package/src/util/ref-counter.d.ts +0 -7
- package/src/util/ref-counter.js +0 -52
- package/src/util/reversible-map.d.ts +0 -11
- package/src/util/reversible-map.js +0 -49
- package/src/util/runtimeVersioning.d.ts +0 -3
- package/src/util/runtimeVersioning.js +0 -25
- package/src/util/utilTypes.d.ts +0 -8
- package/src/util/utilTypes.js +0 -2
- package/src/util/validate.d.ts +0 -3
- package/src/util/validate.js +0 -11
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as OpenFin from '../../../../OpenFin';
|
|
2
|
-
import { Channel as ChannelV1, SystemChannel, TargetApp } from './fdc3v1';
|
|
3
|
-
import type { Listener } from 'fdc3v2/dist/api/Listener';
|
|
4
|
-
import type { AppIntent } from 'fdc3v2/dist/api/AppIntent';
|
|
5
|
-
import type { ImplementationMetadata } from 'fdc3v2/dist/api/ImplementationMetadata';
|
|
6
|
-
import type { ContextMetadata } from 'fdc3v2/dist/api/ContextMetadata';
|
|
7
|
-
import type { AppIdentifier } from 'fdc3v2/dist/api/AppIdentifier';
|
|
8
|
-
import type { AppMetadata } from 'fdc3v2/dist/api/AppMetadata';
|
|
9
|
-
import type { DisplayMetadata } from 'fdc3v2/dist/api/DisplayMetadata';
|
|
10
|
-
export type { Listener } from 'fdc3v2/dist/api/Listener';
|
|
11
|
-
export type { AppIntent } from 'fdc3v2/dist/api/AppIntent';
|
|
12
|
-
export type { ImplementationMetadata } from 'fdc3v2/dist/api/ImplementationMetadata';
|
|
13
|
-
export type { ContextMetadata } from 'fdc3v2/dist/api/ContextMetadata';
|
|
14
|
-
export type { AppIdentifier } from 'fdc3v2/dist/api/AppIdentifier';
|
|
15
|
-
export type { AppMetadata } from 'fdc3v2/dist/api/AppMetadata';
|
|
16
|
-
export type { DisplayMetadata } from 'fdc3v2/dist/api/DisplayMetadata';
|
|
17
|
-
export type ContextHandler = (context: Context, metadata?: ContextMetadata) => void;
|
|
18
|
-
export type IntentHandler = (context: Context, metadata?: ContextMetadata) => Promise<IntentResult> | void;
|
|
19
|
-
export 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 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 | TargetApp, 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 | TargetApp): Promise<IntentResolution>;
|
|
62
|
-
raiseIntentForContext(context: Context, app?: AppIdentifier | TargetApp): 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<Channel>;
|
|
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,45 +0,0 @@
|
|
|
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';
|
|
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;
|
|
11
|
-
export declare class UnsupportedChannelApiError extends Error {
|
|
12
|
-
constructor(apiName: string, channelType?: string);
|
|
13
|
-
}
|
|
14
|
-
export declare enum ResultError {
|
|
15
|
-
/** Returned if the `IntentHandler` exited without returning a Promise or that
|
|
16
|
-
* Promise was not resolved with a Context or Channel object.
|
|
17
|
-
*/
|
|
18
|
-
NoResultReturned = "NoResultReturned",
|
|
19
|
-
/** Returned if the `IntentHandler` function processing the raised intent
|
|
20
|
-
* throws an error or rejects the Promise it returned.
|
|
21
|
-
*/
|
|
22
|
-
IntentHandlerRejected = "IntentHandlerRejected"
|
|
23
|
-
}
|
|
24
|
-
export declare enum ChannelError {
|
|
25
|
-
/** Returned if the specified channel is not found when attempting to join a
|
|
26
|
-
* channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
|
|
27
|
-
*/
|
|
28
|
-
NoChannelFound = "NoChannelFound",
|
|
29
|
-
/** SHOULD be returned when a request to join a user channel or to a retrieve
|
|
30
|
-
* a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
|
|
31
|
-
* of the DesktopAgent (`fdc3`) object is denied.
|
|
32
|
-
*/
|
|
33
|
-
AccessDenied = "AccessDenied",
|
|
34
|
-
/** SHOULD be returned when a channel cannot be created or retrieved via the
|
|
35
|
-
* `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
|
|
36
|
-
*/
|
|
37
|
-
CreationFailed = "CreationFailed"
|
|
38
|
-
}
|
|
39
|
-
export declare const buildPrivateChannelObject: (privateChannelClient: PrivateChannelClient) => PrivateChannel;
|
|
40
|
-
export declare const buildAppChannelObject: (sessionContextGroup: OpenFin.SessionContextGroup) => Channel;
|
|
41
|
-
export declare const connectPrivateChannel: (channelId: string) => Promise<PrivateChannel>;
|
|
42
|
-
export declare const isContext: (context: unknown) => context is Context;
|
|
43
|
-
export declare const isChannel: (channel: unknown) => channel is Channel;
|
|
44
|
-
export declare const getIntentResolution: (interopModule: OpenFin.InteropClient, context: Context, app?: AppIdentifier | TargetApp, intent?: string) => Promise<IntentResolution>;
|
|
45
|
-
export {};
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIntentResolution = exports.isChannel = exports.isContext = exports.connectPrivateChannel = exports.buildAppChannelObject = exports.buildPrivateChannelObject = exports.ChannelError = exports.ResultError = exports.UnsupportedChannelApiError = exports.getUnsupportedChannelApis = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const PrivateChannelClient_1 = require("./PrivateChannelClient");
|
|
6
|
-
const lodash_1 = require("lodash");
|
|
7
|
-
const getUnsupportedChannelApis = (channelType) => {
|
|
8
|
-
return {
|
|
9
|
-
addContextListener: () => {
|
|
10
|
-
throw new UnsupportedChannelApiError('Channel.addContextListener', channelType);
|
|
11
|
-
},
|
|
12
|
-
broadcast: () => {
|
|
13
|
-
throw new UnsupportedChannelApiError('Channel.broadcast', channelType);
|
|
14
|
-
},
|
|
15
|
-
getCurrentContext: () => {
|
|
16
|
-
throw new UnsupportedChannelApiError('Channel.getCurrentContext', channelType);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.getUnsupportedChannelApis = getUnsupportedChannelApis;
|
|
21
|
-
class UnsupportedChannelApiError extends Error {
|
|
22
|
-
constructor(apiName, channelType = 'System') {
|
|
23
|
-
super(apiName);
|
|
24
|
-
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.`;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.UnsupportedChannelApiError = UnsupportedChannelApiError;
|
|
28
|
-
var ResultError;
|
|
29
|
-
(function (ResultError) {
|
|
30
|
-
/** Returned if the `IntentHandler` exited without returning a Promise or that
|
|
31
|
-
* Promise was not resolved with a Context or Channel object.
|
|
32
|
-
*/
|
|
33
|
-
ResultError["NoResultReturned"] = "NoResultReturned";
|
|
34
|
-
/** Returned if the `IntentHandler` function processing the raised intent
|
|
35
|
-
* throws an error or rejects the Promise it returned.
|
|
36
|
-
*/
|
|
37
|
-
ResultError["IntentHandlerRejected"] = "IntentHandlerRejected";
|
|
38
|
-
})(ResultError = exports.ResultError || (exports.ResultError = {}));
|
|
39
|
-
var ChannelError;
|
|
40
|
-
(function (ChannelError) {
|
|
41
|
-
/** Returned if the specified channel is not found when attempting to join a
|
|
42
|
-
* channel via the `joinUserChannel` function of the DesktopAgent (`fdc3`).
|
|
43
|
-
*/
|
|
44
|
-
ChannelError["NoChannelFound"] = "NoChannelFound";
|
|
45
|
-
/** SHOULD be returned when a request to join a user channel or to a retrieve
|
|
46
|
-
* a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
|
|
47
|
-
* of the DesktopAgent (`fdc3`) object is denied.
|
|
48
|
-
*/
|
|
49
|
-
ChannelError["AccessDenied"] = "AccessDenied";
|
|
50
|
-
/** SHOULD be returned when a channel cannot be created or retrieved via the
|
|
51
|
-
* `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
|
|
52
|
-
*/
|
|
53
|
-
ChannelError["CreationFailed"] = "CreationFailed";
|
|
54
|
-
})(ChannelError = exports.ChannelError || (exports.ChannelError = {}));
|
|
55
|
-
const buildPrivateChannelObject = (privateChannelClient) => {
|
|
56
|
-
let clientDisconnected = false;
|
|
57
|
-
const checkIfClientDisconnected = () => {
|
|
58
|
-
if (clientDisconnected) {
|
|
59
|
-
throw new Error('Private Channel Client has been disconnected from the Private Channel');
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
id: privateChannelClient.id,
|
|
64
|
-
type: 'private',
|
|
65
|
-
broadcast: async (context) => {
|
|
66
|
-
checkIfClientDisconnected();
|
|
67
|
-
return privateChannelClient.broadcast(context);
|
|
68
|
-
},
|
|
69
|
-
getCurrentContext: async (contextType) => {
|
|
70
|
-
checkIfClientDisconnected();
|
|
71
|
-
return privateChannelClient.getCurrentContext(contextType);
|
|
72
|
-
},
|
|
73
|
-
addContextListener: async (contextType, handler) => {
|
|
74
|
-
checkIfClientDisconnected();
|
|
75
|
-
let handlerInUse = handler;
|
|
76
|
-
let contextTypeInUse = contextType;
|
|
77
|
-
if (typeof contextType === 'function') {
|
|
78
|
-
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
79
|
-
handlerInUse = contextType;
|
|
80
|
-
contextTypeInUse = null;
|
|
81
|
-
}
|
|
82
|
-
const listener = privateChannelClient.addContextListener(contextTypeInUse, handlerInUse);
|
|
83
|
-
return listener;
|
|
84
|
-
},
|
|
85
|
-
onAddContextListener: (handler) => {
|
|
86
|
-
checkIfClientDisconnected();
|
|
87
|
-
return privateChannelClient.onAddContextListener(handler);
|
|
88
|
-
},
|
|
89
|
-
disconnect: async () => {
|
|
90
|
-
checkIfClientDisconnected();
|
|
91
|
-
clientDisconnected = true;
|
|
92
|
-
return privateChannelClient.disconnect();
|
|
93
|
-
},
|
|
94
|
-
onDisconnect: (handler) => {
|
|
95
|
-
checkIfClientDisconnected();
|
|
96
|
-
return privateChannelClient.onDisconnect(handler);
|
|
97
|
-
},
|
|
98
|
-
onUnsubscribe: (handler) => {
|
|
99
|
-
checkIfClientDisconnected();
|
|
100
|
-
return privateChannelClient.onUnsubscribe(handler);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
exports.buildPrivateChannelObject = buildPrivateChannelObject;
|
|
105
|
-
const buildAppChannelObject = (sessionContextGroup) => {
|
|
106
|
-
return {
|
|
107
|
-
id: sessionContextGroup.id,
|
|
108
|
-
type: 'app',
|
|
109
|
-
broadcast: sessionContextGroup.setContext,
|
|
110
|
-
getCurrentContext: async (contextType) => {
|
|
111
|
-
const context = await sessionContextGroup.getCurrentContext(contextType);
|
|
112
|
-
return context === undefined ? null : context;
|
|
113
|
-
},
|
|
114
|
-
addContextListener: (contextType, handler) => {
|
|
115
|
-
let realHandler;
|
|
116
|
-
let realType;
|
|
117
|
-
if (typeof contextType === 'function') {
|
|
118
|
-
console.warn('addContextListener(handler) has been deprecated. Please use addContextListener(null, handler)');
|
|
119
|
-
realHandler = contextType;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
realHandler = handler;
|
|
123
|
-
if (typeof contextType === 'string') {
|
|
124
|
-
realType = contextType;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const listener = (async () => {
|
|
128
|
-
let first = true;
|
|
129
|
-
const currentContext = await sessionContextGroup.getCurrentContext(realType);
|
|
130
|
-
const wrappedHandler = (context, contextMetadata) => {
|
|
131
|
-
if (first) {
|
|
132
|
-
first = false;
|
|
133
|
-
if ((0, lodash_1.isEqual)(currentContext, context)) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// eslint-disable-next-line consistent-return
|
|
138
|
-
return realHandler(context, contextMetadata);
|
|
139
|
-
};
|
|
140
|
-
return sessionContextGroup.addContextHandler(wrappedHandler, realType);
|
|
141
|
-
})();
|
|
142
|
-
return {
|
|
143
|
-
...listener,
|
|
144
|
-
unsubscribe: () => listener.then((l) => l.unsubscribe())
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
exports.buildAppChannelObject = buildAppChannelObject;
|
|
150
|
-
const connectPrivateChannel = async (channelId) => {
|
|
151
|
-
try {
|
|
152
|
-
const channelClient = await fin.InterApplicationBus.Channel.connect(channelId);
|
|
153
|
-
const privateChannelClient = new PrivateChannelClient_1.PrivateChannelClient(channelClient, channelId);
|
|
154
|
-
return (0, exports.buildPrivateChannelObject)(privateChannelClient);
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
throw new Error(`Private Channel with id: ${channelId} doesn't exist`);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
exports.connectPrivateChannel = connectPrivateChannel;
|
|
161
|
-
const isContext = (context) => {
|
|
162
|
-
if (context && typeof context === 'object' && 'type' in context) {
|
|
163
|
-
const { type } = context;
|
|
164
|
-
return typeof type === 'string';
|
|
165
|
-
}
|
|
166
|
-
return false;
|
|
167
|
-
};
|
|
168
|
-
exports.isContext = isContext;
|
|
169
|
-
const isChannel = (channel) => {
|
|
170
|
-
if (channel && typeof channel === 'object' && 'type' in channel && 'id' in channel) {
|
|
171
|
-
const { type, id } = channel;
|
|
172
|
-
return typeof type === 'string' && typeof id === 'string' && (type === 'app' || type === 'private');
|
|
173
|
-
}
|
|
174
|
-
return false;
|
|
175
|
-
};
|
|
176
|
-
exports.isChannel = isChannel;
|
|
177
|
-
const getIntentResolution = async (interopModule, context, app, intent) => {
|
|
178
|
-
// Generate an ID to make a session context group with. We will pass that ID to the Broker.
|
|
179
|
-
// The broker will then setContext on that session context group later with our Intent Result,
|
|
180
|
-
const guid = (0, utils_1.generateId)();
|
|
181
|
-
// Promise we'll use in getResult
|
|
182
|
-
const getResultPromise = new Promise((resolve) => {
|
|
183
|
-
fin.InterApplicationBus.subscribe({ uuid: '*' }, guid, (intentResult) => {
|
|
184
|
-
resolve(intentResult);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
// Adding the intentResolutionResultId to the intentObj. Because fireIntent only accepts a single arg, we have to slap it in here.
|
|
188
|
-
const metadata = app ? { target: app, intentResolutionResultId: guid } : { intentResolutionResultId: guid };
|
|
189
|
-
const intentObj = intent ? { name: intent, context, metadata } : { ...context, metadata };
|
|
190
|
-
// Set up the getResult call.
|
|
191
|
-
const getResult = async () => {
|
|
192
|
-
let intentResult = await getResultPromise;
|
|
193
|
-
if (!intentResult || typeof intentResult !== 'object') {
|
|
194
|
-
throw new Error(ResultError.NoResultReturned);
|
|
195
|
-
}
|
|
196
|
-
const { error } = intentResult;
|
|
197
|
-
if (error) {
|
|
198
|
-
throw new Error(ResultError.IntentHandlerRejected);
|
|
199
|
-
}
|
|
200
|
-
if ((0, exports.isChannel)(intentResult)) {
|
|
201
|
-
const { id, type } = intentResult;
|
|
202
|
-
switch (type) {
|
|
203
|
-
case 'private': {
|
|
204
|
-
intentResult = await (0, exports.connectPrivateChannel)(id);
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
case 'app': {
|
|
208
|
-
const sessionContextGroup = await interopModule.joinSessionContextGroup(id);
|
|
209
|
-
intentResult = (0, exports.buildAppChannelObject)(sessionContextGroup);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
default: {
|
|
213
|
-
break;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
else if (!(0, exports.isContext)(intentResult)) {
|
|
218
|
-
throw new Error(ResultError.NoResultReturned);
|
|
219
|
-
}
|
|
220
|
-
return intentResult;
|
|
221
|
-
};
|
|
222
|
-
// Finally fire the intent.
|
|
223
|
-
const intentResolutionInfoFromBroker = intent
|
|
224
|
-
? await interopModule.fireIntent(intentObj)
|
|
225
|
-
: await interopModule.fireIntentForContext(intentObj);
|
|
226
|
-
if (typeof intentResolutionInfoFromBroker !== 'object') {
|
|
227
|
-
return {
|
|
228
|
-
source: {
|
|
229
|
-
appId: '',
|
|
230
|
-
instanceId: ''
|
|
231
|
-
},
|
|
232
|
-
intent: '',
|
|
233
|
-
version: '2.0',
|
|
234
|
-
getResult
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return { ...intentResolutionInfoFromBroker, getResult };
|
|
238
|
-
};
|
|
239
|
-
exports.getIntentResolution = getIntentResolution;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Fdc3Version = '1.2' | '2.0';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Entry point for the OpenFin Interop namespace.
|
|
3
|
-
*
|
|
4
|
-
* "InteropModule" contains static members of the `Interop` namespace (available under `fin.Interop`), while `InteropClient` and
|
|
5
|
-
* `InteropBroker` document instances of their respective classes.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import InteropModule from './Factory';
|
|
10
|
-
export default InteropModule;
|
|
11
|
-
export * from './InteropClient';
|
|
12
|
-
export * from './InteropBroker';
|
package/src/api/interop/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Entry point for the OpenFin Interop namespace.
|
|
4
|
-
*
|
|
5
|
-
* "InteropModule" contains static members of the `Interop` namespace (available under `fin.Interop`), while `InteropClient` and
|
|
6
|
-
* `InteropBroker` document instances of their respective classes.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}) : (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
o[k2] = m[k];
|
|
20
|
-
}));
|
|
21
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
const Factory_1 = require("./Factory");
|
|
26
|
-
exports.default = Factory_1.default;
|
|
27
|
-
__exportStar(require("./InteropClient"), exports);
|
|
28
|
-
__exportStar(require("./InteropBroker"), exports);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
export declare const generateId: () => string;
|
|
3
|
-
export declare const wrapInTryCatch: <T>(f: (...args: any[]) => T, prefix?: string) => (...args: any[]) => T;
|
|
4
|
-
export declare const wrapContextHandler: (handler: OpenFin.ContextHandler, handlerId: string) => (context: OpenFin.Context) => Promise<void>;
|
|
5
|
-
export declare const generateOverrideError: (clientApi: string, brokerApi: string) => string;
|
|
6
|
-
export declare const generateOverrideWarning: (fdc3ClientApi: string, brokerApi: string, identity: OpenFin.ClientIdentity, interopClientApi?: string) => string;
|
|
7
|
-
export declare const BROKER_ERRORS: {
|
|
8
|
-
fireIntent: string;
|
|
9
|
-
fireIntentForContext: string;
|
|
10
|
-
getInfoForIntent: string;
|
|
11
|
-
getInfoForIntentsByContext: string;
|
|
12
|
-
joinSessionContextGroupWithJoinContextGroup: string;
|
|
13
|
-
fdc3Open: string;
|
|
14
|
-
fdc3FindInstances: string;
|
|
15
|
-
fdc3GetAppMetadata: string;
|
|
16
|
-
fdc3GetInfo: string;
|
|
17
|
-
};
|
|
18
|
-
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
package/src/api/interop/utils.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
|
|
4
|
-
const generateId = () => `${Math.random()}${Date.now()}`;
|
|
5
|
-
exports.generateId = generateId;
|
|
6
|
-
const wrapInTryCatch = (f, prefix) => (...args) => {
|
|
7
|
-
try {
|
|
8
|
-
return f(...args);
|
|
9
|
-
}
|
|
10
|
-
catch (e) {
|
|
11
|
-
throw new Error((prefix || '') + e);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
exports.wrapInTryCatch = wrapInTryCatch;
|
|
15
|
-
const wrapContextHandler = (handler, handlerId) => {
|
|
16
|
-
return async (context) => {
|
|
17
|
-
try {
|
|
18
|
-
await handler(context);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
console.error(`Error thrown by handler ${handlerId} for context type ${context.type}: ${error}`);
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
exports.wrapContextHandler = wrapContextHandler;
|
|
27
|
-
const generateOverrideError = (clientApi, brokerApi) => {
|
|
28
|
-
return `You have tried to to use ${clientApi} but ${brokerApi} has not been overridden in the Interop Broker. Please override this function. Refer to our documentation for more info.`;
|
|
29
|
-
};
|
|
30
|
-
exports.generateOverrideError = generateOverrideError;
|
|
31
|
-
const generateOverrideWarning = (fdc3ClientApi, brokerApi, identity, interopClientApi) => {
|
|
32
|
-
const { uuid, name } = identity;
|
|
33
|
-
const message = interopClientApi
|
|
34
|
-
? `Entity with identity: ${uuid}/${name} has called ${interopClientApi} or ${fdc3ClientApi} but ${brokerApi} has not been overridden.`
|
|
35
|
-
: `Entity with identity: ${uuid}/${name} has called ${fdc3ClientApi} but ${brokerApi} has not been overridden.`;
|
|
36
|
-
return message;
|
|
37
|
-
};
|
|
38
|
-
exports.generateOverrideWarning = generateOverrideWarning;
|
|
39
|
-
exports.BROKER_ERRORS = {
|
|
40
|
-
fireIntent: (0, exports.generateOverrideError)('fireIntent', 'handleFiredIntent'),
|
|
41
|
-
fireIntentForContext: (0, exports.generateOverrideError)('fireIntentForContext', 'handleFiredIntentForContext'),
|
|
42
|
-
getInfoForIntent: (0, exports.generateOverrideError)('getInfoForIntent', 'handleInfoForIntent'),
|
|
43
|
-
getInfoForIntentsByContext: (0, exports.generateOverrideError)('getInfoForIntentsByContext', 'handleInfoForIntentsByContext'),
|
|
44
|
-
joinSessionContextGroupWithJoinContextGroup: 'The Context Group you have tried to join is a Session Context Group. Custom Context Groups can only be defined by the Interop Broker through code or manifest configuration. Please use joinSessionContextGroup.',
|
|
45
|
-
fdc3Open: (0, exports.generateOverrideError)('fdc3.open', 'fdc3HandleOpen'),
|
|
46
|
-
fdc3FindInstances: (0, exports.generateOverrideError)('fdc3.findInstances', 'fdc3HandleFindInstances'),
|
|
47
|
-
fdc3GetAppMetadata: (0, exports.generateOverrideError)('fdc3.getAppMetadata', 'fdc3HandleGetAppMetadata'),
|
|
48
|
-
fdc3GetInfo: (0, exports.generateOverrideError)('fdc3.getInfo', 'fdc3HandleGetInfo')
|
|
49
|
-
};
|
|
50
|
-
const wrapIntentHandler = (handler, handlerId) => {
|
|
51
|
-
return async (intent) => {
|
|
52
|
-
try {
|
|
53
|
-
return handler(intent);
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
console.error(`Error thrown by handler ${handlerId}: ${error}`);
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
exports.wrapIntentHandler = wrapIntentHandler;
|
package/src/api/me.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type * as OpenFin from '../OpenFin';
|
|
2
|
-
import type { Transport } from '../transport/transport';
|
|
3
|
-
import type { InteropClient } from './interop';
|
|
4
|
-
export declare const environmentUnsupportedMessage = "You are not running in OpenFin.";
|
|
5
|
-
type EntityType = OpenFin.EntityType;
|
|
6
|
-
export type EntityTypeHelpers<T extends EntityType> = T extends 'view' ? {
|
|
7
|
-
isView: true;
|
|
8
|
-
isWindow: false;
|
|
9
|
-
isExternal: false;
|
|
10
|
-
isFrame: false;
|
|
11
|
-
} : T extends 'window' ? {
|
|
12
|
-
isView: false;
|
|
13
|
-
isWindow: true;
|
|
14
|
-
isExternal: false;
|
|
15
|
-
isFrame: false;
|
|
16
|
-
} : T extends 'iframe' ? {
|
|
17
|
-
isView: false;
|
|
18
|
-
isWindow: false;
|
|
19
|
-
isExternal: false;
|
|
20
|
-
isFrame: true;
|
|
21
|
-
} : T extends 'external connection' ? {
|
|
22
|
-
isView: false;
|
|
23
|
-
isWindow: false;
|
|
24
|
-
isExternal: true;
|
|
25
|
-
isFrame: false;
|
|
26
|
-
} : T extends 'unknown' ? {
|
|
27
|
-
isView: false;
|
|
28
|
-
isWindow: false;
|
|
29
|
-
isExternal: false;
|
|
30
|
-
isFrame: false;
|
|
31
|
-
} : never;
|
|
32
|
-
export declare function getBaseMe<T extends EntityType = EntityType>(entityType: T, uuid: string, name: string): OpenFin.EntityInfo & EntityTypeHelpers<T>;
|
|
33
|
-
export interface WithInterop {
|
|
34
|
-
interop: InteropClient;
|
|
35
|
-
}
|
|
36
|
-
export type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType extends 'view' ? EntityTypeHelpers<'view'> & OpenFin.View & WithInterop : MeType extends 'window' ? EntityTypeHelpers<'window'> & OpenFin.Window & WithInterop : MeType extends 'iframe' ? EntityTypeHelpers<'iframe'> & OpenFin.Frame & WithInterop : MeType extends 'external connection' ? EntityTypeHelpers<'external connection'> & OpenFin.ExternalApplication & WithInterop : EntityTypeHelpers<MeType> & WithInterop) & {
|
|
37
|
-
isOpenFin: boolean;
|
|
38
|
-
};
|
|
39
|
-
export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;
|
|
40
|
-
export {};
|
package/src/api/me.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getMe = exports.getBaseMe = exports.environmentUnsupportedMessage = void 0;
|
|
4
|
-
const view_1 = require("./view");
|
|
5
|
-
const frame_1 = require("./frame");
|
|
6
|
-
const window_1 = require("./window");
|
|
7
|
-
const external_application_1 = require("./external-application");
|
|
8
|
-
exports.environmentUnsupportedMessage = 'You are not running in OpenFin.';
|
|
9
|
-
function getBaseMe(entityType, uuid, name) {
|
|
10
|
-
const entityTypeHelpers = {
|
|
11
|
-
isView: entityType === 'view',
|
|
12
|
-
isWindow: entityType === 'window',
|
|
13
|
-
isFrame: entityType === 'iframe',
|
|
14
|
-
isExternal: entityType === 'external connection'
|
|
15
|
-
};
|
|
16
|
-
return { ...entityTypeHelpers, uuid, name, entityType };
|
|
17
|
-
}
|
|
18
|
-
exports.getBaseMe = getBaseMe;
|
|
19
|
-
// We need to do a lot of casting as unknown here because the compiler get's confused about matching types. What matters is that it works on the outside
|
|
20
|
-
function getMe(wire) {
|
|
21
|
-
const { uuid, name, entityType } = wire.me;
|
|
22
|
-
const unsupportedInterop = {
|
|
23
|
-
setContext() {
|
|
24
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
25
|
-
},
|
|
26
|
-
addContextHandler() {
|
|
27
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
28
|
-
},
|
|
29
|
-
getContextGroups() {
|
|
30
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
31
|
-
},
|
|
32
|
-
joinContextGroup() {
|
|
33
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
34
|
-
},
|
|
35
|
-
removeFromContextGroup() {
|
|
36
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
37
|
-
},
|
|
38
|
-
getAllClientsInContextGroup() {
|
|
39
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
40
|
-
},
|
|
41
|
-
getInfoForContextGroup() {
|
|
42
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const fallbackErrorMessage = 'Interop API has not been instantiated. Either connection has failed or you have not declared interop in your config.';
|
|
46
|
-
const fallbackInterop = {
|
|
47
|
-
setContext() {
|
|
48
|
-
throw new Error(fallbackErrorMessage);
|
|
49
|
-
},
|
|
50
|
-
addContextHandler() {
|
|
51
|
-
throw new Error(fallbackErrorMessage);
|
|
52
|
-
},
|
|
53
|
-
getContextGroups() {
|
|
54
|
-
throw new Error(fallbackErrorMessage);
|
|
55
|
-
},
|
|
56
|
-
joinContextGroup() {
|
|
57
|
-
throw new Error(fallbackErrorMessage);
|
|
58
|
-
},
|
|
59
|
-
removeFromContextGroup() {
|
|
60
|
-
throw new Error(fallbackErrorMessage);
|
|
61
|
-
},
|
|
62
|
-
getAllClientsInContextGroup() {
|
|
63
|
-
throw new Error(fallbackErrorMessage);
|
|
64
|
-
},
|
|
65
|
-
getInfoForContextGroup() {
|
|
66
|
-
throw new Error(fallbackErrorMessage);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
const unsupportedEventBase = {
|
|
70
|
-
eventNames: () => {
|
|
71
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
72
|
-
},
|
|
73
|
-
emit: () => {
|
|
74
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
75
|
-
},
|
|
76
|
-
listeners: () => {
|
|
77
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
78
|
-
},
|
|
79
|
-
listenerCount: () => {
|
|
80
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
81
|
-
},
|
|
82
|
-
on: () => {
|
|
83
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
84
|
-
},
|
|
85
|
-
addListener: () => {
|
|
86
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
87
|
-
},
|
|
88
|
-
once: () => {
|
|
89
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
90
|
-
},
|
|
91
|
-
prependListener: () => {
|
|
92
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
93
|
-
},
|
|
94
|
-
prependOnceListener: () => {
|
|
95
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
96
|
-
},
|
|
97
|
-
removeListener: () => {
|
|
98
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
99
|
-
},
|
|
100
|
-
removeAllListeners: () => {
|
|
101
|
-
throw new Error(exports.environmentUnsupportedMessage);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
switch (entityType) {
|
|
105
|
-
case 'view':
|
|
106
|
-
return Object.assign(new view_1.View(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
|
|
107
|
-
interop: fallbackInterop,
|
|
108
|
-
isOpenFin: true
|
|
109
|
-
});
|
|
110
|
-
case 'window':
|
|
111
|
-
return Object.assign(new window_1._Window(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
|
|
112
|
-
interop: fallbackInterop,
|
|
113
|
-
isOpenFin: true
|
|
114
|
-
});
|
|
115
|
-
case 'iframe':
|
|
116
|
-
return Object.assign(new frame_1._Frame(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
|
|
117
|
-
interop: fallbackInterop,
|
|
118
|
-
isOpenFin: true
|
|
119
|
-
});
|
|
120
|
-
case 'external connection':
|
|
121
|
-
return Object.assign(new external_application_1.ExternalApplication(wire, { uuid }), getBaseMe(entityType, uuid, name), {
|
|
122
|
-
interop: fallbackInterop,
|
|
123
|
-
isOpenFin: false
|
|
124
|
-
});
|
|
125
|
-
default:
|
|
126
|
-
return {
|
|
127
|
-
...getBaseMe(entityType, uuid, name),
|
|
128
|
-
...unsupportedEventBase,
|
|
129
|
-
interop: unsupportedInterop,
|
|
130
|
-
isOpenFin: false
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.getMe = getMe;
|