@sdflc/backend-helpers 1.0.46 → 1.0.49

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,6 +1,6 @@
1
1
  import { Logger } from '@sdflc/utils';
2
2
  import { Database } from './Database';
3
- import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, BaseCoreValidatorsInterface, JwtTokenSecretAndSettings, ApiContext } from './interfaces';
3
+ import { BaseCorePropsInterface, BaseCoreActionsInterface, CoreActionInterface, JwtTokenSecretAndSettings, ApiContext } from './interfaces';
4
4
  declare class BaseCore {
5
5
  protected config: BaseCorePropsInterface;
6
6
  protected logger: Logger;
@@ -9,7 +9,7 @@ declare class BaseCore {
9
9
  getRequestId(): string;
10
10
  getContext(): ApiContext;
11
11
  getGateways(): any;
12
- getValidators(): BaseCoreValidatorsInterface;
12
+ getValidators(): any;
13
13
  success(data: any, code?: number): any;
14
14
  failure(code: number, errorMsg: string, data?: any): any;
15
15
  validationFailure(ex: any): any;
package/build/BaseCore.js CHANGED
@@ -804,6 +804,7 @@ var BaseCore = /** @class */ (function () {
804
804
  context.roleId = token.roleId;
805
805
  context.userId = token.userId;
806
806
  context.spaceId = token.spaceId || context.spaceId;
807
+ context.lang = token.lang || context.requestedLang;
807
808
  authByToken = true;
808
809
  }
809
810
  if (!authByToken) {
@@ -98,10 +98,10 @@ var validateUpdate = function (_a) {
98
98
  var rules = _a.rules;
99
99
  // eslint-disable-next-line
100
100
  return function (args, opt) { return __awaiter(void 0, void 0, void 0, function () {
101
- var _a, id, params, idCheck, paramsCheck, result;
101
+ var _a, where, params, idCheck, paramsCheck, result;
102
102
  return __generator(this, function (_b) {
103
- _a = args || {}, id = _a.id, params = _a.params;
104
- idCheck = (0, exports.shouldHaveId)(id)[0];
103
+ _a = args || {}, where = _a.where, params = _a.params;
104
+ idCheck = (0, exports.shouldHaveParams)(where)[0];
105
105
  if (idCheck !== true) {
106
106
  return [2 /*return*/, [idCheck, {}]];
107
107
  }
@@ -19,5 +19,6 @@ export interface ApiContext {
19
19
  accountId?: string;
20
20
  roleId?: string;
21
21
  userId?: string;
22
+ lang?: string;
22
23
  [key: string]: any;
23
24
  }
@@ -1,8 +1,9 @@
1
+ import { BaseCoreActionsInterface } from './BaseCoreActionsInterface';
1
2
  export interface CoreActionInterface {
2
3
  args: any;
3
4
  doAuth?: boolean;
4
5
  accessRights?: any[];
5
- validate?(args?: any, gateways?: any, opt?: any): Promise<any[]> | any[];
6
+ validate?(args: any, opt: BaseCoreActionsInterface): Promise<any[]> | any[];
6
7
  action(args?: any, opt?: any): any;
7
8
  hasTransaction: boolean;
8
9
  doingWhat?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.46",
3
+ "version": "1.0.49",
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",