@openfin/core 31.74.5 → 31.74.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/OpenFin.d.ts +238 -238
- package/src/OpenFin.js +0 -2
- package/src/api/base.d.ts +2 -2
- package/src/api/events/application.d.ts +22 -22
- package/src/api/events/base.d.ts +6 -6
- 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 +3 -3
- package/src/api/events/system.d.ts +17 -17
- package/src/api/events/typedEventEmitter.d.ts +1 -1
- package/src/api/events/view.d.ts +13 -13
- package/src/api/events/webcontents.d.ts +22 -22
- package/src/api/events/window.d.ts +49 -49
- package/src/api/fin.d.ts +1 -1
- package/src/api/frame/Instance.d.ts +1 -1
- package/src/api/interappbus/channel/channel.d.ts +4 -4
- package/src/api/interappbus/channel/channel.js +3 -3
- package/src/api/interappbus/channel/client.d.ts +2 -2
- package/src/api/interappbus/channel/client.js +20 -20
- package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
- package/src/api/interappbus/channel/connection-manager.js +12 -12
- package/src/api/interappbus/channel/index.d.ts +2 -2
- package/src/api/interappbus/channel/index.js +1 -1
- package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +1 -1
- 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 +4 -4
- package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -1
- package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +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 +5 -5
- package/src/api/interappbus/channel/provider.js +24 -24
- package/src/api/interop/InteropBroker.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelClient.d.ts +1 -1
- package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
- package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +3 -3
- package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +4 -4
- package/src/api/interop/fdc3/versions.d.ts +1 -1
- package/src/api/interop/utils.d.ts +0 -1
- package/src/api/interop/utils.js +1 -9
- package/src/api/me.d.ts +3 -3
- package/src/api/platform/common-utils.d.ts +1 -1
- package/src/api/platform/layout/Factory.d.ts +1 -1
- package/src/api/platform/layout/Instance.d.ts +3 -3
- package/src/api/platform/layout/controllers/splitter-controller.d.ts +1 -1
- package/src/api/platform/layout/shapes.d.ts +1 -1
- package/src/api/system/index.d.ts +13 -13
- package/src/api/view/Instance.d.ts +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.js +3 -0
- package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -1
- package/src/shapes/protocol.d.ts +3 -3
- package/src/transport/transport-errors.d.ts +2 -2
- package/src/transport/transport.d.ts +3 -3
- package/src/transport/transport.js +1 -4
- package/src/transport/wire.d.ts +14 -13
- package/src/util/errors.d.ts +2 -2
- package/src/util/http.js +4 -2
- package/src/util/promises.d.ts +1 -1
- package/src/util/utilTypes.d.ts +1 -1
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
2
7
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
8
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
9
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
11
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
12
|
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
13
|
var _ChannelProvider_connections, _ChannelProvider_protectedObj, _ChannelProvider_strategy, _ChannelProvider_removeEndpoint, _ChannelProvider_close;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.ChannelProvider = void 0;
|
|
16
16
|
const channel_1 = require("./channel");
|
|
17
17
|
const runtimeVersioning_1 = require("../../../util/runtimeVersioning");
|
|
18
18
|
class ChannelProvider extends channel_1.ChannelBase {
|
|
19
|
+
get connections() {
|
|
20
|
+
return [...__classPrivateFieldGet(this, _ChannelProvider_connections, "f")];
|
|
21
|
+
}
|
|
22
|
+
static handleClientDisconnection(channel, payload) {
|
|
23
|
+
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
|
24
|
+
if (removeById) {
|
|
25
|
+
__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const multipleRemoves = channel.connections.filter((identity) => {
|
|
29
|
+
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
30
|
+
});
|
|
31
|
+
multipleRemoves.forEach(__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
32
|
+
}
|
|
33
|
+
channel.disconnectListener(payload);
|
|
34
|
+
}
|
|
35
|
+
static setProviderRemoval(provider, remove) {
|
|
36
|
+
ChannelProvider.removalMap.set(provider, remove);
|
|
37
|
+
}
|
|
19
38
|
constructor(providerIdentity, wire, strategy) {
|
|
20
39
|
super();
|
|
21
40
|
_ChannelProvider_connections.set(this, void 0);
|
|
@@ -51,25 +70,6 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
51
70
|
__classPrivateFieldSet(this, _ChannelProvider_strategy, strategy, "f");
|
|
52
71
|
strategy.receive(this.processAction);
|
|
53
72
|
}
|
|
54
|
-
get connections() {
|
|
55
|
-
return [...__classPrivateFieldGet(this, _ChannelProvider_connections, "f")];
|
|
56
|
-
}
|
|
57
|
-
static handleClientDisconnection(channel, payload) {
|
|
58
|
-
const removeById = channel.connections.find((identity) => identity.endpointId === payload.endpointId);
|
|
59
|
-
if (removeById) {
|
|
60
|
-
__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f").call(channel, removeById);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const multipleRemoves = channel.connections.filter((identity) => {
|
|
64
|
-
return identity.uuid === payload.uuid && identity.name === payload.name;
|
|
65
|
-
});
|
|
66
|
-
multipleRemoves.forEach(__classPrivateFieldGet(channel, _ChannelProvider_removeEndpoint, "f"));
|
|
67
|
-
}
|
|
68
|
-
channel.disconnectListener(payload);
|
|
69
|
-
}
|
|
70
|
-
static setProviderRemoval(provider, remove) {
|
|
71
|
-
ChannelProvider.removalMap.set(provider, remove);
|
|
72
|
-
}
|
|
73
73
|
dispatch(to, action, payload) {
|
|
74
74
|
var _a;
|
|
75
75
|
const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
|
|
@@ -3,7 +3,7 @@ import { AppIdentifier } from './fdc3/shapes/fdc3v2';
|
|
|
3
3
|
import type * as OpenFin from '../../OpenFin';
|
|
4
4
|
import { Base } from '../base';
|
|
5
5
|
import type { Transport } from '../../transport/transport';
|
|
6
|
-
|
|
6
|
+
type Identity = OpenFin.Identity;
|
|
7
7
|
/**
|
|
8
8
|
* {@link https://developers.openfin.co/of-docs/docs/enable-color-linking}
|
|
9
9
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../OpenFin';
|
|
2
2
|
import type { Listener, Context, ContextHandler } from './shapes/fdc3v2';
|
|
3
|
-
|
|
3
|
+
type HandlerId = string;
|
|
4
4
|
export declare class PrivateChannelClient {
|
|
5
5
|
id: string;
|
|
6
6
|
client: OpenFin.ChannelClient;
|
|
@@ -8,8 +8,8 @@ export type { Listener } from 'fdc3v1/src/api/Listener';
|
|
|
8
8
|
export type { AppMetadata } from 'fdc3v1/src/api/AppMetadata';
|
|
9
9
|
export type { AppIntent } from 'fdc3v1/src/api/AppIntent';
|
|
10
10
|
export type { ImplementationMetadata } from 'fdc3v1/src/api/ImplementationMetadata';
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type ContextHandler = (context: Context) => void;
|
|
12
|
+
export type TargetApp = string | AppMetadata;
|
|
13
13
|
export interface Context {
|
|
14
14
|
id?: {
|
|
15
15
|
[key: string]: string;
|
|
@@ -30,7 +30,7 @@ export interface Channel {
|
|
|
30
30
|
getCurrentContext(contextType?: string): Promise<Context | null>;
|
|
31
31
|
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
|
|
32
32
|
}
|
|
33
|
-
export
|
|
33
|
+
export type SystemChannel = Omit<Channel, 'addContextListener' | 'broadcast' | 'getCurrentContext'> & {
|
|
34
34
|
addContextListener(): Error;
|
|
35
35
|
broadcast(): Error;
|
|
36
36
|
getCurrentContext(): Error;
|
|
@@ -14,9 +14,9 @@ export type { ContextMetadata } from 'fdc3v2/src/api/ContextMetadata';
|
|
|
14
14
|
export type { AppIdentifier } from 'fdc3v2/src/api/AppIdentifier';
|
|
15
15
|
export type { AppMetadata } from 'fdc3v2/src/api/AppMetadata';
|
|
16
16
|
export type { DisplayMetadata } from 'fdc3v2/src/api/DisplayMetadata';
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
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
20
|
export interface Context {
|
|
21
21
|
id?: {
|
|
22
22
|
[key: string]: string;
|
|
@@ -45,7 +45,7 @@ export interface Channel {
|
|
|
45
45
|
getCurrentContext(contextType?: string): Promise<Context | null>;
|
|
46
46
|
addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise<Listener>;
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type PrivateChannel = Omit<Channel, 'addContextListener'> & {
|
|
49
49
|
addContextListener(contextType: string | null, handler: ContextHandler): Promise<Listener>;
|
|
50
50
|
onAddContextListener(handler: (contextType?: string) => void): Listener;
|
|
51
51
|
onUnsubscribe(handler: (contextType?: string) => void): Listener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Fdc3Version = '1.2' | '2.0';
|
|
@@ -16,4 +16,3 @@ export declare const BROKER_ERRORS: {
|
|
|
16
16
|
fdc3GetInfo: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
|
|
19
|
-
export declare const generateDefaultLoggingOptions: () => OpenFin.InteropLoggingOptions;
|
package/src/api/interop/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
|
|
4
4
|
const generateId = () => `${Math.random()}${Date.now()}`;
|
|
5
5
|
exports.generateId = generateId;
|
|
6
6
|
const wrapInTryCatch = (f, prefix) => (...args) => {
|
|
@@ -59,11 +59,3 @@ const wrapIntentHandler = (handler, handlerId) => {
|
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
exports.wrapIntentHandler = wrapIntentHandler;
|
|
62
|
-
const generateDefaultLoggingOptions = () => {
|
|
63
|
-
const loggingActions = ['beforeAction', 'afterAction'];
|
|
64
|
-
const options = loggingActions.reduce((accumulator, loggingOption) => {
|
|
65
|
-
return { ...accumulator, [loggingOption]: { enabled: true } };
|
|
66
|
-
}, {});
|
|
67
|
-
return options;
|
|
68
|
-
};
|
|
69
|
-
exports.generateDefaultLoggingOptions = generateDefaultLoggingOptions;
|
package/src/api/me.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type * as OpenFin from '../OpenFin';
|
|
|
2
2
|
import type { Transport } from '../transport/transport';
|
|
3
3
|
import type { InteropClient } from './interop';
|
|
4
4
|
export declare const environmentUnsupportedMessage = "You are not running in OpenFin.";
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
type EntityType = OpenFin.EntityType;
|
|
6
|
+
export type EntityTypeHelpers<T extends EntityType> = T extends 'view' ? {
|
|
7
7
|
isView: true;
|
|
8
8
|
isWindow: false;
|
|
9
9
|
isExternal: false;
|
|
@@ -33,7 +33,7 @@ export declare function getBaseMe<T extends EntityType = EntityType>(entityType:
|
|
|
33
33
|
export interface WithInterop {
|
|
34
34
|
interop: InteropClient;
|
|
35
35
|
}
|
|
36
|
-
export
|
|
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 : EntityTypeHelpers<MeType> & WithInterop) & {
|
|
37
37
|
isOpenFin: boolean;
|
|
38
38
|
};
|
|
39
39
|
export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
|
-
|
|
2
|
+
type LayoutPresetType = OpenFin.LayoutPresetType;
|
|
3
3
|
export declare function isValidPresetType(type: LayoutPresetType): type is LayoutPresetType;
|
|
4
4
|
declare const _default: {
|
|
5
5
|
isValidPresetType: typeof isValidPresetType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../OpenFin';
|
|
2
2
|
import { Layout } from './Instance';
|
|
3
3
|
import { Base } from '../../base';
|
|
4
|
-
|
|
4
|
+
type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
5
5
|
/**
|
|
6
6
|
* @PORTED
|
|
7
7
|
* InitLayoutOptions interface
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as OpenFin from '../../../OpenFin';
|
|
2
2
|
import { Transport } from '../../../transport/transport';
|
|
3
3
|
import { Base } from '../../base';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
type Identity = OpenFin.Identity;
|
|
5
|
+
type InitLayoutOptions = OpenFin.InitLayoutOptions;
|
|
6
|
+
type PresetLayoutOptions = OpenFin.PresetLayoutOptions;
|
|
7
7
|
/**
|
|
8
8
|
* @lends Platform#Layout
|
|
9
9
|
*/
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type * as OpenFin from '../../OpenFin';
|
|
2
2
|
import { EmitterBase } from '../base';
|
|
3
3
|
import { Transport } from '../../transport/transport';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
type Identity = OpenFin.Identity;
|
|
5
|
+
type ProxyInfo = OpenFin.ProxyInfo;
|
|
6
|
+
type ProxyConfig = OpenFin.ProxyConfig;
|
|
7
|
+
type InstalledApps = OpenFin.InstalledApps;
|
|
8
|
+
type LogInfo = OpenFin.LogInfo;
|
|
9
|
+
type LogLevel = OpenFin.LogLevel;
|
|
10
|
+
type GetLogRequestType = OpenFin.GetLogRequestType;
|
|
11
|
+
type RegistryInfo = OpenFin.RegistryInfo;
|
|
12
|
+
type EntityInfo = OpenFin.EntityInfo;
|
|
13
|
+
type Entity = OpenFin.ApplicationType;
|
|
14
|
+
type ApplicationState = OpenFin.ApplicationState;
|
|
15
|
+
type ApplicationWindowInfo = OpenFin.ApplicationWindowInfo;
|
|
16
|
+
type PrinterInfo = OpenFin.PrinterInfo;
|
|
17
17
|
/**
|
|
18
18
|
* An object representing the core of OpenFin Runtime. Allows the developer
|
|
19
19
|
* to perform system-level actions, such as accessing logs, viewing processes,
|
|
@@ -3,7 +3,7 @@ import { WebContents } from '../webcontents/main';
|
|
|
3
3
|
import { Transport } from '../../transport/transport';
|
|
4
4
|
import { Layout } from '../platform/layout';
|
|
5
5
|
import { ViewEvent } from '../events/view';
|
|
6
|
-
|
|
6
|
+
type UpdatableViewOptions = OpenFin.UpdatableViewOptions;
|
|
7
7
|
/**
|
|
8
8
|
* @PORTED
|
|
9
9
|
* @typedef {object} View~options
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as OpenFin from '../OpenFin';
|
|
2
2
|
import { NewConnectConfig } from '../transport/wire';
|
|
3
3
|
import { ChildContentOptions, Environment } from './environment';
|
|
4
|
-
|
|
4
|
+
type EntityType = OpenFin.EntityType;
|
|
5
5
|
export declare class BrowserEnvironment implements Environment {
|
|
6
6
|
getManagerConstructor(): Promise<any>;
|
|
7
7
|
getProviderInitializer(): Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as OpenFin from '../OpenFin';
|
|
2
2
|
import { NewConnectConfig } from '../transport/wire';
|
|
3
|
-
|
|
3
|
+
type EntityType = OpenFin.EntityType;
|
|
4
4
|
export interface Environment {
|
|
5
5
|
getManagerConstructor(): Promise<any>;
|
|
6
6
|
getProviderInitializer(): Promise<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as OpenFin from '../OpenFin';
|
|
2
2
|
import { Environment } from './environment';
|
|
3
3
|
import { NewConnectConfig } from '../transport/wire';
|
|
4
|
-
|
|
4
|
+
type EntityType = OpenFin.EntityType;
|
|
5
5
|
export default class NodeEnvironment implements Environment {
|
|
6
6
|
getDefaultChannelOptions(): {
|
|
7
7
|
create: OpenFin.ChannelCreateOptions;
|
|
@@ -2,7 +2,7 @@ import type * as OpenFin from '../OpenFin';
|
|
|
2
2
|
import { ChildContentOptions, Environment } from './environment';
|
|
3
3
|
import { NewConnectConfig } from '../transport/wire';
|
|
4
4
|
import { BrowserEnvironment } from './browser';
|
|
5
|
-
|
|
5
|
+
type EntityType = OpenFin.EntityType;
|
|
6
6
|
export default class OpenFinEnvironment extends BrowserEnvironment implements Environment {
|
|
7
7
|
#private;
|
|
8
8
|
private raiseEventAsync;
|
package/src/mock.js
CHANGED
|
@@ -24,6 +24,9 @@ class MockWire extends events_1.EventEmitter {
|
|
|
24
24
|
shutdown() {
|
|
25
25
|
throw new Error('You are not running in OpenFin.');
|
|
26
26
|
}
|
|
27
|
+
getPort() {
|
|
28
|
+
throw new Error('This transport has no port');
|
|
29
|
+
}
|
|
27
30
|
// eslint-disable-next-line no-useless-constructor
|
|
28
31
|
constructor() {
|
|
29
32
|
super();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type ERROR_BOX_TYPES = 'OF_error_box:app_initialization' | 'OF_error_box:main_process' | 'OF_error_box:renderer_crash';
|
package/src/shapes/protocol.d.ts
CHANGED
|
@@ -149,12 +149,12 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
149
149
|
response: OpenFin.PrinterInfo[];
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
type ApiCall<Request, Response> = {
|
|
153
153
|
request: Request;
|
|
154
154
|
response: Response;
|
|
155
155
|
};
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
type VoidCall = ApiCall<void, void>;
|
|
157
|
+
type IdentityCall<AdditionalPayload = {}, Response = void> = ApiCall<AdditionalPayload & OpenFin.Identity, Response>;
|
|
158
158
|
interface ProtocolMapBase {
|
|
159
159
|
[action: string]: {
|
|
160
160
|
request: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ErrorPlainObject } from '../util/errors';
|
|
2
|
-
export
|
|
2
|
+
export type ReadyState = 'CONNECTING' | 'OPEN' | 'CLOSING' | 'CLOSED';
|
|
3
3
|
export declare class DisconnectedError extends Error {
|
|
4
4
|
constructor(readyState: ReadyState);
|
|
5
5
|
readyState: ReadyState;
|
|
@@ -14,7 +14,7 @@ export declare class NotImplementedError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class NotSupportedError extends Error {
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type RuntimeErrorPayload = {
|
|
18
18
|
reason: string;
|
|
19
19
|
error?: ErrorPlainObject;
|
|
20
20
|
};
|
|
@@ -8,8 +8,8 @@ import { EntityTypeHelpers } from '../api/me';
|
|
|
8
8
|
import { ProtocolMap } from '../shapes/protocol';
|
|
9
9
|
import { NamedEvent } from '../api/events/base';
|
|
10
10
|
import { ErrorPlainObject } from '../util/errors';
|
|
11
|
-
|
|
12
|
-
export
|
|
11
|
+
type EntityType = OpenFin.EntityType;
|
|
12
|
+
export type MessageHandler = (data: any) => boolean;
|
|
13
13
|
export declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
14
14
|
#private;
|
|
15
15
|
protected wireListeners: Map<number, {
|
|
@@ -49,7 +49,7 @@ export interface EventMessage extends Message<NamedEvent> {
|
|
|
49
49
|
action: 'process-desktop-event';
|
|
50
50
|
payload: NamedEvent;
|
|
51
51
|
}
|
|
52
|
-
export
|
|
52
|
+
export type Payload<Success extends boolean = boolean, Data = any> = {
|
|
53
53
|
success: Success;
|
|
54
54
|
data: Success extends true ? Data : never;
|
|
55
55
|
reason: Success extends false ? string : never;
|
|
@@ -32,11 +32,8 @@ class Transport extends events_1.EventEmitter {
|
|
|
32
32
|
};
|
|
33
33
|
// This function is only used in our tests.
|
|
34
34
|
this.getPort = () => {
|
|
35
|
-
if (this.environment.constructor.name !== 'NodeEnvironment') {
|
|
36
|
-
throw new transport_errors_1.NotImplementedError('Not Implemented');
|
|
37
|
-
}
|
|
38
35
|
const wire = __classPrivateFieldGet(this, _Transport_wire, "f");
|
|
39
|
-
return wire.
|
|
36
|
+
return wire.getPort();
|
|
40
37
|
};
|
|
41
38
|
__classPrivateFieldSet(this, _Transport_wire, new WireType(this.onmessage.bind(this)), "f");
|
|
42
39
|
this.environment = environment;
|
package/src/transport/wire.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/// <reference types="mocha" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import EventEmitter = NodeJS.EventEmitter;
|
|
4
|
-
export
|
|
4
|
+
export type Wire = EventEmitter & {
|
|
5
5
|
connect(address: string, WsConstructor: typeof WebSocket): Promise<any>;
|
|
6
6
|
connectSync(): any;
|
|
7
7
|
send(data: any): Promise<any>;
|
|
8
8
|
shutdown(): Promise<void>;
|
|
9
|
+
getPort(): string;
|
|
9
10
|
};
|
|
10
|
-
export
|
|
11
|
+
export type WireConstructor = {
|
|
11
12
|
new (onmessage: (data: any) => void): Wire;
|
|
12
13
|
};
|
|
13
|
-
export
|
|
14
|
+
export type RuntimeConfig = {
|
|
14
15
|
version: string;
|
|
15
16
|
fallbackVersion?: string;
|
|
16
17
|
securityRealm?: string;
|
|
@@ -18,11 +19,11 @@ export declare type RuntimeConfig = {
|
|
|
18
19
|
arguments?: string;
|
|
19
20
|
rvmDir?: string;
|
|
20
21
|
};
|
|
21
|
-
export
|
|
22
|
+
export type ServiceConfig = {
|
|
22
23
|
name: string;
|
|
23
24
|
manifestUrl: string;
|
|
24
25
|
};
|
|
25
|
-
export
|
|
26
|
+
export type BaseConfig = {
|
|
26
27
|
uuid?: string;
|
|
27
28
|
address?: string;
|
|
28
29
|
name?: string;
|
|
@@ -50,22 +51,22 @@ export declare type BaseConfig = {
|
|
|
50
51
|
customItems?: [any];
|
|
51
52
|
timeout?: number;
|
|
52
53
|
};
|
|
53
|
-
export
|
|
54
|
+
export type ConfigWithUuid = BaseConfig & {
|
|
54
55
|
uuid: string;
|
|
55
56
|
};
|
|
56
|
-
export
|
|
57
|
+
export type ExistingConnectConfig = ConfigWithUuid & {
|
|
57
58
|
address: string;
|
|
58
59
|
};
|
|
59
|
-
export
|
|
60
|
+
export type ConfigWithRuntime = BaseConfig & {
|
|
60
61
|
runtime: RuntimeConfig;
|
|
61
62
|
};
|
|
62
|
-
export
|
|
63
|
+
export type ExternalConfig = BaseConfig & {
|
|
63
64
|
manifestUrl: string;
|
|
64
65
|
};
|
|
65
|
-
export
|
|
66
|
-
export
|
|
67
|
-
export
|
|
68
|
-
export
|
|
66
|
+
export type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime;
|
|
67
|
+
export type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig;
|
|
68
|
+
export type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig;
|
|
69
|
+
export type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
|
|
69
70
|
export interface RemoteConfig extends ExistingConnectConfig {
|
|
70
71
|
token: string;
|
|
71
72
|
}
|
package/src/util/errors.d.ts
CHANGED
package/src/util/http.js
CHANGED
|
@@ -38,9 +38,10 @@ const getRequestOptions = (url) => {
|
|
|
38
38
|
};
|
|
39
39
|
exports.getRequestOptions = getRequestOptions;
|
|
40
40
|
const fetch = async (url) => {
|
|
41
|
+
var _a;
|
|
41
42
|
const requestUrl = getProxyVar() ? getProxyVar() : url;
|
|
42
43
|
const proto = (0, url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
|
|
43
|
-
const fetcher = await Promise.resolve().then(() => require(
|
|
44
|
+
const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
|
|
44
45
|
return new Promise((resolve, reject) => {
|
|
45
46
|
const options = (0, exports.getRequestOptions)(url);
|
|
46
47
|
const request = fetcher.get(options, (response) => {
|
|
@@ -60,9 +61,10 @@ const fetch = async (url) => {
|
|
|
60
61
|
};
|
|
61
62
|
exports.fetch = fetch;
|
|
62
63
|
const downloadFile = async (url, writeLocation) => {
|
|
64
|
+
var _a;
|
|
63
65
|
const requestUrl = getProxyVar() ? getProxyVar() : url;
|
|
64
66
|
const proto = (0, url_1.parse)(requestUrl).protocol.slice(0, -1) === 'http' ? 'http' : 'https';
|
|
65
|
-
const fetcher = await Promise.resolve().then(() => require(
|
|
67
|
+
const fetcher = await (_a = proto, Promise.resolve().then(() => require(_a)));
|
|
66
68
|
return new Promise((resolve, reject) => {
|
|
67
69
|
try {
|
|
68
70
|
const options = (0, exports.getRequestOptions)(url);
|
package/src/util/promises.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function promisify(func: Function): (...args: any[]) => Promise<any>;
|
|
2
2
|
export declare function promiseMap<T, S>(arr: T[], asyncF: (x: T, i: number, r: T[]) => Promise<S>): Promise<S[]>;
|
|
3
|
-
export
|
|
3
|
+
export type asyncF<T> = (...args: any[]) => Promise<T>;
|
|
4
4
|
export declare function serial<T>(arr: asyncF<T>[]): Promise<T[]>;
|
|
5
5
|
export declare function promiseMapSerial<T>(arr: any[], func: asyncF<T>): Promise<T[]>;
|
package/src/util/utilTypes.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* which are always populated in certain contexts. A `DeepPick` type would be even better,
|
|
4
4
|
* but no reliable implementation of one appears to exist yet.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type Complete<T extends {}> = T & {
|
|
7
7
|
[MK in keyof T]-?: Complete<NonNullable<T[MK]>>;
|
|
8
8
|
};
|