@openfin/core 30.73.23 → 30.73.24

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 (77) hide show
  1. package/LICENSE.md +4 -0
  2. package/package.json +2 -2
  3. package/src/OpenFin.d.ts +1678 -188
  4. package/src/api/application/Factory.d.ts +1 -0
  5. package/src/api/application/Factory.js +1 -0
  6. package/src/api/application/Instance.d.ts +2 -1
  7. package/src/api/application/Instance.js +1 -0
  8. package/src/api/base.d.ts +16 -14
  9. package/src/api/base.js +2 -2
  10. package/src/api/clipboard/index.d.ts +1 -0
  11. package/src/api/clipboard/index.js +1 -0
  12. package/src/api/events/application.d.ts +65 -56
  13. package/src/api/events/base.d.ts +33 -15
  14. package/src/api/events/channel.d.ts +13 -8
  15. package/src/api/events/eventAggregator.js +1 -9
  16. package/src/api/events/externalApplication.d.ts +10 -5
  17. package/src/api/events/frame.d.ts +13 -7
  18. package/src/api/events/globalHotkey.d.ts +11 -12
  19. package/src/api/events/platform.d.ts +10 -16
  20. package/src/api/events/system.d.ts +41 -29
  21. package/src/api/events/typedEventEmitter.d.ts +15 -8
  22. package/src/api/events/view.d.ts +37 -54
  23. package/src/api/events/webcontents.d.ts +74 -28
  24. package/src/api/events/window.d.ts +147 -134
  25. package/src/api/external-application/Instance.d.ts +1 -1
  26. package/src/api/frame/Instance.d.ts +1 -1
  27. package/src/api/global-hotkey/index.d.ts +1 -3
  28. package/src/api/global-hotkey/index.js +6 -0
  29. package/src/api/interappbus/channel/channels-docs.d.ts +7 -0
  30. package/src/api/interappbus/channel/channels-docs.js +7 -0
  31. package/src/api/interappbus/channel/client.d.ts +2 -1
  32. package/src/api/interappbus/channel/client.js +12 -5
  33. package/src/api/interappbus/channel/index.d.ts +2 -2
  34. package/src/api/interappbus/channel/index.js +7 -7
  35. package/src/api/interappbus/channel/protocols/index.d.ts +3 -0
  36. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +10 -2
  37. package/src/api/interappbus/channel/protocols/rtc/strategy.js +1 -1
  38. package/src/api/interop/Factory.d.ts +1 -2
  39. package/src/api/interop/Factory.js +20 -4
  40. package/src/api/interop/InteropBroker.d.ts +15 -47
  41. package/src/api/interop/InteropBroker.js +33 -47
  42. package/src/api/interop/InteropClient.d.ts +9 -8
  43. package/src/api/interop/InteropClient.js +9 -8
  44. package/src/api/interop/fdc3/fdc3-1.2.js +8 -8
  45. package/src/api/interop/fdc3/fdc3-2.0.d.ts +1 -1
  46. package/src/api/interop/fdc3/fdc3-2.0.js +15 -7
  47. package/src/api/interop/fdc3/fdc3.d.ts +3 -4
  48. package/src/api/interop/fdc3/overrideCheck.d.ts +4 -0
  49. package/src/api/interop/fdc3/overrideCheck.js +32 -0
  50. package/src/api/interop/fdc3/versions.d.ts +1 -0
  51. package/src/api/interop/fdc3/versions.js +2 -0
  52. package/src/api/platform/Factory.d.ts +5 -0
  53. package/src/api/platform/Factory.js +9 -0
  54. package/src/api/platform/Instance.d.ts +7 -6
  55. package/src/api/platform/Instance.js +6 -3
  56. package/src/api/platform/layout/Factory.d.ts +4 -0
  57. package/src/api/platform/layout/Factory.js +4 -0
  58. package/src/api/platform/provider.d.ts +162 -0
  59. package/src/api/platform/provider.js +2 -0
  60. package/src/api/snapshot-source/Factory.d.ts +1 -0
  61. package/src/api/snapshot-source/Factory.js +1 -0
  62. package/src/api/system/index.d.ts +1 -2
  63. package/src/api/system/index.js +22 -6
  64. package/src/api/view/Instance.d.ts +8 -4
  65. package/src/api/view/Instance.js +7 -4
  66. package/src/api/webcontents/main.d.ts +19 -5
  67. package/src/api/webcontents/main.js +10 -0
  68. package/src/api/window/Instance.d.ts +21 -3
  69. package/src/api/window/Instance.js +22 -0
  70. package/src/namespaces.d.ts +21 -0
  71. package/src/namespaces.js +24 -0
  72. package/src/transport/transport-errors.d.ts +6 -1
  73. package/src/transport/transport-errors.js +1 -2
  74. package/src/transport/transport.d.ts +10 -7
  75. package/src/transport/transport.js +9 -1
  76. package/src/util/inaccessibleObject.d.ts +2 -0
  77. package/src/util/inaccessibleObject.js +49 -0
@@ -1,6 +1,7 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
3
  /**
4
+ * @PORTED
4
5
  * @typedef {object} ApplicationOptions
5
6
  * @summary Application creation options.
6
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}.
@@ -7,7 +7,7 @@ import Transport from '../../transport/transport';
7
7
  * @class
8
8
  * @hideconstructor
9
9
  */
10
- export declare class Application extends EmitterBase<OpenFin.ApplicationEvents> {
10
+ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
11
11
  identity: OpenFin.ApplicationIdentity;
12
12
  _manifestUrl?: string;
13
13
  private window;
@@ -102,6 +102,7 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvents>
102
102
  * @property { JumpListItem[] } items Array of JumpListItem objects
103
103
  */
104
104
  /**
105
+ * @PORTED
105
106
  * JumpListItem interface
106
107
  * @typedef { object } JumpListItem
107
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.
package/src/api/base.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- import type * as OpenFin from '../OpenFin';
4
3
  import Transport from '../transport/transport';
4
+ import type * as OpenFin from '../OpenFin';
5
5
  import Fin from './fin';
6
- import { BaseEventMap } from './events/base';
6
+ import { BaseEvent, EventHandler } from './events/base';
7
7
  declare type ApplicationIdentity = OpenFin.ApplicationIdentity;
8
8
  declare type Identity = OpenFin.Identity;
9
9
  export declare class Base {
@@ -15,27 +15,29 @@ export declare class Base {
15
15
  protected isOpenFinEnvironment: () => boolean;
16
16
  protected isBrowserEnvironment: () => boolean;
17
17
  }
18
- 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 {
19
19
  #private;
20
20
  private topic;
21
21
  protected identity: ApplicationIdentity;
22
22
  constructor(wire: Transport, topic: string, ...additionalAccessors: string[]);
23
23
  eventNames: () => (string | symbol)[];
24
- 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;
25
27
  private hasEmitter;
26
28
  private getOrCreateEmitter;
27
29
  listeners: (type: string | symbol) => Function[];
28
30
  listenerCount: (type: string | symbol) => number;
29
- protected registerEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options: OpenFin.SubscriptionOptions, applySubscription: (emitter: EventEmitter) => void, undoSubscription: (emitter: EventEmitter) => void) => Promise<void>;
30
- protected deregisterEventListener: (eventType: Extract<keyof EventTypes, string> | string | symbol, options?: OpenFin.SubscriptionOptions) => Promise<void | EventEmitter>;
31
- 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>;
32
- 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>;
33
- 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>;
34
- 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>;
35
- 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>;
36
- 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>;
37
- protected deregisterAllListeners(eventType: Extract<keyof EventTypes, string> | string | symbol): Promise<EventEmitter | void>;
38
- 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>;
39
41
  private deleteEmitterIfNothingRegistered;
40
42
  }
41
43
  export declare class Reply<TOPIC extends string, TYPE extends string | void> implements Identity {
package/src/api/base.js CHANGED
@@ -42,8 +42,8 @@ class EmitterBase extends Base {
42
42
  this.topic = topic;
43
43
  _EmitterBase_emitterAccessor.set(this, void 0);
44
44
  this.eventNames = () => (this.hasEmitter() ? this.getOrCreateEmitter().eventNames() : []);
45
- this.emit = (eventName, payload, ...args) => {
46
- 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;
47
47
  };
48
48
  this.hasEmitter = () => this.wire.eventAggregator.has(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
49
49
  this.getOrCreateEmitter = () => this.wire.eventAggregator.getOrCreate(__classPrivateFieldGet(this, _EmitterBase_emitterAccessor, "f"));
@@ -1,6 +1,7 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
2
  import { Base } from '../base';
3
3
  /**
4
+ * @PORTED
4
5
  * WriteRequestType interface
5
6
  * @typedef { object } WriteRequestType
6
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,70 +1,79 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
- import { ApplicationEvent, BaseEventMap, WindowEvent } from './base';
3
- import { PropagatedWindowEvents, WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, WindowPerformanceReport } from './window';
4
- import { PropagatedViewEvents } from './view';
5
- export interface CrashedEvent {
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';
6
7
  reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
7
8
  exitCode: number;
8
9
  details: {
9
10
  reason: string;
10
11
  exitCode: number;
11
12
  };
12
- }
13
- export interface RunRequestedEvent<Topic, Type> extends ApplicationEvent<Topic, Type> {
14
- userAppConfigArgs: any;
13
+ };
14
+ export declare type RunRequestedEvent = IdentityEvent & {
15
+ type: 'run-requested';
16
+ userAppConfigArgs: Record<string, any>;
15
17
  manifest: OpenFin.ManifestInfo;
16
- }
17
- export interface TrayIconClicked<Topic, Type> extends ApplicationEvent<Topic, Type> {
18
+ };
19
+ export declare type TrayIconClickedEvent = IdentityEvent & {
20
+ type: 'tray-icon-clicked';
18
21
  button: 0 | 1 | 2;
19
22
  bounds: OpenFin.Rectangle;
20
23
  x: number;
21
24
  y: number;
22
25
  monitorInfo: any;
23
- }
24
- export interface ApplicationEventMapping<Topic = string, Type = string> extends BaseEventMap {
25
- 'closed': ApplicationEvent<Topic, Type>;
26
- 'connected': ApplicationEvent<Topic, Type>;
27
- 'crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
28
- 'initialized': ApplicationEvent<Topic, Type>;
29
- 'manifest-changed': ApplicationEvent<Topic, Type>;
30
- 'not-responding': ApplicationEvent<Topic, Type>;
31
- 'responding': ApplicationEvent<Topic, Type>;
32
- 'run-requested': RunRequestedEvent<Topic, Type>;
33
- 'started': ApplicationEvent<Topic, Type>;
34
- 'tray-icon-clicked': TrayIconClicked<Topic, Type>;
35
- 'window-alert-requested': WindowAlertRequestedEvent<Topic, Type>;
36
- 'window-auth-requested': WindowAuthRequestedEvent<Topic, Type>;
37
- 'window-created': WindowEvent<Topic, Type>;
38
- 'window-end-load': WindowEndLoadEvent<Topic, Type>;
39
- 'window-not-responding': WindowEvent<Topic, Type>;
40
- 'window-performance-report': WindowPerformanceReport<Topic, Type>;
41
- 'window-responding': WindowEvent<Topic, Type>;
42
- 'window-show-requested': WindowEvent<Topic, Type>;
43
- 'window-start-load': WindowEvent<Topic, Type>;
44
- }
45
- export interface PropagatedApplicationEventMapping<Topic = string, Type = string> {
46
- 'application-closed': ApplicationEvent<Topic, Type>;
47
- 'application-connected': ApplicationEvent<Topic, Type>;
48
- 'application-crashed': CrashedEvent & ApplicationEvent<Topic, Type>;
49
- 'application-initialized': ApplicationEvent<Topic, Type>;
50
- 'application-manifest-changed': ApplicationEvent<Topic, Type>;
51
- 'application-not-responding': ApplicationEvent<Topic, Type>;
52
- 'application-responding': ApplicationEvent<Topic, Type>;
53
- 'application-started': ApplicationEvent<Topic, Type>;
54
- 'application-tray-icon-clicked': TrayIconClicked<Topic, Type>;
55
- 'window-created': WindowEvent<Topic, Type>;
56
- 'window-did-change-theme-color': WindowEvent<Topic, Type>;
57
- 'window-end-load': WindowEndLoadEvent<Topic, Type>;
58
- 'window-not-responding': WindowEvent<Topic, Type>;
59
- 'window-page-favicon-updated': WindowEvent<Topic, Type>;
60
- 'window-page-title-updated': WindowEvent<Topic, Type>;
61
- 'window-performance-report': WindowPerformanceReport<Topic, Type>;
62
- 'window-responding': WindowEvent<Topic, Type>;
63
- 'window-start-load': WindowEvent<Topic, Type>;
64
- }
65
- export declare type ApplicationEvents = PropagatedWindowEvents<'application'> & PropagatedViewEvents<'application'> & {
66
- [Type in keyof ApplicationEventMapping]: ApplicationEventMapping<'application', Type>[Type];
67
- };
68
- export declare type PropagatedApplicationEvents<Topic> = {
69
- [Type in keyof PropagatedApplicationEventMapping]: PropagatedApplicationEventMapping<Topic, Type>[Type];
70
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 { ApplicationEvent, BaseEventMap } 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 { BaseEventMap, RuntimeEvent } 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,12 +1,11 @@
1
- import type * as OpenFin from '../../OpenFin';
2
- import { BaseEventMap, RuntimeEvent } from './base';
3
- declare type Identity = OpenFin.Identity;
4
- export interface GlobalHotkeyEvent<Type> extends RuntimeEvent<'global-hotkey', Type> {
5
- identity: Identity;
6
- hotkey: string;
7
- }
8
- export interface GlobalHotkeyEvents extends BaseEventMap {
9
- registered: GlobalHotkeyEvent<'registered'>;
10
- unregistered: GlobalHotkeyEvent<'unregistered'>;
11
- }
12
- export {};
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);
@@ -1,38 +1,50 @@
1
1
  import type * as OpenFin from '../../OpenFin';
2
- import { ApplicationEvent, BaseEvent, BaseEventMap } from './base';
3
- import { PropagatedWindowEvents } from './window';
4
- import { PropagatedApplicationEvents } from './application';
5
- import { PropagatedViewEvents } from './view';
6
- export interface IdleEvent<Topic, Type> extends BaseEvent<Topic, Type> {
2
+ import { PropagatedApplicationEvent } from './application';
3
+ import { BaseEvent } from './base';
4
+ import { PropagatedViewEvent } from './view';
5
+ import { PropagatedWindowEvent } from './window';
6
+ import { AppVersionCompleteEvent, AppVersionErrorEvent, AppVersionProgressEvent, AppVersionRuntimeStatusEvent } from '../../OpenFin';
7
+ export declare type NotRequested<EventType> = EventType extends `${infer U}-requested` ? never : EventType;
8
+ export declare type ExcludeRequested<Event extends {
9
+ type: string;
10
+ }> = Extract<Event, {
11
+ type: NotRequested<Event['type']>;
12
+ }>;
13
+ export declare type IdleEvent = {
14
+ type: 'idle-state-changed';
7
15
  elapsedTime: number;
8
16
  isIdle: boolean;
9
- }
10
- export declare type MonitorEvent<Topic, Type> = OpenFin.MonitorInfo & BaseEvent<Topic, Type>;
11
- export interface SessionChangedEvent<Topic, Type> extends BaseEvent<Topic, Type> {
17
+ };
18
+ export declare type MonitorEvent = OpenFin.MonitorInfo & {
19
+ type: 'monitor-info-changed';
20
+ };
21
+ export declare type SessionChangedEvent = {
22
+ type: 'session-changed';
12
23
  reason: 'lock' | 'unlock' | 'remote-connect' | 'remote-disconnect' | 'unknown';
13
- }
14
- export declare type SystemEventMapping<Topic = string, Type = string> = BaseEventMap & {
15
- 'application-created': ApplicationEvent<Topic, Type>;
16
- 'desktop-icon-clicked': ApplicationEvent<Topic, Type>;
17
- 'idle-state-changed': IdleEvent<Topic, Type>;
18
- 'monitor-info-changed': MonitorEvent<Topic, Type>;
19
- 'session-changed': SessionChangedEvent<Topic, Type>;
20
24
  };
21
- export declare type WithId<T extends AppVersionEventNames> = `${T}.${string}`;
25
+ export declare type AppVersionEvent = AppVersionProgressEvent | AppVersionRuntimeStatusEvent | AppVersionCompleteEvent | AppVersionErrorEvent;
26
+ export declare type AppVersionEventType = AppVersionEvent['type'];
27
+ export declare type IdEventType = WithId<AppVersionEventType>;
28
+ export declare type WithId<T extends AppVersionEventType> = `${T}.${string}`;
22
29
  export declare type WithoutId<T extends string> = T extends WithId<infer U> ? U : never;
23
- declare type AppVersionEventNames = OpenFin.AppVersionEvents['type'];
24
- declare type IdEventNames = WithId<AppVersionEventNames>;
25
- export declare type AppVersionTypeFromIdEvent<T extends IdEventNames> = Extract<OpenFin.AppVersionEvents, {
30
+ export declare type AppVersionTypeFromIdEvent<T extends IdEventType> = Extract<AppVersionEvent, {
26
31
  type: WithoutId<T>;
27
32
  }>;
28
- export declare type AppVersionEventsWithId = {
29
- [key in IdEventNames]: Omit<AppVersionTypeFromIdEvent<key>, 'type'> & {
30
- type: key;
31
- topic: 'system';
32
- appVersionId: string;
33
- };
33
+ export declare type EventWithId<Event extends AppVersionEvent> = Event extends infer E extends {
34
+ type: AppVersionEventType;
35
+ } ? Omit<E, 'type'> & {
36
+ type: WithId<E['type']>;
37
+ topic: 'system';
38
+ appVersionId: string;
39
+ } : never;
40
+ export declare type AppVersionEventWithId = EventWithId<AppVersionEvent>;
41
+ export declare type ApplicationCreatedEvent = BaseEvent & {
42
+ type: 'application-created';
43
+ };
44
+ export declare type DesktopIconClickedEvent = BaseEvent & {
45
+ type: 'desktop-icon-clicked';
34
46
  };
35
- export declare type SystemEvents = PropagatedWindowEvents<'system'> & PropagatedApplicationEvents<'system'> & PropagatedViewEvents<'system'> & {
36
- [Type in keyof SystemEventMapping]: SystemEventMapping<'system', Type>[Type];
37
- } & AppVersionEventsWithId;
38
- export {};
47
+ export declare type SystemEvent = {
48
+ topic: 'system';
49
+ } & (ExcludeRequested<PropagatedWindowEvent> | PropagatedViewEvent | PropagatedApplicationEvent | ApplicationCreatedEvent | DesktopIconClickedEvent | IdleEvent | MonitorEvent | SessionChangedEvent | AppVersionEventWithId);
50
+ export declare type SystemEventType = SystemEvent['type'];
@@ -1,13 +1,20 @@
1
1
  export declare type Listener<T extends {
2
2
  type: string;
3
3
  }> = (payload: T) => void;
4
- export interface TypedEventEmitter<Events extends {
4
+ export interface TypedEventEmitter<Event extends {
5
5
  type: string;
6
- }> {
7
- on<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
8
- once<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
9
- addListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
10
- removeListener<Event extends Events>(event: Event['type'], listener: Listener<Event>): this;
11
- removeAllListeners<Event extends Events>(event?: Event['type']): this;
12
- emit<Event extends Events>(event: Event['type'], payload: Event): boolean;
6
+ }, EmitterEventType = Event['type']> {
7
+ on<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
8
+ type: EventType;
9
+ }>>): this;
10
+ addListener<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
11
+ type: EventType;
12
+ }>>): this;
13
+ removeListener<EventType extends EmitterEventType>(event: EventType, listener: Listener<Extract<Event, {
14
+ type: EventType;
15
+ }>>): this;
16
+ removeAllListeners<EventType extends EmitterEventType>(event?: EmitterEventType): this;
17
+ emit<EventType extends EmitterEventType>(event: EventType, payload: Extract<Event, {
18
+ type: EventType;
19
+ }>): boolean;
13
20
  }