@openfin/core 29.72.15 → 29.72.17

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
@@ -1550,7 +1550,7 @@ declare namespace OpenFin {
1550
1550
  topic: string,
1551
1551
  payload: unknown,
1552
1552
  senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
1553
- ) => unknown;
1553
+ ) => Promise<unknown> |unknown;
1554
1554
 
1555
1555
  export type ErrorMiddleware = (
1556
1556
  topic: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "29.72.15",
3
+ "version": "29.72.17",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./src/mock.js",
6
6
  "types": "./src/mock.d.ts",
@@ -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;
@@ -415,7 +415,7 @@ export declare class InteropBroker extends Base {
415
415
  * @param _id the identity tryinc to connect
416
416
  * @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
417
417
  */
418
- isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean>;
418
+ isConnectionAuthorized(_id: Identity, _connectionPayload?: any): Promise<boolean> | boolean;
419
419
  /**
420
420
  * Called before every action to check if this entity should be allowed to take the action.
421
421
  * Return false to prevent the action
@@ -423,5 +423,5 @@ export declare class InteropBroker extends Base {
423
423
  * @param _payload the data being sent for this action
424
424
  * @param _identity the connection attempting to dispatch this action
425
425
  */
426
- isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean>;
426
+ isActionAuthorized(_action: string, _payload: any, _identity: OpenFin.ClientIdentity): Promise<boolean> | boolean;
427
427
  }
@@ -940,8 +940,8 @@ class InteropBroker extends base_1.Base {
940
940
  }
941
941
  // Setup Channel Connection Logic
942
942
  wireChannel(channel) {
943
- channel.onConnection((clientIdentity, payload) => {
944
- if (!this.isConnectionAuthorized(clientIdentity, payload)) {
943
+ channel.onConnection(async (clientIdentity, payload) => {
944
+ if (!(await this.isConnectionAuthorized(clientIdentity, payload))) {
945
945
  throw new Error(`Connection not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
946
946
  }
947
947
  if (!clientIdentity.endpointId) {
@@ -973,8 +973,8 @@ class InteropBroker extends base_1.Base {
973
973
  });
974
974
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
975
975
  // @ts-ignore
976
- channel.beforeAction((action, payload, clientIdentity) => {
977
- if (!this.isActionAuthorized(action, payload, clientIdentity)) {
976
+ channel.beforeAction(async (action, payload, clientIdentity) => {
977
+ if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
978
978
  throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
979
979
  }
980
980
  console.log(action, payload, clientIdentity);
@@ -1012,11 +1012,11 @@ class InteropBroker extends base_1.Base {
1012
1012
  * @param _id the identity tryinc to connect
1013
1013
  * @param _connectionPayload optional payload to use in custom implementations, will be undefined by default
1014
1014
  */
1015
- async isConnectionAuthorized(_id, _connectionPayload) {
1015
+ isConnectionAuthorized(_id, _connectionPayload) {
1016
1016
  this.wire.sendAction('interop-broker-is-connection-authorized').catch((e) => {
1017
1017
  // don't expose, analytics-only call
1018
1018
  });
1019
- return true;
1019
+ return Promise.resolve(true);
1020
1020
  }
1021
1021
  /**
1022
1022
  * Called before every action to check if this entity should be allowed to take the action.
@@ -1025,11 +1025,11 @@ class InteropBroker extends base_1.Base {
1025
1025
  * @param _payload the data being sent for this action
1026
1026
  * @param _identity the connection attempting to dispatch this action
1027
1027
  */
1028
- async isActionAuthorized(_action, _payload, _identity) {
1028
+ isActionAuthorized(_action, _payload, _identity) {
1029
1029
  this.wire.sendAction('interop-broker-is-action-authorized').catch((e) => {
1030
1030
  // don't expose, analytics-only call
1031
1031
  });
1032
- return true;
1032
+ return Promise.resolve(true);
1033
1033
  }
1034
1034
  }
1035
1035
  exports.InteropBroker = InteropBroker;