@openfin/core 31.74.31 → 32.75.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/src/OpenFin.d.ts +58 -13
  3. package/src/api/application/Instance.d.ts +13 -1
  4. package/src/api/application/Instance.js +39 -7
  5. package/src/api/base.d.ts +1 -2
  6. package/src/api/base.js +1 -2
  7. package/src/api/events/application.d.ts +4 -1
  8. package/src/api/events/system.d.ts +6 -3
  9. package/src/api/events/webcontents.d.ts +54 -5
  10. package/src/api/fin.js +1 -2
  11. package/src/api/interappbus/channel/client.d.ts +2 -2
  12. package/src/api/interappbus/channel/index.d.ts +4 -3
  13. package/src/api/interappbus/channel/index.js +111 -74
  14. package/src/api/interappbus/channel/protocols/classic/strategy.js +24 -6
  15. package/src/api/interappbus/index.js +1 -1
  16. package/src/api/interop/InteropClient.d.ts +1 -1
  17. package/src/api/interop/InteropClient.js +1 -1
  18. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -1
  19. package/src/api/interop/SessionContextGroupBroker.js +5 -4
  20. package/src/api/interop/SessionContextGroupClient.js +1 -1
  21. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -1
  22. package/src/api/interop/fdc3/PrivateChannelProvider.js +1 -8
  23. package/src/api/interop/fdc3/fdc3-1.2.js +34 -1
  24. package/src/api/interop/fdc3/utils.js +24 -4
  25. package/src/api/me.d.ts +1 -1
  26. package/src/api/me.js +2 -1
  27. package/src/api/platform/Factory.d.ts +3 -3
  28. package/src/api/platform/Factory.js +2 -11
  29. package/src/api/platform/Instance.d.ts +5 -4
  30. package/src/api/platform/Instance.js +2 -1
  31. package/src/api/platform/layout/Factory.d.ts +1 -1
  32. package/src/api/platform/layout/Factory.js +7 -39
  33. package/src/api/platform/layout/Instance.js +3 -0
  34. package/src/api/platform/layout/controllers/layout-entities-controller.d.ts +6 -2
  35. package/src/api/platform/layout/controllers/layout-entities-controller.js +40 -8
  36. package/src/api/platform/layout/entities/layout-entities.d.ts +143 -42
  37. package/src/api/platform/layout/entities/layout-entities.js +151 -43
  38. package/src/api/platform/layout/utils/layout-traversal.d.ts +1 -0
  39. package/src/api/platform/layout/utils/layout-traversal.js +11 -11
  40. package/src/api/platform/provider.d.ts +2 -1
  41. package/src/api/system/index.d.ts +9 -0
  42. package/src/api/system/index.js +78 -40
  43. package/src/api/view/Instance.d.ts +6 -3
  44. package/src/api/view/Instance.js +10 -9
  45. package/src/api/webcontents/main.d.ts +2 -22
  46. package/src/api/webcontents/main.js +2 -1
  47. package/src/api/window/Instance.d.ts +10 -0
  48. package/src/api/window/Instance.js +22 -0
  49. package/src/environment/browser.d.ts +4 -2
  50. package/src/environment/browser.js +5 -2
  51. package/src/environment/environment.d.ts +4 -2
  52. package/src/environment/mockEnvironment.d.ts +27 -0
  53. package/src/environment/mockEnvironment.js +61 -0
  54. package/src/environment/node-env.d.ts +3 -2
  55. package/src/environment/node-env.js +5 -2
  56. package/src/environment/openfin-env.d.ts +5 -3
  57. package/src/environment/openfin-env.js +12 -10
  58. package/src/mock.js +4 -83
  59. package/src/shapes/protocol.d.ts +26 -9
  60. package/src/transport/mockWire.d.ts +11 -0
  61. package/src/transport/mockWire.js +26 -0
  62. package/src/transport/transport-errors.d.ts +9 -1
  63. package/src/transport/transport-errors.js +45 -2
  64. package/src/transport/transport.d.ts +16 -5
  65. package/src/transport/transport.js +48 -20
  66. package/src/util/channel-api-relay.js +11 -1
  67. package/src/util/errors.d.ts +1 -0
  68. package/src/util/errors.js +1 -0
  69. package/src/util/lazy.d.ts +18 -0
  70. package/src/util/lazy.js +29 -1
  71. package/src/util/ref-counter.d.ts +1 -1
  72. package/src/util/ref-counter.js +3 -2
  73. package/src/api/platform/layout/controllers/splitter-controller.d.ts +0 -30
  74. package/src/api/platform/layout/controllers/splitter-controller.js +0 -83
  75. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +0 -58
  76. package/src/api/platform/layout/controllers/tab-drag-controller.js +0 -124
  77. package/src/api/platform/layout/utils/bounds-observer.d.ts +0 -19
  78. package/src/api/platform/layout/utils/bounds-observer.js +0 -52
  79. package/src/api/platform/layout/utils/view-overlay.d.ts +0 -35
  80. package/src/api/platform/layout/utils/view-overlay.js +0 -49
  81. package/src/transport/fin_store.d.ts +0 -4
  82. package/src/transport/fin_store.js +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "31.74.31",
3
+ "version": "32.75.1",
4
4
  "license": "SEE LICENSE IN LICENSE.MD",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
package/src/OpenFin.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- import type { Application } from './api/application';
1
+ import type { Application } from './api/application/index';
2
2
  import { AppVersionEvent } from './api/events/system';
3
3
  import { TypedEventEmitter } from './api/events/typedEventEmitter';
4
- import type { ExternalApplication } from './api/external-application';
4
+ import type { ExternalApplication } from './api/external-application/index';
5
5
  import { FinApi } from './api/fin';
6
- import type { _Frame } from './api/frame';
6
+ import type { _Frame } from './api/frame/index';
7
7
  import type ChannelClient from './api/interappbus/channel/client';
8
- import { MessagingProtocols } from './api/interappbus/channel/protocols';
8
+ import { MessagingProtocols } from './api/interappbus/channel/protocols/index';
9
9
  import type { ChannelProvider } from './api/interappbus/channel/provider';
10
- import type { InteropBroker, InteropClient } from './api/interop';
11
- import type { Platform } from './api/platform';
12
- import type { Layout } from './api/platform/layout';
13
- import type { ColumnOrRow, TabStack } from './api/platform/layout/entities/layout-entities';
10
+ import type { InteropBroker, InteropClient } from './api/interop/index';
11
+ import type { Platform } from './api/platform/index';
12
+ import type { Layout } from './api/platform/layout/index';
14
13
  import { PlatformProvider } from './api/platform/provider';
15
- import { SnapshotSource } from './api/snapshot-source';
16
- import type { View } from './api/view';
17
- import { _Window } from './api/window';
14
+ import { SnapshotSource } from './api/snapshot-source/index';
15
+ import type { View } from './api/view/index';
16
+ import { _Window } from './api/window/index';
17
+ import { ColumnOrRow, TabStack } from './api/platform/layout/entities/layout-entities';
18
18
  export type Fin<MeType extends EntityType = 'window' | 'view'> = FinApi<MeType>;
19
19
  export type { Application, ExternalApplication, _Frame as Frame, ChannelClient, ChannelProvider, Platform, Layout, View, ColumnOrRow, TabStack, _Window as Window, InteropClient, InteropBroker, SnapshotSource };
20
20
  export type { LayoutEntityDefinition, LayoutEntityTypes, LayoutPosition } from './api/platform/layout/entities/shapes';
@@ -246,7 +246,7 @@ export type DisplayMetadata = {
246
246
  */
247
247
  readonly glyph?: string;
248
248
  };
249
- export type LegacyWinOptionsInAppOptions = Pick<WindowCreationOptions, 'accelerator' | 'alwaysOnTop' | 'api' | 'aspectRatio' | 'autoplayPolicy' | 'autoShow' | 'backgroundColor' | 'contentNavigation' | 'contextMenu' | 'cornerRounding' | 'customData' | 'customRequestHeaders' | 'defaultCentered' | 'defaultHeight' | 'defaultLeft' | 'defaultTop' | 'defaultWidth' | 'frame' | 'hideOnClose' | 'icon' | 'maxHeight' | 'maximizable' | 'maxWidth' | 'minHeight' | 'minimizable' | 'minWidth' | 'opacity' | 'preloadScripts' | 'resizable' | 'resizeRegion' | 'saveWindowState' | 'ignoreSavedWindowState' | 'shadow' | 'showTaskbarIcon' | 'smallWindow' | 'state' | 'taskbarIconGroup' | 'waitForPageLoad'>;
249
+ export type LegacyWinOptionsInAppOptions = Pick<WindowCreationOptions, 'accelerator' | 'alwaysOnTop' | 'api' | 'aspectRatio' | 'autoplayPolicy' | 'autoShow' | 'backgroundColor' | 'contentNavigation' | 'contextMenu' | 'cornerRounding' | 'customData' | 'customRequestHeaders' | 'defaultCentered' | 'defaultHeight' | 'defaultLeft' | 'defaultTop' | 'defaultWidth' | 'frame' | 'hideOnClose' | 'icon' | 'maxHeight' | 'maximizable' | 'maxWidth' | 'minHeight' | 'minimizable' | 'minWidth' | 'opacity' | 'preloadScripts' | 'resizable' | 'resizeRegion' | 'saveWindowState' | 'ignoreSavedWindowState' | 'shadow' | 'showTaskbarIcon' | 'smallWindow' | 'state' | 'taskbarIconGroup' | 'waitForPageLoad' | '_internalWorkspaceData'>;
250
250
  export type Snapshot = {
251
251
  windows: WindowCreationOptions[];
252
252
  snapshotDetails?: {
@@ -794,6 +794,11 @@ export type MutableWindowOptions = {
794
794
  */
795
795
  showTaskbarIcon: boolean;
796
796
  interop: InteropConfig;
797
+ /**
798
+ * @internal
799
+ * Used by Workspace to store custom data. Overwriting or modifying this field may impact the functionality of Workspace
800
+ */
801
+ _internalWorkspaceData: any;
797
802
  workspacePlatform: WorkspacePlatformOptions;
798
803
  };
799
804
  export type WorkspacePlatformOptions = {
@@ -1193,6 +1198,11 @@ export type MutableViewOptions = {
1193
1198
  */
1194
1199
  preventDragOut: boolean;
1195
1200
  interop?: InteropConfig;
1201
+ /**
1202
+ * @internal
1203
+ * Used by Workspace to store custom data. Overwriting or modifying this field may impact the functionality of Workspace
1204
+ */
1205
+ _internalWorkspaceData: any;
1196
1206
  };
1197
1207
  /**
1198
1208
  * User-facing options for a view.
@@ -1423,6 +1433,7 @@ export type GetWindowContextPayload = {
1423
1433
  };
1424
1434
  export type ApplicationPermissions = {
1425
1435
  setFileDownloadLocation: boolean;
1436
+ getFileDownloadLocation: boolean;
1426
1437
  };
1427
1438
  export type LaunchExternalProcessRule = {
1428
1439
  behavior: 'allow' | 'block';
@@ -1913,6 +1924,7 @@ export type Margins = {
1913
1924
  * Options for printing a webpage in OpenFin.
1914
1925
  */
1915
1926
  export type PrintOptions = {
1927
+ content?: 'self';
1916
1928
  /**
1917
1929
  * Disables prompting the user for print settings.
1918
1930
  */
@@ -1956,7 +1968,7 @@ export type PrintOptions = {
1956
1968
  /**
1957
1969
  * Page range to print.
1958
1970
  */
1959
- pageRanges?: Record<'from' | 'to', number>;
1971
+ pageRanges?: Array<Record<'from' | 'to', number>>;
1960
1972
  /**
1961
1973
  * Duplex mode of the printed webpage.
1962
1974
  */
@@ -1966,6 +1978,14 @@ export type PrintOptions = {
1966
1978
  */
1967
1979
  dpi?: Dpi;
1968
1980
  };
1981
+ export type ScreenshotPrintOptions = {
1982
+ content: 'screenshot';
1983
+ };
1984
+ export type WindowViewsPrintOptions = {
1985
+ content: 'views';
1986
+ includeSelf?: boolean;
1987
+ };
1988
+ export type WindowPrintOptions = PrintOptions | ScreenshotPrintOptions | WindowViewsPrintOptions;
1969
1989
  /**
1970
1990
  * A request to write data to the clipboard.
1971
1991
  */
@@ -2233,6 +2253,7 @@ export type FindInPageResult = {
2233
2253
  export type FrameInfo = {
2234
2254
  name: string;
2235
2255
  uuid: string;
2256
+ url: string;
2236
2257
  entityType: EntityType;
2237
2258
  parent: Identity;
2238
2259
  };
@@ -2909,6 +2930,9 @@ export interface PopupResult<T = any> {
2909
2930
  data?: T;
2910
2931
  lastDispatchResult?: PopupResult;
2911
2932
  }
2933
+ export type SystemShutdownHandler = (shutdownEvent: {
2934
+ proceed: () => void;
2935
+ }) => void;
2912
2936
  export type AppVersionProgressEvent = {
2913
2937
  type: 'app-version-progress';
2914
2938
  } & AppVersionProgress;
@@ -2971,3 +2995,24 @@ export interface InteropActionLoggingOption {
2971
2995
  export type InteropLoggingActions = 'beforeAction' | 'afterAction';
2972
2996
  export type InteropLoggingOptions = Record<InteropLoggingActions, InteropActionLoggingOption>;
2973
2997
  export type { Me } from './api/me';
2998
+ /**
2999
+ * Configuration for page capture.
3000
+ */
3001
+ export interface CapturePageOptions {
3002
+ /**
3003
+ * The area of the window to be captured.
3004
+ */
3005
+ area?: Rectangle;
3006
+ /**
3007
+ * @defaultValue 'png'
3008
+ *
3009
+ * The format of the captured image. Can be 'png', 'jpg', or 'bmp'.
3010
+ */
3011
+ format?: 'bmp' | 'jpg' | 'png';
3012
+ /**
3013
+ * @defaultValue 100
3014
+ *
3015
+ * Quality of JPEG image. Between 0 - 100.
3016
+ */
3017
+ quality?: number;
3018
+ }
@@ -300,10 +300,22 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
300
300
  */
301
301
  getProcessInfo(): Promise<OpenFin.AppProcessInfo>;
302
302
  /**
303
- * Sets file auto download location.
303
+ * Sets file auto download location. It's only allowed in the same application.
304
+ * Note: This method is restricted by default and must be enabled via
305
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
304
306
  * @param { string } downloadLocation file auto download location
305
307
  * @return {Promise.<void>}
308
+ * @throws if setting file auto download location on different applications.
306
309
  * @tutorial Application.setFileDownloadLocation
307
310
  */
308
311
  setFileDownloadLocation(downloadLocation: string): Promise<void>;
312
+ /**
313
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
314
+ * Note: This method is restricted by default and must be enabled via
315
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
316
+ * @return {Promise.<string>}
317
+ * @throws if getting file auto download location on different applications.
318
+ * @tutorial Application.getFileDownloadLocation
319
+ */
320
+ getFileDownloadLocation(): Promise<string>;
309
321
  }
@@ -141,11 +141,26 @@ class Application extends base_1.EmitterBase {
141
141
  * @tutorial Application.quit
142
142
  */
143
143
  async quit(force = false) {
144
- await this._close(force);
145
- await this.wire.sendAction('destroy-application', { force, ...this.identity });
146
- }
147
- _close(force = false) {
148
- return this.wire.sendAction('close-application', { force, ...this.identity }).then(() => undefined);
144
+ try {
145
+ await this._close(force);
146
+ await this.wire.sendAction('destroy-application', { force, ...this.identity });
147
+ }
148
+ catch (error) {
149
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
150
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
151
+ throw error;
152
+ }
153
+ }
154
+ }
155
+ async _close(force = false) {
156
+ try {
157
+ await this.wire.sendAction('close-application', { force, ...this.identity });
158
+ }
159
+ catch (error) {
160
+ if (!error.message.includes('Remote connection has closed')) {
161
+ throw error;
162
+ }
163
+ }
149
164
  }
150
165
  close(force = false) {
151
166
  console.warn('Deprecation Warning: Application.close is deprecated Please use Application.quit');
@@ -409,13 +424,30 @@ class Application extends base_1.EmitterBase {
409
424
  return data;
410
425
  }
411
426
  /**
412
- * Sets file auto download location.
427
+ * Sets file auto download location. It's only allowed in the same application.
428
+ * Note: This method is restricted by default and must be enabled via
429
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
413
430
  * @param { string } downloadLocation file auto download location
414
431
  * @return {Promise.<void>}
432
+ * @throws if setting file auto download location on different applications.
415
433
  * @tutorial Application.setFileDownloadLocation
416
434
  */
417
435
  async setFileDownloadLocation(downloadLocation) {
418
- await this.wire.sendAction('set-file-download-location', { downloadLocation, ...this.identity });
436
+ const { name } = this.wire.me;
437
+ const entityIdentity = { uuid: this.identity.uuid, name };
438
+ await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
439
+ }
440
+ /**
441
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
442
+ * Note: This method is restricted by default and must be enabled via
443
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
444
+ * @return {Promise.<string>}
445
+ * @throws if getting file auto download location on different applications.
446
+ * @tutorial Application.getFileDownloadLocation
447
+ */
448
+ async getFileDownloadLocation() {
449
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
450
+ return data;
419
451
  }
420
452
  }
421
453
  exports.Application = Application;
package/src/api/base.d.ts CHANGED
@@ -2,14 +2,13 @@
2
2
  import { EventEmitter } from 'events';
3
3
  import { Transport } from '../transport/transport';
4
4
  import type * as OpenFin from '../OpenFin';
5
- import Fin from './fin';
6
5
  import { BaseEvent, EventHandler } from './events/base';
7
6
  type ApplicationIdentity = OpenFin.ApplicationIdentity;
8
7
  type Identity = OpenFin.Identity;
9
8
  export declare class Base {
10
9
  wire: Transport;
11
10
  constructor(wire: Transport);
12
- protected get fin(): Fin;
11
+ protected get fin(): OpenFin.Fin<OpenFin.EntityType>;
13
12
  get me(): Identity;
14
13
  protected isNodeEnvironment: () => boolean;
15
14
  protected isOpenFinEnvironment: () => boolean;
package/src/api/base.js CHANGED
@@ -14,7 +14,6 @@ var _EmitterBase_emitterAccessor;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.Reply = exports.EmitterBase = exports.Base = void 0;
16
16
  const promises_1 = require("../util/promises");
17
- const fin_store_1 = require("../transport/fin_store");
18
17
  class Base {
19
18
  constructor(wire) {
20
19
  this.isNodeEnvironment = () => {
@@ -29,7 +28,7 @@ class Base {
29
28
  this.wire = wire;
30
29
  }
31
30
  get fin() {
32
- return (0, fin_store_1.getFin)(this.wire);
31
+ return this.wire.getFin();
33
32
  }
34
33
  get me() {
35
34
  return this.wire.me;
@@ -11,6 +11,9 @@ export type CrashedEvent = NamedEvent & {
11
11
  exitCode: number;
12
12
  };
13
13
  };
14
+ export type FileDownloadLocationChangedEvent = NamedEvent & {
15
+ type: 'file-download-location-changed';
16
+ };
14
17
  export type RunRequestedEvent = IdentityEvent & {
15
18
  type: 'run-requested';
16
19
  userAppConfigArgs: Record<string, any>;
@@ -70,7 +73,7 @@ export type StartedEvent = IdentityEvent & {
70
73
  /**
71
74
  * An Application event that does propagate to (republish on) parent topics.
72
75
  */
73
- export type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent;
76
+ export type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent | FileDownloadLocationChangedEvent;
74
77
  export type ApplicationEvent = {
75
78
  topic: 'application';
76
79
  } & (PropagatedViewEvent | PropagatedWindowEvent | ApplicationWindowEvent | WillPropagateApplicationEvent);
@@ -1,6 +1,6 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { PropagatedApplicationEvent } from './application';
3
- import { BaseEvent } from './base';
3
+ import { BaseEvent, IdentityEvent } from './base';
4
4
  import { PropagatedViewEvent } from './view';
5
5
  import { PropagatedWindowEvent } from './window';
6
6
  import { AppVersionCompleteEvent, AppVersionErrorEvent, AppVersionProgressEvent, AppVersionRuntimeStatusEvent } from '../../OpenFin';
@@ -38,13 +38,16 @@ export type EventWithId<Event extends AppVersionEvent> = Event extends infer E e
38
38
  appVersionId: string;
39
39
  } : never;
40
40
  export type AppVersionEventWithId = EventWithId<AppVersionEvent>;
41
- export type ApplicationCreatedEvent = BaseEvent & {
41
+ export type ApplicationCreatedEvent = IdentityEvent & {
42
42
  type: 'application-created';
43
43
  };
44
44
  export type DesktopIconClickedEvent = BaseEvent & {
45
45
  type: 'desktop-icon-clicked';
46
46
  };
47
+ export type SystemShutdownEvent = BaseEvent & {
48
+ type: 'system-shutdown';
49
+ };
47
50
  export type SystemEvent = {
48
51
  topic: 'system';
49
- } & (ExcludeRequested<PropagatedWindowEvent> | PropagatedViewEvent | PropagatedApplicationEvent | ApplicationCreatedEvent | DesktopIconClickedEvent | IdleEvent | MonitorEvent | SessionChangedEvent | AppVersionEventWithId);
52
+ } & (ExcludeRequested<PropagatedWindowEvent> | PropagatedViewEvent | PropagatedApplicationEvent | ApplicationCreatedEvent | DesktopIconClickedEvent | IdleEvent | MonitorEvent | SessionChangedEvent | AppVersionEventWithId | SystemShutdownEvent);
50
53
  export type SystemEventType = SystemEvent['type'];
@@ -67,10 +67,6 @@ export type FoundInPageEvent = NamedEvent & {
67
67
  } & {
68
68
  result: OpenFin.FindInPageResult;
69
69
  };
70
- /**
71
- * A WebContents event that does not propagate to (republish on) parent topics.
72
- */
73
- export type NonPropagatedWebContentsEvent = FoundInPageEvent | CertificateErrorEvent;
74
70
  export type BlurredEvent = NamedEvent & {
75
71
  type: 'blurred';
76
72
  };
@@ -89,9 +85,62 @@ export type ChildContentOpenedInBrowserEvent = NamedEvent & {
89
85
  export type ChildViewCreatedEvent = NamedEvent & {
90
86
  type: 'child-view-created';
91
87
  };
88
+ export type FileDownloadEvent = NamedEvent & {
89
+ state: 'started' | 'progressing' | 'cancelled' | 'interrupted' | 'completed';
90
+ /**
91
+ * The url from which the file is being downloaded.
92
+ */
93
+ url: string;
94
+ mimeType: string;
95
+ /**
96
+ * Name used to save the file locally.
97
+ */
98
+ fileName: string;
99
+ /**
100
+ * Original name of the file.
101
+ */
102
+ originalFileName: string;
103
+ totalBytes: number;
104
+ /**
105
+ * The number of seconds since the UNIX epoch when the download was started.
106
+ */
107
+ startTime: number;
108
+ /**
109
+ * The value of the Content-Disposition field from the response header.
110
+ */
111
+ contentDisposition: string;
112
+ /**
113
+ * The value of the Last-Modified header.
114
+ */
115
+ lastModifiedTime: Date;
116
+ /**
117
+ * The value of the ETag header.
118
+ */
119
+ eTag: string;
120
+ /**
121
+ * The number of bytes of the item that have already been downloaded.
122
+ */
123
+ downloadedBytes: number;
124
+ };
125
+ export type FileDownloadStartedEvent = FileDownloadEvent & {
126
+ type: 'file-download-started';
127
+ state: 'started';
128
+ };
129
+ export type FileDownloadProgressEvent = FileDownloadEvent & {
130
+ type: 'file-download-progress';
131
+ state: 'progressing' | 'interrupted';
132
+ };
133
+ export type FileDownloadCompletedEvent = FileDownloadEvent & {
134
+ type: 'file-download-completed';
135
+ state: 'completed' | 'interrupted' | 'cancelled';
136
+ };
92
137
  /**
93
138
  * A WebContents event that does propagate to (republish on) parent topics.
94
139
  */
95
- export type WillPropagateWebContentsEvent = BlurredEvent | CertificateSelectionShownEvent | CrashedEvent | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | FaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent;
140
+ export type WillPropagateWebContentsEvent = BlurredEvent | CertificateSelectionShownEvent | CrashedEvent | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | FaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent;
141
+ /**
142
+ * A WebContents event that does not propagate to (republish on) parent topics.
143
+ */
144
+ export type NonPropagatedWebContentsEvent = FoundInPageEvent | CertificateErrorEvent;
96
145
  export type WebContentsEvent = NonPropagatedWebContentsEvent | WillPropagateWebContentsEvent;
97
146
  export {};
package/src/api/fin.js CHANGED
@@ -13,13 +13,11 @@ const index_8 = require("./global-hotkey/index");
13
13
  const index_9 = require("./view/index");
14
14
  const index_10 = require("./platform/index");
15
15
  const me_1 = require("./me");
16
- const fin_store_1 = require("../transport/fin_store");
17
16
  const interop_1 = require("./interop");
18
17
  const snapshot_source_1 = require("./snapshot-source");
19
18
  class Fin extends events_1.EventEmitter {
20
19
  constructor(wire) {
21
20
  super();
22
- (0, fin_store_1.registerFin)(wire, this);
23
21
  this.wire = wire;
24
22
  this.System = new index_1.default(wire);
25
23
  this.Window = new index_2.default(wire);
@@ -33,6 +31,7 @@ class Fin extends events_1.EventEmitter {
33
31
  this.View = new index_9.default(wire);
34
32
  this.Interop = new interop_1.default(wire);
35
33
  this.SnapshotSource = new snapshot_source_1.default(wire);
34
+ wire.registerFin(this);
36
35
  this.me = (0, me_1.getMe)(wire);
37
36
  // Handle disconnect events
38
37
  wire.on('disconnected', () => {
@@ -4,9 +4,9 @@ import { Transport } from '../../../transport/transport';
4
4
  import { AnyStrategy } from './protocols/strategy-types';
5
5
  type ProviderIdentity = OpenFin.ProviderIdentity;
6
6
  type DisconnectionListener = (providerIdentity: ProviderIdentity) => any;
7
- interface RoutingInfo extends ProviderIdentity {
7
+ export type RoutingInfo = ProviderIdentity & {
8
8
  endpointId: string;
9
- }
9
+ };
10
10
  export default class ChannelClient extends ChannelBase {
11
11
  #private;
12
12
  private disconnectListener;
@@ -1,9 +1,9 @@
1
1
  import type * as OpenFin from '../../../OpenFin';
2
- import ChannelClient from './client';
3
- import { ChannelProvider } from './provider';
2
+ import { Message, Transport } from '../../../transport/transport';
4
3
  import { EmitterBase } from '../../base';
5
- import { Transport, Message } from '../../../transport/transport';
6
4
  import { ChannelEvent } from '../../events/channel';
5
+ import ChannelClient from './client';
6
+ import { ChannelProvider } from './provider';
7
7
  type ProviderIdentity = OpenFin.ProviderIdentity;
8
8
  type Identity = OpenFin.Identity;
9
9
  export interface ChannelMessage extends Message<any> {
@@ -18,6 +18,7 @@ export declare class Channel extends EmitterBase<ChannelEvent> {
18
18
  getAllChannels(): Promise<ProviderIdentity[]>;
19
19
  onChannelConnect(listener: (...args: any[]) => void): Promise<void>;
20
20
  onChannelDisconnect(listener: (...args: any[]) => void): Promise<void>;
21
+ private safeConnect;
21
22
  connect(channelName: string, options?: OpenFin.ChannelConnectOptions): Promise<ChannelClient>;
22
23
  create(channelName: string, options?: OpenFin.ChannelCreateOptions): Promise<ChannelProvider>;
23
24
  }