@openfin/core 32.75.18 → 32.75.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "32.75.18",
3
+ "version": "32.75.19",
4
4
  "license": "SEE LICENSE IN LICENSE.MD",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
package/src/OpenFin.d.ts CHANGED
@@ -1433,6 +1433,7 @@ export type GetWindowContextPayload = {
1433
1433
  };
1434
1434
  export type ApplicationPermissions = {
1435
1435
  setFileDownloadLocation: boolean;
1436
+ getFileDownloadLocation: boolean;
1436
1437
  };
1437
1438
  export type LaunchExternalProcessRule = {
1438
1439
  behavior: 'allow' | 'block';
@@ -300,10 +300,22 @@ export declare class Application extends EmitterBase<OpenFin.ApplicationEvent> {
300
300
  */
301
301
  getProcessInfo(): Promise<OpenFin.AppProcessInfo>;
302
302
  /**
303
- * Sets file auto download location.
303
+ * Sets file auto download location. It's only allowed in the same application.
304
+ * Note: This method is restricted by default and must be enabled via
305
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
304
306
  * @param { string } downloadLocation file auto download location
305
307
  * @return {Promise.<void>}
308
+ * @throws if setting file auto download location on different applications.
306
309
  * @tutorial Application.setFileDownloadLocation
307
310
  */
308
311
  setFileDownloadLocation(downloadLocation: string): Promise<void>;
312
+ /**
313
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
314
+ * Note: This method is restricted by default and must be enabled via
315
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
316
+ * @return {Promise.<string>}
317
+ * @throws if getting file auto download location on different applications.
318
+ * @tutorial Application.getFileDownloadLocation
319
+ */
320
+ getFileDownloadLocation(): Promise<string>;
309
321
  }
@@ -146,11 +146,8 @@ class Application extends base_1.EmitterBase {
146
146
  await this.wire.sendAction('destroy-application', { force, ...this.identity });
147
147
  }
148
148
  catch (error) {
149
- const acceptableErrors = [
150
- 'Remote connection has closed',
151
- 'Could not locate the requested application'
152
- ];
153
- if (!acceptableErrors.some(msg => error.message.includes(msg))) {
149
+ const acceptableErrors = ['Remote connection has closed', 'Could not locate the requested application'];
150
+ if (!acceptableErrors.some((msg) => error.message.includes(msg))) {
154
151
  throw error;
155
152
  }
156
153
  }
@@ -427,13 +424,28 @@ class Application extends base_1.EmitterBase {
427
424
  return data;
428
425
  }
429
426
  /**
430
- * Sets file auto download location.
427
+ * Sets file auto download location. It's only allowed in the same application.
428
+ * Note: This method is restricted by default and must be enabled via
429
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
431
430
  * @param { string } downloadLocation file auto download location
432
431
  * @return {Promise.<void>}
432
+ * @throws if setting file auto download location on different applications.
433
433
  * @tutorial Application.setFileDownloadLocation
434
434
  */
435
435
  async setFileDownloadLocation(downloadLocation) {
436
436
  await this.wire.sendAction('set-file-download-location', { downloadLocation, ...this.identity });
437
437
  }
438
+ /**
439
+ * Gets file auto download location. It's only allowed in the same application. If file auto download location is not set, it will return the default location.
440
+ * Note: This method is restricted by default and must be enabled via
441
+ * <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
442
+ * @return {Promise.<string>}
443
+ * @throws if getting file auto download location on different applications.
444
+ * @tutorial Application.getFileDownloadLocation
445
+ */
446
+ async getFileDownloadLocation() {
447
+ const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
448
+ return data;
449
+ }
438
450
  }
439
451
  exports.Application = Application;
@@ -77,7 +77,10 @@ class Channel extends base_1.EmitterBase {
77
77
  }
78
78
  try {
79
79
  const { offer, rtc: rtcPacket } = await __classPrivateFieldGet(this, _Channel_connectionManager, "f").createClientOffer(opts);
80
- const connectionUrl = (await this.fin.me.getInfo()).url;
80
+ let connectionUrl;
81
+ if (this.fin.me.isFrame || this.fin.me.isView || this.fin.me.isWindow) {
82
+ connectionUrl = (await this.fin.me.getInfo()).url;
83
+ }
81
84
  const { payload: { data: routingInfo } } = await this.wire.sendAction('connect-to-channel', {
82
85
  channelName,
83
86
  ...opts,
package/src/api/me.d.ts CHANGED
@@ -33,7 +33,7 @@ export declare function getBaseMe<T extends EntityType = EntityType>(entityType:
33
33
  export interface WithInterop {
34
34
  interop: InteropClient;
35
35
  }
36
- export type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType extends 'view' ? EntityTypeHelpers<'view'> & OpenFin.View & WithInterop : MeType extends 'window' ? EntityTypeHelpers<'window'> & OpenFin.Window & WithInterop : MeType extends 'iframe' ? EntityTypeHelpers<'iframe'> & OpenFin.Frame & WithInterop : EntityTypeHelpers<MeType> & WithInterop) & {
36
+ export type Me<MeType extends EntityType> = OpenFin.EntityInfo & (MeType extends 'view' ? EntityTypeHelpers<'view'> & OpenFin.View & WithInterop : MeType extends 'window' ? EntityTypeHelpers<'window'> & OpenFin.Window & WithInterop : MeType extends 'iframe' ? EntityTypeHelpers<'iframe'> & OpenFin.Frame & WithInterop : MeType extends 'external connection' ? EntityTypeHelpers<'external connection'> & OpenFin.ExternalApplication & WithInterop : EntityTypeHelpers<MeType> & WithInterop) & {
37
37
  isOpenFin: boolean;
38
38
  };
39
39
  export declare function getMe<MeType extends EntityType>(wire: Transport<MeType>): Me<MeType>;
package/src/api/me.js CHANGED
@@ -4,6 +4,7 @@ exports.getMe = exports.getBaseMe = exports.environmentUnsupportedMessage = void
4
4
  const view_1 = require("./view");
5
5
  const frame_1 = require("./frame");
6
6
  const window_1 = require("./window");
7
+ const external_application_1 = require("./external-application");
7
8
  exports.environmentUnsupportedMessage = 'You are not running in OpenFin.';
8
9
  function getBaseMe(entityType, uuid, name) {
9
10
  const entityTypeHelpers = {
@@ -117,7 +118,7 @@ function getMe(wire) {
117
118
  isOpenFin: true
118
119
  });
119
120
  case 'external connection':
120
- return Object.assign(new window_1._Window(wire, { uuid, name }), getBaseMe(entityType, uuid, name), {
121
+ return Object.assign(new external_application_1.ExternalApplication(wire, { uuid }), getBaseMe(entityType, uuid, name), {
121
122
  interop: fallbackInterop,
122
123
  isOpenFin: false
123
124
  });
@@ -90,6 +90,10 @@ export interface ProtocolMap extends ProtocolMapBase {
90
90
  };
91
91
  response: void;
92
92
  };
93
+ 'get-file-download-location': {
94
+ request: OpenFin.ApplicationIdentity;
95
+ response: string;
96
+ };
93
97
  'close-popup-menu': IdentityCall;
94
98
  'fdc3-add-context-listener': VoidCall;
95
99
  'fdc3-broadcast': VoidCall;