@openfin/core 30.73.5 → 30.73.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.
Files changed (158) hide show
  1. package/OpenFin.d.ts +1 -1729
  2. package/fin.d.ts +3 -4
  3. package/package.json +1 -1
  4. package/src/GlobalOpenFin.d.ts +4 -0
  5. package/src/OpenFin.d.ts +2938 -0
  6. package/src/OpenFin.js +4 -0
  7. package/src/api/application/Factory.d.ts +2 -0
  8. package/src/api/application/Factory.js +4 -3
  9. package/src/api/application/Instance.d.ts +3 -1
  10. package/src/api/application/Instance.js +1 -0
  11. package/src/api/application/index.js +7 -3
  12. package/src/api/base.d.ts +19 -15
  13. package/src/api/base.js +20 -22
  14. package/src/api/clipboard/index.d.ts +2 -0
  15. package/src/api/clipboard/index.js +1 -0
  16. package/src/api/events/application.d.ts +66 -56
  17. package/src/api/events/base.d.ts +33 -15
  18. package/src/api/events/channel.d.ts +13 -8
  19. package/src/api/events/eventAggregator.js +1 -9
  20. package/src/api/events/externalApplication.d.ts +10 -5
  21. package/src/api/events/frame.d.ts +13 -7
  22. package/src/api/events/globalHotkey.d.ts +11 -10
  23. package/src/api/events/platform.d.ts +10 -16
  24. package/src/api/events/system.d.ts +48 -18
  25. package/src/api/events/typedEventEmitter.d.ts +20 -0
  26. package/src/api/events/typedEventEmitter.js +2 -0
  27. package/src/api/events/view.d.ts +38 -54
  28. package/src/api/events/webcontents.d.ts +55 -28
  29. package/src/api/events/window.d.ts +148 -134
  30. package/src/api/external-application/Factory.d.ts +1 -0
  31. package/src/api/external-application/Instance.d.ts +2 -1
  32. package/src/api/external-application/index.js +7 -3
  33. package/src/api/fin.d.ts +3 -1
  34. package/src/api/fin.js +2 -2
  35. package/src/api/frame/Factory.d.ts +1 -0
  36. package/src/api/frame/Factory.js +2 -2
  37. package/src/api/frame/Instance.d.ts +3 -1
  38. package/src/api/frame/index.js +7 -3
  39. package/src/api/global-hotkey/index.d.ts +2 -2
  40. package/src/api/global-hotkey/index.js +6 -0
  41. package/src/api/interappbus/channel/channel.d.ts +6 -4
  42. package/src/api/interappbus/channel/channels-docs.d.ts +22 -0
  43. package/src/api/interappbus/channel/channels-docs.js +22 -0
  44. package/src/api/interappbus/channel/client.d.ts +2 -1
  45. package/src/api/interappbus/channel/client.js +24 -26
  46. package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
  47. package/src/api/interappbus/channel/connection-manager.js +30 -28
  48. package/src/api/interappbus/channel/index.d.ts +6 -4
  49. package/src/api/interappbus/channel/index.js +34 -19
  50. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +3 -1
  51. package/src/api/interappbus/channel/protocols/classic/strategy.js +21 -22
  52. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  53. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
  54. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +3 -1
  55. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +25 -27
  56. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
  57. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +3 -1
  58. package/src/api/interappbus/channel/protocols/rtc/strategy.js +29 -31
  59. package/src/api/interappbus/channel/protocols/strategy.d.ts +3 -1
  60. package/src/api/interappbus/channel/provider.d.ts +8 -4
  61. package/src/api/interappbus/channel/provider.js +140 -139
  62. package/src/api/interappbus/index.js +1 -1
  63. package/src/api/interop/Factory.d.ts +2 -0
  64. package/src/api/interop/Factory.js +20 -2
  65. package/src/api/interop/InteropBroker.d.ts +62 -39
  66. package/src/api/interop/InteropBroker.js +114 -55
  67. package/src/api/interop/InteropClient.d.ts +9 -0
  68. package/src/api/interop/InteropClient.js +46 -40
  69. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
  70. package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
  71. package/src/api/interop/SessionContextGroupClient.js +22 -24
  72. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +9 -7
  73. package/src/api/interop/fdc3/PrivateChannelClient.js +6 -6
  74. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
  75. package/src/api/interop/fdc3/fdc3-1.2.d.ts +14 -13
  76. package/src/api/interop/fdc3/fdc3-1.2.js +3 -14
  77. package/src/api/interop/fdc3/fdc3-2.0.d.ts +24 -21
  78. package/src/api/interop/fdc3/fdc3-2.0.js +27 -27
  79. package/src/api/interop/fdc3/fdc3.d.ts +12 -0
  80. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  81. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  82. package/src/api/interop/fdc3/shapes/fdc3v1.d.ts +53 -0
  83. package/src/api/interop/fdc3/shapes/fdc3v1.js +4 -0
  84. package/src/api/interop/fdc3/shapes/fdc3v2.d.ts +75 -0
  85. package/src/api/interop/fdc3/shapes/fdc3v2.js +2 -0
  86. package/src/api/interop/fdc3/utils.d.ts +15 -5
  87. package/src/api/interop/fdc3/utils.js +29 -11
  88. package/src/api/interop/fdc3/versions.d.ts +1 -0
  89. package/src/api/interop/fdc3/versions.js +2 -0
  90. package/src/api/interop/index.js +7 -3
  91. package/src/api/interop/utils.d.ts +2 -0
  92. package/src/api/interop/utils.js +29 -15
  93. package/src/api/me.d.ts +3 -1
  94. package/src/api/platform/Factory.d.ts +6 -0
  95. package/src/api/platform/Factory.js +14 -5
  96. package/src/api/platform/Instance.d.ts +18 -3
  97. package/src/api/platform/Instance.js +30 -13
  98. package/src/api/platform/common-utils.d.ts +2 -1
  99. package/src/api/platform/index.js +7 -3
  100. package/src/api/platform/layout/Factory.d.ts +7 -1
  101. package/src/api/platform/layout/Factory.js +22 -20
  102. package/src/api/platform/layout/Instance.d.ts +6 -4
  103. package/src/api/platform/layout/Instance.js +2 -3
  104. package/src/api/platform/layout/controllers/splitter-controller.js +1 -1
  105. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
  106. package/src/api/platform/layout/controllers/tab-drag-controller.js +1 -1
  107. package/src/api/platform/layout/index.js +7 -3
  108. package/src/api/platform/layout/shapes.d.ts +3 -1
  109. package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
  110. package/src/api/platform/layout/utils/bounds-observer.js +7 -5
  111. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
  112. package/src/api/platform/provider.d.ts +162 -0
  113. package/src/api/platform/provider.js +2 -0
  114. package/src/api/snapshot-source/Factory.d.ts +2 -0
  115. package/src/api/snapshot-source/Factory.js +2 -1
  116. package/src/api/snapshot-source/Instance.d.ts +1 -0
  117. package/src/api/snapshot-source/Instance.js +33 -35
  118. package/src/api/snapshot-source/index.js +7 -3
  119. package/src/api/snapshot-source/utils.d.ts +1 -0
  120. package/src/api/snapshot-source/utils.js +2 -1
  121. package/src/api/system/index.d.ts +76 -16
  122. package/src/api/system/index.js +127 -3
  123. package/src/api/view/Factory.d.ts +1 -0
  124. package/src/api/view/Factory.js +2 -2
  125. package/src/api/view/Instance.d.ts +17 -3
  126. package/src/api/view/Instance.js +20 -0
  127. package/src/api/view/index.js +7 -3
  128. package/src/api/webcontents/main.d.ts +20 -5
  129. package/src/api/webcontents/main.js +10 -0
  130. package/src/api/window/Factory.d.ts +1 -0
  131. package/src/api/window/Factory.js +2 -2
  132. package/src/api/window/Instance.d.ts +26 -3
  133. package/src/api/window/Instance.js +26 -1
  134. package/src/api/window/index.js +7 -3
  135. package/src/browser.d.ts +4 -4
  136. package/src/environment/browser.d.ts +3 -1
  137. package/src/environment/environment.d.ts +3 -1
  138. package/src/environment/node-env.d.ts +3 -1
  139. package/src/environment/node-env.js +2 -2
  140. package/src/environment/openfin-env.d.ts +3 -1
  141. package/src/environment/openfin-env.js +15 -17
  142. package/src/fdc3.d.ts +3 -0
  143. package/src/fdc3.js +1 -1
  144. package/src/mock.d.ts +2 -2
  145. package/src/mock.js +3 -3
  146. package/src/namespaces.d.ts +21 -0
  147. package/src/namespaces.js +24 -0
  148. package/src/shapes/WebOptions.d.ts +1 -0
  149. package/src/shapes/WindowOptions.d.ts +1 -0
  150. package/src/shapes/protocol.d.ts +34 -26
  151. package/src/transport/transport.d.ts +6 -5
  152. package/src/transport/transport.js +26 -28
  153. package/src/transport/wire.d.ts +9 -7
  154. package/src/util/http.d.ts +1 -1
  155. package/src/util/http.js +16 -11
  156. package/src/util/inaccessibleObject.d.ts +2 -0
  157. package/src/util/inaccessibleObject.js +49 -0
  158. package/src/util/normalize-config.js +5 -5
package/src/OpenFin.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const snapshot_source_1 = require("./api/snapshot-source");
4
+ const window_1 = require("./api/window");
@@ -1,5 +1,7 @@
1
+ import type * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
4
+ * @PORTED
3
5
  * @typedef {object} ApplicationOptions
4
6
  * @summary Application creation options.
5
7
  * @desc This is the options object required by {@link Application.start Application.start}.
@@ -4,6 +4,7 @@ const base_1 = require("../base");
4
4
  const validate_1 = require("../../util/validate");
5
5
  const Instance_1 = require("./Instance");
6
6
  /**
7
+ * @PORTED
7
8
  * @typedef {object} ApplicationOptions
8
9
  * @summary Application creation options.
9
10
  * @desc This is the options object required by {@link Application.start Application.start}.
@@ -89,7 +90,7 @@ class ApplicationModule extends base_1.Base {
89
90
  this.wire.sendAction('wrap-application').catch((e) => {
90
91
  // we do not want to expose this error, just continue if this analytics-only call fails
91
92
  });
92
- const errorMsg = validate_1.validateIdentity(identity);
93
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
93
94
  if (errorMsg) {
94
95
  throw new Error(errorMsg);
95
96
  }
@@ -106,7 +107,7 @@ class ApplicationModule extends base_1.Base {
106
107
  this.wire.sendAction('wrap-application-sync').catch((e) => {
107
108
  // we do not want to expose this error, just continue if this analytics-only call fails
108
109
  });
109
- const errorMsg = validate_1.validateIdentity(identity);
110
+ const errorMsg = (0, validate_1.validateIdentity)(identity);
110
111
  if (errorMsg) {
111
112
  throw new Error(errorMsg);
112
113
  }
@@ -202,7 +203,7 @@ class ApplicationModule extends base_1.Base {
202
203
  // we do not want to expose this error, just continue if this analytics-only call fails
203
204
  });
204
205
  const app = await this._createFromManifest(manifestUrl);
205
- // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
206
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
206
207
  // @ts-ignore using private method without warning.
207
208
  await app._run(opts); // eslint-disable-line no-underscore-dangle
208
209
  return app;
@@ -1,3 +1,4 @@
1
+ import type * as OpenFin from '../../OpenFin';
1
2
  import { EmitterBase } from '../base';
2
3
  import Transport from '../../transport/transport';
3
4
  /**
@@ -6,7 +7,7 @@ import Transport from '../../transport/transport';
6
7
  * @class
7
8
  * @hideconstructor
8
9
  */
9
- export declare class Application extends EmitterBase<OpenFin.ApplicationEvents> {
10
+ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
10
11
  identity: OpenFin.ApplicationIdentity;
11
12
  _manifestUrl?: string;
12
13
  private window;
@@ -101,6 +102,7 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvents>
101
102
  * @property { JumpListItem[] } items Array of JumpListItem objects
102
103
  */
103
104
  /**
105
+ * @PORTED
104
106
  * JumpListItem interface
105
107
  * @typedef { object } JumpListItem
106
108
  * @property { string } type One of the following: "task" or "separator". Defaults to task.
@@ -119,6 +119,7 @@ class Application extends base_1.EmitterBase {
119
119
  * @property { JumpListItem[] } items Array of JumpListItem objects
120
120
  */
121
121
  /**
122
+ * @PORTED
122
123
  * JumpListItem interface
123
124
  * @typedef { object } JumpListItem
124
125
  * @property { string } type One of the following: "task" or "separator". Defaults to task.
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- }
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  const Factory_1 = require("./Factory");
14
18
  __exportStar(require("./Instance"), exports);
package/src/api/base.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
3
  import Transport from '../transport/transport';
4
+ import type * as OpenFin from '../OpenFin';
4
5
  import Fin from './fin';
5
- import { BaseEventMap } from './events/base';
6
- import ApplicationIdentity = OpenFin.ApplicationIdentity;
7
- import Identity = OpenFin.Identity;
6
+ import { BaseEvent, EventHandler } from './events/base';
7
+ declare type ApplicationIdentity = OpenFin.ApplicationIdentity;
8
+ declare type Identity = OpenFin.Identity;
8
9
  export declare class Base {
9
10
  wire: Transport;
10
11
  constructor(wire: Transport);
@@ -14,27 +15,29 @@ export declare class Base {
14
15
  protected isOpenFinEnvironment: () => boolean;
15
16
  protected isBrowserEnvironment: () => boolean;
16
17
  }
17
- export declare class EmitterBase<EventTypes extends BaseEventMap> extends Base {
18
+ export declare class EmitterBase<EmitterEvent extends BaseEvent, EmitterEventType extends EmitterEvent['type'] = EmitterEvent['type']> extends Base {
18
19
  #private;
19
20
  private topic;
20
21
  protected identity: ApplicationIdentity;
21
22
  constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
22
23
  eventNames: () => (string | symbol)[];
23
- emit: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventName: E, payload: E extends Extract<keyof EventTypes, string> ? EventTypes[E] : any, ...args: any[]) => boolean;
24
+ emit: <EventType extends EmitterEventType>(eventType: EventType, payload: Extract<EmitterEvent, {
25
+ type: EventType;
26
+ }>, ...args: any[]) => boolean;
24
27
  private hasEmitter;
25
28
  private getOrCreateEmitter;
26
29
  listeners: (type: string | symbol) => Function[];
27
30
  listenerCount: (type: string | symbol) => number;
28
- protected registerEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
29
- protected deregisterEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
30
- on<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions): Promise<this>;
31
- addListener: <E extends string | symbol | Extract<keyof EventTypes, string>>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions) => Promise<this>;
32
- once<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions): Promise<this>;
33
- prependListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions): Promise<this>;
34
- prependOnceListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions): Promise<this>;
35
- removeListener<E extends Extract<keyof EventTypes, string> | string | symbol>(eventType: E, listener: (payload: E extends keyof EventTypes ? EventTypes[E] : any, ...args: any[]) => void, options?: OpenFin.SubscriptionOptions): Promise<this>;
36
- protected deregisterAllListeners(eventType: Extract<keyof EventTypes, string> | string | symbol): Promise<EventEmitter | void>;
37
- removeAllListeners(eventType?: Extract<keyof EventTypes, string> | string | symbol): Promise<this>;
31
+ protected registerEventListener: (eventType: EmitterEventType, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
32
+ protected deregisterEventListener: (eventType: EmitterEventType, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
33
+ on<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
34
+ addListener: <EventType extends EmitterEventType>(eventType: EventType, listener: OpenFin.BaseEvents.EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions) => Promise<this>;
35
+ once<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
36
+ prependListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
37
+ prependOnceListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
38
+ removeListener<EventType extends EmitterEventType>(eventType: EventType, listener: EventHandler<EmitterEvent, EventType>, options?: OpenFin.SubscriptionOptions): Promise<this>;
39
+ protected deregisterAllListeners(eventType: EmitterEventType): Promise<EventEmitter | void>;
40
+ removeAllListeners(eventType?: EmitterEventType): Promise<this>;
38
41
  private deleteEmitterIfNothingRegistered;
39
42
  }
40
43
  export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
@@ -43,3 +46,4 @@ export declare class Reply<TOPIC extends string, TYPE extends string | void> imp
43
46
  uuid: string;
44
47
  name: string;
45
48
  }
49
+ export {};
package/src/api/base.js CHANGED
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) {
3
- if (!privateMap.has(receiver)) {
4
- throw new TypeError("attempted to set private field on non-instance");
5
- }
6
- privateMap.set(receiver, value);
7
- return value;
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ 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
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
8
7
  };
9
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) {
10
- if (!privateMap.has(receiver)) {
11
- throw new TypeError("attempted to get private field on non-instance");
12
- }
13
- return privateMap.get(receiver);
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);
14
12
  };
15
- var _emitterAccessor;
13
+ var _EmitterBase_emitterAccessor;
16
14
  Object.defineProperty(exports, "__esModule", { value: true });
17
15
  exports.Reply = exports.EmitterBase = exports.Base = void 0;
18
16
  const promises_1 = require("../util/promises");
@@ -31,7 +29,7 @@ class Base {
31
29
  this.wire = wire;
32
30
  }
33
31
  get fin() {
34
- return fin_store_1.getFin(this.wire);
32
+ return (0, fin_store_1.getFin)(this.wire);
35
33
  }
36
34
  get me() {
37
35
  return this.wire.me;
@@ -42,13 +40,13 @@ class EmitterBase extends Base {
42
40
  constructor(wire, topic, ...additionalAccessors) {
43
41
  super(wire);
44
42
  this.topic = topic;
45
- _emitterAccessor.set(this, void 0);
43
+ _EmitterBase_emitterAccessor.set(this, void 0);
46
44
  this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
47
- this.emit = (eventName, payload, ...args) => {
48
- return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventName, payload, ...args) : false;
45
+ this.emit = (eventType, payload, ...args) => {
46
+ return this.hasEmitter() ? this.getOrCreateEmitter().emit(eventType, payload, ...args) : false;
49
47
  };
50
- this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _emitterAccessor));
51
- this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _emitterAccessor));
48
+ this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
49
+ this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
52
50
  this.listeners = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(type) : [];
53
51
  this.listenerCount = (type) => this.hasEmitter() ? this.getOrCreateEmitter().listenerCount(type) : 0;
54
52
  this.registerEventListener = async (eventType, options = {}, applySubscription, undoSubscription) => {
@@ -87,7 +85,7 @@ class EmitterBase extends Base {
87
85
  return Promise.resolve();
88
86
  };
89
87
  this.addListener = this.on;
90
- __classPrivateFieldSet(this, _emitterAccessor, [topic, ...additionalAccessors]);
88
+ __classPrivateFieldSet(this, _EmitterBase_emitterAccessor, [topic, ...additionalAccessors], "f");
91
89
  this.listeners = (event) => this.hasEmitter() ? this.getOrCreateEmitter().listeners(event) : [];
92
90
  }
93
91
  async on(eventType, listener, options) {
@@ -163,18 +161,18 @@ class EmitterBase extends Base {
163
161
  }
164
162
  else if (this.hasEmitter()) {
165
163
  const events = this.getOrCreateEmitter().eventNames();
166
- await promises_1.promiseMap(events, removeByEvent);
164
+ await (0, promises_1.promiseMap)(events, removeByEvent);
167
165
  }
168
166
  return this;
169
167
  }
170
168
  deleteEmitterIfNothingRegistered(emitter) {
171
169
  if (emitter.eventNames().length === 0) {
172
- this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _emitterAccessor));
170
+ this.wire.eventAggregator.delete(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
173
171
  }
174
172
  }
175
173
  }
176
174
  exports.EmitterBase = EmitterBase;
177
- _emitterAccessor = new WeakMap();
175
+ _EmitterBase_emitterAccessor = new WeakMap();
178
176
  class Reply {
179
177
  }
180
178
  exports.Reply = Reply;
@@ -1,5 +1,7 @@
1
+ import type * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
4
+ * @PORTED
3
5
  * WriteRequestType interface
4
6
  * @typedef { object } WriteRequestType
5
7
  * @property { string } data Data to be written
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const base_1 = require("../base");
4
4
  /**
5
+ * @PORTED
5
6
  * WriteRequestType interface
6
7
  * @typedef { object } WriteRequestType
7
8
  * @property { string } data Data to be written
@@ -1,69 +1,79 @@
1
- import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
2
- import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents, WindowPerformanceReport } from './window';
3
- import { PropagatedViewEvents } from './view';
4
- export interface CrashedEvent {
1
+ import type * as OpenFin from '../../OpenFin';
2
+ import { IdentityEvent, NamedEvent, PropagatedEvent } from './base';
3
+ import { PropagatedWindowEvent } from './window';
4
+ import { PropagatedViewEvent } from './view';
5
+ export declare type CrashedEvent = NamedEvent & {
6
+ type: 'crashed';
5
7
  reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
6
8
  exitCode: number;
7
9
  details: {
8
10
  reason: string;
9
11
  exitCode: number;
10
12
  };
11
- }
12
- export interface RunRequestedEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
13
- userAppConfigArgs: any;
13
+ };
14
+ export declare type RunRequestedEvent = IdentityEvent & {
15
+ type: 'run-requested';
16
+ userAppConfigArgs: Record<string, any>;
14
17
  manifest: OpenFin.ManifestInfo;
15
- }
16
- export interface TrayIconClicked<Topic, Type> extends ApplicationEvent<Topic, Type> {
18
+ };
19
+ export declare type TrayIconClickedEvent = IdentityEvent & {
20
+ type: 'tray-icon-clicked';
17
21
  button: 0 | 1 | 2;
18
22
  bounds: OpenFin.Rectangle;
19
23
  x: number;
20
24
  y: number;
21
25
  monitorInfo: any;
22
- }
23
- export interface ApplicationEventMapping<Topic = string, Type = string> extends BaseEventMap {
24
- 'closed': ApplicationEvent<Topic, Type>;
25
- 'connected': ApplicationEvent<Topic, Type>;
26
- 'crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
27
- 'initialized': ApplicationEvent<Topic, Type>;
28
- 'manifest-changed': ApplicationEvent<Topic, Type>;
29
- 'not-responding': ApplicationEvent<Topic, Type>;
30
- 'responding': ApplicationEvent<Topic, Type>;
31
- 'run-requested': RunRequestedEvent<Topic, Type>;
32
- 'started': ApplicationEvent<Topic, Type>;
33
- 'tray-icon-clicked': TrayIconClicked<Topic, Type>;
34
- 'window-alert-requested': WindowAlertRequestedEvent<Topic, Type>;
35
- 'window-auth-requested': WindowAuthRequestedEvent<Topic, Type>;
36
- 'window-created': WindowEvent<Topic, Type>;
37
- 'window-end-load': WindowEndLoadEvent<Topic, Type>;
38
- 'window-not-responding': WindowEvent<Topic, Type>;
39
- 'window-performance-report': WindowPerformanceReport<Topic, Type>;
40
- 'window-responding': WindowEvent<Topic, Type>;
41
- 'window-show-requested': WindowEvent<Topic, Type>;
42
- 'window-start-load': WindowEvent<Topic, Type>;
43
- }
44
- export interface PropagatedApplicationEventMapping<Topic = string, Type = string> {
45
- 'application-closed': ApplicationEvent<Topic, Type>;
46
- 'application-connected': ApplicationEvent<Topic, Type>;
47
- 'application-crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
48
- 'application-initialized': ApplicationEvent<Topic, Type>;
49
- 'application-manifest-changed': ApplicationEvent<Topic, Type>;
50
- 'application-not-responding': ApplicationEvent<Topic, Type>;
51
- 'application-responding': ApplicationEvent<Topic, Type>;
52
- 'application-started': ApplicationEvent<Topic, Type>;
53
- 'application-tray-icon-clicked': TrayIconClicked<Topic, Type>;
54
- 'window-created': WindowEvent<Topic, Type>;
55
- 'window-did-change-theme-color': WindowEvent<Topic, Type>;
56
- 'window-end-load': WindowEndLoadEvent<Topic, Type>;
57
- 'window-not-responding': WindowEvent<Topic, Type>;
58
- 'window-page-favicon-updated': WindowEvent<Topic, Type>;
59
- 'window-page-title-updated': WindowEvent<Topic, Type>;
60
- 'window-performance-report': WindowPerformanceReport<Topic, Type>;
61
- 'window-responding': WindowEvent<Topic, Type>;
62
- 'window-start-load': WindowEvent<Topic, Type>;
63
- }
64
- export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
65
- [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
66
- };
67
- export declare type PropagatedApplicationEvents<Topic> = {
68
- [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping<Topic, Type>[Type];
69
26
  };
27
+ export declare type WindowAlertRequestedEvent = NamedEvent & {
28
+ type: 'window-alert-requested';
29
+ };
30
+ export declare type WindowCreatedEvent = NamedEvent & {
31
+ type: 'window-created';
32
+ };
33
+ export declare type WindowEndLoadEvent = NamedEvent & {
34
+ type: 'window-end-load';
35
+ };
36
+ export declare type WindowNotRespondingEvent = NamedEvent & {
37
+ type: 'window-not-responding';
38
+ };
39
+ export declare type WindowRespondingEvent = NamedEvent & {
40
+ type: 'window-responding';
41
+ };
42
+ export declare type WindowStartLoadEvent = NamedEvent & {
43
+ type: 'window-start-load';
44
+ };
45
+ /**
46
+ * A Window event that is natively published at the Application level (not Window).
47
+ */
48
+ export declare type ApplicationWindowEvent = WindowAlertRequestedEvent | WindowCreatedEvent | WindowEndLoadEvent | WindowNotRespondingEvent | WindowRespondingEvent | WindowStartLoadEvent;
49
+ export declare type ClosedEvent = IdentityEvent & {
50
+ type: 'closed';
51
+ };
52
+ export declare type ApplicationConnectedEvent = IdentityEvent & {
53
+ type: 'connected';
54
+ };
55
+ export declare type InitializedEvent = IdentityEvent & {
56
+ type: 'initialized';
57
+ };
58
+ export declare type ManifestChangedEvent = IdentityEvent & {
59
+ type: 'manifest-changed';
60
+ };
61
+ export declare type NotRespondingEvent = IdentityEvent & {
62
+ type: 'not-responding';
63
+ };
64
+ export declare type RespondingEvent = IdentityEvent & {
65
+ type: 'responding';
66
+ };
67
+ export declare type StartedEvent = IdentityEvent & {
68
+ type: 'started';
69
+ };
70
+ /**
71
+ * An Application event that does propagate to (republish on) parent topics.
72
+ */
73
+ export declare type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent;
74
+ export declare type ApplicationEvent = {
75
+ topic: 'application';
76
+ } & (PropagatedViewEvent | PropagatedWindowEvent | ApplicationWindowEvent | WillPropagateApplicationEvent);
77
+ export declare type ApplicationEventType = ApplicationEvent['type'];
78
+ export declare type PropagatedApplicationEvent = PropagatedEvent<'application', WillPropagateApplicationEvent> | ApplicationWindowEvent;
79
+ export declare type PropagatedApplicationEventType = PropagatedApplicationEvent['type'];
@@ -1,17 +1,35 @@
1
- import { FrameEvent } from './frame';
2
- export declare type RuntimeEvent<Topic = string, Type = string> = Topic extends 'window' | 'view' ? WindowEvent<Topic, Type> : Topic extends 'frame' ? FrameEvent<Type> : Topic extends 'application' ? ApplicationEvent<Topic, Type> : BaseEvent<Topic, Type>;
3
- export interface BaseEvent<Topic, Type> {
4
- topic: Topic;
5
- type: Type;
6
- }
7
- export interface ApplicationEvent<Topic, Type> extends BaseEvent<Topic, Type> {
1
+ import type * as OpenFin from '../../OpenFin';
2
+ /**
3
+ * Modifies an event key to reflect propagation by prefixing with the topic.
4
+ */
5
+ export declare type PropagatedEventType<Topic extends string, Type extends string> = `${Topic}-${Type}`;
6
+ /**
7
+ * Modifies an event shape to reflect propagation to a parent topic. The 'type' field
8
+ * is prefixed with the original topic, and a new property is added with the original topic's identity.
9
+ */
10
+ export declare type PropagatedEvent<Topic extends string, Event extends {
11
+ type: string;
12
+ }> = Event extends infer E extends {
13
+ type: string;
14
+ } ? Omit<E, 'type'> & {
15
+ type: PropagatedEventType<Topic, E['type']>;
16
+ } & {
17
+ [topic in `${Topic}Identity`]: OpenFin.Identity;
18
+ } : never;
19
+ /**
20
+ * Handler for an event on an EventEmitter; selects the correct type for the event
21
+ * payload from the provided union based on the provided string literal type.
22
+ */
23
+ export declare type EventHandler<EmitterEvent extends BaseEvent, EventType extends string> = (payload: Extract<EmitterEvent, {
24
+ type: EventType;
25
+ }>, ...args: any[]) => void;
26
+ export declare type BaseEvent = {
27
+ topic: string;
28
+ type: string;
29
+ };
30
+ export declare type IdentityEvent = BaseEvent & {
8
31
  uuid: string;
9
- }
10
- export interface WindowEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
32
+ };
33
+ export declare type NamedEvent = IdentityEvent & {
11
34
  name: string;
12
- }
13
- export interface BaseEventMap {
14
- [name: string]: any;
15
- newListener: string;
16
- listenerRemoved: string;
17
- }
35
+ };
@@ -1,10 +1,15 @@
1
- import { BaseEventMap, ApplicationEvent } from './base';
2
- export interface ChannelEvent<Type> extends ApplicationEvent<'channel', Type> {
1
+ import { NamedEvent } from './base';
2
+ export declare type BaseChannelEvent = NamedEvent & {
3
3
  channelName: string;
4
4
  channelId: string;
5
- name: string;
6
- }
7
- export interface ChannelEvents extends BaseEventMap {
8
- connected: ChannelEvent<'connected'>;
9
- disconnected: ChannelEvent<'disconnected'>;
10
- }
5
+ };
6
+ export declare type ChannelConnectedEvent = BaseChannelEvent & {
7
+ type: 'connected';
8
+ };
9
+ export declare type ChannelDisconnectedEvent = BaseChannelEvent & {
10
+ type: 'disconnected';
11
+ };
12
+ export declare type ChannelEvent = {
13
+ topic: 'channel';
14
+ } & (ChannelConnectedEvent | ChannelDisconnectedEvent);
15
+ export declare type ChannelEventType = ChannelEvent['type'];
@@ -6,11 +6,7 @@ function isEventMessage(message) {
6
6
  }
7
7
  function mapKeyFromEvent(event) {
8
8
  const { topic } = event;
9
- if (topic === 'frame') {
10
- const { uuid, name } = event;
11
- return [topic, uuid, name];
12
- }
13
- if (topic === 'window') {
9
+ if (topic === 'frame' || topic === 'window' || topic === 'view') {
14
10
  const { uuid, name } = event;
15
11
  return [topic, uuid, name];
16
12
  }
@@ -18,10 +14,6 @@ function mapKeyFromEvent(event) {
18
14
  const { uuid } = event;
19
15
  return [topic, uuid];
20
16
  }
21
- if (topic === 'view') {
22
- const { uuid, name } = event;
23
- return [topic, uuid, name];
24
- }
25
17
  return [topic];
26
18
  }
27
19
  class EventAggregator extends emitterMap_1.EmitterMap {
@@ -1,5 +1,10 @@
1
- import { RuntimeEvent, BaseEventMap } from './base';
2
- export interface ExternalApplicationEvents extends BaseEventMap {
3
- connected: RuntimeEvent<'externalapplication', 'connected'>;
4
- disconnected: RuntimeEvent<'externalapplication', 'disconnected'>;
5
- }
1
+ import { BaseEvent } from './base';
2
+ export declare type ExternalApplicationConnectedEvent = BaseEvent & {
3
+ type: 'connected';
4
+ };
5
+ export declare type ExternalApplicationDisconnectedEvent = BaseEvent & {
6
+ type: 'disconnected';
7
+ };
8
+ export declare type ExternalApplicationEvent = {
9
+ topic: 'externalapplication';
10
+ } & (ExternalApplicationConnectedEvent | ExternalApplicationDisconnectedEvent);
@@ -1,9 +1,15 @@
1
- import { BaseEventMap, WindowEvent } from './base';
2
- export interface FrameEvent<Type> extends WindowEvent<'frame', Type> {
1
+ import { NamedEvent } from './base';
2
+ export declare type BaseFrameEvent = NamedEvent & {
3
3
  entityType: 'iframe';
4
4
  frameName: string;
5
- }
6
- export interface FrameEvents extends BaseEventMap {
7
- connected: FrameEvent<'connected'>;
8
- disconnected: FrameEvent<'disconnected'>;
9
- }
5
+ };
6
+ export declare type FrameConnectedEvent = BaseFrameEvent & {
7
+ type: 'connected';
8
+ };
9
+ export declare type FrameDisconnectedEvent = BaseFrameEvent & {
10
+ type: 'disconnected';
11
+ };
12
+ export declare type FrameEvent = {
13
+ topic: 'frame';
14
+ } & (FrameConnectedEvent | FrameDisconnectedEvent);
15
+ export declare type FrameEventType = FrameEvent['type'];
@@ -1,10 +1,11 @@
1
- import { RuntimeEvent, BaseEventMap } from './base';
2
- import Identity = OpenFin.Identity;
3
- export interface GlobalHotkeyEvent<Type> extends RuntimeEvent<'global-hotkey', Type> {
4
- identity: Identity;
5
- hotkey: string;
6
- }
7
- export interface GlobalHotkeyEvents extends BaseEventMap {
8
- registered: GlobalHotkeyEvent<'registered'>;
9
- unregistered: GlobalHotkeyEvent<'unregistered'>;
10
- }
1
+ import { BaseEvent } from './base';
2
+ export declare type RegisteredEvent = BaseEvent & {
3
+ type: 'registered';
4
+ };
5
+ export declare type UnregisteredEvent = BaseEvent & {
6
+ type: 'unregistered';
7
+ };
8
+ export declare type GlobalHotkeyEvent = {
9
+ topic: 'global-hotkey';
10
+ hotkey: 'string';
11
+ } & (RegisteredEvent | UnregisteredEvent);
@@ -1,18 +1,12 @@
1
- import { ApplicationEvent } from './base';
2
- import { PropagatedWindowEvents } from './window';
3
- import { PropagatedViewEvents } from './view';
4
- import { ApplicationEventMapping, PropagatedApplicationEventMapping } from './application';
5
- export interface PlatformEventMapping<Topic = string, Type = string> extends ApplicationEventMapping {
6
- 'platform-api-ready': ApplicationEvent<Topic, Type>;
7
- 'platform-snapshot-applied': ApplicationEvent<Topic, Type>;
8
- }
9
- export interface PropagatedPlatformEventMapping<Topic = string, Type = string> extends PropagatedApplicationEventMapping {
10
- 'platform-api-ready': ApplicationEvent<Topic, Type>;
11
- 'platform-snapshot-applied': ApplicationEvent<Topic, Type>;
12
- }
13
- export declare type PlatformEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
14
- [Type in keyof PlatformEventMapping]: PlatformEventMapping<'application', Type>[Type];
1
+ import { BaseEvent } from './base';
2
+ import { PropagatedViewEvent } from './view';
3
+ import { PropagatedWindowEvent } from './window';
4
+ export declare type PlatformApiReadyEvent = BaseEvent & {
5
+ type: 'platform-api-ready';
15
6
  };
16
- export declare type PropagatedPlatformEvents<Topic> = {
17
- [Type in keyof PropagatedPlatformEventMapping]: PropagatedPlatformEventMapping<Topic, Type>[Type];
7
+ export declare type PlatformSnapshotAppliedEvent = BaseEvent & {
8
+ type: 'platform-snapshot-applied';
18
9
  };
10
+ export declare type PlatformEvent = {
11
+ topic: 'platform';
12
+ } & (PropagatedWindowEvent | PropagatedViewEvent | PlatformApiReadyEvent | PlatformSnapshotAppliedEvent);