@openfin/core 30.73.16 → 30.73.18

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.
package/OpenFin.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  // / <reference lib="dom"/>
2
2
 
3
3
  declare namespace OpenFin {
4
+ // fin
5
+ export type Fin<MeType extends EntityType = 'window' | 'view'> = import('./src/api/fin').FinApi<MeType>;
6
+
4
7
  // "wrappable entities"
5
8
  export type Application = import('./src/api/application/index').Application;
6
9
  export type ExternalApplication = import('./src/api/external-application/index').ExternalApplication;
@@ -105,6 +108,7 @@ declare namespace OpenFin {
105
108
 
106
109
  type InteropBrokerOptions = {
107
110
  contextGroups?: ContextGroupInfo;
111
+ logging?: InteropLoggingOptions;
108
112
  };
109
113
 
110
114
  export type ContextGroupInfo = {
@@ -728,6 +732,7 @@ declare namespace OpenFin {
728
732
  forwardErrorReports?: boolean;
729
733
  enableErrorReporting?: boolean;
730
734
  };
735
+ interopBrokerConfiguration: InteropBrokerOptions;
731
736
  };
732
737
 
733
738
  export type LayoutContent = (LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent)[];
@@ -1749,4 +1754,12 @@ declare namespace OpenFin {
1749
1754
  export type InteropClientOnDisconnectionListener = (
1750
1755
  InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent
1751
1756
  ) => any;
1757
+
1758
+ export interface InteropActionLoggingOption {
1759
+ enabled: boolean;
1760
+ }
1761
+
1762
+ export type InteropLoggingActions = 'beforeAction' | 'afterAction';
1763
+
1764
+ export type InteropLoggingOptions = Record<InteropLoggingActions, InteropActionLoggingOption>;
1752
1765
  }
package/fin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /* eslint-disable spaced-comment */
2
2
  /* eslint-disable @typescript-eslint/triple-slash-reference */
3
3
  /// <reference path="./OpenFin.d.ts"/>
4
- declare const fin: import('./src/api/fin').FinApi<'window' | 'view'>;
4
+ declare const fin: OpenFin.Fin<'window' | 'view'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "30.73.16",
3
+ "version": "30.73.18",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -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.
@@ -46,6 +46,32 @@ import Identity = OpenFin.Identity;
46
46
  * }
47
47
  * ```
48
48
  *
49
+ * By default the Interop Broker logs all actions to the console. You can disable this by using the logging option in `interopBrokerConfiguration`:
50
+ * ```js
51
+ * {
52
+ * "runtime": {
53
+ * "arguments": "--v=1 --inspect",
54
+ * "version": "alpha-v19"
55
+ * },
56
+ * "platform": {
57
+ * "uuid": "platform_customization_local",
58
+ * "applicationIcon": "https://openfin.github.io/golden-prototype/favicon.ico",
59
+ * "autoShow": false,
60
+ * "providerUrl": "http://localhost:5555/provider.html",
61
+ * "interopBrokerConfiguration": {
62
+ * "logging": {
63
+ * "beforeAction": {
64
+ * "enabled": false
65
+ * },
66
+ * "afterAction": {
67
+ * "enabled": false
68
+ * }
69
+ * }
70
+ * }
71
+ * }
72
+ * }
73
+ * ```
74
+ *
49
75
  * ---
50
76
  * **2. Overriding**
51
77
  *
@@ -131,6 +157,7 @@ export declare class InteropBroker extends Base {
131
157
  private lastContextMap;
132
158
  private sessionContextGroupMap;
133
159
  private channel;
160
+ private logging;
134
161
  constructor(wire: Transport, getProvider: () => Promise<OpenFin.ChannelProvider>, options?: any);
135
162
  /**
136
163
  * SetContextOptions interface
@@ -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();
@@ -986,12 +1015,20 @@ class InteropBroker extends base_1.Base {
986
1015
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
987
1016
  // @ts-ignore
988
1017
  channel.beforeAction(async (action, payload, clientIdentity) => {
1018
+ var _a, _b;
989
1019
  if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
990
1020
  throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
991
1021
  }
992
- console.log(action, payload, clientIdentity);
1022
+ if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.beforeAction) === null || _b === void 0 ? void 0 : _b.enabled) {
1023
+ console.log(action, payload, clientIdentity);
1024
+ }
1025
+ });
1026
+ channel.afterAction((action, payload, clientIdentity) => {
1027
+ var _a, _b;
1028
+ if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
1029
+ console.log(action, payload, clientIdentity);
1030
+ }
993
1031
  });
994
- channel.afterAction(console.log);
995
1032
  // Client functions
996
1033
  channel.register('setContext', this.setContext.bind(this));
997
1034
  channel.register('fireIntent', this.handleFiredIntent.bind(this));
@@ -15,3 +15,4 @@ export declare const BROKER_ERRORS: {
15
15
  fdc3GetInfo: string;
16
16
  };
17
17
  export declare const wrapIntentHandler: (handler: OpenFin.IntentHandler, handlerId: string) => (intent: OpenFin.Intent) => Promise<void>;
18
+ export declare const generateDefaultLoggingOptions: () => OpenFin.InteropLoggingOptions;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
3
+ exports.generateDefaultLoggingOptions = exports.wrapIntentHandler = exports.BROKER_ERRORS = exports.generateOverrideWarning = exports.generateOverrideError = exports.wrapContextHandler = exports.wrapInTryCatch = exports.generateId = void 0;
4
4
  const generateId = () => `${Math.random()}${Date.now()}`;
5
5
  exports.generateId = generateId;
6
6
  const wrapInTryCatch = (f, prefix) => (...args) => {
@@ -59,3 +59,11 @@ const wrapIntentHandler = (handler, handlerId) => {
59
59
  };
60
60
  };
61
61
  exports.wrapIntentHandler = wrapIntentHandler;
62
+ const generateDefaultLoggingOptions = () => {
63
+ const loggingActions = ['beforeAction', 'afterAction'];
64
+ const options = loggingActions.reduce((accumulator, loggingOption) => {
65
+ return { ...accumulator, [loggingOption]: { enabled: true } };
66
+ }, {});
67
+ return options;
68
+ };
69
+ exports.generateDefaultLoggingOptions = generateDefaultLoggingOptions;
package/src/browser.d.ts CHANGED
@@ -1,10 +1,9 @@
1
- import { FinApi } from './api/fin';
2
1
  import { RemoteConfig } from './transport/wire';
3
2
  interface GetRemoteConnectionPayload extends RemoteConfig {
4
3
  interopProviderId: string;
5
4
  withInterop: boolean;
6
5
  }
7
- export declare function getRemoteConnectionPayload(fin: FinApi<OpenFin.EntityType>, uuid?: string, interopProviderId?: string): Promise<GetRemoteConnectionPayload>;
8
- export declare function remoteConnect({ uuid, token, address, interopProviderId, withInterop }: GetRemoteConnectionPayload): Promise<FinApi<'external connection'>>;
9
- export declare function remoteConnectInterop(fin: FinApi<OpenFin.EntityType>, interopProviderId: string): Promise<FinApi<OpenFin.EntityType>>;
6
+ export declare function getRemoteConnectionPayload(fin: OpenFin.Fin<OpenFin.EntityType>, uuid?: string, interopProviderId?: string): Promise<GetRemoteConnectionPayload>;
7
+ export declare function remoteConnect({ uuid, token, address, interopProviderId, withInterop }: GetRemoteConnectionPayload): Promise<OpenFin.Fin<'external connection'>>;
8
+ export declare function remoteConnectInterop(fin: OpenFin.Fin<OpenFin.EntityType>, interopProviderId: string): Promise<OpenFin.Fin<OpenFin.EntityType>>;
10
9
  export {};