@openfin/core 27.71.21 → 27.71.24

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
@@ -1546,7 +1546,7 @@ declare namespace OpenFin {
1546
1546
  topic: string,
1547
1547
  payload: unknown,
1548
1548
  senderIdentity: ProviderIdentity | OpenFin.ClientIdentity
1549
- ) => unknown;
1549
+ ) => Promise<unknown> |unknown;
1550
1550
 
1551
1551
  export type ErrorMiddleware = (
1552
1552
  topic: string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfin/core",
3
- "version": "27.71.21",
3
+ "version": "27.71.24",
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;
@@ -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
- async isConnectionAuthorized(_id, _connectionPayload) {
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
- async isActionAuthorized(_action, _payload, _identity) {
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;