@openfin/core 29.73.3 → 29.73.4

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
@@ -105,6 +105,7 @@ declare namespace OpenFin {
105
105
 
106
106
  type InteropBrokerOptions = {
107
107
  contextGroups?: ContextGroupInfo;
108
+ logging?: InteropLoggingOptions;
108
109
  };
109
110
 
110
111
  export type ContextGroupInfo = {
@@ -615,9 +616,28 @@ declare namespace OpenFin {
615
616
  setFileDownloadLocation: boolean;
616
617
  };
617
618
 
619
+ export type LaunchExternalProcessRule = {
620
+ behavior: 'allow' | 'block';
621
+ match: string[]; // could be url match or path match
622
+ };
623
+
618
624
  export type SystemPermissions = {
619
625
  getAllExternalWindows: boolean;
620
- launchExternalProcess: boolean;
626
+ launchExternalProcess:
627
+ | boolean
628
+ | {
629
+ assets: {
630
+ enabled: boolean;
631
+ srcRules?: LaunchExternalProcessRule[];
632
+ };
633
+ downloads: {
634
+ enabled: boolean;
635
+ };
636
+ executables: {
637
+ enabled: boolean;
638
+ pathRules?: LaunchExternalProcessRule[];
639
+ };
640
+ };
621
641
  readRegistryValue:
622
642
  | boolean
623
643
  | {
@@ -728,6 +748,7 @@ declare namespace OpenFin {
728
748
  forwardErrorReports?: boolean;
729
749
  enableErrorReporting?: boolean;
730
750
  };
751
+ interopBrokerConfiguration: InteropBrokerOptions;
731
752
  };
732
753
 
733
754
  export type LayoutContent = (LayoutItemConfig | LayoutRow | LayoutColumn | LayoutComponent)[];
@@ -1254,6 +1275,7 @@ declare namespace OpenFin {
1254
1275
  lifetime?: string;
1255
1276
  certificate?: CertificationInfo;
1256
1277
  uuid?: string;
1278
+ fileUuid?: string;
1257
1279
  initialWindowState?: string;
1258
1280
  cwd?: string;
1259
1281
  };
@@ -1749,4 +1771,12 @@ declare namespace OpenFin {
1749
1771
  export type InteropClientOnDisconnectionListener = (
1750
1772
  InteropBrokerDisconnectionEvent: InteropBrokerDisconnectionEvent
1751
1773
  ) => any;
1774
+
1775
+ export interface InteropActionLoggingOption {
1776
+ enabled: boolean;
1777
+ }
1778
+
1779
+ export type InteropLoggingActions = 'beforeAction' | 'afterAction';
1780
+
1781
+ export type InteropLoggingOptions = Record<InteropLoggingActions, InteropActionLoggingOption>;
1752
1782
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "29.73.3",
3
+ "version": "29.73.4",
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
@@ -377,7 +404,9 @@ export declare class InteropBroker extends Base {
377
404
  * @param clientIdentity
378
405
  * @returns { Promise<ImplementationMetadata(2)> }
379
406
  */
380
- fdc3HandleGetInfo(clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
407
+ fdc3HandleGetInfo(payload: {
408
+ fdc3Version: string;
409
+ }, clientIdentity: OpenFin.ClientIdentity): Promise<unknown>;
381
410
  /**
382
411
  * Returns an array of info for each Interop Client connected to the Interop Broker.
383
412
  *
@@ -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();
@@ -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 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.
@@ -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
  /**
@@ -290,6 +290,7 @@ export default class Fdc3Module2 extends Base implements FDC3v2.DesktopAgent {
290
290
  leaveCurrentChannel(): Promise<void>;
291
291
  /**
292
292
  * 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.
293
+ * fdc3HandleGetInfo must be overridden in the InteropBroker so that the ImplementationMetadata will have the appMetadata info.
293
294
  * @returns { Promise<ImplementationMetadata(2)> }
294
295
  * @tutorial fdc3v2.getInfo
295
296
  */
@@ -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(fin.me.interop, 'fdc3v2GetInfo', { fdc3Version: '2.0' });
471
464
  }
472
465
  }
473
466
  exports.default = Fdc3Module2;
@@ -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;
@@ -770,7 +770,7 @@ export default class System extends EmitterBase<SystemEvents> {
770
770
  * Runs an executable or batch file. A path to the file must be included in options.
771
771
  * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
772
772
  * <br> Note: This method is restricted by default and must be enabled via
773
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
773
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
774
774
  * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
775
775
  * @return {Promise.<Identity>}
776
776
  * @tutorial System.launchExternalProcess
@@ -891,7 +891,7 @@ class System extends base_1.EmitterBase {
891
891
  * Runs an executable or batch file. A path to the file must be included in options.
892
892
  * <br> A uuid may be optionally provided. If not provided, OpenFin will create a uuid for the new process.
893
893
  * <br> Note: This method is restricted by default and must be enabled via
894
- * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
894
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>. Also, this api has an enhanced permission set to make it less dangerous. So application owners can only allow to launch the assets owned by the application, the enabled downloaded files or the restricted executables.
895
895
  * @param { ExternalProcessRequestType } options A object that is defined in the ExternalProcessRequestType interface
896
896
  * @return {Promise.<Identity>}
897
897
  * @tutorial System.launchExternalProcess