@openfin/core 30.73.17 → 30.73.19

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 (90) hide show
  1. package/OpenFin.d.ts +1 -1752
  2. package/fdc3.js +2 -0
  3. package/fdc3.ts +264 -0
  4. package/fin.d.ts +3 -4
  5. package/package.json +1 -1
  6. package/src/GlobalOpenFin.d.ts +4 -0
  7. package/src/OpenFin.d.ts +1404 -0
  8. package/src/OpenFin.js +2 -0
  9. package/src/api/application/Factory.d.ts +1 -0
  10. package/src/api/application/Instance.d.ts +1 -0
  11. package/src/api/base.d.ts +1 -0
  12. package/src/api/clipboard/index.d.ts +1 -0
  13. package/src/api/events/application.d.ts +3 -2
  14. package/src/api/events/channel.d.ts +1 -1
  15. package/src/api/events/externalApplication.d.ts +1 -1
  16. package/src/api/events/globalHotkey.d.ts +2 -1
  17. package/src/api/events/system.d.ts +2 -1
  18. package/src/api/events/view.d.ts +3 -2
  19. package/src/api/events/webcontents.d.ts +1 -0
  20. package/src/api/events/window.d.ts +4 -3
  21. package/src/api/external-application/Factory.d.ts +1 -0
  22. package/src/api/external-application/Instance.d.ts +1 -0
  23. package/src/api/fin.d.ts +1 -0
  24. package/src/api/frame/Factory.d.ts +1 -0
  25. package/src/api/frame/Instance.d.ts +1 -0
  26. package/src/api/global-hotkey/index.d.ts +1 -0
  27. package/src/api/interappbus/channel/channel.d.ts +1 -0
  28. package/src/api/interappbus/channel/client.d.ts +1 -0
  29. package/src/api/interappbus/channel/connection-manager.d.ts +1 -0
  30. package/src/api/interappbus/channel/connection-manager.js +6 -2
  31. package/src/api/interappbus/channel/index.d.ts +1 -0
  32. package/src/api/interappbus/channel/index.js +4 -3
  33. package/src/api/interappbus/channel/protocols/classic/strategy.d.ts +1 -0
  34. package/src/api/interappbus/channel/protocols/protocol-manager.d.ts +1 -1
  35. package/src/api/interappbus/channel/protocols/rtc/endpoint.d.ts +1 -0
  36. package/src/api/interappbus/channel/protocols/rtc/endpoint.js +1 -1
  37. package/src/api/interappbus/channel/protocols/rtc/ice-manager.js +0 -1
  38. package/src/api/interappbus/channel/protocols/rtc/strategy.d.ts +1 -0
  39. package/src/api/interappbus/channel/protocols/strategy.d.ts +1 -0
  40. package/src/api/interappbus/channel/provider.d.ts +1 -0
  41. package/src/api/interop/Factory.d.ts +1 -0
  42. package/src/api/interop/Factory.js +1 -1
  43. package/src/api/interop/InteropBroker.d.ts +33 -2
  44. package/src/api/interop/InteropBroker.js +63 -15
  45. package/src/api/interop/InteropClient.d.ts +1 -0
  46. package/src/api/interop/SessionContextGroupBroker.d.ts +1 -0
  47. package/src/api/interop/SessionContextGroupClient.d.ts +1 -0
  48. package/src/api/interop/fdc3/PrivateChannelClient.d.ts +2 -0
  49. package/src/api/interop/fdc3/PrivateChannelProvider.d.ts +1 -0
  50. package/src/api/interop/fdc3/fdc3-1.2.d.ts +2 -0
  51. package/src/api/interop/fdc3/fdc3-1.2.js +1 -1
  52. package/src/api/interop/fdc3/fdc3-2.0.d.ts +3 -0
  53. package/src/api/interop/fdc3/fdc3-2.0.js +6 -13
  54. package/src/api/interop/fdc3/utils.d.ts +2 -0
  55. package/src/api/interop/utils.d.ts +2 -0
  56. package/src/api/interop/utils.js +9 -1
  57. package/src/api/me.d.ts +1 -0
  58. package/src/api/platform/Factory.d.ts +1 -0
  59. package/src/api/platform/Instance.d.ts +1 -0
  60. package/src/api/platform/common-utils.d.ts +1 -0
  61. package/src/api/platform/layout/Factory.d.ts +1 -0
  62. package/src/api/platform/layout/Instance.d.ts +1 -0
  63. package/src/api/platform/layout/Instance.js +0 -1
  64. package/src/api/platform/layout/controllers/tab-drag-controller.d.ts +1 -0
  65. package/src/api/platform/layout/shapes.d.ts +1 -0
  66. package/src/api/platform/layout/utils/bounds-observer.d.ts +1 -1
  67. package/src/api/platform/layout/utils/view-overlay.d.ts +1 -0
  68. package/src/api/snapshot-source/Factory.d.ts +1 -0
  69. package/src/api/snapshot-source/Factory.js +1 -1
  70. package/src/api/snapshot-source/Instance.d.ts +1 -0
  71. package/src/api/snapshot-source/utils.d.ts +1 -0
  72. package/src/api/system/index.d.ts +2 -1
  73. package/src/api/system/index.js +1 -1
  74. package/src/api/view/Factory.d.ts +1 -0
  75. package/src/api/view/Instance.d.ts +1 -0
  76. package/src/api/webcontents/main.d.ts +1 -0
  77. package/src/api/window/Factory.d.ts +1 -0
  78. package/src/api/window/Instance.d.ts +2 -1
  79. package/src/api/window/Instance.js +1 -1
  80. package/src/browser.d.ts +4 -4
  81. package/src/environment/browser.d.ts +1 -0
  82. package/src/environment/environment.d.ts +1 -0
  83. package/src/environment/node-env.d.ts +1 -0
  84. package/src/environment/openfin-env.d.ts +1 -0
  85. package/src/mock.d.ts +1 -1
  86. package/src/mock.js +3 -1
  87. package/src/shapes/WebOptions.d.ts +1 -0
  88. package/src/shapes/WindowOptions.d.ts +1 -0
  89. package/src/shapes/protocol.d.ts +1 -0
  90. package/src/transport/transport.d.ts +2 -1
package/src/OpenFin.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
3
4
  * @typedef {object} ApplicationOptions
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { EmitterBase } from '../base';
2
3
  import Transport from '../../transport/transport';
3
4
  /**
package/src/api/base.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
+ import * as OpenFin from '../OpenFin';
3
4
  import Transport from '../transport/transport';
4
5
  import Fin from './fin';
5
6
  import { BaseEventMap } from './events/base';
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
3
4
  * WriteRequestType interface
@@ -1,5 +1,6 @@
1
- import { WindowEvent, BaseEventMap, ApplicationEvent } from './base';
2
- import { WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, PropagatedWindowEvents, WindowPerformanceReport } from './window';
1
+ import * as OpenFin from '../../OpenFin';
2
+ import { ApplicationEvent, BaseEventMap, WindowEvent } from './base';
3
+ import { PropagatedWindowEvents, WindowAlertRequestedEvent, WindowAuthRequestedEvent, WindowEndLoadEvent, WindowPerformanceReport } from './window';
3
4
  import { PropagatedViewEvents } from './view';
4
5
  export interface CrashedEvent {
5
6
  reason: 'normal-termination' | 'abnormal-termination' | 'killed' | 'crashed' | 'still-running' | 'launch-failed' | 'out-of-memory' | 'integrity-failure';
@@ -1,4 +1,4 @@
1
- import { BaseEventMap, ApplicationEvent } from './base';
1
+ import { ApplicationEvent, BaseEventMap } from './base';
2
2
  export interface ChannelEvent<Type> extends ApplicationEvent<'channel', Type> {
3
3
  channelName: string;
4
4
  channelId: string;
@@ -1,4 +1,4 @@
1
- import { RuntimeEvent, BaseEventMap } from './base';
1
+ import { BaseEventMap, RuntimeEvent } from './base';
2
2
  export interface ExternalApplicationEvents extends BaseEventMap {
3
3
  connected: RuntimeEvent<'externalapplication', 'connected'>;
4
4
  disconnected: RuntimeEvent<'externalapplication', 'disconnected'>;
@@ -1,4 +1,5 @@
1
- import { RuntimeEvent, BaseEventMap } from './base';
1
+ import * as OpenFin from '../../OpenFin';
2
+ import { BaseEventMap, RuntimeEvent } from './base';
2
3
  import Identity = OpenFin.Identity;
3
4
  export interface GlobalHotkeyEvent<Type> extends RuntimeEvent<'global-hotkey', Type> {
4
5
  identity: Identity;
@@ -1,4 +1,5 @@
1
- import { BaseEvent, ApplicationEvent, BaseEventMap } from './base';
1
+ import * as OpenFin from '../../OpenFin';
2
+ import { ApplicationEvent, BaseEvent, BaseEventMap } from './base';
2
3
  import { PropagatedWindowEvents } from './window';
3
4
  import { PropagatedApplicationEvents } from './application';
4
5
  import { PropagatedViewEvents } from './view';
@@ -1,5 +1,6 @@
1
- import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent, CertificateSelectionShownEvent } from './webcontents';
2
- import { WindowEvent, BaseEventMap } from './base';
1
+ import * as OpenFin from '../../OpenFin';
2
+ import { CertificateSelectionShownEvent, WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
3
+ import { BaseEventMap, WindowEvent } from './base';
3
4
  import { WindowNavigationRejectedEvent } from './window';
4
5
  import { CrashedEvent } from './application';
5
6
  export interface ViewEventMapping<Topic = string, Type = string> extends WebContentsEventMapping {
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { BaseEventMap, WindowEvent } from './base';
2
3
  import { CrashedEvent } from './application';
3
4
  import { WindowNavigationRejectedEvent } from './window';
@@ -1,7 +1,8 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { CrashedEvent } from './application';
2
- import { WindowEvent, BaseEventMap } from './base';
3
- import { WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent, CertificateSelectionShownEvent } from './webcontents';
4
- import { PropagatedViewEventMapping, InputEvent } from './view';
3
+ import { BaseEventMap, WindowEvent } from './base';
4
+ import { CertificateSelectionShownEvent, WebContentsEventMapping, WindowResourceLoadFailedEvent, WindowResourceResponseReceivedEvent } from './webcontents';
5
+ import { InputEvent, PropagatedViewEventMapping } from './view';
5
6
  export interface WindowAlertRequestedEvent<Topic, Type> extends WindowEvent<Topic, Type> {
6
7
  message: string;
7
8
  url: string;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
3
4
  * @lends ExternalApplication
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { EmitterBase } from '../base';
2
3
  import Transport from '../../transport/transport';
3
4
  /**
package/src/api/fin.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
+ import * as OpenFin from '../OpenFin';
3
4
  import Transport from '../transport/transport';
4
5
  import System from './system/index';
5
6
  import _WindowModule from './window/index';
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  /**
3
4
  * @lends Frame
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { EmitterBase } from '../base';
2
3
  import Transport from '../../transport/transport';
3
4
  import FrameEvents = OpenFin.FrameEvents;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { EmitterBase } from '../base';
2
3
  import Transport from '../../transport/transport';
3
4
  import GlobalHotkeyEvents = OpenFin.GlobalHotkeyEvents;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import Transport from '../../../transport/transport';
2
3
  import ProviderIdentity = OpenFin.ProviderIdentity;
3
4
  import ChannelMiddleware = OpenFin.ChannelMiddleware;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import { ChannelBase } from './channel';
2
3
  import Transport from '../../../transport/transport';
3
4
  import { AnyStrategy } from './protocols/strategy-types';
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import { ChannelMessage } from '.';
2
3
  import Transport from '../../../transport/transport';
3
4
  import { Base } from '../../base';
@@ -44,7 +44,7 @@ class ConnectionManager extends base_1.Base {
44
44
  wire.registerMessageHandler(this.onmessage.bind(this));
45
45
  }
46
46
  static getProtocolOptionsFromStrings(protocols) {
47
- return protocols.map(protocol => {
47
+ return protocols.map((protocol) => {
48
48
  switch (protocol) {
49
49
  case 'rtc':
50
50
  return strategy_2.RTCInfo;
@@ -85,7 +85,11 @@ class ConnectionManager extends base_1.Base {
85
85
  }
86
86
  const channel = new provider_1.ChannelProvider(providerIdentity, this.wire, strategy);
87
87
  const key = providerIdentity.channelId;
88
- this.providerMap.set(key, { provider: channel, strategy, supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols) });
88
+ this.providerMap.set(key, {
89
+ provider: channel,
90
+ strategy,
91
+ supportedProtocols: ConnectionManager.getProtocolOptionsFromStrings(protocols)
92
+ });
89
93
  provider_1.ChannelProvider.setProviderRemoval(channel, this.removeChannelFromProviderMap.bind(this));
90
94
  return channel;
91
95
  }
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import ChannelClient from './client';
2
3
  import { ChannelProvider } from './provider';
3
4
  import { EmitterBase } from '../../base';
@@ -57,11 +57,12 @@ class Channel extends base_1.EmitterBase {
57
57
  let connectionUrl;
58
58
  const entityType = this.wire.environment.getCurrentEntityType();
59
59
  if (entityType === 'iframe') {
60
- const frame = fin.Frame.getCurrentSync();
61
- connectionUrl = (await frame.getInfo()).url;
60
+ // @ts-expect-error
61
+ // TODO: type this correctly (frame types are broken)
62
+ const frame = (await this.fin.me.getInfo()).url;
62
63
  }
63
64
  else if (entityType === 'window' || entityType === 'view') {
64
- connectionUrl = (await fin.me.getInfo()).url;
65
+ connectionUrl = (await this.fin.me.getInfo()).url;
65
66
  }
66
67
  const res = await this.wire.sendAction('connect-to-channel', {
67
68
  channelName,
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../../../OpenFin';
1
2
  import Transport from '../../../../../transport/transport';
2
3
  import { MessageReceiver } from './message-receiver';
3
4
  import { ChannelStrategy, EndpointPayload } from '../strategy';
@@ -1,4 +1,4 @@
1
- import { MessagingProtocols, ExternalClientOffer, ProtocolOffer, LocalSupportedProtocol } from '.';
1
+ import { ExternalClientOffer, LocalSupportedProtocol, MessagingProtocols, ProtocolOffer } from '.';
2
2
  export declare class ProtocolManager {
3
3
  private ProtocolsInPreferenceOrder;
4
4
  DefaultClientProtocols: ['classic'];
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../../../OpenFin';
1
2
  import ProviderIdentity = OpenFin.ProviderIdentity;
2
3
  export interface RTCEndpointChannels {
3
4
  request: RTCDataChannel;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-unused-vars */
3
2
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
4
3
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
5
4
  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");
@@ -14,6 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
14
13
  var _RTCEndpoint_processAction, _RTCEndpoint_disconnectListener;
15
14
  Object.defineProperty(exports, "__esModule", { value: true });
16
15
  exports.RTCEndpoint = void 0;
16
+ /* eslint-disable @typescript-eslint/no-unused-vars */
17
17
  const errors_1 = require("../../../../../util/errors");
18
18
  /*
19
19
  This handles sending RTC messages between RTC connections over the request and response data channels.
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable class-methods-use-this */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.RTCICEManager = void 0;
5
4
  const base_1 = require("../../../../base");
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../../../OpenFin';
1
2
  import { ChannelStrategy } from '../strategy';
2
3
  import { RTCPacket } from './endpoint';
3
4
  import { LocalSupportedProtocol } from '..';
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../../OpenFin';
1
2
  import ProviderIdentity = OpenFin.ProviderIdentity;
2
3
  export interface ChannelStrategy<T extends unknown> {
3
4
  onEndpointDisconnect(endpointId: string, listener: () => void): void;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import { ChannelBase } from './channel';
2
3
  import Transport from '../../../transport/transport';
3
4
  import { AnyStrategy } from './protocols/strategy-types';
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import { Base } from '../base';
2
3
  import { InteropBroker } from './InteropBroker';
3
4
  import { InteropClient } from './InteropClient';
@@ -38,7 +38,7 @@ class InteropModule extends base_1.Base {
38
38
  }
39
39
  return provider;
40
40
  };
41
- return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration || {});
41
+ return override(InteropBroker_1.InteropBroker, this.wire, getProvider, options.initialOptions.interopBrokerConfiguration);
42
42
  }
43
43
  /**
44
44
  * Connects a client to an Interop broker. This is called under-the-hood for Views in a Platform.
@@ -1,3 +1,5 @@
1
+ import { FDC3, FDC3v2 } from '../../../fdc3';
2
+ import * as OpenFin from '../../OpenFin';
1
3
  import { Base } from '../base';
2
4
  import type Transport from '../../transport/transport';
3
5
  import Identity = OpenFin.Identity;
@@ -46,6 +48,32 @@ import Identity = OpenFin.Identity;
46
48
  * }
47
49
  * ```
48
50
  *
51
+ * By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
52
+ * ```js
53
+ * {
54
+ * "runtime": {
55
+ * "arguments": "--v=1 --inspect",
56
+ * "version": "alpha-v19"
57
+ * },
58
+ * "platform": {
59
+ * "uuid": "platform_customization_local",
60
+ * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
61
+ * "autoShow": false,
62
+ * "providerUrl": "http://localhost:5555/provider.html",
63
+ * "interopBrokerConfiguration": {
64
+ * "logging": {
65
+ * "beforeAction": {
66
+ * "enabled": false
67
+ * },
68
+ * "afterAction": {
69
+ * "enabled": false
70
+ * }
71
+ * }
72
+ * }
73
+ * }
74
+ * }
75
+ * ```
76
+ *
49
77
  * ---
50
78
  * **2. Overriding**
51
79
  *
@@ -131,6 +159,7 @@ export declare class InteropBroker extends Base {
131
159
  private lastContextMap;
132
160
  private sessionContextGroupMap;
133
161
  private channel;
162
+ private logging;
134
163
  constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
135
164
  /**
136
165
  * SetContextOptions interface
@@ -377,7 +406,9 @@ export declare class InteropBroker extends Base {
377
406
  * @param clientIdentity
378
407
  * @returns { Promise<ImplementationMetadata(2)> }
379
408
  */
380
- fdc3HandleGetInfo(clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
409
+ fdc3HandleGetInfo(payload: {
410
+ fdc3Version: string;
411
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
381
412
  /**
382
413
  * Returns an array of info for each Interop Client connected to the Interop Broker.
383
414
  *
@@ -416,7 +447,7 @@ export declare class InteropBroker extends Base {
416
447
  private static hasEndpointId;
417
448
  static isContextTypeCompatible(contextType: string, registeredContextType: string | undefined): boolean;
418
449
  private setContextGroupMap;
419
- private static setCurrentContextGroupInClientOptions;
450
+ private setCurrentContextGroupInClientOptions;
420
451
  private setupChannelProvider;
421
452
  private wireChannel;
422
453
  /**
@@ -93,6 +93,32 @@ let contextGroups = [
93
93
  * }
94
94
  * ```
95
95
  *
96
+ * By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
97
+ * ```js
98
+ * {
99
+ * "runtime": {
100
+ * "arguments": "--v=1 --inspect",
101
+ * "version": "alpha-v19"
102
+ * },
103
+ * "platform": {
104
+ * "uuid": "platform_customization_local",
105
+ * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
106
+ * "autoShow": false,
107
+ * "providerUrl": "http://localhost:5555/provider.html",
108
+ * "interopBrokerConfiguration": {
109
+ * "logging": {
110
+ * "beforeAction": {
111
+ * "enabled": false
112
+ * },
113
+ * "afterAction": {
114
+ * "enabled": false
115
+ * }
116
+ * }
117
+ * }
118
+ * }
119
+ * }
120
+ * ```
121
+ *
96
122
  * ---
97
123
  * **2. Overriding**
98
124
  *
@@ -176,9 +202,12 @@ class InteropBroker extends base_1.Base {
176
202
  this.getProvider = getProvider;
177
203
  this.interopClients = new Map();
178
204
  this.contextGroupsById = new Map();
179
- if (options.contextGroups) {
205
+ if (options === null || options === void 0 ? void 0 : options.contextGroups) {
180
206
  contextGroups = options.contextGroups;
181
207
  }
208
+ if (options === null || options === void 0 ? void 0 : options.logging) {
209
+ this.logging = options.logging;
210
+ }
182
211
  this.intentClientMap = new Map();
183
212
  this.lastContextMap = new Map();
184
213
  this.sessionContextGroupMap = new Map();
@@ -371,7 +400,7 @@ class InteropBroker extends base_1.Base {
371
400
  const oldContextGroupId = clientSubscriptionState.contextGroupId;
372
401
  if (oldContextGroupId !== contextGroupId) {
373
402
  clientSubscriptionState.contextGroupId = contextGroupId;
374
- await InteropBroker.setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId);
403
+ await this.setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId);
375
404
  const contextGroupMap = this.contextGroupsById.get(contextGroupId);
376
405
  for (const [, handlerInfo] of clientSubscriptionState.contextHandlers) {
377
406
  const { contextType, handlerId } = handlerInfo;
@@ -450,7 +479,7 @@ class InteropBroker extends base_1.Base {
450
479
  if (clientState) {
451
480
  clientState.contextGroupId = undefined;
452
481
  }
453
- await InteropBroker.setCurrentContextGroupInClientOptions(clientIdentity, null);
482
+ await this.setCurrentContextGroupInClientOptions(clientIdentity, null);
454
483
  }
455
484
  // Used by platform windows to know what client groups the provider has declared. Also used internally to access context groups. Overrideable so that the platform developer can modify it.
456
485
  /**
@@ -695,10 +724,21 @@ class InteropBroker extends base_1.Base {
695
724
  * @returns { Promise<ImplementationMetadata(2)> }
696
725
  */
697
726
  // eslint-disable-next-line class-methods-use-this
698
- async fdc3HandleGetInfo(clientIdentity) {
699
- const warning = (0, utils_1.generateOverrideWarning)('fdc3.getInfo', 'InteropBroker.fdc3GetInfo', clientIdentity);
700
- console.warn(warning);
701
- throw new Error(utils_1.BROKER_ERRORS.fdc3GetInfo);
727
+ async fdc3HandleGetInfo(payload, clientIdentity) {
728
+ const { fdc3Version } = payload;
729
+ return {
730
+ fdc3Version,
731
+ provider: 'OpenFin',
732
+ providerVersion: await this.fin.System.getVersion(),
733
+ optionalFeatures: {
734
+ OriginatingAppMetadata: false,
735
+ UserChannelMembershipAPIs: true
736
+ },
737
+ appMetadata: {
738
+ appId: '',
739
+ instanceId: ''
740
+ }
741
+ };
702
742
  }
703
743
  /**
704
744
  * Returns an array of info for each Interop Client connected to the Interop Broker.
@@ -920,14 +960,14 @@ class InteropBroker extends base_1.Base {
920
960
  this.contextGroupsById.set(contextGroupInfo.id, new Map());
921
961
  }
922
962
  }
923
- static async setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId) {
924
- const entityInfo = await fin.System.getEntityInfo(clientIdentity.uuid, clientIdentity.name);
963
+ async setCurrentContextGroupInClientOptions(clientIdentity, contextGroupId) {
964
+ const entityInfo = await this.fin.System.getEntityInfo(clientIdentity.uuid, clientIdentity.name);
925
965
  let entity;
926
966
  if (entityInfo.entityType === 'view') {
927
- entity = await fin.View.wrap(clientIdentity);
967
+ entity = await this.fin.View.wrap(clientIdentity);
928
968
  }
929
969
  else if (entityInfo.entityType === 'window') {
930
- entity = await fin.Window.wrap(clientIdentity);
970
+ entity = await this.fin.Window.wrap(clientIdentity);
931
971
  }
932
972
  if (entity) {
933
973
  await entity.updateOptions({
@@ -973,7 +1013,7 @@ class InteropBroker extends base_1.Base {
973
1013
  channel.onDisconnection((clientIdentity) => {
974
1014
  this.interopClients.delete(clientIdentity.endpointId);
975
1015
  const targetInfo = this.intentClientMap.get(clientIdentity.name);
976
- if (targetInfo && clientIdentity.uuid === fin.me.identity.uuid) {
1016
+ if (targetInfo && clientIdentity.uuid === this.fin.me.uuid) {
977
1017
  targetInfo.forEach((handler) => {
978
1018
  handler.isReady = false;
979
1019
  });
@@ -986,12 +1026,20 @@ class InteropBroker extends base_1.Base {
986
1026
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
987
1027
  // @ts-ignore
988
1028
  channel.beforeAction(async (action, payload, clientIdentity) => {
1029
+ var _a, _b;
989
1030
  if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
990
1031
  throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
991
1032
  }
992
- console.log(action, payload, clientIdentity);
1033
+ if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.beforeAction) === null || _b === void 0 ? void 0 : _b.enabled) {
1034
+ console.log(action, payload, clientIdentity);
1035
+ }
1036
+ });
1037
+ channel.afterAction((action, payload, clientIdentity) => {
1038
+ var _a, _b;
1039
+ if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
1040
+ console.log(action, payload, clientIdentity);
1041
+ }
993
1042
  });
994
- channel.afterAction(console.log);
995
1043
  // Client functions
996
1044
  channel.register('setContext', this.setContext.bind(this));
997
1045
  channel.register('fireIntent', this.handleFiredIntent.bind(this));
@@ -1016,7 +1064,7 @@ class InteropBroker extends base_1.Base {
1016
1064
  channel.register('fdc3FindInstances', this.fdc3HandleFindInstances.bind(this));
1017
1065
  channel.register('fdc3GetAppMetadata', this.fdc3HandleGetAppMetadata.bind(this));
1018
1066
  channel.register('fdc3v2GetInfo', async (payload, clientIdentity) => {
1019
- return this.fdc3HandleGetInfo.bind(this)(clientIdentity);
1067
+ return this.fdc3HandleGetInfo.bind(this)(payload, clientIdentity);
1020
1068
  });
1021
1069
  }
1022
1070
  /**
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import Transport from '../../transport/transport';
2
3
  import { Base } from '../base';
3
4
  /**
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import type { ChannelProvider } from '../interappbus/channel/provider';
2
3
  export default class SessionContextGroupBroker {
3
4
  id: string;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../OpenFin';
1
2
  import Transport from '../../transport/transport';
2
3
  import { Base } from '../base';
3
4
  export default class SessionContextGroupClient extends Base {
@@ -1,3 +1,5 @@
1
+ import { FDC3v2 } from '../../../../fdc3';
2
+ import * as OpenFin from '../../../OpenFin';
1
3
  declare type HandlerId = string;
2
4
  export declare class PrivateChannelClient {
3
5
  id: string;
@@ -1,3 +1,4 @@
1
+ import * as OpenFin from '../../../OpenFin';
1
2
  import { ChannelProvider } from '../../interappbus/channel/provider';
2
3
  declare type HandlerId = string;
3
4
  export declare class PrivateChannelProvider {
@@ -1,3 +1,5 @@
1
+ import { FDC3 } from '../../../../fdc3';
2
+ import * as OpenFin from '../../../OpenFin';
1
3
  import { Base } from '../../base';
2
4
  /**
3
5
  * @typedef { object } Listener
@@ -351,7 +351,7 @@ class Fdc3Module extends base_1.Base {
351
351
  // we do not want to expose this error, just continue if this analytics-only call fails
352
352
  });
353
353
  try {
354
- return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3Open', { app, context });
354
+ return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3Open', { app, context });
355
355
  }
356
356
  catch (error) {
357
357
  const errorToThrow = error.message === utils_2.BROKER_ERRORS.fdc3Open ? 'ResolverUnavailable' : error;
@@ -1,3 +1,5 @@
1
+ import { FDC3, FDC3v2 } from '../../../../fdc3';
2
+ import * as OpenFin from '../../../OpenFin';
1
3
  import { Base } from '../../base';
2
4
  import Transport from '../../../transport/transport';
3
5
  /**
@@ -290,6 +292,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
290
292
  leaveCurrentChannel(): Promise<void>;
291
293
  /**
292
294
  * Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
295
+ * fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
293
296
  * @returns { Promise<ImplementationMetadata(2)> }
294
297
  * @tutorial fdc3v2.getInfo
295
298
  */
@@ -188,7 +188,7 @@ class Fdc3Module2 extends base_1.Base {
188
188
  // we do not want to expose this error, just continue if this analytics-only call fails
189
189
  });
190
190
  try {
191
- return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3FindInstances', app);
191
+ return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3FindInstances', app);
192
192
  }
193
193
  catch (error) {
194
194
  const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3FindInstances ? 'ResolverUnavailable' : error;
@@ -206,7 +206,7 @@ class Fdc3Module2 extends base_1.Base {
206
206
  // we do not want to expose this error, just continue if this analytics-only call fails
207
207
  });
208
208
  try {
209
- return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3GetAppMetadata', app);
209
+ return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3GetAppMetadata', app);
210
210
  }
211
211
  catch (error) {
212
212
  const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetAppMetadata ? 'ResolverUnavailable' : error;
@@ -285,7 +285,7 @@ class Fdc3Module2 extends base_1.Base {
285
285
  });
286
286
  const payload = resultType ? { context, metadata: { resultType } } : context;
287
287
  try {
288
- return await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
288
+ return await InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2FindIntentsByContext', payload);
289
289
  }
290
290
  catch (error) {
291
291
  const errorToThrow = error.message === utils_1.BROKER_ERRORS.getInfoForIntentsByContext ? 'ResolverUnavailable' : error;
@@ -362,7 +362,7 @@ class Fdc3Module2 extends base_1.Base {
362
362
  const intentResolutionResultId = (intentMetadata === null || intentMetadata === void 0 ? void 0 : intentMetadata.intentResolutionResultId) || (metadata === null || metadata === void 0 ? void 0 : metadata.intentResolutionResultId);
363
363
  if (intentResolutionResultId) {
364
364
  // Send whatever the result is.
365
- fin.InterApplicationBus.publish(intentResolutionResultId, intentResult);
365
+ this.fin.InterApplicationBus.publish(intentResolutionResultId, intentResult);
366
366
  }
367
367
  if (intentResult instanceof Error) {
368
368
  throw new Error(intentResult.message);
@@ -455,19 +455,12 @@ class Fdc3Module2 extends base_1.Base {
455
455
  }
456
456
  /**
457
457
  * Retrieves information about the FDC3 implementation, including the supported version of the FDC3 specification, the name of the provider of the implementation, its own version number, details of whether optional API features are implemented and the metadata of the calling application according to the desktop agent.
458
+ * fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
458
459
  * @returns { Promise<ImplementationMetadata(2)> }
459
460
  * @tutorial fdc3v2.getInfo
460
461
  */
461
462
  async getInfo() {
462
- try {
463
- const result = await InteropClient_1.InteropClient.ferryFdc3Call(fin.me.interop, 'fdc3v2GetInfo', {});
464
- const partialInfo = this.fdc3Module.getInfo();
465
- return { ...partialInfo, ...result };
466
- }
467
- catch (error) {
468
- const errorToThrow = error.message === utils_1.BROKER_ERRORS.fdc3GetInfo ? 'ResolverUnavailable' : error;
469
- throw new Error(errorToThrow);
470
- }
463
+ return InteropClient_1.InteropClient.ferryFdc3Call(this.fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
471
464
  }
472
465
  }
473
466
  exports.default = Fdc3Module2;
@@ -1,3 +1,5 @@
1
+ import { FDC3, FDC3v2 } from '../../../../fdc3';
2
+ import * as OpenFin from '../../../OpenFin';
1
3
  import { PrivateChannelClient } from './PrivateChannelClient';
2
4
  interface UnsupportedChannelApis {
3
5
  addContextListener(): Error;