@openfin/core 30.73.28 → 31.74.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -0
- package/package.json +2 -2
- package/src/OpenFin.d.ts +1929 -407
- package/src/OpenFin.js +0 -2
- package/src/api/api-exposer/api-consumer.d.ts +28 -0
- package/src/api/api-exposer/api-consumer.js +28 -0
- package/src/api/api-exposer/api-exposer.d.ts +35 -0
- package/src/api/api-exposer/api-exposer.js +38 -0
- package/src/api/api-exposer/decorators.d.ts +10 -0
- package/src/api/api-exposer/decorators.js +18 -0
- package/src/api/api-exposer/index.d.ts +4 -0
- package/src/api/api-exposer/index.js +20 -0
- package/src/api/api-exposer/strategies/index.d.ts +1 -0
- package/src/api/api-exposer/strategies/index.js +17 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
- package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
- package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
- package/src/api/application/Factory.d.ts +1 -0
- package/src/api/application/Factory.js +2 -2
- package/src/api/application/Instance.d.ts +2 -1
- package/src/api/application/Instance.js +1 -0
- package/src/api/base.d.ts +4 -4
- package/src/api/clipboard/index.d.ts +1 -0
- package/src/api/clipboard/index.js +1 -0
- package/src/api/events/application.d.ts +22 -22
- package/src/api/events/base.d.ts +6 -9
- package/src/api/events/channel.d.ts +5 -5
- package/src/api/events/emitterMap.d.ts +1 -1
- package/src/api/events/externalApplication.d.ts +3 -3
- package/src/api/events/frame.d.ts +5 -5
- package/src/api/events/globalHotkey.d.ts +3 -3
- package/src/api/events/platform.d.ts +6 -7
- package/src/api/events/system.d.ts +20 -21
- package/src/api/events/typedEventEmitter.d.ts +1 -1
- package/src/api/events/view.d.ts +17 -14
- package/src/api/events/webcontents.d.ts +40 -18
- package/src/api/events/window.d.ts +65 -57
- package/src/api/external-application/Instance.d.ts +1 -1
- package/src/api/fin.d.ts +2 -2
- package/src/api/frame/Instance.d.ts +2 -2
- package/src/api/global-hotkey/index.d.ts +1 -1
- package/src/api/interappbus/channel/channel.d.ts +5 -5
- package/src/api/interappbus/channel/channel.js +3 -3
- package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
- package/src/api/interappbus/channel/channels-docs.js +7 -0
- package/src/api/interappbus/channel/client.d.ts +5 -4
- package/src/api/interappbus/channel/client.js +24 -17
- package/src/api/interappbus/channel/connection-manager.d.ts +2 -2
- package/src/api/interappbus/channel/connection-manager.js +12 -12
- package/src/api/interappbus/channel/index.d.ts +3 -3
- package/src/api/interappbus/channel/index.js +6 -8
- package/src/api/interappbus/channel/protocols/classic/message-receiver.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +2 -2
- package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +2 -2
- package/src/api/interappbus/channel/protocols/combined/strategy.js +5 -5
- package/src/api/interappbus/channel/protocols/index.d.ts +7 -4
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
- package/src/api/interappbus/channel/protocols/rtc/ice-manager.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
- package/src/api/interappbus/channel/protocols/strategy-types.d.ts +4 -4
- package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -3
- package/src/api/interappbus/channel/provider.d.ts +6 -6
- package/src/api/interappbus/channel/provider.js +24 -24
- package/src/api/interappbus/index.d.ts +1 -1
- package/src/api/interop/Factory.d.ts +1 -2
- package/src/api/interop/Factory.js +20 -4
- package/src/api/interop/InteropBroker.d.ts +16 -48
- package/src/api/interop/InteropBroker.js +38 -48
- package/src/api/interop/InteropClient.d.ts +10 -9
- package/src/api/interop/InteropClient.js +9 -8
- package/src/api/interop/SessionContextGroupClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +2 -1
- package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
- package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
- package/src/api/interop/fdc3/fdc3-1.2.js +27 -12
- package/src/api/interop/fdc3/fdc3-2.0.d.ts +13 -12
- package/src/api/interop/fdc3/fdc3-2.0.js +33 -26
- package/src/api/interop/fdc3/fdc3.d.ts +4 -5
- package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
- package/src/api/interop/fdc3/overrideCheck.js +32 -0
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +3 -3
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +5 -5
- package/src/api/interop/fdc3/utils.d.ts +17 -0
- package/src/api/interop/fdc3/utils.js +52 -18
- package/src/api/interop/fdc3/versions.d.ts +1 -0
- package/src/api/interop/fdc3/versions.js +2 -0
- package/src/api/interop/utils.d.ts +0 -1
- package/src/api/interop/utils.js +1 -9
- package/src/api/me.d.ts +4 -4
- package/src/api/platform/Factory.d.ts +6 -1
- package/src/api/platform/Factory.js +10 -9
- package/src/api/platform/Instance.d.ts +5 -3
- package/src/api/platform/Instance.js +5 -3
- package/src/api/platform/common-utils.d.ts +1 -1
- package/src/api/platform/layout/Factory.d.ts +5 -1
- package/src/api/platform/layout/Factory.js +15 -3
- package/src/api/platform/layout/Instance.d.ts +10 -4
- package/src/api/platform/layout/Instance.js +26 -1
- package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
- package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
- package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
- package/src/api/platform/layout/controllers/splitter-controller.d.ts +1 -1
- package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
- package/src/api/platform/layout/entities/layout-entities.js +216 -0
- package/src/api/platform/layout/entities/shapes.d.ts +6 -0
- package/src/api/platform/layout/entities/shapes.js +2 -0
- package/src/api/platform/layout/layout.constants.d.ts +1 -0
- package/src/api/platform/layout/layout.constants.js +4 -0
- package/src/api/platform/layout/shapes.d.ts +4 -1
- package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
- package/src/api/platform/layout/utils/layout-traversal.js +65 -0
- package/src/api/platform/layout/utils/view-overlay.d.ts +1 -1
- package/src/api/platform/provider.d.ts +162 -0
- package/src/api/platform/provider.js +2 -0
- package/src/api/snapshot-source/Factory.d.ts +1 -0
- package/src/api/snapshot-source/Factory.js +1 -0
- package/src/api/snapshot-source/Instance.d.ts +1 -1
- package/src/api/system/index.d.ts +14 -484
- package/src/api/system/index.js +6 -476
- package/src/api/view/Instance.d.ts +20 -6
- package/src/api/view/Instance.js +48 -8
- package/src/api/webcontents/main.d.ts +18 -4
- package/src/api/window/Instance.d.ts +21 -1
- package/src/api/window/Instance.js +20 -0
- package/src/browser.js +1 -1
- package/src/environment/browser.d.ts +1 -1
- package/src/environment/environment.d.ts +1 -1
- package/src/environment/node-env.d.ts +1 -1
- package/src/environment/openfin-env.d.ts +1 -1
- package/src/mock.d.ts +1 -1
- package/src/mock.js +6 -3
- package/src/namespaces.d.ts +21 -0
- package/src/namespaces.js +24 -0
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -1
- package/src/shapes/protocol.d.ts +3 -3
- package/src/transport/fin_store.d.ts +1 -1
- package/src/transport/transport-errors.d.ts +7 -2
- package/src/transport/transport-errors.js +1 -2
- package/src/transport/transport.d.ts +11 -8
- package/src/transport/transport.js +12 -6
- package/src/transport/wire.d.ts +14 -13
- package/src/util/channel-api-relay.d.ts +13 -0
- package/src/util/channel-api-relay.js +37 -0
- package/src/util/errors.d.ts +2 -2
- package/src/util/http.js +4 -2
- package/src/util/inaccessibleObject.d.ts +2 -0
- package/src/util/inaccessibleObject.js +49 -0
- package/src/util/lazy.d.ts +16 -0
- package/src/util/lazy.js +26 -0
- package/src/util/promises.d.ts +1 -1
- package/src/util/reversible-map.d.ts +11 -0
- package/src/util/reversible-map.js +49 -0
- package/src/util/utilTypes.d.ts +1 -1
package/src/OpenFin.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ExposedProp } from "./decorators";
|
|
2
|
+
export type ConsumeStrategy<TMetaConsumeOptions, TPropConsumeDefinition> = {
|
|
3
|
+
getExposedFunctions: (options: TMetaConsumeOptions) => Promise<ExposedProp<TPropConsumeDefinition>[]>;
|
|
4
|
+
createFunction: (options: ExposedProp<TPropConsumeDefinition>, meta: TMetaConsumeOptions) => Function;
|
|
5
|
+
};
|
|
6
|
+
type PickOfType<T extends Record<any, any>, TTarget> = {
|
|
7
|
+
[key in keyof T as T[key] extends TTarget | undefined ? key : never]: T[key];
|
|
8
|
+
};
|
|
9
|
+
export type ApiClient<T extends Record<any, any>> = {
|
|
10
|
+
[key in keyof PickOfType<T, Function>]: (...args: Parameters<T[key]>) => ReturnType<T[key]> extends Promise<any> ? ReturnType<T[key]> : Promise<ReturnType<T[key]>>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Consumer for apis exposed with {@see ApiExposer}.
|
|
14
|
+
*
|
|
15
|
+
* A strategy that matches the strategy used to expose a target API must be provided.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ApiConsumer<TMetaConsumeOptions = any, TPropConsumptionOptions = any> {
|
|
18
|
+
private strategy;
|
|
19
|
+
constructor(strategy: ConsumeStrategy<TMetaConsumeOptions, TPropConsumptionOptions>);
|
|
20
|
+
/**
|
|
21
|
+
* Consumes an api exposed using a given transport strategy, and generates a client
|
|
22
|
+
* for easy, type safe consumption of that client.
|
|
23
|
+
* @param options Strategy specific consumption options.
|
|
24
|
+
* @returns An api client matching the given type.
|
|
25
|
+
*/
|
|
26
|
+
consume: <T extends Record<any, any>>(options: TMetaConsumeOptions) => Promise<ApiClient<T>>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiConsumer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Consumer for apis exposed with {@see ApiExposer}.
|
|
6
|
+
*
|
|
7
|
+
* A strategy that matches the strategy used to expose a target API must be provided.
|
|
8
|
+
*/
|
|
9
|
+
class ApiConsumer {
|
|
10
|
+
// eslint-disable-next-line
|
|
11
|
+
constructor(strategy) {
|
|
12
|
+
this.strategy = strategy;
|
|
13
|
+
/**
|
|
14
|
+
* Consumes an api exposed using a given transport strategy, and generates a client
|
|
15
|
+
* for easy, type safe consumption of that client.
|
|
16
|
+
* @param options Strategy specific consumption options.
|
|
17
|
+
* @returns An api client matching the given type.
|
|
18
|
+
*/
|
|
19
|
+
this.consume = async (options) => {
|
|
20
|
+
const exposedProperties = await this.strategy.getExposedFunctions(options);
|
|
21
|
+
return exposedProperties.reduce((client, prop) => ({
|
|
22
|
+
...client,
|
|
23
|
+
[prop.key]: this.strategy.createFunction(prop, options)
|
|
24
|
+
}), {});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ApiConsumer = ApiConsumer;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ExposedProp } from './decorators';
|
|
2
|
+
export type ConsumptionConfig<T> = {
|
|
3
|
+
key: string;
|
|
4
|
+
options: T;
|
|
5
|
+
};
|
|
6
|
+
export type ExposeStrategy<TInstanceExposeOptions, TPropExposeOptions, TPropConsumeOptions> = {
|
|
7
|
+
/**
|
|
8
|
+
* Exposes the given function on the strategy.
|
|
9
|
+
*/
|
|
10
|
+
exposeFunction: (target: Function, config: {
|
|
11
|
+
key: string;
|
|
12
|
+
options: TPropExposeOptions;
|
|
13
|
+
meta: TInstanceExposeOptions;
|
|
14
|
+
}) => Promise<TPropConsumeOptions>;
|
|
15
|
+
/**
|
|
16
|
+
* Exposes metadata to enable creation of client objects.
|
|
17
|
+
*/
|
|
18
|
+
exposeMeta: (instanceOptions: TInstanceExposeOptions, props: ExposedProp<TPropConsumeOptions>[]) => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Exposes api services on the transport of choice.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ApiExposer<TInstanceExposeOptions = any, TPropExposeOptions = any, TPropConsumptionOptions = any> {
|
|
24
|
+
private strategy;
|
|
25
|
+
/**
|
|
26
|
+
* @param strategy The expose strategy to use to expose instances.
|
|
27
|
+
*/
|
|
28
|
+
constructor(strategy: ExposeStrategy<TInstanceExposeOptions, TPropExposeOptions, TPropConsumptionOptions>);
|
|
29
|
+
/**
|
|
30
|
+
* Exposes an instance of a given api on
|
|
31
|
+
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
|
32
|
+
* @param instanceOptions Transport strategy specific options to use when exposing.
|
|
33
|
+
*/
|
|
34
|
+
exposeInstance: (instance: Record<any, any>, instanceOptions: TInstanceExposeOptions) => Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiExposer = void 0;
|
|
4
|
+
const decorators_1 = require("./decorators");
|
|
5
|
+
/**
|
|
6
|
+
* Exposes api services on the transport of choice.
|
|
7
|
+
*/
|
|
8
|
+
class ApiExposer {
|
|
9
|
+
/**
|
|
10
|
+
* @param strategy The expose strategy to use to expose instances.
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line
|
|
13
|
+
constructor(strategy) {
|
|
14
|
+
this.strategy = strategy;
|
|
15
|
+
/**
|
|
16
|
+
* Exposes an instance of a given api on
|
|
17
|
+
* @param instance Instance of a class which has been decorated to indicate which functions can be exposed.
|
|
18
|
+
* @param instanceOptions Transport strategy specific options to use when exposing.
|
|
19
|
+
*/
|
|
20
|
+
this.exposeInstance = async (instance, instanceOptions) => {
|
|
21
|
+
const exposableProps = (0, decorators_1.getExposedProperties)(instance);
|
|
22
|
+
const exposedProps = await Promise.all(exposableProps.map(async ({ key, options }) => {
|
|
23
|
+
const customConsumptionOptions = await this.strategy.exposeFunction(instance[key].bind(instance), {
|
|
24
|
+
key,
|
|
25
|
+
options,
|
|
26
|
+
meta: instanceOptions
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
key,
|
|
30
|
+
options: customConsumptionOptions
|
|
31
|
+
};
|
|
32
|
+
}));
|
|
33
|
+
await this.strategy.exposeMeta(instanceOptions, exposedProps);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
;
|
|
37
|
+
}
|
|
38
|
+
exports.ApiExposer = ApiExposer;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ExposedProp<T> = {
|
|
2
|
+
key: string;
|
|
3
|
+
options: T;
|
|
4
|
+
};
|
|
5
|
+
export declare const getExposedProperties: <T>(target: Record<any, any>) => ExposedProp<T>[];
|
|
6
|
+
/**
|
|
7
|
+
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
|
8
|
+
* @param options Options specific to the strategy used in {@link ApiExposer}
|
|
9
|
+
*/
|
|
10
|
+
export declare const expose: <T = undefined>(options?: T) => any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expose = exports.getExposedProperties = void 0;
|
|
4
|
+
const exposedProperties = Symbol('exposedProperties');
|
|
5
|
+
const getExposedProperties = (target) => {
|
|
6
|
+
return target[exposedProperties] || target.prototype[exposedProperties] || [];
|
|
7
|
+
};
|
|
8
|
+
exports.getExposedProperties = getExposedProperties;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates that a class member function can be exposed using {@link ApiExposer}.
|
|
11
|
+
* @param options Options specific to the strategy used in {@link ApiExposer}
|
|
12
|
+
*/
|
|
13
|
+
// Returns any as decorator typing is weird.
|
|
14
|
+
const expose = (options) => (target, key, descriptor) => {
|
|
15
|
+
target[exposedProperties] = target[exposedProperties] || [];
|
|
16
|
+
target[exposedProperties].push({ key, descriptor, options });
|
|
17
|
+
};
|
|
18
|
+
exports.expose = expose;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-consumer"), exports);
|
|
18
|
+
__exportStar(require("./api-exposer"), exports);
|
|
19
|
+
__exportStar(require("./strategies"), exports);
|
|
20
|
+
__exportStar(require("./decorators"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './openfin-channels';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./openfin-channels"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConsumeStrategy } from "../../api-consumer";
|
|
2
|
+
import { ExposedProp } from "../../decorators";
|
|
3
|
+
export type ChannelConsumeOptions = {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
export type ChannelsPropConfig = {
|
|
7
|
+
action: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class ChannelsConsumer implements ConsumeStrategy<ChannelConsumeOptions, ChannelsPropConfig> {
|
|
10
|
+
private channel;
|
|
11
|
+
constructor(channel: any);
|
|
12
|
+
getExposedFunctions: (options: ChannelConsumeOptions) => Promise<ExposedProp<ChannelsPropConfig>[]>;
|
|
13
|
+
createFunction: (prop: ExposedProp<ChannelsPropConfig>) => Function;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelsConsumer = void 0;
|
|
4
|
+
class ChannelsConsumer {
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
constructor(channel) {
|
|
7
|
+
this.channel = channel;
|
|
8
|
+
this.getExposedFunctions = async (options) => {
|
|
9
|
+
const { id } = options;
|
|
10
|
+
const { props } = await this.channel.dispatch(`api-meta:${id}`);
|
|
11
|
+
return props;
|
|
12
|
+
};
|
|
13
|
+
this.createFunction = (prop) => (...args) => {
|
|
14
|
+
const { action } = prop.options;
|
|
15
|
+
return this.channel.dispatch(action, { args });
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
;
|
|
19
|
+
}
|
|
20
|
+
exports.ChannelsConsumer = ChannelsConsumer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExposeStrategy } from '../../api-exposer';
|
|
2
|
+
import { ExposedProp } from '../../decorators';
|
|
3
|
+
import { ChannelsPropConfig } from './channels-consumer';
|
|
4
|
+
type ChannelInstanceExposeOptions = {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
export type ChannelsPropOptions = {
|
|
8
|
+
action?: string;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare class ChannelsExposer implements ExposeStrategy<ChannelInstanceExposeOptions, ChannelsPropOptions, ChannelsPropConfig> {
|
|
11
|
+
private channelProviderOrClient;
|
|
12
|
+
constructor(channelProviderOrClient: any);
|
|
13
|
+
exposeFunction: (target: Function, config: {
|
|
14
|
+
key: string;
|
|
15
|
+
options: ChannelsPropOptions;
|
|
16
|
+
meta: ChannelInstanceExposeOptions;
|
|
17
|
+
}) => Promise<ChannelsPropConfig>;
|
|
18
|
+
exposeMeta: ({ id }: ChannelInstanceExposeOptions, props: ExposedProp<ChannelsPropOptions>[]) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelsExposer = void 0;
|
|
4
|
+
class ChannelsExposer {
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
constructor(channelProviderOrClient) {
|
|
7
|
+
this.channelProviderOrClient = channelProviderOrClient;
|
|
8
|
+
this.exposeFunction = async (target, config) => {
|
|
9
|
+
const { key, options, meta } = config;
|
|
10
|
+
const { id } = meta;
|
|
11
|
+
const action = `${id}.${(options === null || options === void 0 ? void 0 : options.action) || key}`;
|
|
12
|
+
await this.channelProviderOrClient.register(action, async ({ args }) => {
|
|
13
|
+
return target(...args);
|
|
14
|
+
});
|
|
15
|
+
return { action };
|
|
16
|
+
};
|
|
17
|
+
this.exposeMeta = async ({ id }, props) => {
|
|
18
|
+
const action = `api-meta:${id}`;
|
|
19
|
+
await this.channelProviderOrClient.register(action, () => ({ props }));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ChannelsExposer = ChannelsExposer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./channels-consumer"), exports);
|
|
18
|
+
__exportStar(require("./channels-exposer"), exports);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { Base } from '../base';
|
|
3
3
|
/**
|
|
4
|
+
* @PORTED
|
|
4
5
|
* @typedef {object} ApplicationOptions
|
|
5
6
|
* @summary Application creation options.
|
|
6
7
|
* @desc This is the options object required by {@link Application.start Application.start}.
|
|
@@ -4,6 +4,7 @@ const base_1 = require("../base");
|
|
|
4
4
|
const validate_1 = require("../../util/validate");
|
|
5
5
|
const Instance_1 = require("./Instance");
|
|
6
6
|
/**
|
|
7
|
+
* @PORTED
|
|
7
8
|
* @typedef {object} ApplicationOptions
|
|
8
9
|
* @summary Application creation options.
|
|
9
10
|
* @desc This is the options object required by {@link Application.start Application.start}.
|
|
@@ -202,8 +203,7 @@ class ApplicationModule extends base_1.Base {
|
|
|
202
203
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
203
204
|
});
|
|
204
205
|
const app = await this._createFromManifest(manifestUrl);
|
|
205
|
-
//
|
|
206
|
-
// @ts-ignore using private method without warning.
|
|
206
|
+
// @ts-expect-error using private method without warning.
|
|
207
207
|
await app._run(opts); // eslint-disable-line no-underscore-dangle
|
|
208
208
|
return app;
|
|
209
209
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
|
-
import Transport from '../../transport/transport';
|
|
3
|
+
import { Transport } from '../../transport/transport';
|
|
4
4
|
/**
|
|
5
5
|
* @classdesc An object representing an application. Allows the developer to create,
|
|
6
6
|
* execute, show/close an application as well as listen to <a href="tutorial-Application.EventEmitter.html">application events</a>.
|
|
@@ -102,6 +102,7 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
|
|
|
102
102
|
* @property { JumpListItem[] } items Array of JumpListItem objects
|
|
103
103
|
*/
|
|
104
104
|
/**
|
|
105
|
+
* @PORTED
|
|
105
106
|
* JumpListItem interface
|
|
106
107
|
* @typedef { object } JumpListItem
|
|
107
108
|
* @property { string } type One of the following: "task" or "separator". Defaults to task.
|
|
@@ -119,6 +119,7 @@ class Application extends base_1.EmitterBase {
|
|
|
119
119
|
* @property { JumpListItem[] } items Array of JumpListItem objects
|
|
120
120
|
*/
|
|
121
121
|
/**
|
|
122
|
+
* @PORTED
|
|
122
123
|
* JumpListItem interface
|
|
123
124
|
* @typedef { object } JumpListItem
|
|
124
125
|
* @property { string } type One of the following: "task" or "separator". Defaults to task.
|
package/src/api/base.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
|
-
import Transport from '../transport/transport';
|
|
3
|
+
import { Transport } from '../transport/transport';
|
|
4
4
|
import type * as OpenFin from '../OpenFin';
|
|
5
5
|
import Fin from './fin';
|
|
6
6
|
import { BaseEvent, EventHandler } from './events/base';
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type ApplicationIdentity = OpenFin.ApplicationIdentity;
|
|
8
|
+
type Identity = OpenFin.Identity;
|
|
9
9
|
export declare class Base {
|
|
10
10
|
wire: Transport;
|
|
11
11
|
constructor(wire: Transport);
|
|
@@ -31,7 +31,7 @@ export declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventTyp
|
|
|
31
31
|
protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
|
|
32
32
|
protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
|
|
33
33
|
on<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
34
|
-
addListener: <EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions) => Promise<this>;
|
|
34
|
+
addListener: <EventType extends EmitterEventType>(eventType: EventType, listener: OpenFin.BaseEvents.EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions) => Promise<this>;
|
|
35
35
|
once<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
36
36
|
prependListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
37
37
|
prependOnceListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
|
|
@@ -2,7 +2,7 @@ import type * as OpenFin from '../../OpenFin';
|
|
|
2
2
|
import { IdentityEvent, NamedEvent, PropagatedEvent } from './base';
|
|
3
3
|
import { PropagatedWindowEvent } from './window';
|
|
4
4
|
import { PropagatedViewEvent } from './view';
|
|
5
|
-
export
|
|
5
|
+
export type CrashedEvent = NamedEvent & {
|
|
6
6
|
type: 'crashed';
|
|
7
7
|
reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
|
|
8
8
|
exitCode: number;
|
|
@@ -11,12 +11,12 @@ export declare type CrashedEvent = NamedEvent & {
|
|
|
11
11
|
exitCode: number;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type RunRequestedEvent = IdentityEvent & {
|
|
15
15
|
type: 'run-requested';
|
|
16
16
|
userAppConfigArgs: Record<string, any>;
|
|
17
17
|
manifest: OpenFin.ManifestInfo;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type TrayIconClickedEvent = IdentityEvent & {
|
|
20
20
|
type: 'tray-icon-clicked';
|
|
21
21
|
button: 0 | 1 | 2;
|
|
22
22
|
bounds: OpenFin.Rectangle;
|
|
@@ -24,56 +24,56 @@ export declare type TrayIconClickedEvent = IdentityEvent & {
|
|
|
24
24
|
y: number;
|
|
25
25
|
monitorInfo: any;
|
|
26
26
|
};
|
|
27
|
-
export
|
|
27
|
+
export type WindowAlertRequestedEvent = NamedEvent & {
|
|
28
28
|
type: 'window-alert-requested';
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type WindowCreatedEvent = NamedEvent & {
|
|
31
31
|
type: 'window-created';
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type WindowEndLoadEvent = NamedEvent & {
|
|
34
34
|
type: 'window-end-load';
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type WindowNotRespondingEvent = NamedEvent & {
|
|
37
37
|
type: 'window-not-responding';
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type WindowRespondingEvent = NamedEvent & {
|
|
40
40
|
type: 'window-responding';
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type WindowStartLoadEvent = NamedEvent & {
|
|
43
43
|
type: 'window-start-load';
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
46
|
* A Window event that is natively published at the Application level (not Window).
|
|
47
47
|
*/
|
|
48
|
-
export
|
|
49
|
-
export
|
|
48
|
+
export type ApplicationWindowEvent = WindowAlertRequestedEvent | WindowCreatedEvent | WindowEndLoadEvent | WindowNotRespondingEvent | WindowRespondingEvent | WindowStartLoadEvent;
|
|
49
|
+
export type ClosedEvent = IdentityEvent & {
|
|
50
50
|
type: 'closed';
|
|
51
51
|
};
|
|
52
|
-
export
|
|
52
|
+
export type ApplicationConnectedEvent = IdentityEvent & {
|
|
53
53
|
type: 'connected';
|
|
54
54
|
};
|
|
55
|
-
export
|
|
55
|
+
export type InitializedEvent = IdentityEvent & {
|
|
56
56
|
type: 'initialized';
|
|
57
57
|
};
|
|
58
|
-
export
|
|
58
|
+
export type ManifestChangedEvent = IdentityEvent & {
|
|
59
59
|
type: 'manifest-changed';
|
|
60
60
|
};
|
|
61
|
-
export
|
|
61
|
+
export type NotRespondingEvent = IdentityEvent & {
|
|
62
62
|
type: 'not-responding';
|
|
63
63
|
};
|
|
64
|
-
export
|
|
64
|
+
export type RespondingEvent = IdentityEvent & {
|
|
65
65
|
type: 'responding';
|
|
66
66
|
};
|
|
67
|
-
export
|
|
67
|
+
export type StartedEvent = IdentityEvent & {
|
|
68
68
|
type: 'started';
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* An Application event that does propagate to (republish on) parent topics.
|
|
72
72
|
*/
|
|
73
|
-
export
|
|
74
|
-
export
|
|
73
|
+
export type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent;
|
|
74
|
+
export type ApplicationEvent = {
|
|
75
75
|
topic: 'application';
|
|
76
76
|
} & (PropagatedViewEvent | PropagatedWindowEvent | ApplicationWindowEvent | WillPropagateApplicationEvent);
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
export
|
|
77
|
+
export type ApplicationEventType = ApplicationEvent['type'];
|
|
78
|
+
export type PropagatedApplicationEvent = PropagatedEvent<'application', WillPropagateApplicationEvent> | ApplicationWindowEvent;
|
|
79
|
+
export type PropagatedApplicationEventType = PropagatedApplicationEvent['type'];
|
package/src/api/events/base.d.ts
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
import type * as OpenFin from '../../OpenFin';
|
|
2
1
|
/**
|
|
3
2
|
* Modifies an event key to reflect propagation by prefixing with the topic.
|
|
4
3
|
*/
|
|
5
|
-
export
|
|
4
|
+
export type PropagatedEventType<Topic extends string, Type extends string> = `${Topic}-${Type}`;
|
|
6
5
|
/**
|
|
7
6
|
* Modifies an event shape to reflect propagation to a parent topic. The 'type' field
|
|
8
7
|
* is prefixed with the original topic, and a new property is added with the original topic's identity.
|
|
9
8
|
*/
|
|
10
|
-
export
|
|
9
|
+
export type PropagatedEvent<Topic extends string, Event extends {
|
|
11
10
|
type: string;
|
|
12
11
|
}> = Event extends infer E extends {
|
|
13
12
|
type: string;
|
|
14
13
|
} ? Omit<E, 'type'> & {
|
|
15
14
|
type: PropagatedEventType<Topic, E['type']>;
|
|
16
|
-
} & {
|
|
17
|
-
[topic in `${Topic}Identity`]: OpenFin.Identity;
|
|
18
15
|
} : never;
|
|
19
16
|
/**
|
|
20
17
|
* Handler for an event on an EventEmitter; selects the correct type for the event
|
|
21
18
|
* payload from the provided union based on the provided string literal type.
|
|
22
19
|
*/
|
|
23
|
-
export
|
|
20
|
+
export type EventHandler<EmitterEvent extends BaseEvent, EventType extends string> = (payload: Extract<EmitterEvent, {
|
|
24
21
|
type: EventType;
|
|
25
22
|
}>, ...args: any[]) => void;
|
|
26
|
-
export
|
|
23
|
+
export type BaseEvent = {
|
|
27
24
|
topic: string;
|
|
28
25
|
type: string;
|
|
29
26
|
};
|
|
30
|
-
export
|
|
27
|
+
export type IdentityEvent = BaseEvent & {
|
|
31
28
|
uuid: string;
|
|
32
29
|
};
|
|
33
|
-
export
|
|
30
|
+
export type NamedEvent = IdentityEvent & {
|
|
34
31
|
name: string;
|
|
35
32
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { NamedEvent } from './base';
|
|
2
|
-
export
|
|
2
|
+
export type BaseChannelEvent = NamedEvent & {
|
|
3
3
|
channelName: string;
|
|
4
4
|
channelId: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type ChannelConnectedEvent = BaseChannelEvent & {
|
|
7
7
|
type: 'connected';
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type ChannelDisconnectedEvent = BaseChannelEvent & {
|
|
10
10
|
type: 'disconnected';
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type ChannelEvent = {
|
|
13
13
|
topic: 'channel';
|
|
14
14
|
} & (ChannelConnectedEvent | ChannelDisconnectedEvent);
|
|
15
|
-
export
|
|
15
|
+
export type ChannelEventType = ChannelEvent['type'];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseEvent } from './base';
|
|
2
|
-
export
|
|
2
|
+
export type ExternalApplicationConnectedEvent = BaseEvent & {
|
|
3
3
|
type: 'connected';
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type ExternalApplicationDisconnectedEvent = BaseEvent & {
|
|
6
6
|
type: 'disconnected';
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type ExternalApplicationEvent = {
|
|
9
9
|
topic: 'externalapplication';
|
|
10
10
|
} & (ExternalApplicationConnectedEvent | ExternalApplicationDisconnectedEvent);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { NamedEvent } from './base';
|
|
2
|
-
export
|
|
2
|
+
export type BaseFrameEvent = NamedEvent & {
|
|
3
3
|
entityType: 'iframe';
|
|
4
4
|
frameName: string;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type FrameConnectedEvent = BaseFrameEvent & {
|
|
7
7
|
type: 'connected';
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type FrameDisconnectedEvent = BaseFrameEvent & {
|
|
10
10
|
type: 'disconnected';
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type FrameEvent = {
|
|
13
13
|
topic: 'frame';
|
|
14
14
|
} & (FrameConnectedEvent | FrameDisconnectedEvent);
|
|
15
|
-
export
|
|
15
|
+
export type FrameEventType = FrameEvent['type'];
|