@openfin/core 25.70.4 → 25.70.7
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 +22 -1
- package/package.json +1 -1
- package/src/api/interappbus/channel/channel.js +2 -2
- package/src/api/interappbus/channel/provider.d.ts +1 -1
- package/src/api/interop/InteropBroker.d.ts +2 -2
- package/src/api/interop/InteropBroker.js +8 -8
- package/src/api/window/Instance.d.ts +5 -5
- package/src/api/window/Instance.js +12 -6
- package/src/shapes/protocol.d.ts +29 -0
package/OpenFin.d.ts
CHANGED
|
@@ -1443,7 +1443,7 @@ declare namespace OpenFin {
|
|
|
1443
1443
|
topic: string,
|
|
1444
1444
|
payload: unknown,
|
|
1445
1445
|
senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
|
|
1446
|
-
) => unknown;
|
|
1446
|
+
) => Promise<unknown> |unknown;
|
|
1447
1447
|
|
|
1448
1448
|
export type ErrorMiddleware = (
|
|
1449
1449
|
topic: string,
|
|
@@ -1536,6 +1536,27 @@ declare namespace OpenFin {
|
|
|
1536
1536
|
presetType: LayoutPresetType;
|
|
1537
1537
|
};
|
|
1538
1538
|
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Leveraged by the following windowing apis to influence side effects of the positioning.
|
|
1542
|
+
* - {@link OpenFin.Window.moveBy}
|
|
1543
|
+
* - {@link OpenFin.Window.moveTo}
|
|
1544
|
+
* - {@link OpenFin.Window.setBounds}
|
|
1545
|
+
* - {@link OpenFin.Window.resizeBy}
|
|
1546
|
+
* - {@link OpenFin.Window.resizeTo}
|
|
1547
|
+
* @example ```js
|
|
1548
|
+
fin.me.setBounds({top: 50, left: 50, width: 200, height: 200}, {skipRestore: true})
|
|
1549
|
+
```
|
|
1550
|
+
*/
|
|
1551
|
+
export interface PositioningOptions {
|
|
1552
|
+
/**
|
|
1553
|
+
* Windows Only.
|
|
1554
|
+
* If set to true, will not restore a maximized window before setting the bounds.
|
|
1555
|
+
* This will have the effect of the maximized window staying maximized and not immediately taking this new position.
|
|
1556
|
+
*/
|
|
1557
|
+
skipRestore?: boolean;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1539
1560
|
export type SystemEvents = import('./src/api/events/system').SystemEvents;
|
|
1540
1561
|
|
|
1541
1562
|
export type ApplicationEvents = import('./src/api/events/application').ApplicationEvents;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ChannelBase = exports.ProtectedItems = void 0;
|
|
4
|
-
const resultOrPayload = (func) => (topic, payload, senderIdentity) => {
|
|
5
|
-
const res = func(topic, payload, senderIdentity);
|
|
4
|
+
const resultOrPayload = (func) => async (topic, payload, senderIdentity) => {
|
|
5
|
+
const res = await func(topic, payload, senderIdentity);
|
|
6
6
|
return res === undefined ? payload : res;
|
|
7
7
|
};
|
|
8
8
|
class ProtectedItems {
|
|
@@ -3,7 +3,7 @@ import Transport from '../../../transport/transport';
|
|
|
3
3
|
import { AnyStrategy } from './protocols/strategy-types';
|
|
4
4
|
import ProviderIdentity = OpenFin.ProviderIdentity;
|
|
5
5
|
import ClientIdentity = OpenFin.ClientIdentity;
|
|
6
|
-
export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => any;
|
|
6
|
+
export declare type ConnectionListener = (identity: ClientIdentity, connectionMessage?: any) => Promise<any> | any;
|
|
7
7
|
export declare type DisconnectionListener = (identity: ClientIdentity) => any;
|
|
8
8
|
export declare class ChannelProvider extends ChannelBase {
|
|
9
9
|
#private;
|
|
@@ -351,7 +351,7 @@ export declare class InteropBroker extends Base {
|
|
|
351
351
|
* @param _id the identity tryinc to connect
|
|
352
352
|
* @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
|
|
353
353
|
*/
|
|
354
|
-
isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean
|
|
354
|
+
isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean> | boolean;
|
|
355
355
|
/**
|
|
356
356
|
* Called before every action to check if this entity should be allowed to take the action.
|
|
357
357
|
* Return false to prevent the action
|
|
@@ -359,5 +359,5 @@ export declare class InteropBroker extends Base {
|
|
|
359
359
|
* @param _payload the data being sent for this action
|
|
360
360
|
* @param _identity the connection attempting to dispatch this action
|
|
361
361
|
*/
|
|
362
|
-
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean
|
|
362
|
+
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean> | boolean;
|
|
363
363
|
}
|
|
@@ -828,8 +828,8 @@ class InteropBroker extends base_1.Base {
|
|
|
828
828
|
}
|
|
829
829
|
// Setup Channel Connection Logic
|
|
830
830
|
wireChannel(channel) {
|
|
831
|
-
channel.onConnection((clientIdentity, payload) => {
|
|
832
|
-
if (!this.isConnectionAuthorized(clientIdentity, payload)) {
|
|
831
|
+
channel.onConnection(async (clientIdentity, payload) => {
|
|
832
|
+
if (!(await this.isConnectionAuthorized(clientIdentity, payload))) {
|
|
833
833
|
throw new Error(`Connection not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
834
834
|
}
|
|
835
835
|
if (!clientIdentity.endpointId) {
|
|
@@ -860,8 +860,8 @@ class InteropBroker extends base_1.Base {
|
|
|
860
860
|
});
|
|
861
861
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
862
862
|
// @ts-ignore
|
|
863
|
-
channel.beforeAction((action, payload, clientIdentity) => {
|
|
864
|
-
if (!this.isActionAuthorized(action, payload, clientIdentity)) {
|
|
863
|
+
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
864
|
+
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
865
865
|
throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
866
866
|
}
|
|
867
867
|
console.log(action, payload, clientIdentity);
|
|
@@ -891,11 +891,11 @@ class InteropBroker extends base_1.Base {
|
|
|
891
891
|
* @param _id the identity tryinc to connect
|
|
892
892
|
* @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
|
|
893
893
|
*/
|
|
894
|
-
|
|
894
|
+
isConnectionAuthorized(_id, _connectionPayload) {
|
|
895
895
|
this.wire.sendAction('interop-broker-is-connection-authorized').catch((e) => {
|
|
896
896
|
// don't expose, analytics-only call
|
|
897
897
|
});
|
|
898
|
-
return true;
|
|
898
|
+
return Promise.resolve(true);
|
|
899
899
|
}
|
|
900
900
|
/**
|
|
901
901
|
* Called before every action to check if this entity should be allowed to take the action.
|
|
@@ -904,11 +904,11 @@ class InteropBroker extends base_1.Base {
|
|
|
904
904
|
* @param _payload the data being sent for this action
|
|
905
905
|
* @param _identity the connection attempting to dispatch this action
|
|
906
906
|
*/
|
|
907
|
-
|
|
907
|
+
isActionAuthorized(_action, _payload, _identity) {
|
|
908
908
|
this.wire.sendAction('interop-broker-is-action-authorized').catch((e) => {
|
|
909
909
|
// don't expose, analytics-only call
|
|
910
910
|
});
|
|
911
|
-
return true;
|
|
911
|
+
return Promise.resolve(true);
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
exports.InteropBroker = InteropBroker;
|
|
@@ -840,7 +840,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
840
840
|
* @return {Promise.<void>}
|
|
841
841
|
* @tutorial Window.moveBy
|
|
842
842
|
*/
|
|
843
|
-
moveBy(deltaLeft: number, deltaTop: number): Promise<void>;
|
|
843
|
+
moveBy(deltaLeft: number, deltaTop: number, positioningOptions?: OpenFin.PositioningOptions): Promise<void>;
|
|
844
844
|
/**
|
|
845
845
|
* Moves the window to a specified location.
|
|
846
846
|
* @param { number } left The left position of the window
|
|
@@ -848,7 +848,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
848
848
|
* @return {Promise.<void>}
|
|
849
849
|
* @tutorial Window.moveTo
|
|
850
850
|
*/
|
|
851
|
-
moveTo(left: number, top: number): Promise<void>;
|
|
851
|
+
moveTo(left: number, top: number, positioningOptions?: OpenFin.PositioningOptions): Promise<void>;
|
|
852
852
|
/**
|
|
853
853
|
* Resizes the window by a specified amount.
|
|
854
854
|
* @param { number } deltaWidth The change in the width of the window
|
|
@@ -859,7 +859,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
859
859
|
* @return {Promise.<void>}
|
|
860
860
|
* @tutorial Window.resizeBy
|
|
861
861
|
*/
|
|
862
|
-
resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFin.AnchorType): Promise<void>;
|
|
862
|
+
resizeBy(deltaWidth: number, deltaHeight: number, anchor: OpenFin.AnchorType, positioningOptions?: OpenFin.PositioningOptions): Promise<void>;
|
|
863
863
|
/**
|
|
864
864
|
* Resizes the window to the specified dimensions.
|
|
865
865
|
* @param { number } width The change in the width of the window
|
|
@@ -870,7 +870,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
870
870
|
* @return {Promise.<void>}
|
|
871
871
|
* @tutorial Window.resizeTo
|
|
872
872
|
*/
|
|
873
|
-
resizeTo(width: number, height: number, anchor: OpenFin.AnchorType): Promise<void>;
|
|
873
|
+
resizeTo(width: number, height: number, anchor: OpenFin.AnchorType, positioningOptions?: OpenFin.PositioningOptions): Promise<void>;
|
|
874
874
|
/**
|
|
875
875
|
* Restores the window to its normal state (i.e., unminimized, unmaximized).
|
|
876
876
|
* @return {Promise.<void>}
|
|
@@ -889,7 +889,7 @@ export declare class _Window extends WebContents<WindowEvents> {
|
|
|
889
889
|
* @return {Promise.<void>}
|
|
890
890
|
* @tutorial Window.setBounds
|
|
891
891
|
*/
|
|
892
|
-
setBounds(bounds: Partial<OpenFin.Bounds
|
|
892
|
+
setBounds(bounds: Partial<OpenFin.Bounds>, positioningOptions?: OpenFin.PositioningOptions): Promise<void>;
|
|
893
893
|
/**
|
|
894
894
|
* Shows the window if it is hidden.
|
|
895
895
|
* @param { boolean } [force = false] Show will be prevented from showing when force is false and
|
|
@@ -1014,11 +1014,12 @@ class _Window extends main_1.WebContents {
|
|
|
1014
1014
|
* @return {Promise.<void>}
|
|
1015
1015
|
* @tutorial Window.moveBy
|
|
1016
1016
|
*/
|
|
1017
|
-
moveBy(deltaLeft, deltaTop) {
|
|
1017
|
+
moveBy(deltaLeft, deltaTop, positioningOptions) {
|
|
1018
1018
|
return this.wire
|
|
1019
1019
|
.sendAction('move-window-by', {
|
|
1020
1020
|
deltaLeft,
|
|
1021
1021
|
deltaTop,
|
|
1022
|
+
positioningOptions,
|
|
1022
1023
|
...this.identity
|
|
1023
1024
|
})
|
|
1024
1025
|
.then(() => undefined);
|
|
@@ -1030,11 +1031,12 @@ class _Window extends main_1.WebContents {
|
|
|
1030
1031
|
* @return {Promise.<void>}
|
|
1031
1032
|
* @tutorial Window.moveTo
|
|
1032
1033
|
*/
|
|
1033
|
-
moveTo(left, top) {
|
|
1034
|
+
moveTo(left, top, positioningOptions) {
|
|
1034
1035
|
return this.wire
|
|
1035
1036
|
.sendAction('move-window', {
|
|
1036
1037
|
left,
|
|
1037
1038
|
top,
|
|
1039
|
+
positioningOptions,
|
|
1038
1040
|
...this.identity
|
|
1039
1041
|
})
|
|
1040
1042
|
.then(() => undefined);
|
|
@@ -1049,12 +1051,13 @@ class _Window extends main_1.WebContents {
|
|
|
1049
1051
|
* @return {Promise.<void>}
|
|
1050
1052
|
* @tutorial Window.resizeBy
|
|
1051
1053
|
*/
|
|
1052
|
-
resizeBy(deltaWidth, deltaHeight, anchor) {
|
|
1054
|
+
resizeBy(deltaWidth, deltaHeight, anchor, positioningOptions) {
|
|
1053
1055
|
return this.wire
|
|
1054
1056
|
.sendAction('resize-window-by', {
|
|
1055
1057
|
deltaWidth: Math.floor(deltaWidth),
|
|
1056
1058
|
deltaHeight: Math.floor(deltaHeight),
|
|
1057
1059
|
anchor,
|
|
1060
|
+
positioningOptions,
|
|
1058
1061
|
...this.identity
|
|
1059
1062
|
})
|
|
1060
1063
|
.then(() => undefined);
|
|
@@ -1069,12 +1072,13 @@ class _Window extends main_1.WebContents {
|
|
|
1069
1072
|
* @return {Promise.<void>}
|
|
1070
1073
|
* @tutorial Window.resizeTo
|
|
1071
1074
|
*/
|
|
1072
|
-
resizeTo(width, height, anchor) {
|
|
1075
|
+
resizeTo(width, height, anchor, positioningOptions) {
|
|
1073
1076
|
return this.wire
|
|
1074
1077
|
.sendAction('resize-window', {
|
|
1075
1078
|
width: Math.floor(width),
|
|
1076
1079
|
height: Math.floor(height),
|
|
1077
1080
|
anchor,
|
|
1081
|
+
positioningOptions,
|
|
1078
1082
|
...this.identity
|
|
1079
1083
|
})
|
|
1080
1084
|
.then(() => undefined);
|
|
@@ -1101,8 +1105,10 @@ class _Window extends main_1.WebContents {
|
|
|
1101
1105
|
* @return {Promise.<void>}
|
|
1102
1106
|
* @tutorial Window.setBounds
|
|
1103
1107
|
*/
|
|
1104
|
-
setBounds(bounds) {
|
|
1105
|
-
return this.wire
|
|
1108
|
+
setBounds(bounds, positioningOptions) {
|
|
1109
|
+
return this.wire
|
|
1110
|
+
.sendAction('set-window-bounds', { ...bounds, ...this.identity, positioningOptions })
|
|
1111
|
+
.then(() => undefined);
|
|
1106
1112
|
}
|
|
1107
1113
|
/**
|
|
1108
1114
|
* Shows the window if it is hidden.
|
package/src/shapes/protocol.d.ts
CHANGED
|
@@ -167,7 +167,36 @@ export interface ProtocolMap extends ProtocolMapBase {
|
|
|
167
167
|
};
|
|
168
168
|
response: OpenFin.QueryPermissionResult;
|
|
169
169
|
};
|
|
170
|
+
'move-window-by': IdentityCall<WithPositioningOptions<{
|
|
171
|
+
deltaLeft: number;
|
|
172
|
+
deltaTop: number;
|
|
173
|
+
}>>;
|
|
174
|
+
'move-window': IdentityCall<WithPositioningOptions<{
|
|
175
|
+
left: number;
|
|
176
|
+
top: number;
|
|
177
|
+
}>>;
|
|
178
|
+
'resize-window-by': IdentityCall<WithPositioningOptions<{
|
|
179
|
+
deltaWidth: number;
|
|
180
|
+
deltaHeight: number;
|
|
181
|
+
anchor: OpenFin.AnchorType;
|
|
182
|
+
}>>;
|
|
183
|
+
'resize-window': IdentityCall<WithPositioningOptions<{
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
anchor: OpenFin.AnchorType;
|
|
187
|
+
}>>;
|
|
188
|
+
'set-window-bounds': IdentityCall<WithPositioningOptions<Partial<OpenFin.Bounds>>>;
|
|
170
189
|
}
|
|
190
|
+
export declare type ApiCall<Request, Response> = {
|
|
191
|
+
request: Request;
|
|
192
|
+
response: Response;
|
|
193
|
+
};
|
|
194
|
+
export declare type VoidCall = ApiCall<void, void>;
|
|
195
|
+
export declare type GetterCall<T> = ApiCall<void, T>;
|
|
196
|
+
export declare type WithPositioningOptions<AdditionalPayload = {}> = AdditionalPayload & {
|
|
197
|
+
positioningOptions: OpenFin.PositioningOptions;
|
|
198
|
+
};
|
|
199
|
+
export declare type IdentityCall<AdditionalPayload = {}, Response = void> = ApiCall<AdditionalPayload & OpenFin.Identity, Response>;
|
|
171
200
|
interface ProtocolMapBase {
|
|
172
201
|
[action: string]: {
|
|
173
202
|
request: any;
|