@bearei/server-common 0.0.107 → 0.0.110

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.
Files changed (38) hide show
  1. package/dist/access/access.guard.js +3 -4
  2. package/dist/access/access.guard.js.map +1 -1
  3. package/dist/action-logs/action-logs.service.js +2 -3
  4. package/dist/action-logs/action-logs.service.js.map +1 -1
  5. package/dist/app.dto.js +1 -2
  6. package/dist/app.dto.js.map +1 -1
  7. package/dist/app.entity.js +3 -3
  8. package/dist/app.entity.js.map +1 -1
  9. package/dist/app.interface.d.ts +12 -6
  10. package/dist/app.interface.js +43 -43
  11. package/dist/app.interface.js.map +1 -1
  12. package/dist/authentication/authentication.interface.d.ts +1 -1
  13. package/dist/authentication/authentication.service.d.ts +2 -2
  14. package/dist/base/base.interface.d.ts +4 -4
  15. package/dist/base/base.service.d.ts +7 -7
  16. package/dist/base/base.service.js +52 -52
  17. package/dist/base/base.service.js.map +1 -1
  18. package/dist/decorators/authentication-permissions.decorator.d.ts +3 -3
  19. package/dist/decorators/authentication-permissions.decorator.js +4 -4
  20. package/dist/decorators/authentication-permissions.decorator.js.map +1 -1
  21. package/dist/decorators/public.decorator.d.ts +3 -3
  22. package/dist/decorators/public.decorator.js +4 -4
  23. package/dist/decorators/public.decorator.js.map +1 -1
  24. package/dist/external/external.interface.d.ts +2 -2
  25. package/dist/external/external.service.js +2 -3
  26. package/dist/external/external.service.js.map +1 -1
  27. package/dist/jwt/jwt.service.js +1 -2
  28. package/dist/jwt/jwt.service.js.map +1 -1
  29. package/dist/permissions/permissions.guard.js.map +1 -1
  30. package/dist/permissions/permissions.interface.d.ts +54 -53
  31. package/dist/permissions/permissions.interface.js +56 -56
  32. package/dist/permissions/permissions.interface.js.map +1 -1
  33. package/dist/tsconfig.build.tsbuildinfo +1 -1
  34. package/dist/utils/error.util.js +9 -9
  35. package/dist/utils/error.util.js.map +1 -1
  36. package/dist/utils/sign.util.js +1 -2
  37. package/dist/utils/sign.util.js.map +1 -1
  38. package/package.json +1 -1
@@ -13,7 +13,6 @@ exports.AccessGuard = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const config_1 = require("@nestjs/config");
15
15
  const core_1 = require("@nestjs/core");
16
- const app_interface_1 = require("../app.interface");
17
16
  const decorators_1 = require("../decorators");
18
17
  const jwt_1 = require("../jwt");
19
18
  const utils_1 = require("../utils");
@@ -37,12 +36,12 @@ let AccessGuard = class AccessGuard {
37
36
  const tokenKey = headers['ei-internal-authorization'] ? 'ei-internal-authorization' : 'authorization';
38
37
  const token = (0, utils_1.formatToken)(headers)(tokenKey);
39
38
  if (!token) {
40
- (0, utils_1.throwAPIError)({ code: '401001', message: 'Authentication token does not exist' })(app_interface_1.APIError.UNAUTHORIZED);
39
+ (0, utils_1.throwAPIError)({ code: '401001', message: 'Authentication token does not exist' })('UNAUTHORIZED');
41
40
  }
42
41
  const handleJWTPayload = (request) => {
43
42
  const handleCompareResult = (request) => (result) => {
44
43
  if (!result) {
45
- (0, utils_1.throwAPIError)({ code: '401007', message: 'Internal service signature verification failed' })(app_interface_1.APIError.UNAUTHORIZED);
44
+ (0, utils_1.throwAPIError)({ code: '401007', message: 'Internal service signature verification failed' })('UNAUTHORIZED');
46
45
  }
47
46
  request['internalAccess'] = result;
48
47
  return result;
@@ -58,7 +57,7 @@ let AccessGuard = class AccessGuard {
58
57
  })(sub).then(handleCompareResult(request));
59
58
  }
60
59
  if (sub === 'guest' && !requiredAccesses?.includes(access_interface_1.Access.GUEST)) {
61
- (0, utils_1.throwAPIError)({ code: '401002', message: 'Guest user do not have access to current resource' })(app_interface_1.APIError.UNAUTHORIZED);
60
+ (0, utils_1.throwAPIError)({ code: '401002', message: 'Guest user do not have access to current resource' })('UNAUTHORIZED');
62
61
  }
63
62
  return Boolean(sub);
64
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"access.guard.js","sourceRoot":"","sources":["../../src/access/access.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA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CAAC,CAAA;QACT,CAAC,CAAA;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAC/F,CAAC;CACJ,CAAA;AA5DY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAGwB,gBAAU;QACP,sBAAa;QACjB,gBAAS;GAJhC,WAAW,CA4DvB"}
@@ -11,7 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ActionLogsService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
- const app_interface_1 = require("../app.interface");
15
14
  const external_1 = require("../external");
16
15
  let ActionLogsService = class ActionLogsService {
17
16
  externalService;
@@ -19,10 +18,10 @@ let ActionLogsService = class ActionLogsService {
19
18
  this.externalService = externalService;
20
19
  }
21
20
  success(options) {
22
- return async (data) => this.create({ ...options, result: app_interface_1.ActionResult.SUCCESS })(data);
21
+ return async (data) => this.create({ ...options, result: 'SUCCESS' })(data);
23
22
  }
24
23
  failure(options) {
25
- return async (data) => this.create({ ...options, result: app_interface_1.ActionResult.FAILURE })(data);
24
+ return async (data) => this.create({ ...options, result: 'FAILURE' })(data);
26
25
  }
27
26
  create({ headers, enableLogging = true, ...args }) {
28
27
  return async (data) => {
@@ -1 +1 @@
1
- {"version":3,"file":"action-logs.service.js","sourceRoot":"","sources":["../../src/action-logs/action-logs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AACzC,oDAA6C;AAC7C,0CAA2C;AAIpC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACG;IAA7B,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAEjE,OAAO,CAAC,OAA0B;QAC9B,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE,CAAC,IAAI,CA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AE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACtG,CAAC;IAED,MAAM,CAAC,EAAC,OAAO,EAAE,aAAa,GAAG,IAAI,EAAE,GAAG,IAAI,EAA0B;QACpE,OAAO,KAAK,EAAE,IAA6B,EAAE,EAAE;YAC3C,IAAI,aAAa,EAAE,CAAC;gBAChB,MAAM,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAA;YACzE,CAAC;QACL,CAAC,CAAA;IACL,CAAC;CACJ,CAAA;AAlBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAEqC,0BAAe;GADpD,iBAAiB,CAkB7B"}
package/dist/app.dto.js CHANGED
@@ -47,8 +47,7 @@ __decorate([
47
47
  __metadata("design:type", Boolean)
48
48
  ], IndexDTO.prototype, "count", void 0);
49
49
  __decorate([
50
- (0, class_validator_1.IsEnum)(app_interface_1.Order),
51
- (0, class_transformer_1.Transform)(({ value }) => app_interface_1.Order[value] ?? value),
50
+ (0, class_validator_1.IsEnum)(app_interface_1.OrderEnum),
52
51
  __metadata("design:type", String)
53
52
  ], IndexDTO.prototype, "order", void 0);
54
53
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"app.dto.js","sourceRoot":"","sources":["../src/app.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAWwB;AACxB,mDAAqC;AACrC,6CAAqC;AAErC,MAAa,QAAQ;IAEjB,EAAE,CAAS;IAKX,IAAI,CAAS;IAMb,IAAI,CAAS;IAIb,KAAK,CAAU;IAIf,KAAK,CAAQ;IAMb,GAAG,CAAW;IAOd,cAAc,CAAW;CAC5B;AAnCD,4BAmCC;AAjCG;IADC,IAAA,qBAAQ,GAAE;;oCACA;AA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EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IACrC,IAAA,qBAAQ,EAAC,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC;IACtB,IAAA,6BAAS,EAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;;gDACtD;AAG7B,MAAa,OAAO;IAGhB,EAAE,CAAQ;CACb;AAJD,0BAIC;AADG;IAFC,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAQ,GAAE;;mCACD;AAGd,MAAa,UAAU;IAGnB,KAAK,CAAQ;CAChB;AAJD,gCAIC;AADG;IAFC,IAAA,2BAAS,GAAE;IACX,IAAA,yBAAO,GAAE;;yCACG;AAGjB,MAAa,QAAQ;IAEjB,KAAK,CAAS;CACjB;AAHD,4BAGC;AADG;IADC,IAAA,qBAAQ,GAAE;;uCACG"}
@@ -25,10 +25,10 @@ let AppEntity = class AppEntity extends typeorm_1.BaseEntity {
25
25
  this.id = (0, nanoid_1.nanoid)();
26
26
  }
27
27
  beforeSoftRemove() {
28
- this.entityStatus = app_interface_1.EntityStatus.SOFT_REMOVED;
28
+ this.entityStatus = 'SOFT_REMOVED';
29
29
  }
30
30
  beforeRecover() {
31
- this.entityStatus = app_interface_1.EntityStatus.RECOVERED;
31
+ this.entityStatus = 'RECOVERED';
32
32
  }
33
33
  };
34
34
  exports.AppEntity = AppEntity;
@@ -41,7 +41,7 @@ __decorate([
41
41
  __metadata("design:type", String)
42
42
  ], AppEntity.prototype, "id", void 0);
43
43
  __decorate([
44
- (0, typeorm_1.Column)({ default: app_interface_1.EntityStatus.RECOVERED, enum: app_interface_1.EntityStatus, nullable: false, type: 'enum' }),
44
+ (0, typeorm_1.Column)({ default: 'RECOVERED', enum: app_interface_1.EntityStatusEnum, nullable: false, type: 'enum' }),
45
45
  __metadata("design:type", String)
46
46
  ], AppEntity.prototype, "entityStatus", void 0);
47
47
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../src/app.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAA6B;AAC7B,qCAYgB;AAChB,mDAA4C;AAIrC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,oBAAU;IAErC,SAAS,CAAQ;IAGjB,EAAE,CAAQ;IAGV,YAAY,CAAc;IAG1B,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,OAAO,CAAQ;IAGf,SAAS,CAAQ;IAGjB,YAAY;QACR,IAAI,CAAC,EAAE,GAAG,IAAA,eAAM,GAAE,CAAA;IACtB,CAAC;IAGD,gBAAgB;QACZ,IAAI,CAAC,YAAY,GAAG,4BAAY,CAAC,YAAY,CAAA;IACjD,CAAC;IAGD,aAAa;QACT,IAAI,CAAC,YAAY,GAAG,4BAAY,CAAC,SAAS,CAAA;IAC9C,CAAC;CACJ,CAAA;AApCY,8BAAS;AAElB;IADC,IAAA,gCAAsB,EAAC,UAAU,CAAC;;4CAClB;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;;qCAC7C;AAGV;IADC,IAAA,gBAAM,EAAC,EAAC,OAAO,EAAE,4BAAY,CAAC,SAAS,EAAE,IAAI,EAAE,4BAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;;+CACnE;AAG1B;IADC,IAAA,0BAAgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,uBAAa,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;0CAClB;AAGf;IADC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AgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,uBAAa,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;0CAClB;AAGf;IADC,IAAA,0BAAgB,GAAE;;4CACF;AAGjB;IADC,IAAA,sBAAY,GAAE;;;;6CAGd;AAGD;IADC,IAAA,0BAAgB,GAAE;;;;iDAGlB;AAGD;IADC,IAAA,uBAAa,GAAE;;;;8CAGf;oBAnCQ,SAAS;IAFrB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;IACpB,IAAA,eAAK,EAAC,CAAC,IAAI,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;GACjB,SAAS,CAoCrB"}
@@ -1,20 +1,20 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
  import { AppEntity } from './app.entity';
3
- export declare enum EntityStatus {
3
+ export declare enum EntityStatusEnum {
4
4
  SOFT_REMOVED = "softRemoved",
5
5
  RECOVERED = "recovered"
6
6
  }
7
- export declare enum Language {
7
+ export declare enum LanguageEnum {
8
8
  EN_US = "enUS",
9
9
  ZH_CN = "zhCN"
10
10
  }
11
- export declare enum Order {
11
+ export declare enum OrderEnum {
12
12
  ASC = "asc",
13
13
  DESC = "desc"
14
14
  }
15
15
  export type CustomHeaders = Record<'ei-domain-id' | 'ei-ip' | 'ei-client' | 'ei-internal-authorization' | 'ei-subject', string>;
16
16
  export type APIHeaders = Record<string, string> | CustomHeaders | AxiosRequestConfig['headers'];
17
- export declare enum APIError {
17
+ export declare enum APIErrorEnum {
18
18
  BAD_REQUEST = "badRequest",
19
19
  FORBIDDEN = "forbidden",
20
20
  HTTP_EXCEPTION = "httpException",
@@ -24,11 +24,11 @@ export declare enum APIError {
24
24
  UNAUTHORIZED = "unauthorized",
25
25
  UNPROCESSABLE_ENTITY = "unprocessableEntity"
26
26
  }
27
- export declare enum ActionResult {
27
+ export declare enum ActionResultEnum {
28
28
  FAILURE = "failure",
29
29
  SUCCESS = "success"
30
30
  }
31
- export declare enum Action {
31
+ export declare enum ActionEnum {
32
32
  CREATE = "create",
33
33
  DELETE = "delete",
34
34
  EXPORT = "export",
@@ -44,3 +44,9 @@ export interface FindResult<T extends AppEntity> {
44
44
  results: T[];
45
45
  total: string;
46
46
  }
47
+ export type Action = keyof typeof ActionEnum;
48
+ export type ActionResult = keyof typeof ActionResultEnum;
49
+ export type APIError = keyof typeof APIErrorEnum;
50
+ export type EntityStatus = keyof typeof EntityStatusEnum;
51
+ export type Language = keyof typeof LanguageEnum;
52
+ export type Order = keyof typeof OrderEnum;
@@ -1,46 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Action = exports.ActionResult = exports.APIError = exports.Order = exports.Language = exports.EntityStatus = void 0;
4
- var EntityStatus;
5
- (function (EntityStatus) {
6
- EntityStatus["SOFT_REMOVED"] = "softRemoved";
7
- EntityStatus["RECOVERED"] = "recovered";
8
- })(EntityStatus || (exports.EntityStatus = EntityStatus = {}));
9
- var Language;
10
- (function (Language) {
11
- Language["EN_US"] = "enUS";
12
- Language["ZH_CN"] = "zhCN";
13
- })(Language || (exports.Language = Language = {}));
14
- var Order;
15
- (function (Order) {
16
- Order["ASC"] = "asc";
17
- Order["DESC"] = "desc";
18
- })(Order || (exports.Order = Order = {}));
19
- var APIError;
20
- (function (APIError) {
21
- APIError["BAD_REQUEST"] = "badRequest";
22
- APIError["FORBIDDEN"] = "forbidden";
23
- APIError["HTTP_EXCEPTION"] = "httpException";
24
- APIError["INTERNAL_SERVER_ERROR"] = "internalServerError";
25
- APIError["NOT_FOUND"] = "notFound";
26
- APIError["REQUEST_TIMEOUT"] = "requestTimeout";
27
- APIError["UNAUTHORIZED"] = "unauthorized";
28
- APIError["UNPROCESSABLE_ENTITY"] = "unprocessableEntity";
29
- })(APIError || (exports.APIError = APIError = {}));
30
- var ActionResult;
31
- (function (ActionResult) {
32
- ActionResult["FAILURE"] = "failure";
33
- ActionResult["SUCCESS"] = "success";
34
- })(ActionResult || (exports.ActionResult = ActionResult = {}));
35
- var Action;
36
- (function (Action) {
37
- Action["CREATE"] = "create";
38
- Action["DELETE"] = "delete";
39
- Action["EXPORT"] = "export";
40
- Action["IMPORT"] = "import";
41
- Action["SIGN_IN"] = "signIn";
42
- Action["SIGN_OUT"] = "signOut";
43
- Action["SIGN_UP"] = "signUp";
44
- Action["UPDATE"] = "update";
45
- })(Action || (exports.Action = Action = {}));
3
+ exports.ActionEnum = exports.ActionResultEnum = exports.APIErrorEnum = exports.OrderEnum = exports.LanguageEnum = exports.EntityStatusEnum = void 0;
4
+ var EntityStatusEnum;
5
+ (function (EntityStatusEnum) {
6
+ EntityStatusEnum["SOFT_REMOVED"] = "softRemoved";
7
+ EntityStatusEnum["RECOVERED"] = "recovered";
8
+ })(EntityStatusEnum || (exports.EntityStatusEnum = EntityStatusEnum = {}));
9
+ var LanguageEnum;
10
+ (function (LanguageEnum) {
11
+ LanguageEnum["EN_US"] = "enUS";
12
+ LanguageEnum["ZH_CN"] = "zhCN";
13
+ })(LanguageEnum || (exports.LanguageEnum = LanguageEnum = {}));
14
+ var OrderEnum;
15
+ (function (OrderEnum) {
16
+ OrderEnum["ASC"] = "asc";
17
+ OrderEnum["DESC"] = "desc";
18
+ })(OrderEnum || (exports.OrderEnum = OrderEnum = {}));
19
+ var APIErrorEnum;
20
+ (function (APIErrorEnum) {
21
+ APIErrorEnum["BAD_REQUEST"] = "badRequest";
22
+ APIErrorEnum["FORBIDDEN"] = "forbidden";
23
+ APIErrorEnum["HTTP_EXCEPTION"] = "httpException";
24
+ APIErrorEnum["INTERNAL_SERVER_ERROR"] = "internalServerError";
25
+ APIErrorEnum["NOT_FOUND"] = "notFound";
26
+ APIErrorEnum["REQUEST_TIMEOUT"] = "requestTimeout";
27
+ APIErrorEnum["UNAUTHORIZED"] = "unauthorized";
28
+ APIErrorEnum["UNPROCESSABLE_ENTITY"] = "unprocessableEntity";
29
+ })(APIErrorEnum || (exports.APIErrorEnum = APIErrorEnum = {}));
30
+ var ActionResultEnum;
31
+ (function (ActionResultEnum) {
32
+ ActionResultEnum["FAILURE"] = "failure";
33
+ ActionResultEnum["SUCCESS"] = "success";
34
+ })(ActionResultEnum || (exports.ActionResultEnum = ActionResultEnum = {}));
35
+ var ActionEnum;
36
+ (function (ActionEnum) {
37
+ ActionEnum["CREATE"] = "create";
38
+ ActionEnum["DELETE"] = "delete";
39
+ ActionEnum["EXPORT"] = "export";
40
+ ActionEnum["IMPORT"] = "import";
41
+ ActionEnum["SIGN_IN"] = "signIn";
42
+ ActionEnum["SIGN_OUT"] = "signOut";
43
+ ActionEnum["SIGN_UP"] = "signUp";
44
+ ActionEnum["UPDATE"] = "update";
45
+ })(ActionEnum || (exports.ActionEnum = ActionEnum = {}));
46
46
  //# sourceMappingURL=app.interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,4CAA4B,CAAA;IAC5B,uCAAuB,CAAA;AAC3B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,QAGX;AAHD,WAAY,QAAQ;IAChB,0BAAc,CAAA;IACd,0BAAc,CAAA;AAClB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED,IAAY,KAGX;AAHD,WAAY,KAAK;IACb,oBAAW,CAAA;IACX,sBAAa,CAAA;AACjB,CAAC,EAHW,KAAK,qBAAL,KAAK,QAGhB;AAQD,IAAY,QASX;AATD,WAAY,QAAQ;IAChB,sCAA0B,CAAA;IAC1B,mCAAuB,CAAA;IACvB,4CAAgC,CAAA;IAChC,yDAA6C,CAAA;IAC7C,kCAAsB,CAAA;IACtB,8CAAkC,CAAA;IAClC,yCAA6B,CAAA;IAC7B,wDAA4C,CAAA;AAChD,CAAC,EATW,QAAQ,wBAAR,QAAQ,QASnB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACvB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,MASX;AATD,WAAY,MAAM;IACd,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;IACjB,4BAAkB,CAAA;IAClB,8BAAoB,CAAA;IACpB,4BAAkB,CAAA;IAClB,2BAAiB,CAAA;AACrB,CAAC,EATW,MAAM,sBAAN,MAAM,QASjB"}
1
+ {"version":3,"file":"app.interface.js","sourceRoot":"","sources":["../src/app.interface.ts"],"names":[],"mappings":";;;AAGA,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,gDAA4B,CAAA;IAC5B,2CAAuB,CAAA;AAC3B,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,8BAAc,CAAA;IACd,8BAAc,CAAA;AAClB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACjB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAQD,IAAY,YASX;AATD,WAAY,YAAY;IACpB,0CAA0B,CAAA;IAC1B,uCAAuB,CAAA;IACvB,gDAAgC,CAAA;IAChC,6DAA6C,CAAA;IAC7C,sCAAsB,CAAA;IACtB,kDAAkC,CAAA;IAClC,6CAA6B,CAAA;IAC7B,4DAA4C,CAAA;AAChD,CAAC,EATW,YAAY,4BAAZ,YAAY,QASvB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACvB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,UASX;AATD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,gCAAkB,CAAA;IAClB,kCAAoB,CAAA;IACpB,gCAAkB,CAAA;IAClB,+BAAiB,CAAA;AACrB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB"}
@@ -1,2 +1,2 @@
1
1
  import { AuthenticationExternalPermissionsOptions } from '../external';
2
- export type authenticationPermissionsOptions = AuthenticationExternalPermissionsOptions;
2
+ export type AuthenticationPermissionsOptions = AuthenticationExternalPermissionsOptions;
@@ -1,8 +1,8 @@
1
1
  import { APIHeaders } from '../app.interface';
2
2
  import { ExternalService } from '../external';
3
- import { authenticationPermissionsOptions } from './authentication.interface';
3
+ import { AuthenticationPermissionsOptions } from './authentication.interface';
4
4
  export declare class AuthenticationService {
5
5
  private readonly externalService;
6
6
  constructor(externalService: ExternalService);
7
- authenticationPermissions(headers: APIHeaders): (options: authenticationPermissionsOptions) => Promise<any>;
7
+ authenticationPermissions(headers: APIHeaders): (options: AuthenticationPermissionsOptions) => Promise<any>;
8
8
  }
@@ -7,13 +7,13 @@ export interface BaseServiceOptions<T> extends Pick<ActionLogsOptions, 'enableLo
7
7
  entityOptions: DeepPartial<T>;
8
8
  findOptions: FindOptionsWhere<T>;
9
9
  headers: APIHeaders;
10
- preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'ActionLogsOptions'>;
10
+ preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'actionLogsOptions'>;
11
11
  serviceName: string;
12
12
  }
13
13
  export type CreateOptions<T> = Omit<BaseServiceOptions<T>, 'findOptions'>;
14
14
  export type DelOptions<T> = Omit<BaseServiceOptions<T>, 'entityOptions'>;
15
15
  export type UpdateOptions<T> = Omit<BaseServiceOptions<T>, 'preValidateOptions'> & {
16
- preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'ActionLogsOptions'> & {
16
+ preValidateOptions?: Omit<PreValidateOptions<T>, 'serviceName' | 'actionLogsOptions'> & {
17
17
  validateKeys?: (keyof FindOptionsWhere<T>)[];
18
18
  };
19
19
  };
@@ -40,10 +40,10 @@ export interface UpdateAssociationOptions<T> extends Omit<BaseServiceOptions<T>,
40
40
  addEntityOptions?: DeepPartial<T>;
41
41
  }
42
42
  export interface FindOneOptions<T> extends Omit<BaseServiceOptions<T>, 'headers' | 'entityOptions'> {
43
- ActionLogsOptions?: ActionLogsOptions;
43
+ actionLogsOptions?: ActionLogsOptions;
44
44
  }
45
45
  export interface PreValidateOptions<T> {
46
- ActionLogsOptions?: ActionLogsOptions;
46
+ actionLogsOptions?: ActionLogsOptions;
47
47
  findOptions: FindOptionsWhere<T> & NotIdDTO;
48
48
  orValidateKeysGroups?: (keyof FindOptionsWhere<T>)[][];
49
49
  serviceName: string;
@@ -3,8 +3,8 @@ import { ActionLogsOptions, ActionLogsService } from '../action-logs';
3
3
  import { AppEntity } from '../app.entity';
4
4
  import { CountOptions, CountResult, CreateOptions, DelOptions, FindOneOptions, FindOptions, PreValidateOptions, ThrowErrorOptions, UpdateAssociationOptions, UpdateOptions } from './base.interface';
5
5
  export declare class BaseService {
6
- private readonly ActionLogsService;
7
- constructor(ActionLogsService: ActionLogsService);
6
+ private readonly actionLogsService;
7
+ constructor(actionLogsService: ActionLogsService);
8
8
  create<T extends AppEntity>({ enableLogging, entityOptions, headers, preValidateOptions, serviceName }: CreateOptions<T>): (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<T>>;
9
9
  del<T extends AppEntity>({ findOptions, serviceName, headers, enableLogging }: DelOptions<T>): (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<void>>;
10
10
  update<T extends AppEntity>({ enableLogging, entityOptions, findOptions, headers, preValidateOptions, serviceName }: UpdateOptions<T>): (repository: Repository<T>) => (rawEntity?: T) => Promise<(entityManager?: EntityManager) => Promise<T>>;
@@ -15,14 +15,14 @@ export declare class BaseService {
15
15
  total: string;
16
16
  }>;
17
17
  count<T extends AppEntity>({ findOptions, findManyOptions }: CountOptions<T>): (repository: Repository<T>) => Promise<CountResult>;
18
- findOne<T extends AppEntity>({ serviceName, findOptions, ActionLogsOptions }: FindOneOptions<T>): (repository: Repository<T>) => Promise<T>;
18
+ findOne<T extends AppEntity>({ serviceName, findOptions, actionLogsOptions }: FindOneOptions<T>): (repository: Repository<T>) => Promise<T>;
19
19
  updateAssociation<T extends AppEntity & {
20
20
  protected?: boolean;
21
21
  }>({ addEntityOptions, enableLogging, entityIds: rawEntityIds, findOptions, headers, serviceName }: UpdateAssociationOptions<T>): (associationKey: string) => (repository: Repository<T>) => Promise<(entityManager?: EntityManager) => Promise<T[]>>;
22
- preValidate<T extends AppEntity>({ ActionLogsOptions, findOptions, orValidateKeysGroups, serviceName, validateMethod }: PreValidateOptions<T>): Promise<(repository: Repository<T>) => Promise<void>>;
23
- checkProhibited<T extends AppEntity>(ActionLogsOptions?: ActionLogsOptions): (entity: T & {
22
+ preValidate<T extends AppEntity>({ actionLogsOptions, findOptions, orValidateKeysGroups, serviceName, validateMethod }: PreValidateOptions<T>): Promise<(repository: Repository<T>) => Promise<void>>;
23
+ checkProhibited<T extends AppEntity>(actionLogsOptions?: ActionLogsOptions): (entity: T & {
24
24
  protected?: boolean;
25
25
  }) => Promise<void>;
26
- ActionLogsSuccess<T extends AppEntity>(ActionLogsOptions: ActionLogsOptions): (entity: T | T[]) => Promise<void>;
27
- throwError({ errorType, ...args }: ThrowErrorOptions): (ActionLogsOptions: ActionLogsOptions) => Promise<void>;
26
+ ActionLogsSuccess<T extends AppEntity>(actionLogsOptions: ActionLogsOptions): (entity: T | T[]) => Promise<void>;
27
+ throwError({ errorType, ...args }: ThrowErrorOptions): (actionLogsOptions: ActionLogsOptions) => Promise<void>;
28
28
  }
@@ -13,16 +13,15 @@ exports.BaseService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const typeorm_1 = require("typeorm");
15
15
  const action_logs_1 = require("../action-logs");
16
- const app_interface_1 = require("../app.interface");
17
16
  const utils_1 = require("../utils");
18
17
  let BaseService = class BaseService {
19
- ActionLogsService;
20
- constructor(ActionLogsService) {
21
- this.ActionLogsService = ActionLogsService;
18
+ actionLogsService;
19
+ constructor(actionLogsService) {
20
+ this.actionLogsService = actionLogsService;
22
21
  }
23
22
  create({ enableLogging = true, entityOptions, headers, preValidateOptions, serviceName }) {
24
- const ActionLogsOptions = {
25
- action: app_interface_1.Action.CREATE,
23
+ const actionLogsOptions = {
24
+ action: 'CREATE',
26
25
  enableLogging,
27
26
  headers,
28
27
  message: `Create a ${serviceName}`,
@@ -34,19 +33,19 @@ let BaseService = class BaseService {
34
33
  Object.entries(preValidateOptions.findOptions).filter(([, value]) => typeof value !== 'undefined')
35
34
  .length;
36
35
  if (preValidate) {
37
- await (await this.preValidate({ ...preValidateOptions, serviceName, ActionLogsOptions }))(repository);
36
+ await (await this.preValidate({ ...preValidateOptions, serviceName, actionLogsOptions }))(repository);
38
37
  }
39
38
  const createdEntity = repository.create({ ...entityOptions });
40
39
  return async (entityManager) => {
41
40
  const entity = await (entityManager ? entityManager.save(createdEntity) : createdEntity.save());
42
- await this.ActionLogsSuccess(ActionLogsOptions)(entity);
41
+ await this.ActionLogsSuccess(actionLogsOptions)(entity);
43
42
  return entity;
44
43
  };
45
44
  };
46
45
  }
47
46
  del({ findOptions, serviceName, headers, enableLogging = true }) {
48
- const ActionLogsOptions = {
49
- action: app_interface_1.Action.DELETE,
47
+ const actionLogsOptions = {
48
+ action: 'DELETE',
50
49
  enableLogging,
51
50
  headers,
52
51
  message: `Delete a ${serviceName}`,
@@ -54,19 +53,19 @@ let BaseService = class BaseService {
54
53
  serviceName
55
54
  };
56
55
  return async (repository) => {
57
- const entity = await this.findOne({ serviceName, findOptions, ActionLogsOptions })(repository);
58
- const raw = enableLogging ? { ...ActionLogsOptions.raw, entity: { ...entity } } : undefined;
59
- await this.checkProhibited(ActionLogsOptions)(entity);
56
+ const entity = await this.findOne({ serviceName, findOptions, actionLogsOptions })(repository);
57
+ const raw = enableLogging ? { ...actionLogsOptions.raw, entity: { ...entity } } : undefined;
58
+ await this.checkProhibited(actionLogsOptions)(entity);
60
59
  await entity.softRemove();
61
60
  return async (entityManager) => {
62
61
  await (entityManager ? entityManager.save(entity) : entity.save());
63
- await this.ActionLogsSuccess({ ...ActionLogsOptions, raw })(entity);
62
+ await this.ActionLogsSuccess({ ...actionLogsOptions, raw })(entity);
64
63
  };
65
64
  };
66
65
  }
67
66
  update({ enableLogging = true, entityOptions, findOptions, headers, preValidateOptions, serviceName }) {
68
- const ActionLogsOptions = {
69
- action: app_interface_1.Action.UPDATE,
67
+ const actionLogsOptions = {
68
+ action: 'UPDATE',
70
69
  enableLogging,
71
70
  headers,
72
71
  message: `Update a ${serviceName}`,
@@ -80,7 +79,7 @@ let BaseService = class BaseService {
80
79
  [currentValue]: rawPreValidateFindOptions[currentValue] ?? entity[currentValue]
81
80
  }
82
81
  : accumulator;
83
- const updatePreValidate = (preValidateOptions) => (ActionLogsOptions) => async ({ entity, repository }) => {
82
+ const updatePreValidate = (preValidateOptions) => (actionLogsOptions) => async ({ entity, repository }) => {
84
83
  const { validateKeys = [], findOptions: rawPreValidateFindOptions, ...otherPreValidateOptions } = preValidateOptions;
85
84
  const preValidateKeys = [
86
85
  ...new Set([
@@ -96,15 +95,15 @@ let BaseService = class BaseService {
96
95
  const preValidateFindOptions = preValidateKeys.reduce(handlePreValidateFindOptions(rawPreValidateFindOptions)(entity), {});
97
96
  await (await this.preValidate({
98
97
  ...otherPreValidateOptions,
99
- ActionLogsOptions,
98
+ actionLogsOptions,
100
99
  findOptions: { ...preValidateFindOptions, notId: entity.id },
101
100
  serviceName
102
101
  }))(repository);
103
102
  };
104
103
  return (repository) => async (rawEntity) => {
105
- const entity = rawEntity ?? (await this.findOne({ ActionLogsOptions, findOptions, serviceName })(repository));
106
- const raw = enableLogging ? { ...ActionLogsOptions.raw, entity: { ...entity }, entityOptions } : undefined;
107
- const nextActionLogsOptions = { ...ActionLogsOptions, raw };
104
+ const entity = rawEntity ?? (await this.findOne({ actionLogsOptions, findOptions, serviceName })(repository));
105
+ const raw = enableLogging ? { ...actionLogsOptions.raw, entity: { ...entity }, entityOptions } : undefined;
106
+ const nextActionLogsOptions = { ...actionLogsOptions, raw };
108
107
  await this.checkProhibited(nextActionLogsOptions)(entity);
109
108
  if (preValidateOptions) {
110
109
  await updatePreValidate(preValidateOptions)(nextActionLogsOptions)({ entity, repository });
@@ -112,7 +111,7 @@ let BaseService = class BaseService {
112
111
  repository.merge(entity, entityOptions);
113
112
  return async (entityManager) => {
114
113
  await (entityManager ? entityManager.save(entity) : entity.save());
115
- await this.ActionLogsSuccess({ ...ActionLogsOptions, raw })(entity);
114
+ await this.ActionLogsSuccess({ ...actionLogsOptions, raw })(entity);
116
115
  return entity;
117
116
  };
118
117
  };
@@ -184,17 +183,17 @@ let BaseService = class BaseService {
184
183
  : { count: `${await queryBuilder.getCount()}` };
185
184
  };
186
185
  }
187
- findOne({ serviceName, findOptions, ActionLogsOptions }) {
186
+ findOne({ serviceName, findOptions, actionLogsOptions }) {
188
187
  return async (repository) => {
189
188
  const entity = await repository.findOne({
190
189
  where: Object.entries(findOptions).reduce((accumulator, [key, value]) => typeof value !== 'undefined' ? { ...accumulator, [key]: value } : accumulator, {})
191
190
  });
192
191
  if (!entity) {
193
- const field = JSON.stringify(Object.keys(findOptions));
192
+ const fields = JSON.stringify(Object.keys(findOptions));
194
193
  await this.throwError({
195
- errorType: app_interface_1.APIError.NOT_FOUND,
196
- message: `The ${serviceName} does not exist. Find by fields ${field}`
197
- })(ActionLogsOptions);
194
+ errorType: 'NOT_FOUND',
195
+ message: `The ${serviceName} does not exist. Find by fields ${fields}`
196
+ })(actionLogsOptions);
198
197
  }
199
198
  return entity;
200
199
  };
@@ -202,10 +201,10 @@ let BaseService = class BaseService {
202
201
  updateAssociation({ addEntityOptions, enableLogging = true, entityIds: rawEntityIds, findOptions, headers, serviceName }) {
203
202
  const { size: _, ...otherFindOptions } = findOptions;
204
203
  const entityIds = [...new Set(rawEntityIds)];
205
- const filterSoftRemoved = ({ entityStatus }) => entityStatus !== 'softRemoved';
204
+ const filterSoftRemoved = ({ entityStatus }) => entityStatus !== 'SOFT_REMOVED';
206
205
  return (associationKey) => {
207
- const ActionLogsOptions = {
208
- action: app_interface_1.Action.UPDATE,
206
+ const actionLogsOptions = {
207
+ action: 'UPDATE',
209
208
  enableLogging,
210
209
  headers,
211
210
  message: `Update ${serviceName} and ${associationKey} associations`,
@@ -219,7 +218,7 @@ let BaseService = class BaseService {
219
218
  })(repository).then(({ results }) => results);
220
219
  const raw = enableLogging ?
221
220
  {
222
- ...ActionLogsOptions.raw,
221
+ ...actionLogsOptions.raw,
223
222
  associationKey,
224
223
  entities: entities.map(entity => ({ ...entity })),
225
224
  entityIds
@@ -236,7 +235,7 @@ let BaseService = class BaseService {
236
235
  const entitiesToRemove = await Promise.all(entities
237
236
  .filter(entity => !entityIds.includes(entity[associationKey]))
238
237
  .map(entity => entity.softRemove()));
239
- await Promise.all(entitiesToRemove.map(this.checkProhibited(ActionLogsOptions)));
238
+ await Promise.all(entitiesToRemove.map(this.checkProhibited(actionLogsOptions)));
240
239
  const entitiesToRecover = await Promise.all(entities
241
240
  .filter(entity => entityIds.includes(entity[associationKey]) && entity.deletedAt)
242
241
  .map(entity => entity.recover()));
@@ -245,28 +244,29 @@ let BaseService = class BaseService {
245
244
  const savedEntities = await (entityManager ?
246
245
  entityManager.save(entityActions)
247
246
  : repository.save(entityActions));
248
- await this.ActionLogsSuccess({ ...ActionLogsOptions, raw })(savedEntities);
247
+ await this.ActionLogsSuccess({ ...actionLogsOptions, raw })(savedEntities);
249
248
  return [...entities, ...entitiesToAdd].filter(filterSoftRemoved);
250
249
  };
251
250
  };
252
251
  };
253
252
  }
254
- async preValidate({ ActionLogsOptions, findOptions, orValidateKeysGroups, serviceName, validateMethod = 'and' }) {
253
+ async preValidate({ actionLogsOptions, findOptions, orValidateKeysGroups, serviceName, validateMethod = 'and' }) {
255
254
  const handleOrKeys = ({ notId, ...args }) => (keys) => keys.reduce((accumulator, currentValue) => typeof currentValue !== 'undefined' ?
256
255
  { ...accumulator, [currentValue]: args[currentValue] }
257
256
  : accumulator, (notId ? { id: (0, typeorm_1.Not)(notId) } : {}));
258
257
  const handleOrValidateWhere = (findOptions) => async (orValidateKeysGroups) => {
259
258
  const { notId, ...otherFindOptions } = findOptions;
260
259
  if (orValidateKeysGroups && !orValidateKeysGroups.every(keys => Array.isArray(keys))) {
261
- const orValidateKeysGroup = JSON.stringify([
260
+ const orValidateKeysGroups = JSON.stringify([
262
261
  ['key1', 'key2'],
263
262
  ['key1', 'key3']
264
263
  ]);
265
264
  await this.throwError({
266
265
  code: '400001',
267
- errorType: app_interface_1.APIError.BAD_REQUEST,
268
- message: `When using "or" as a validation method, "orValidateKeysGroups" must be a nested array. ${orValidateKeysGroup}`
269
- })(ActionLogsOptions);
266
+ errorType: 'BAD_REQUEST',
267
+ message: `When using "or" as a validation method, "orValidateKeysGroups" must be a nested array.
268
+ ${orValidateKeysGroups}`
269
+ })(actionLogsOptions);
270
270
  }
271
271
  const flattedValidateOrKeys = [...new Set(orValidateKeysGroups?.flat())];
272
272
  const findOrOptions = orValidateKeysGroups?.map(handleOrKeys(findOptions)) ?? [];
@@ -288,41 +288,41 @@ let BaseService = class BaseService {
288
288
  return async (repository) => {
289
289
  const entity = await repository.findOne({ select: Object.keys(otherFindOptions), where });
290
290
  if (entity) {
291
- const field = JSON.stringify(Object.keys({
291
+ const fields = JSON.stringify(Object.keys({
292
292
  ...findOrOptions?.reduce((accumulator, currentValue) => ({ ...accumulator, ...currentValue }), {}),
293
293
  ...otherFindOptions
294
294
  }));
295
295
  await this.throwError({
296
296
  code: '400002',
297
- errorType: app_interface_1.APIError.BAD_REQUEST,
298
- message: `The ${serviceName} fields already exists. ${field}`
299
- })(ActionLogsOptions);
297
+ errorType: 'BAD_REQUEST',
298
+ message: `The ${serviceName} fields already exists. ${fields}`
299
+ })(actionLogsOptions);
300
300
  }
301
301
  };
302
302
  }
303
- checkProhibited(ActionLogsOptions) {
303
+ checkProhibited(actionLogsOptions) {
304
304
  return async (entity) => {
305
305
  if (typeof entity.protected === 'boolean' && entity.protected) {
306
306
  await this.throwError({
307
307
  code: '403001',
308
- errorType: app_interface_1.APIError.FORBIDDEN,
309
- message: `ALL actions on default ${ActionLogsOptions.serviceName} are prohibited`
310
- })(ActionLogsOptions);
308
+ errorType: 'FORBIDDEN',
309
+ message: `ALL actions on default ${actionLogsOptions.serviceName} are prohibited`
310
+ })(actionLogsOptions);
311
311
  }
312
312
  };
313
313
  }
314
- ActionLogsSuccess(ActionLogsOptions) {
315
- return async (entity) => await this.ActionLogsService.success(ActionLogsOptions)({ entity });
314
+ ActionLogsSuccess(actionLogsOptions) {
315
+ return async (entity) => await this.actionLogsService.success(actionLogsOptions)({ entity });
316
316
  }
317
317
  throwError({ errorType, ...args }) {
318
- return async (ActionLogsOptions) => {
318
+ return async (actionLogsOptions) => {
319
319
  try {
320
320
  (0, utils_1.throwAPIError)(args)(errorType);
321
321
  }
322
322
  catch (error) {
323
- if (ActionLogsOptions) {
324
- await this.ActionLogsService.failure({
325
- ...ActionLogsOptions,
323
+ if (actionLogsOptions) {
324
+ await this.actionLogsService.failure({
325
+ ...actionLogsOptions,
326
326
  message: error?.message
327
327
  })({ error });
328
328
  }