@openfin/core 28.72.3 → 28.72.6
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
|
@@ -1555,7 +1555,7 @@ declare namespace OpenFin {
|
|
|
1555
1555
|
topic: string,
|
|
1556
1556
|
payload: unknown,
|
|
1557
1557
|
senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
|
|
1558
|
-
) => unknown;
|
|
1558
|
+
) => Promise<unknown> |unknown;
|
|
1559
1559
|
|
|
1560
1560
|
export type ErrorMiddleware = (
|
|
1561
1561
|
topic: string,
|
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;
|
|
@@ -372,7 +372,7 @@ export declare class InteropBroker extends Base {
|
|
|
372
372
|
* @param _id the identity tryinc to connect
|
|
373
373
|
* @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
|
|
374
374
|
*/
|
|
375
|
-
isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean
|
|
375
|
+
isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean> | boolean;
|
|
376
376
|
/**
|
|
377
377
|
* Called before every action to check if this entity should be allowed to take the action.
|
|
378
378
|
* Return false to prevent the action
|
|
@@ -380,5 +380,5 @@ export declare class InteropBroker extends Base {
|
|
|
380
380
|
* @param _payload the data being sent for this action
|
|
381
381
|
* @param _identity the connection attempting to dispatch this action
|
|
382
382
|
*/
|
|
383
|
-
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean
|
|
383
|
+
isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean> | boolean;
|
|
384
384
|
}
|
|
@@ -888,8 +888,8 @@ class InteropBroker extends base_1.Base {
|
|
|
888
888
|
}
|
|
889
889
|
// Setup Channel Connection Logic
|
|
890
890
|
wireChannel(channel) {
|
|
891
|
-
channel.onConnection((clientIdentity, payload) => {
|
|
892
|
-
if (!this.isConnectionAuthorized(clientIdentity, payload)) {
|
|
891
|
+
channel.onConnection(async (clientIdentity, payload) => {
|
|
892
|
+
if (!(await this.isConnectionAuthorized(clientIdentity, payload))) {
|
|
893
893
|
throw new Error(`Connection not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
894
894
|
}
|
|
895
895
|
if (!clientIdentity.endpointId) {
|
|
@@ -921,8 +921,8 @@ class InteropBroker extends base_1.Base {
|
|
|
921
921
|
});
|
|
922
922
|
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
923
923
|
// @ts-ignore
|
|
924
|
-
channel.beforeAction((action, payload, clientIdentity) => {
|
|
925
|
-
if (!this.isActionAuthorized(action, payload, clientIdentity)) {
|
|
924
|
+
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
925
|
+
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
926
926
|
throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
927
927
|
}
|
|
928
928
|
console.log(action, payload, clientIdentity);
|
|
@@ -957,11 +957,11 @@ class InteropBroker extends base_1.Base {
|
|
|
957
957
|
* @param _id the identity tryinc to connect
|
|
958
958
|
* @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
|
|
959
959
|
*/
|
|
960
|
-
|
|
960
|
+
isConnectionAuthorized(_id, _connectionPayload) {
|
|
961
961
|
this.wire.sendAction('interop-broker-is-connection-authorized').catch((e) => {
|
|
962
962
|
// don't expose, analytics-only call
|
|
963
963
|
});
|
|
964
|
-
return true;
|
|
964
|
+
return Promise.resolve(true);
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* Called before every action to check if this entity should be allowed to take the action.
|
|
@@ -970,11 +970,11 @@ class InteropBroker extends base_1.Base {
|
|
|
970
970
|
* @param _payload the data being sent for this action
|
|
971
971
|
* @param _identity the connection attempting to dispatch this action
|
|
972
972
|
*/
|
|
973
|
-
|
|
973
|
+
isActionAuthorized(_action, _payload, _identity) {
|
|
974
974
|
this.wire.sendAction('interop-broker-is-action-authorized').catch((e) => {
|
|
975
975
|
// don't expose, analytics-only call
|
|
976
976
|
});
|
|
977
|
-
return true;
|
|
977
|
+
return Promise.resolve(true);
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
exports.InteropBroker = InteropBroker;
|