@sdflc/backend-helpers 1.0.24 → 1.0.25

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.
@@ -1,7 +1,6 @@
1
1
  import { Logger } from '@sdflc/utils';
2
2
  import { BaseCoreInterface, BaseCoreDoingWhatInterface, BaseCoreActionsInterface, CoreActionInterface, BaseCoreValidatorsInterface } from './interfaces';
3
3
  import { VerifyUserTokenArgs } from './interfaces/VerifyUserTokenArgs';
4
- import { BaseGateway } from './baseGateway';
5
4
  import { Database } from './database';
6
5
  declare class BaseCore {
7
6
  protected props: BaseCoreInterface;
@@ -10,9 +9,9 @@ declare class BaseCore {
10
9
  protected doingWhat?: BaseCoreDoingWhatInterface;
11
10
  protected logger: Logger;
12
11
  protected name?: string;
13
- protected gateway?: BaseGateway;
12
+ protected gateway?: any;
14
13
  protected gateways?: any;
15
- protected gwSpace?: BaseGateway;
14
+ protected gwSpace?: any;
16
15
  protected interserviceApiKey?: string;
17
16
  protected jwtSecret: string;
18
17
  protected verifytokenArgs?: VerifyUserTokenArgs;
package/build/baseCore.js CHANGED
@@ -801,18 +801,23 @@ var BaseCore = /** @class */ (function () {
801
801
  context.spaceId = token.spaceId || context.spaceId;
802
802
  authByToken = true;
803
803
  }
804
+ space = null;
805
+ if (!this.gwSpace) return [3 /*break*/, 4];
804
806
  return [4 /*yield*/, ((_a = this.gwSpace) === null || _a === void 0 ? void 0 : _a.get(context.spaceId || ''))];
805
807
  case 3:
808
+ // Lookup space in case we have gateway
806
809
  space = _b.sent();
807
810
  if (!space) {
808
811
  return [2 /*return*/, [false, 'Space Not Found']];
809
812
  }
810
813
  context.space = space;
814
+ _b.label = 4;
815
+ case 4:
811
816
  if (!authByToken) {
812
817
  if (this.interserviceApiKey && context.apiKey === this.interserviceApiKey) {
813
818
  return [2 /*return*/, [true, '']];
814
819
  }
815
- else if (space.apiKey && space.apiKey !== context.apiKey) {
820
+ else if ((space === null || space === void 0 ? void 0 : space.apiKey) && (space === null || space === void 0 ? void 0 : space.apiKey) !== context.apiKey) {
816
821
  return [2 /*return*/, [false, 'API Key is invalid']];
817
822
  }
818
823
  }
@@ -8,7 +8,7 @@ import { VerifyUserTokenArgs } from './VerifyUserTokenArgs';
8
8
  export interface BaseCoreInterface {
9
9
  db: Database;
10
10
  context?: any;
11
- gateway?: BaseGateway;
11
+ gateway?: any;
12
12
  gateways?: any;
13
13
  isProduction: boolean;
14
14
  logLevel: LoggerLevels;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "@types/dotenv-safe": "^8.1.2",
30
30
  "@types/jest": "^26.0.24",
31
31
  "@types/jsonwebtoken": "^8.5.8",
32
- "@types/lodash": "^4.14.178",
32
+ "@types/lodash": "^4.14.179",
33
33
  "@types/node": "^14.18.12",
34
34
  "@types/redis": "^2.8.32",
35
35
  "@types/uuid": "^8.3.4",
@@ -39,7 +39,7 @@
39
39
  "eslint-config-prettier": "^6.15.0",
40
40
  "eslint-plugin-jest": "^24.7.0",
41
41
  "eslint-plugin-prettier": "^3.4.1",
42
- "eslint-plugin-react": "^7.28.0",
42
+ "eslint-plugin-react": "^7.29.1",
43
43
  "husky": "^6.0.0",
44
44
  "jest": "^26.6.3",
45
45
  "prettier": "^2.5.1",
@@ -50,7 +50,7 @@
50
50
  "typescript": "^4.5.5"
51
51
  },
52
52
  "dependencies": {
53
- "@sdflc/api-helpers": "^1.1.7",
53
+ "@sdflc/api-helpers": "^1.1.8",
54
54
  "@sdflc/utils": "^1.0.18",
55
55
  "bcrypt": "^5.0.1",
56
56
  "bluebird": "^3.7.2",