@openfin/core 25.68.26 → 25.68.29

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 (98) hide show
  1. package/OpenFin.d.ts +1378 -373
  2. package/README.md +6 -2
  3. package/package.json +2 -3
  4. package/src/api/application/Instance.d.ts +2 -2
  5. package/src/api/application/Instance.js +1 -1
  6. package/src/api/base.d.ts +1 -1
  7. package/src/api/events/channel.d.ts +2 -1
  8. package/src/api/events/eventAggregator.d.ts +1 -1
  9. package/src/api/external-application/Instance.d.ts +1 -1
  10. package/src/api/fin.d.ts +1 -1
  11. package/src/api/frame/Instance.d.ts +1 -1
  12. package/src/api/global-hotkey/index.d.ts +1 -1
  13. package/src/api/interappbus/channel/channel.d.ts +3 -3
  14. package/src/api/interappbus/channel/index.d.ts +2 -1
  15. package/src/api/interappbus/index.d.ts +2 -1
  16. package/src/api/me.d.ts +1 -1
  17. package/src/api/platform/Instance.d.ts +1 -1
  18. package/src/api/platform/Instance.js +1 -2
  19. package/src/api/platform/common-utils.d.ts +1 -1
  20. package/src/api/platform/layout/Factory.d.ts +1 -1
  21. package/src/api/platform/layout/Factory.js +1 -0
  22. package/src/api/platform/layout/Instance.d.ts +2 -1
  23. package/src/api/platform/layout/index.d.ts +0 -1
  24. package/src/api/platform/layout/index.js +0 -1
  25. package/src/api/system/index.d.ts +17 -13
  26. package/src/api/system/index.js +3 -3
  27. package/src/api/view/Instance.d.ts +1 -1
  28. package/src/api/webcontents/main.d.ts +1 -1
  29. package/src/api/window/Instance.d.ts +3 -3
  30. package/src/environment/environment.d.ts +5 -8
  31. package/src/environment/node-env.d.ts +5 -4
  32. package/src/environment/openfin-env.d.ts +5 -4
  33. package/src/environment/openfin-env.js +2 -0
  34. package/src/mock.d.ts +0 -1
  35. package/src/mock.js +1 -2
  36. package/src/transport/transport-errors.d.ts +3 -2
  37. package/src/transport/transport-errors.js +1 -3
  38. package/src/transport/transport.d.ts +10 -24
  39. package/src/transport/transport.js +0 -14
  40. package/src/transport/wire.d.ts +6 -71
  41. package/src/transport/wire.js +1 -8
  42. package/src/util/errors.d.ts +1 -5
  43. package/src/util/errors.js +0 -3
  44. package/src/util/normalize-config.d.ts +3 -1
  45. package/src/api/events/application.d.ts +0 -69
  46. package/src/api/events/application.js +0 -2
  47. package/src/api/events/base.d.ts +0 -17
  48. package/src/api/events/base.js +0 -2
  49. package/src/api/events/externalApplication.d.ts +0 -5
  50. package/src/api/events/externalApplication.js +0 -2
  51. package/src/api/events/frame.d.ts +0 -9
  52. package/src/api/events/frame.js +0 -2
  53. package/src/api/events/globalHotkey.d.ts +0 -10
  54. package/src/api/events/globalHotkey.js +0 -2
  55. package/src/api/events/platform.d.ts +0 -18
  56. package/src/api/events/platform.js +0 -2
  57. package/src/api/events/system.d.ts +0 -22
  58. package/src/api/events/system.js +0 -2
  59. package/src/api/events/view.d.ts +0 -56
  60. package/src/api/events/view.js +0 -2
  61. package/src/api/events/webcontents.d.ts +0 -48
  62. package/src/api/events/webcontents.js +0 -2
  63. package/src/api/events/window.d.ts +0 -169
  64. package/src/api/events/window.js +0 -2
  65. package/src/api/platform/layout/shapes.d.ts +0 -11
  66. package/src/api/platform/layout/shapes.js +0 -2
  67. package/src/api/system/application.d.ts +0 -6
  68. package/src/api/system/application.js +0 -2
  69. package/src/api/system/entity.d.ts +0 -11
  70. package/src/api/system/entity.js +0 -2
  71. package/src/api/system/installedApps.d.ts +0 -6
  72. package/src/api/system/installedApps.js +0 -2
  73. package/src/api/system/log.d.ts +0 -11
  74. package/src/api/system/log.js +0 -2
  75. package/src/api/system/process.d.ts +0 -15
  76. package/src/api/system/process.js +0 -2
  77. package/src/api/system/proxy.d.ts +0 -15
  78. package/src/api/system/proxy.js +0 -2
  79. package/src/api/system/queryPermissionTypes.d.ts +0 -1
  80. package/src/api/system/queryPermissionTypes.js +0 -2
  81. package/src/api/system/registry-info.d.ts +0 -7
  82. package/src/api/system/registry-info.js +0 -2
  83. package/src/api/system/window.d.ts +0 -16
  84. package/src/api/system/window.js +0 -2
  85. package/src/shapes/ERROR_BOX_TYPES.d.ts +0 -6
  86. package/src/shapes/ERROR_BOX_TYPES.js +0 -10
  87. package/src/shapes/EntityType.d.ts +0 -1
  88. package/src/shapes/EntityType.js +0 -2
  89. package/src/shapes/LayoutPresetType.d.ts +0 -1
  90. package/src/shapes/LayoutPresetType.js +0 -2
  91. package/src/shapes/Platform.d.ts +0 -112
  92. package/src/shapes/Platform.js +0 -16
  93. package/src/shapes/WebOptions.d.ts +0 -12
  94. package/src/shapes/WebOptions.js +0 -2
  95. package/src/shapes/WindowOptions.d.ts +0 -42
  96. package/src/shapes/WindowOptions.js +0 -2
  97. package/src/shapes/protocol.d.ts +0 -178
  98. package/src/shapes/protocol.js +0 -2
package/README.md CHANGED
@@ -18,14 +18,18 @@ To install, run:
18
18
 
19
19
  ## Usage
20
20
 
21
- The `fin` export is the primary API entry point. Type definitions are defined in the package's default export. The exported `inOpenFin` boolean is true if the `fin` API is available in the current context.
21
+ The `fin` export is the primary API entry point. Type definitions are defined in the package's default export.
22
+
23
+ The static `fin.me` object contains some information about the current runtime environment even if imported outside of an OpenFin setting. In this case, the `isOpenFin` property of `fin.me` will be `false`. Outside of OpenFin environments, OpenFin API calls will nullop and throw an error.
22
24
 
23
25
  ```typescript
24
- import OpenFin, { fin, inOpenFin } from "@openfin/core";
26
+ import OpenFin, { fin } from "@openfin/core";
25
27
 
26
28
  const showWindow = async (identity: OpenFin.Identity) => {
27
29
  const win = await fin.Window.wrap(identity);
28
30
  await win.show();
31
+
32
+ const isOpenFin = fin.me.isOpenFin; // false if not in OpenFin
29
33
  }
30
34
  ```
31
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "25.68.26",
3
+ "version": "25.68.29",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -27,7 +27,6 @@
27
27
  "sinon": "~1.17.6"
28
28
  },
29
29
  "dependencies": {
30
- "lodash": "^4.17.21",
31
- "ws": "^7.3.0"
30
+ "lodash": "^4.17.21"
32
31
  }
33
32
  }
@@ -1,6 +1,6 @@
1
1
  import { EmitterBase } from '../base';
2
2
  import Transport from '../../transport/transport';
3
- import { ApplicationEvents } from '../events/application';
3
+ import ApplicationEvents = OpenFin.ApplicationEvents;
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>.
@@ -259,7 +259,7 @@ export declare class Application extends EmitterBase<ApplicationEvents> {
259
259
  */
260
260
  setAppLogUsername(username: string): Promise<void>;
261
261
  /**
262
- * @summary Retrieves information about the system tray.
262
+ * @summary Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
263
263
  * @desc The only information currently returned is the position and dimensions.
264
264
  * @return {Promise.<TrayInfo>}
265
265
  * @tutorial Application.getTrayIconInfo
@@ -355,7 +355,7 @@ class Application extends base_1.EmitterBase {
355
355
  await this.wire.sendAction('set-app-log-username', { data: username, ...this.identity });
356
356
  }
357
357
  /**
358
- * @summary Retrieves information about the system tray.
358
+ * @summary Retrieves information about the system tray. If the system tray is not set, it will throw an error message.
359
359
  * @desc The only information currently returned is the position and dimensions.
360
360
  * @return {Promise.<TrayInfo>}
361
361
  * @tutorial Application.getTrayIconInfo
package/src/api/base.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { EventEmitter } from 'events';
2
2
  import Transport from '../transport/transport';
3
- import { BaseEventMap } from './events/base';
4
3
  import Fin from './fin';
5
4
  import ApplicationIdentity = OpenFin.ApplicationIdentity;
6
5
  import Identity = OpenFin.Identity;
6
+ import BaseEventMap = OpenFin.BaseEventMap;
7
7
  export declare class Base {
8
8
  wire: Transport;
9
9
  constructor(wire: Transport);
@@ -1,4 +1,5 @@
1
- import { BaseEventMap, ApplicationEvent } from './base';
1
+ import ApplicationEvent = OpenFin.ApplicationEvent;
2
+ import BaseEventMap = OpenFin.BaseEventMap;
2
3
  export interface ChannelEvent<Type> extends ApplicationEvent<'channel', Type> {
3
4
  channelName: string;
4
5
  channelId: string;
@@ -1,5 +1,5 @@
1
- import { Message } from '../../transport/transport';
2
1
  import { EmitterMap } from './emitterMap';
2
+ import Message = OpenFin.Message;
3
3
  export default class EventAggregator extends EmitterMap {
4
4
  dispatchEvent: (message: Message<any>) => boolean;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { EmitterBase } from '../base';
2
2
  import Transport from '../../transport/transport';
3
- import { ExternalApplicationEvents } from '../events/externalApplication';
3
+ import ExternalApplicationEvents = OpenFin.ExternalApplicationEvents;
4
4
  /**
5
5
  * @classdesc An ExternalApplication object representing native language adapter connections to the runtime. Allows
6
6
  * the developer to listen to <a href="tutorial-ExternalApplication.EventEmitter.html">application events.</a>
package/src/api/fin.d.ts CHANGED
@@ -11,10 +11,10 @@ import _FrameModule from './frame/index';
11
11
  import GlobalHotkey from './global-hotkey/index';
12
12
  import ViewModule from './view/index';
13
13
  import PlatformModule from './platform/index';
14
- import { EntityType } from '../shapes/EntityType';
15
14
  import { Me } from './me';
16
15
  import InteropModule from './interop';
17
16
  import SnapshotSourceModule from './snapshot-source';
17
+ import EntityType = OpenFin.EntityType;
18
18
  export interface FinApi<MeType extends EntityType> {
19
19
  readonly System: System;
20
20
  readonly Window: _WindowModule;
@@ -1,6 +1,6 @@
1
1
  import { EmitterBase } from '../base';
2
2
  import Transport from '../../transport/transport';
3
- import { FrameEvents } from '../events/frame';
3
+ import FrameEvents = OpenFin.FrameEvents;
4
4
  /**
5
5
  * @classdesc
6
6
  * An iframe represents an embedded HTML page within a parent HTML page. Because this embedded page
@@ -1,6 +1,6 @@
1
1
  import { EmitterBase } from '../base';
2
2
  import Transport from '../../transport/transport';
3
- import { GlobalHotkeyEvents } from '../events/globalHotkey';
3
+ import GlobalHotkeyEvents = OpenFin.GlobalHotkeyEvents;
4
4
  /**
5
5
  * The GlobalHotkey module can register/unregister a global hotkeys.
6
6
  * @namespace
@@ -1,8 +1,8 @@
1
1
  import Transport from '../../../transport/transport';
2
2
  import ProviderIdentity = OpenFin.ProviderIdentity;
3
- export declare type ChannelAction = (payload: unknown, id: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
4
- export declare type ChannelMiddleware = (topic: string, payload: unknown, senderIdentity: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
5
- export declare type ErrorMiddleware = (topic: string, error: Error, id: ProviderIdentity | OpenFin.ClientIdentity) => unknown;
3
+ import ChannelMiddleware = OpenFin.ChannelMiddleware;
4
+ import ErrorMiddleware = OpenFin.ErrorMiddleware;
5
+ import ChannelAction = OpenFin.ChannelAction;
6
6
  export declare class ProtectedItems {
7
7
  providerIdentity: ProviderIdentity;
8
8
  wire: Transport;
@@ -1,10 +1,11 @@
1
1
  import ChannelClient from './client';
2
2
  import { ChannelProvider } from './provider';
3
3
  import { EmitterBase } from '../../base';
4
- import Transport, { Message } from '../../../transport/transport';
4
+ import Transport from '../../../transport/transport';
5
5
  import { ChannelEvents } from '../../events/channel';
6
6
  import ProviderIdentity = OpenFin.ProviderIdentity;
7
7
  import Identity = OpenFin.Identity;
8
+ import Message = OpenFin.Message;
8
9
  export interface ChannelMessage extends Message<any> {
9
10
  senderIdentity: Identity;
10
11
  ackToSender: any;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import { Base } from '../base';
4
- import Transport, { Message } from '../../transport/transport';
4
+ import Transport from '../../transport/transport';
5
5
  import { Channel } from './channel/index';
6
+ import Message = OpenFin.Message;
6
7
  /**
7
8
  * A messaging bus that allows for pub/sub messaging between different applications.
8
9
  * @namespace
package/src/api/me.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { EntityType } from '../shapes/EntityType';
2
1
  import Transport from '../transport/transport';
3
2
  import type { InteropClient } from './interop';
3
+ import EntityType = OpenFin.EntityType;
4
4
  export declare type EntityTypeHelpers<T extends EntityType> = T extends 'view' ? {
5
5
  isView: true;
6
6
  isWindow: false;
@@ -3,7 +3,7 @@ import { EmitterBase } from '../base';
3
3
  import { Channel } from '../interappbus/channel/index';
4
4
  import ChannelClient from '../interappbus/channel/client';
5
5
  import { LayoutModule } from './layout';
6
- import { PlatformEvents } from '../events/platform';
6
+ import PlatformEvents = OpenFin.PlatformEvents;
7
7
  /** Manages the life cycle of windows and views in the application.
8
8
  *
9
9
  * Enables taking snapshots of itself and applying them to restore a previous configuration
@@ -10,7 +10,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.Platform = void 0;
11
11
  const base_1 = require("../base");
12
12
  const validate_1 = require("../../util/validate");
13
- const Platform_1 = require("../../shapes/Platform");
14
13
  // Reuse clients to avoid overwriting already-registered client in provider
15
14
  const clientMap = new Map();
16
15
  /** Manages the life cycle of windows and views in the application.
@@ -98,7 +97,7 @@ class Platform extends base_1.EmitterBase {
98
97
  });
99
98
  const client = await this.getClient();
100
99
  if (!options.reason) {
101
- options.reason = Platform_1.WindowCreationReason.APICall;
100
+ options.reason = 'api-call';
102
101
  }
103
102
  const response = await client.dispatch('create-view-container', options);
104
103
  if (!response || validate_1.validateIdentity(response.identity)) {
@@ -1,4 +1,4 @@
1
- import { LayoutPresetType } from '../../shapes/LayoutPresetType';
1
+ import LayoutPresetType = OpenFin.LayoutPresetType;
2
2
  export declare function isValidPresetType(type: LayoutPresetType): type is LayoutPresetType;
3
3
  declare const _default: {
4
4
  isValidPresetType: typeof isValidPresetType;
@@ -1,6 +1,6 @@
1
- import { InitLayoutOptions } from './shapes';
2
1
  import { Layout } from './Instance';
3
2
  import { Base } from '../../base';
3
+ import InitLayoutOptions = OpenFin.InitLayoutOptions;
4
4
  /**
5
5
  * InitLayoutOptions interface
6
6
  * @typedef { object } InitLayoutOptions
@@ -15,6 +15,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
15
15
  var _layoutManager;
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.LayoutModule = void 0;
18
+ /* eslint-disable no-undef, import/prefer-default-export */
18
19
  const Instance_1 = require("./Instance");
19
20
  const base_1 = require("../../base");
20
21
  /**
@@ -1,7 +1,8 @@
1
1
  import Transport from '../../../transport/transport';
2
- import { InitLayoutOptions, PresetLayoutOptions } from './shapes';
3
2
  import { Base } from '../../base';
4
3
  import Identity = OpenFin.Identity;
4
+ import InitLayoutOptions = OpenFin.InitLayoutOptions;
5
+ import PresetLayoutOptions = OpenFin.PresetLayoutOptions;
5
6
  /**
6
7
  * @lends Platform#Layout
7
8
  */
@@ -1,3 +1,2 @@
1
1
  export * from './Factory';
2
2
  export * from './Instance';
3
- export * from './shapes';
@@ -12,4 +12,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./Factory"), exports);
14
14
  __exportStar(require("./Instance"), exports);
15
- __exportStar(require("./shapes"), exports);
@@ -1,15 +1,19 @@
1
1
  import { EmitterBase } from '../base';
2
- import { ApplicationInfo } from './application';
3
- import { WindowInfo } from './window';
4
- import { GetLogRequestType, LogInfo, LogLevel } from './log';
5
- import { ProxyInfo, ProxyConfig } from './proxy';
6
- import { ProcessInfo } from './process';
7
- import { Entity, EntityInfo } from './entity';
8
2
  import Transport from '../../transport/transport';
9
- import { RegistryInfo } from './registry-info';
10
- import { SystemEvents } from '../events/system';
11
- import { InstalledApps } from './installedApps';
12
3
  import Identity = OpenFin.Identity;
4
+ import ProxyInfo = OpenFin.ProxyInfo;
5
+ import ProxyConfig = OpenFin.ProxyConfig;
6
+ import SystemEvents = OpenFin.SystemEvents;
7
+ import InstalledApps = OpenFin.InstalledApps;
8
+ import LogInfo = OpenFin.LogInfo;
9
+ import LogLevel = OpenFin.LogLevel;
10
+ import GetLogRequestType = OpenFin.GetLogRequestType;
11
+ import ProcessInfo = OpenFin.ProcessInfo;
12
+ import RegistryInfo = OpenFin.RegistryInfo;
13
+ import EntityInfo = OpenFin.EntityInfo;
14
+ import Entity = OpenFin.Entity;
15
+ import WindowInfo = OpenFin.WindowInfo;
16
+ import SystemApplicationInfo = OpenFin.SystemApplicationInfo;
13
17
  /**
14
18
  * AppAssetInfo interface
15
19
  * @typedef { object } AppAssetInfo
@@ -27,8 +31,8 @@ import Identity = OpenFin.Identity;
27
31
  * @property { string } alias The name of the asset
28
32
  */
29
33
  /**
30
- * ApplicationInfo interface
31
- * @typedef { object } ApplicationInfo
34
+ * SystemApplicationInfo interface
35
+ * @typedef { object } SystemApplicationInfo
32
36
  * @property { boolean } isPlatform true when the application is a Platform controller
33
37
  * @property { boolean } isRunning true when the application is running
34
38
  * @property { string } uuid uuid of the application
@@ -612,10 +616,10 @@ export default class System extends EmitterBase<SystemEvents> {
612
616
  getAllWindows(): Promise<Array<WindowInfo>>;
613
617
  /**
614
618
  * Retrieves an array of data for all applications.
615
- * @return {Promise.Array.<ApplicationInfo>}
619
+ * @return {Promise.Array.<SystemApplicationInfo>}
616
620
  * @tutorial System.getAllApplications
617
621
  */
618
- getAllApplications(): Promise<Array<ApplicationInfo>>;
622
+ getAllApplications(): Promise<Array<SystemApplicationInfo>>;
619
623
  /**
620
624
  * Retrieves the command line argument string that started OpenFin Runtime.
621
625
  * @return {Promise.<string>}
@@ -20,8 +20,8 @@ const window_1 = require("../window");
20
20
  * @property { string } alias The name of the asset
21
21
  */
22
22
  /**
23
- * ApplicationInfo interface
24
- * @typedef { object } ApplicationInfo
23
+ * SystemApplicationInfo interface
24
+ * @typedef { object } SystemApplicationInfo
25
25
  * @property { boolean } isPlatform true when the application is a Platform controller
26
26
  * @property { boolean } isRunning true when the application is running
27
27
  * @property { string } uuid uuid of the application
@@ -666,7 +666,7 @@ class System extends base_1.EmitterBase {
666
666
  }
667
667
  /**
668
668
  * Retrieves an array of data for all applications.
669
- * @return {Promise.Array.<ApplicationInfo>}
669
+ * @return {Promise.Array.<SystemApplicationInfo>}
670
670
  * @tutorial System.getAllApplications
671
671
  */
672
672
  getAllApplications() {
@@ -1,7 +1,7 @@
1
1
  import { WebContents } from '../webcontents/main';
2
2
  import Transport from '../../transport/transport';
3
- import { ViewEvents } from '../events/view';
4
3
  import { Layout } from '../platform/layout';
4
+ import ViewEvents = OpenFin.ViewEvents;
5
5
  /**
6
6
  * @typedef {object} View~options
7
7
  * @summary View creation options.
@@ -1,6 +1,6 @@
1
1
  import { EmitterBase } from '../base';
2
2
  import Transport from '../../transport/transport';
3
- import { WebContentsEventMapping } from '../events/webcontents';
3
+ import WebContentsEventMapping = OpenFin.WebContentsEventMapping;
4
4
  declare type ImageFormat = 'bmp' | 'jpg' | 'png';
5
5
  export interface CapturePageOptions {
6
6
  area?: OpenFin.Rectangle;
@@ -1,7 +1,7 @@
1
1
  import Transport from '../../transport/transport';
2
- import { WindowEvents } from '../events/window';
3
2
  import { WebContents } from '../webcontents/main';
4
3
  import { WindowInfo } from './shapes';
4
+ import WindowEvents = OpenFin.WindowEvents;
5
5
  /**
6
6
  * @typedef { object } Margins
7
7
  * @property { string } [marginType]
@@ -802,7 +802,7 @@ export declare class _Window extends WebContents<WindowEvents> {
802
802
  * @return {object}
803
803
  * @tutorial Window.getWebWindow
804
804
  */
805
- getWebWindow(): Window;
805
+ getWebWindow(): globalThis.Window;
806
806
  /**
807
807
  * Determines if the window is a main window.
808
808
  * @return {boolean}
@@ -916,7 +916,7 @@ export declare class _Window extends WebContents<WindowEvents> {
916
916
  * @return {Promise.<void>}
917
917
  * @tutorial Window.updateOptions
918
918
  */
919
- updateOptions(options: Partial<OpenFin.WindowUpdatableOptions>): Promise<void>;
919
+ updateOptions(options: OpenFin.UpdateableWindowOptions): Promise<void>;
920
920
  /**
921
921
  * Provides credentials to authentication requests
922
922
  * @param { string } userName userName to provide to the authentication challenge
@@ -1,5 +1,7 @@
1
- import { NewConnectConfig } from '../transport/wire';
2
- import { EntityType } from '../shapes/EntityType';
1
+ import NewConnectConfig = OpenFin.NewConnectConfig;
2
+ import ChildContentOptions = OpenFin.ChildContentOptions;
3
+ import EntityType = OpenFin.EntityType;
4
+ export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";
3
5
  export interface Environment {
4
6
  getManagerConstructor(): Promise<any>;
5
7
  getProviderInitializer(): Promise<any>;
@@ -8,7 +10,7 @@ export interface Environment {
8
10
  getNextMessageId(): any;
9
11
  getRandomId(): string;
10
12
  createChildContent(options: ChildContentOptions): Promise<any>;
11
- getWebWindow(identity: OpenFin.Identity): Window;
13
+ getWebWindow(identity: OpenFin.Identity): globalThis.Window;
12
14
  getCurrentEntityIdentity(): OpenFin.EntityInfo;
13
15
  getCurrentEntityType(): EntityType;
14
16
  raiseEvent(eventName: string, eventArgs: any): void;
@@ -21,8 +23,3 @@ export interface Environment {
21
23
  getRtcPeer(): RTCPeerConnection;
22
24
  whenReady(): Promise<void>;
23
25
  }
24
- export interface ChildContentOptions {
25
- options: any;
26
- entityType: EntityType;
27
- }
28
- export declare const notImplementedEnvErrorMsg = "Not implemented in this environment";
@@ -1,6 +1,7 @@
1
- import { Environment, ChildContentOptions } from './environment';
2
- import { NewConnectConfig } from '../transport/wire';
3
- import { EntityType } from '../shapes/EntityType';
1
+ import { Environment } from './environment';
2
+ import NewConnectConfig = OpenFin.NewConnectConfig;
3
+ import EntityType = OpenFin.EntityType;
4
+ import ChildContentOptions = OpenFin.ChildContentOptions;
4
5
  export default class NodeEnvironment implements Environment {
5
6
  getDefaultChannelOptions(): {
6
7
  create: OpenFin.ChannelCreateOptions;
@@ -17,7 +18,7 @@ export default class NodeEnvironment implements Environment {
17
18
  getNextMessageId: () => any;
18
19
  getRandomId: () => string;
19
20
  createChildContent(options: ChildContentOptions): Promise<any>;
20
- getWebWindow: (identity: OpenFin.Identity) => Window;
21
+ getWebWindow: (identity: OpenFin.Identity) => globalThis.Window;
21
22
  getCurrentEntityIdentity: () => OpenFin.EntityInfo;
22
23
  getCurrentEntityType: () => EntityType;
23
24
  raiseEvent: (eventName: string, eventArgs: any) => void;
@@ -1,6 +1,7 @@
1
- import { Environment, ChildContentOptions } from './environment';
2
- import { NewConnectConfig } from '../transport/wire';
3
- import { EntityType } from '../shapes/EntityType';
1
+ import { Environment } from './environment';
2
+ import NewConnectConfig = OpenFin.NewConnectConfig;
3
+ import ChildContentOptions = OpenFin.ChildContentOptions;
4
+ import EntityType = OpenFin.EntityType;
4
5
  export default class OpenFinEnvironment implements Environment {
5
6
  #private;
6
7
  private raiseEventAsync;
@@ -20,7 +21,7 @@ export default class OpenFinEnvironment implements Environment {
20
21
  private normalizeOptions;
21
22
  getRandomId: () => string;
22
23
  private resolveUrl;
23
- getWebWindow: (identity: OpenFin.Identity) => Window;
24
+ getWebWindow: (identity: OpenFin.Identity) => globalThis.Window;
24
25
  getCurrentEntityIdentity: () => OpenFin.EntityInfo;
25
26
  getCurrentEntityType: () => EntityType;
26
27
  raiseEvent: (eventName: string, eventArgs: any) => void;
@@ -14,6 +14,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
14
14
  };
15
15
  var _ready;
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ /* global window, location */
18
+ /* eslint-disable class-methods-use-this */
17
19
  const transport_errors_1 = require("../transport/transport-errors");
18
20
  class OpenFinEnvironment {
19
21
  constructor() {
package/src/mock.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  /// <reference path="../OpenFin.d.ts" />
2
2
  export declare const fin: import("./api/fin").FinApi<"window" | "iframe" | "view">;
3
- export declare const inOpenFin: boolean;
4
3
  export default OpenFin;
package/src/mock.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.inOpenFin = exports.fin = void 0;
4
+ exports.fin = void 0;
5
5
  /* eslint-disable import/prefer-default-export */
6
6
  /* eslint-disable spaced-comment */
7
7
  /* eslint-disable @typescript-eslint/triple-slash-reference */
@@ -88,4 +88,3 @@ exports.fin = ((typeof window !== 'undefined' && ((_a = window) === null || _a =
88
88
  });
89
89
  return new fin_1.default(transport);
90
90
  })());
91
- exports.inOpenFin = typeof window !== 'undefined' && typeof window.fin === 'object';
@@ -1,6 +1,7 @@
1
+ import ReadyState = OpenFin.ReadyState;
1
2
  export declare class DisconnectedError extends Error {
2
- constructor(readyState: number);
3
- readyState: number;
3
+ constructor(readyState: ReadyState);
4
+ readyState: ReadyState;
4
5
  }
5
6
  export declare class UnexpectedActionError extends Error {
6
7
  }
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RuntimeError = exports.NotSupportedError = exports.NotImplementedError = exports.NoAckError = exports.DuplicateCorrelationError = exports.UnexpectedActionError = exports.DisconnectedError = void 0;
4
- /* eslint-disable max-classes-per-file */
5
- const wire_1 = require("./wire");
6
4
  class DisconnectedError extends Error {
7
5
  constructor(readyState) {
8
- super(`Expected websocket state OPEN but found ${wire_1.READY_STATE[readyState]}`);
6
+ super(`Expected websocket state OPEN but found ${readyState}`);
9
7
  this.readyState = readyState;
10
8
  }
11
9
  }
@@ -1,13 +1,17 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import { Wire, WireConstructor, READY_STATE, ExistingConnectConfig, InternalConnectConfig } from './wire';
4
- import { Environment } from '../environment/environment';
5
- import { RuntimeEvent } from '../api/events/base';
6
3
  import EventAggregator from '../api/events/eventAggregator';
7
4
  import { EntityTypeHelpers } from '../api/me';
8
- import { EntityType } from '../shapes/EntityType';
9
- import { ProtocolMap } from '../shapes/protocol';
10
- export declare type MessageHandler = (data: any) => boolean;
5
+ import { Environment } from '../environment/environment';
6
+ import EntityType = OpenFin.EntityType;
7
+ import Message = OpenFin.Message;
8
+ import Payload = OpenFin.Payload;
9
+ import ProtocolMap = OpenFin.ProtocolMap;
10
+ import MessageHandler = OpenFin.MessageHandler;
11
+ import Wire = OpenFin.Wire;
12
+ import WireConstructor = OpenFin.WireConstructor;
13
+ import InternalConnectConfig = OpenFin.InternalConnectConfig;
14
+ import ExistingConnectConfig = OpenFin.ExistingConnectConfig;
11
15
  declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
12
16
  #private;
13
17
  protected wireListeners: Map<number, {
@@ -27,7 +31,6 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
27
31
  shutdown(): Promise<void>;
28
32
  connect(config: InternalConnectConfig): Promise<string | void>;
29
33
  connectByPort(config: ExistingConnectConfig): Promise<string>;
30
- READY_STATE: typeof READY_STATE;
31
34
  sendAction<T extends keyof ProtocolMap = string>(action: T, payload?: ProtocolMap[T]['request'], uncorrelated?: boolean): Promise<Message<{
32
35
  data: ProtocolMap[T]['response'];
33
36
  } & ProtocolMap[T]['specialResponse']>>;
@@ -38,20 +41,3 @@ declare class Transport<MeType extends EntityType = EntityType> extends EventEmi
38
41
  protected handleMessage(data: Message<Payload>): boolean;
39
42
  }
40
43
  export default Transport;
41
- export interface Message<T> {
42
- action: string;
43
- payload: T;
44
- correlationId?: number;
45
- }
46
- export interface EventMessage extends Message<RuntimeEvent> {
47
- action: 'process-desktop-event';
48
- payload: RuntimeEvent;
49
- }
50
- export interface Payload {
51
- success: boolean;
52
- data: any;
53
- }
54
- export interface AuthorizationPayload {
55
- token: string;
56
- file: string;
57
- }
@@ -39,20 +39,6 @@ class Transport extends events_1.EventEmitter {
39
39
  const wire = __classPrivateFieldGet(this, _wire);
40
40
  return wire.wire.url.split(':').slice(-1)[0];
41
41
  };
42
- /* `READY_STATE` is an instance var set by `constructor` to reference the `WebTransportSocket.READY_STATE` enum.
43
- * This is syntactic sugar that makes the enum accessible through the `wire` property of the various `fin` singletons.
44
- * For example, `fin.system.wire.READY_STATE` is a shortcut to `fin.system.wire.wire.constructor.READY_STATE`.
45
- * However it is accessed, the enum is useful for interrogating the state of the web socket on send failure.
46
- * The `err.readyState` value is passed to the `reject` handler of the promise returned by either of
47
- * `sendAction` or `ferryAction`, and hence all the API methods in the various `fin` singletons that call them.
48
- * The enum can be used in two distinct ways by the `reject` handler (using `fin.System.getVersion` by way of example):
49
- * 1. State name by state value:
50
- * fin.system.getVersion().catch(err => { console.log('State:', fin.system.wire.READY_STATE[err.readyState]); });
51
- * 2. State value by state name:
52
- * fin.system.getVersion().catch(err => { console.log('Closed:', err.readyState === fin.system.wire.READY_STATE.CLOSED); });
53
- * Note that `reject` is called when and only when `readyState` is not `OPEN`.
54
- */
55
- this.READY_STATE = wire_1.READY_STATE;
56
42
  __classPrivateFieldSet(this, _wire, new WireType(this.onmessage.bind(this)));
57
43
  this.environment = environment;
58
44
  this.sendRaw = __classPrivateFieldGet(this, _wire).send.bind(__classPrivateFieldGet(this, _wire));