@openfin/core 31.74.1 → 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.
Files changed (118) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +284 -253
  3. package/src/OpenFin.js +0 -2
  4. package/src/api/api-exposer/api-consumer.d.ts +28 -0
  5. package/src/api/api-exposer/api-consumer.js +28 -0
  6. package/src/api/api-exposer/api-exposer.d.ts +35 -0
  7. package/src/api/api-exposer/api-exposer.js +38 -0
  8. package/src/api/api-exposer/decorators.d.ts +10 -0
  9. package/src/api/api-exposer/decorators.js +18 -0
  10. package/src/api/api-exposer/index.d.ts +4 -0
  11. package/src/api/api-exposer/index.js +20 -0
  12. package/src/api/api-exposer/strategies/index.d.ts +1 -0
  13. package/src/api/api-exposer/strategies/index.js +17 -0
  14. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.d.ts +14 -0
  15. package/src/api/api-exposer/strategies/openfin-channels/channels-consumer.js +20 -0
  16. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.d.ts +20 -0
  17. package/src/api/api-exposer/strategies/openfin-channels/channels-exposer.js +23 -0
  18. package/src/api/api-exposer/strategies/openfin-channels/index.d.ts +2 -0
  19. package/src/api/api-exposer/strategies/openfin-channels/index.js +18 -0
  20. package/src/api/application/Factory.js +1 -2
  21. package/src/api/base.d.ts +2 -2
  22. package/src/api/events/application.d.ts +22 -22
  23. package/src/api/events/base.d.ts +6 -9
  24. package/src/api/events/channel.d.ts +5 -5
  25. package/src/api/events/emitterMap.d.ts +1 -1
  26. package/src/api/events/externalApplication.d.ts +3 -3
  27. package/src/api/events/frame.d.ts +5 -5
  28. package/src/api/events/globalHotkey.d.ts +3 -3
  29. package/src/api/events/platform.d.ts +3 -3
  30. package/src/api/events/system.d.ts +17 -17
  31. package/src/api/events/typedEventEmitter.d.ts +1 -1
  32. package/src/api/events/view.d.ts +17 -14
  33. package/src/api/events/webcontents.d.ts +24 -22
  34. package/src/api/events/window.d.ts +65 -57
  35. package/src/api/fin.d.ts +1 -1
  36. package/src/api/frame/Instance.d.ts +1 -1
  37. package/src/api/interappbus/channel/channel.d.ts +4 -4
  38. package/src/api/interappbus/channel/channel.js +3 -3
  39. package/src/api/interappbus/channel/client.d.ts +2 -2
  40. package/src/api/interappbus/channel/client.js +20 -20
  41. package/src/api/interappbus/channel/connection-manager.d.ts +1 -1
  42. package/src/api/interappbus/channel/connection-manager.js +12 -12
  43. package/src/api/interappbus/channel/index.d.ts +2 -2
  44. package/src/api/interappbus/channel/index.js +1 -1
  45. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +1 -1
  46. package/src/api/interappbus/channel/protocols/combined/strategy.d.ts +2 -2
  47. package/src/api/interappbus/channel/protocols/combined/strategy.js +5 -5
  48. package/src/api/interappbus/channel/protocols/index.d.ts +4 -4
  49. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -1
  50. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +1 -1
  51. package/src/api/interappbus/channel/protocols/strategy-types.d.ts +4 -4
  52. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -3
  53. package/src/api/interappbus/channel/provider.d.ts +5 -5
  54. package/src/api/interappbus/channel/provider.js +24 -24
  55. package/src/api/interop/InteropBroker.d.ts +1 -1
  56. package/src/api/interop/InteropBroker.js +6 -2
  57. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +2 -1
  58. package/src/api/interop/fdc3/PrivateChannelClient.js +15 -7
  59. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +16 -2
  60. package/src/api/interop/fdc3/PrivateChannelProvider.js +80 -21
  61. package/src/api/interop/fdc3/fdc3-1.2.js +19 -4
  62. package/src/api/interop/fdc3/fdc3-2.0.d.ts +11 -10
  63. package/src/api/interop/fdc3/fdc3-2.0.js +18 -19
  64. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +3 -3
  65. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +5 -5
  66. package/src/api/interop/fdc3/utils.d.ts +17 -0
  67. package/src/api/interop/fdc3/utils.js +52 -18
  68. package/src/api/interop/fdc3/versions.d.ts +1 -1
  69. package/src/api/interop/utils.d.ts +0 -1
  70. package/src/api/interop/utils.js +1 -9
  71. package/src/api/me.d.ts +3 -3
  72. package/src/api/platform/Factory.js +5 -9
  73. package/src/api/platform/Instance.d.ts +1 -1
  74. package/src/api/platform/Instance.js +1 -1
  75. package/src/api/platform/common-utils.d.ts +1 -1
  76. package/src/api/platform/layout/Factory.d.ts +1 -1
  77. package/src/api/platform/layout/Factory.js +11 -3
  78. package/src/api/platform/layout/Instance.d.ts +9 -3
  79. package/src/api/platform/layout/Instance.js +26 -1
  80. package/src/api/platform/layout/controllers/layout-content-cache.d.ts +9 -0
  81. package/src/api/platform/layout/controllers/layout-content-cache.js +54 -0
  82. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +117 -0
  83. package/src/api/platform/layout/controllers/layout-entities-controller.js +270 -0
  84. package/src/api/platform/layout/controllers/splitter-controller.d.ts +1 -1
  85. package/src/api/platform/layout/entities/layout-entities.d.ts +144 -0
  86. package/src/api/platform/layout/entities/layout-entities.js +216 -0
  87. package/src/api/platform/layout/entities/shapes.d.ts +6 -0
  88. package/src/api/platform/layout/entities/shapes.js +2 -0
  89. package/src/api/platform/layout/layout.constants.d.ts +1 -0
  90. package/src/api/platform/layout/layout.constants.js +4 -0
  91. package/src/api/platform/layout/shapes.d.ts +4 -1
  92. package/src/api/platform/layout/utils/layout-traversal.d.ts +4 -0
  93. package/src/api/platform/layout/utils/layout-traversal.js +65 -0
  94. package/src/api/system/index.d.ts +13 -13
  95. package/src/api/view/Instance.d.ts +13 -3
  96. package/src/api/view/Instance.js +41 -4
  97. package/src/environment/browser.d.ts +1 -1
  98. package/src/environment/environment.d.ts +1 -1
  99. package/src/environment/node-env.d.ts +1 -1
  100. package/src/environment/openfin-env.d.ts +1 -1
  101. package/src/mock.d.ts +1 -1
  102. package/src/mock.js +5 -2
  103. package/src/shapes/ERROR_BOX_TYPES.d.ts +1 -1
  104. package/src/shapes/protocol.d.ts +3 -3
  105. package/src/transport/transport-errors.d.ts +2 -2
  106. package/src/transport/transport.d.ts +3 -3
  107. package/src/transport/transport.js +1 -4
  108. package/src/transport/wire.d.ts +14 -13
  109. package/src/util/channel-api-relay.d.ts +13 -0
  110. package/src/util/channel-api-relay.js +37 -0
  111. package/src/util/errors.d.ts +2 -2
  112. package/src/util/http.js +4 -2
  113. package/src/util/lazy.d.ts +16 -0
  114. package/src/util/lazy.js +26 -0
  115. package/src/util/promises.d.ts +1 -1
  116. package/src/util/reversible-map.d.ts +11 -0
  117. package/src/util/reversible-map.js +49 -0
  118. package/src/util/utilTypes.d.ts +1 -1
@@ -1,16 +1,17 @@
1
1
  /// <reference types="mocha" />
2
2
  /// <reference types="node" />
3
3
  import EventEmitter = NodeJS.EventEmitter;
4
- export declare type Wire = EventEmitter & {
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 declare type WireConstructor = {
11
+ export type WireConstructor = {
11
12
  new (onmessage: (data: any) => void): Wire;
12
13
  };
13
- export declare type RuntimeConfig = {
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 declare type ServiceConfig = {
22
+ export type ServiceConfig = {
22
23
  name: string;
23
24
  manifestUrl: string;
24
25
  };
25
- export declare type BaseConfig = {
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 declare type ConfigWithUuid = BaseConfig & {
54
+ export type ConfigWithUuid = BaseConfig & {
54
55
  uuid: string;
55
56
  };
56
- export declare type ExistingConnectConfig = ConfigWithUuid & {
57
+ export type ExistingConnectConfig = ConfigWithUuid & {
57
58
  address: string;
58
59
  };
59
- export declare type ConfigWithRuntime = BaseConfig & {
60
+ export type ConfigWithRuntime = BaseConfig & {
60
61
  runtime: RuntimeConfig;
61
62
  };
62
- export declare type ExternalConfig = BaseConfig & {
63
+ export type ExternalConfig = BaseConfig & {
63
64
  manifestUrl: string;
64
65
  };
65
- export declare type NewConnectConfig = ConfigWithUuid & ConfigWithRuntime;
66
- export declare type PortDiscoveryConfig = (ExternalConfig & ConfigWithRuntime) | NewConnectConfig;
67
- export declare type ConnectConfig = ExistingConnectConfig | NewConnectConfig | ExternalConfig;
68
- export declare type InternalConnectConfig = ExistingConnectConfig | NewConnectConfig;
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
  }
@@ -0,0 +1,13 @@
1
+ import type * as OpenFin from '../OpenFin';
2
+ /**
3
+ * @internal
4
+ * Create a channel relay for a given channel exposition, allowing a single provider to route
5
+ * actions to the designated clients.
6
+ *
7
+ * Designed to be used in conjunction with @expose
8
+ *
9
+ * @param channelProvider The channel provider to relay the actions on.
10
+ * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
11
+ */
12
+ export declare const relayChannelClientApi: (channelProvider: OpenFin.ChannelProvider, relayId: string) => Promise<void>;
13
+ export declare const createRelayedDispatch: (client: OpenFin.ChannelClient, target: OpenFin.Identity, relayId: string, relayErrorMsg?: string) => OpenFin.ChannelClient['dispatch'];
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createRelayedDispatch = exports.relayChannelClientApi = void 0;
4
+ /**
5
+ * @internal
6
+ * Create a channel relay for a given channel exposition, allowing a single provider to route
7
+ * actions to the designated clients.
8
+ *
9
+ * Designed to be used in conjunction with @expose
10
+ *
11
+ * @param channelProvider The channel provider to relay the actions on.
12
+ * @param config Determines which actions to relay. Please ensure action prefix matches the exposed api.
13
+ */
14
+ const relayChannelClientApi = async (channelProvider, relayId) => {
15
+ channelProvider.register(`relay:${relayId}`, ({ action, target, payload }) => {
16
+ return channelProvider.dispatch(target, action, payload);
17
+ });
18
+ await Promise.resolve();
19
+ };
20
+ exports.relayChannelClientApi = relayChannelClientApi;
21
+ const createRelayedDispatch = (client, target, relayId, relayErrorMsg) => async (action, payload) => {
22
+ try {
23
+ return await client.dispatch(`relay:${relayId}`, {
24
+ action,
25
+ payload,
26
+ target
27
+ });
28
+ }
29
+ catch (e) {
30
+ if (e.message.includes('no longer connected') && relayErrorMsg) {
31
+ throw new Error(relayErrorMsg);
32
+ }
33
+ ;
34
+ throw e;
35
+ }
36
+ };
37
+ exports.createRelayedDispatch = createRelayedDispatch;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * This function converts JS errors into plain objects
3
3
  */
4
- export declare type ErrorPlainObject = {
5
- stack: string;
4
+ export type ErrorPlainObject = {
5
+ stack?: string;
6
6
  message: string;
7
7
  toString(): string;
8
8
  };
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(proto));
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(proto));
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);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Handy class for managing asynchronous dependencies of classes.
3
+ *
4
+ * Will call the producer function once and only once when getValue is called,
5
+ * returning the resultant value for every subsequent call.
6
+ */
7
+ export declare class Lazy<T> {
8
+ private producerFn;
9
+ constructor(producerFn: () => T);
10
+ private value;
11
+ /**
12
+ * Lazily get the value returned by the producer.
13
+ * @returns The value returned from the producer function
14
+ */
15
+ getValue(): T;
16
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Lazy = void 0;
4
+ /**
5
+ * Handy class for managing asynchronous dependencies of classes.
6
+ *
7
+ * Will call the producer function once and only once when getValue is called,
8
+ * returning the resultant value for every subsequent call.
9
+ */
10
+ class Lazy {
11
+ // eslint-disable-next-line
12
+ constructor(producerFn) {
13
+ this.producerFn = producerFn;
14
+ }
15
+ /**
16
+ * Lazily get the value returned by the producer.
17
+ * @returns The value returned from the producer function
18
+ */
19
+ getValue() {
20
+ if (!this.value) {
21
+ this.value = this.producerFn();
22
+ }
23
+ return this.value;
24
+ }
25
+ }
26
+ exports.Lazy = Lazy;
@@ -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 declare type asyncF<T> = (...args: any[]) => Promise<T>;
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[]>;
@@ -0,0 +1,11 @@
1
+ export declare class ReversibleMap<TKey extends string | number | symbol, TValue extends Object | string | number> {
2
+ private readonly valueToKey;
3
+ private readonly keyToValue;
4
+ setUnique: (key: TKey, value: TValue) => void;
5
+ getKey: (value: TValue) => TKey;
6
+ getValue(key: TKey): TValue;
7
+ deleteKey: (key: TKey) => TValue | undefined;
8
+ deleteValue: (value: TValue) => TKey | undefined;
9
+ hasKey: (key: TKey) => boolean;
10
+ hasValue: (value: TValue) => boolean;
11
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReversibleMap = void 0;
4
+ class ReversibleMap {
5
+ constructor() {
6
+ this.valueToKey = new Map();
7
+ this.keyToValue = new Map();
8
+ this.setUnique = (key, value) => {
9
+ if (this.hasKey(key) || this.hasValue(value)) {
10
+ throw new Error('Key or value already in the map.');
11
+ }
12
+ this.keyToValue.set(key, value);
13
+ this.valueToKey.set(value, key);
14
+ };
15
+ this.getKey = (value) => {
16
+ const existingKey = this.valueToKey.get(value);
17
+ if (!existingKey) {
18
+ throw new Error('Value not found in the map.');
19
+ }
20
+ return existingKey;
21
+ };
22
+ this.deleteKey = (key) => {
23
+ const value = this.getValue(key);
24
+ this.keyToValue.delete(key);
25
+ this.valueToKey.delete(value);
26
+ return value;
27
+ };
28
+ this.deleteValue = (value) => {
29
+ const key = this.getKey(value);
30
+ this.keyToValue.delete(key);
31
+ this.valueToKey.delete(value);
32
+ return key;
33
+ };
34
+ this.hasKey = (key) => {
35
+ return this.keyToValue.has(key);
36
+ };
37
+ this.hasValue = (value) => {
38
+ return this.valueToKey.has(value);
39
+ };
40
+ }
41
+ getValue(key) {
42
+ const item = this.keyToValue.get(key);
43
+ if (!item) {
44
+ throw new Error('Key not found in the map.');
45
+ }
46
+ return item;
47
+ }
48
+ }
49
+ exports.ReversibleMap = ReversibleMap;
@@ -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 declare type Complete<T extends {}> = T & {
6
+ export type Complete<T extends {}> = T & {
7
7
  [MK in keyof T]-?: Complete<NonNullable<T[MK]>>;
8
8
  };