@openfin/core 32.75.18 → 32.75.20
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 +1 -1
- package/src/OpenFin.d.ts +1 -0
- package/src/api/application/Instance.d.ts +13 -1
- package/src/api/application/Instance.js +21 -7
- package/src/api/events/application.d.ts +4 -1
- package/src/api/interappbus/channel/index.js +4 -1
- package/src/api/me.d.ts +1 -1
- package/src/api/me.js +2 -1
- package/src/shapes/protocol.d.ts +5 -1
package/package.json
CHANGED
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
|
-
|
|
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,30 @@ 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
|
+
const { name } = this.wire.me;
|
|
437
|
+
const entityIdentity = { uuid: this.identity.uuid, name };
|
|
438
|
+
await this.wire.sendAction('set-file-download-location', { ...entityIdentity, downloadLocation });
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* 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.
|
|
442
|
+
* Note: This method is restricted by default and must be enabled via
|
|
443
|
+
* <a href="https://developers.openfin.co/docs/api-security">API security settings</a>.
|
|
444
|
+
* @return {Promise.<string>}
|
|
445
|
+
* @throws if getting file auto download location on different applications.
|
|
446
|
+
* @tutorial Application.getFileDownloadLocation
|
|
447
|
+
*/
|
|
448
|
+
async getFileDownloadLocation() {
|
|
449
|
+
const { payload: { data } } = await this.wire.sendAction('get-file-download-location', this.identity);
|
|
450
|
+
return data;
|
|
437
451
|
}
|
|
438
452
|
}
|
|
439
453
|
exports.Application = Application;
|
|
@@ -11,6 +11,9 @@ export type CrashedEvent = NamedEvent & {
|
|
|
11
11
|
exitCode: number;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
+
export type FileDownloadLocationChangedEvent = NamedEvent & {
|
|
15
|
+
type: 'file-download-location-changed';
|
|
16
|
+
};
|
|
14
17
|
export type RunRequestedEvent = IdentityEvent & {
|
|
15
18
|
type: 'run-requested';
|
|
16
19
|
userAppConfigArgs: Record<string, any>;
|
|
@@ -70,7 +73,7 @@ export type StartedEvent = IdentityEvent & {
|
|
|
70
73
|
/**
|
|
71
74
|
* An Application event that does propagate to (republish on) parent topics.
|
|
72
75
|
*/
|
|
73
|
-
export type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent;
|
|
76
|
+
export type WillPropagateApplicationEvent = ClosedEvent | ApplicationConnectedEvent | CrashedEvent | InitializedEvent | ManifestChangedEvent | NotRespondingEvent | RespondingEvent | RunRequestedEvent | StartedEvent | TrayIconClickedEvent | FileDownloadLocationChangedEvent;
|
|
74
77
|
export type ApplicationEvent = {
|
|
75
78
|
topic: 'application';
|
|
76
79
|
} & (PropagatedViewEvent | PropagatedWindowEvent | ApplicationWindowEvent | WillPropagateApplicationEvent);
|
|
@@ -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
|
-
|
|
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
|
|
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
|
});
|
package/src/shapes/protocol.d.ts
CHANGED
|
@@ -85,11 +85,15 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
85
85
|
'get-permissions': GetterCall<any>;
|
|
86
86
|
'get-all-channels': GetterCall<OpenFin.ProviderIdentity[]>;
|
|
87
87
|
'set-file-download-location': {
|
|
88
|
-
request: OpenFin.
|
|
88
|
+
request: OpenFin.Identity & {
|
|
89
89
|
downloadLocation: string;
|
|
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;
|