@serene-dev/la-nest-library 0.0.19 → 0.0.22

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 (57) hide show
  1. package/dist/libs/la-library/src/dtos/base.dto.d.ts +1 -0
  2. package/dist/libs/la-library/src/dtos/base.dto.js +6 -0
  3. package/dist/libs/la-library/src/dtos/base.dto.js.map +1 -1
  4. package/dist/libs/la-library/src/entities/base.entity.d.ts +1 -0
  5. package/dist/libs/la-library/src/entities/base.entity.js +4 -0
  6. package/dist/libs/la-library/src/entities/base.entity.js.map +1 -1
  7. package/dist/libs/la-library/src/enums/base.enum.d.ts +2 -0
  8. package/dist/libs/la-library/src/enums/base.enum.js +2 -0
  9. package/dist/libs/la-library/src/enums/base.enum.js.map +1 -1
  10. package/dist/libs/la-library/src/index.d.ts +7 -0
  11. package/dist/libs/la-library/src/index.js +23 -1
  12. package/dist/libs/la-library/src/index.js.map +1 -1
  13. package/dist/libs/la-library/src/modules/authentication/authentication.controller.d.ts +10 -0
  14. package/dist/libs/la-library/src/modules/authentication/authentication.controller.js +77 -0
  15. package/dist/libs/la-library/src/modules/authentication/authentication.controller.js.map +1 -0
  16. package/dist/libs/la-library/src/modules/authentication/authentication.dto.d.ts +24 -0
  17. package/dist/libs/la-library/src/modules/authentication/authentication.dto.js +73 -0
  18. package/dist/libs/la-library/src/modules/authentication/authentication.dto.js.map +1 -0
  19. package/dist/libs/la-library/src/modules/authentication/authentication.entity.d.ts +16 -0
  20. package/dist/libs/la-library/src/modules/authentication/authentication.entity.js +65 -0
  21. package/dist/libs/la-library/src/modules/authentication/authentication.entity.js.map +1 -0
  22. package/dist/libs/la-library/src/modules/authentication/authentication.enum.d.ts +9 -0
  23. package/dist/libs/la-library/src/modules/authentication/authentication.enum.js +15 -0
  24. package/dist/libs/la-library/src/modules/authentication/authentication.enum.js.map +1 -0
  25. package/dist/libs/la-library/src/modules/authentication/authentication.guard.d.ts +13 -0
  26. package/dist/libs/la-library/src/modules/authentication/authentication.guard.js +69 -0
  27. package/dist/libs/la-library/src/modules/authentication/authentication.guard.js.map +1 -0
  28. package/dist/libs/la-library/src/modules/authentication/authentication.module.d.ts +4 -0
  29. package/dist/libs/la-library/src/modules/authentication/authentication.module.js +38 -0
  30. package/dist/libs/la-library/src/modules/authentication/authentication.module.js.map +1 -0
  31. package/dist/libs/la-library/src/modules/authentication/authentication.service.d.ts +32 -0
  32. package/dist/libs/la-library/src/modules/authentication/authentication.service.js +142 -0
  33. package/dist/libs/la-library/src/modules/authentication/authentication.service.js.map +1 -0
  34. package/dist/libs/la-library/src/modules/logs/logs.dto.d.ts +0 -1
  35. package/dist/libs/la-library/src/modules/logs/logs.dto.js +4 -9
  36. package/dist/libs/la-library/src/modules/logs/logs.dto.js.map +1 -1
  37. package/dist/libs/la-library/src/modules/logs/logs.module.js +1 -1
  38. package/dist/libs/la-library/src/modules/logs/logs.module.js.map +1 -1
  39. package/dist/libs/la-library/src/samples/base.sample.d.ts +2 -0
  40. package/dist/libs/la-library/src/samples/base.sample.js +2 -0
  41. package/dist/libs/la-library/src/samples/base.sample.js.map +1 -1
  42. package/dist/libs/la-library/src/services/base.service.d.ts +4 -0
  43. package/dist/libs/la-library/src/services/base.service.js +10 -0
  44. package/dist/libs/la-library/src/services/base.service.js.map +1 -1
  45. package/dist/libs/la-library/src/services/environment.service.d.ts +4 -0
  46. package/dist/libs/la-library/src/services/environment.service.js +2 -2
  47. package/dist/libs/la-library/src/services/environment.service.js.map +1 -1
  48. package/dist/libs/la-library/src/services/file.service.d.ts +3 -1
  49. package/dist/libs/la-library/src/services/file.service.js +1 -1
  50. package/dist/libs/la-library/src/services/file.service.js.map +1 -1
  51. package/dist/libs/la-library/src/services/token.service.d.ts +6 -2
  52. package/dist/libs/la-library/src/services/token.service.js +3 -2
  53. package/dist/libs/la-library/src/services/token.service.js.map +1 -1
  54. package/dist/libs/la-library/src/services/utility.service.d.ts +4 -1
  55. package/dist/libs/la-library/src/services/utility.service.js +13 -0
  56. package/dist/libs/la-library/src/services/utility.service.js.map +1 -1
  57. package/package.json +3 -1
@@ -1,6 +1,7 @@
1
1
  import { BaseEntity } from '../entities/base.entity';
2
2
  export declare class BaseDto implements Partial<BaseEntity> {
3
3
  createdBy?: string;
4
+ ownerID?: string;
4
5
  orgID?: string;
5
6
  }
6
7
  export declare class BatchDeleteDto {
@@ -23,6 +23,12 @@ __decorate([
23
23
  (0, swagger_1.ApiProperty)({ default: base_sample_1.Sample.createdBy, required: false }),
24
24
  __metadata("design:type", String)
25
25
  ], BaseDto.prototype, "createdBy", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsUUID)(),
28
+ (0, class_validator_1.IsOptional)(),
29
+ (0, swagger_1.ApiProperty)({ default: base_sample_1.Sample.createdBy, required: false }),
30
+ __metadata("design:type", String)
31
+ ], BaseDto.prototype, "ownerID", void 0);
26
32
  __decorate([
27
33
  (0, class_validator_1.IsString)(),
28
34
  (0, class_validator_1.IsOptional)(),
@@ -1 +1 @@
1
- {"version":3,"file":"base.dto.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/dtos/base.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAgE;AAEhE,wDAAgD;AAChD,iEAA2D;AAE3D,MAAa,OAAO;CAcnB;AAdD,0BAcC;AAVC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,OAAO,EAAE,oBAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0CACzC;AASnB;IAPC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,oBAAM,CAAC,KAAK;QACrB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,gEAAgE;KAC9E,CAAC;;sCACa;AAGjB,MAAa,cAAc;CAM1B;AAND,wCAMC;AADC;IAJC,I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export declare class BaseEntity implements IBaseInterface {
5
5
  createdAt: string;
6
6
  updatedAt: string;
7
7
  createdBy?: string;
8
+ ownerID?: string;
8
9
  orgID?: string;
9
10
  }
@@ -36,6 +36,10 @@ __decorate([
36
36
  (0, typeorm_1.Column)({ nullable: true, type: 'uuid' }),
37
37
  __metadata("design:type", String)
38
38
  ], BaseEntity.prototype, "createdBy", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ nullable: true, type: 'uuid' }),
41
+ __metadata("design:type", String)
42
+ ], BaseEntity.prototype, "ownerID", void 0);
39
43
  __decorate([
40
44
  (0, typeorm_1.Column)({ nullable: true, type: 'uuid' }),
41
45
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"base.entity.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/entities/base.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAKiB;AAEjB,MAAa,UAAU;CAoBtB;AApBD,gCAoBC;AAlBC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAC3B;AAId;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC7B,IAAA,0BAAgB,GAAE;;6CACD;AAIlB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC7B,IAAA,0BAAgB,GAAE;;6CACD;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACtB;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAC1B"}
1
+ {"version":3,"file":"base.entity.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/entities/base.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAKiB;AAEjB,MAAa,UAAU;CAuBtB;AAvBD,gCAuBC;AArBC;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAC3B;AAId;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC7B,IAAA,0BAAgB,GAAE;;6CACD;AAIlB;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC7B,IAAA,0BAAgB,GAAE;;6CACD;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACtB;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACxB;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCAC1B"}
@@ -5,6 +5,8 @@ export declare enum ETableName {
5
5
  likes = "likes",
6
6
  file = "file",
7
7
  logs = "logs",
8
+ authentication = "authentication",
9
+ authenticationSession = "authentication_session",
8
10
  fileBin = "file_bin",
9
11
  user = "user"
10
12
  }
@@ -10,6 +10,8 @@ var ETableName;
10
10
  ETableName["likes"] = "likes";
11
11
  ETableName["file"] = "file";
12
12
  ETableName["logs"] = "logs";
13
+ ETableName["authentication"] = "authentication";
14
+ ETableName["authenticationSession"] = "authentication_session";
13
15
  ETableName["fileBin"] = "file_bin";
14
16
  ETableName["user"] = "user";
15
17
  })(ETableName || (exports.ETableName = ETableName = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"base.enum.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/enums/base.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+BAAc,CAAA;AAChB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB;AAED,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,kCAAoB,CAAA;IACpB,2BAAa,CAAA;AACf,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
1
+ {"version":3,"file":"base.enum.js","sourceRoot":"","sources":["../../../../../libs/la-library/src/enums/base.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAEX;AAFD,WAAY,aAAa;IACvB,+BAAc,CAAA;AAChB,CAAC,EAFW,aAAa,6BAAb,aAAa,QAExB;AAED,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,2BAAa,CAAA;IACb,+CAAiC,CAAA;IACjC,8DAAgD,CAAA;IAChD,kCAAoB,CAAA;IACpB,2BAAa,CAAA;AACf,CAAC,EARW,UAAU,0BAAV,UAAU,QAQrB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
@@ -24,5 +24,12 @@ export { SDKConfig } from './configs/index.config';
24
24
  export { FileController as SDKFileController } from './controllers/file.controller';
25
25
  export { LogsModule as SDKLogsModule } from './modules/logs/logs.module';
26
26
  export { LogsService as SDKLogsService } from './modules/logs/logs.service';
27
+ export { LogSerarchDTO as SDKLogSerarchDTO, LogCreateMultipleDTO as SDKLogCreateMultipleDTO, LogCreateSingleDTO as SDKLogCreateSingleDTO, } from './modules/logs/logs.dto';
27
28
  export { LogsController as SDKLogsController } from './modules/logs/logs.controller';
28
29
  export { LogEntity as SDKLogEntity } from './modules/logs/logs.entity';
30
+ export { AuthenticationModule as AuthenticationModule } from './modules/authentication/authentication.module';
31
+ export { AuthenticationGuard as SDKAuthenticationGuard, PublicAuth as SDKPublicAuth, } from './modules/authentication/authentication.guard';
32
+ export { AuthenticationService as AuthenticationService, AuthenticationSessionService as AuthenticationSessionService, } from './modules/authentication/authentication.service';
33
+ export { AuthenticationController as AuthenticationController } from './modules/authentication/authentication.controller';
34
+ export { AuthEntity as AuthEntity, AuthSessionEntity as AuthSessionEntity, } from './modules/authentication/authentication.entity';
35
+ export { LoginDTO as LoginDTO, LogoutDTO as LogoutDTO, RegisterDTO as RegisterDTO, SystemLogoutDTO as SystemLogoutDTO, } from './modules/authentication/authentication.dto';
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.SDKLogEntity = exports.SDKLogsController = exports.SDKLogsService = exports.SDKLogsModule = exports.SDKFileController = exports.SDKConfig = exports.SDKSample = exports.ESortOrder = exports.ESearchCondition = exports.SDKETableName = exports.SDKERefCat = exports.SDKEFileSizeUnit = exports.SearchQueryDto = exports.SDKFileUploadDto = exports.SDKFileUpdateDto = exports.SDKFileSearchDto = exports.SDKFileActionDto = exports.SDKBaseDto = exports.FileEntity = exports.FileBinEntity = exports.LikesEntity = exports.BaseEntity = exports.SDKUtilityClass = exports.SDKTokenService = exports.SDKSearchService = exports.stream = exports.logger = exports.SDKLikesService = exports.SDKFileService = exports.SDKBaseService = exports.SDKEnvironmentService = void 0;
17
+ exports.SystemLogoutDTO = exports.RegisterDTO = exports.LogoutDTO = exports.LoginDTO = exports.AuthSessionEntity = exports.AuthEntity = exports.AuthenticationController = exports.AuthenticationSessionService = exports.AuthenticationService = exports.SDKPublicAuth = exports.SDKAuthenticationGuard = exports.AuthenticationModule = exports.SDKLogEntity = exports.SDKLogsController = exports.SDKLogCreateSingleDTO = exports.SDKLogCreateMultipleDTO = exports.SDKLogSerarchDTO = exports.SDKLogsService = exports.SDKLogsModule = exports.SDKFileController = exports.SDKConfig = exports.SDKSample = exports.ESortOrder = exports.ESearchCondition = exports.SDKETableName = exports.SDKERefCat = exports.SDKEFileSizeUnit = exports.SearchQueryDto = exports.SDKFileUploadDto = exports.SDKFileUpdateDto = exports.SDKFileSearchDto = exports.SDKFileActionDto = exports.SDKBaseDto = exports.FileEntity = exports.FileBinEntity = exports.LikesEntity = exports.BaseEntity = exports.SDKUtilityClass = exports.SDKTokenService = exports.SDKSearchService = exports.stream = exports.logger = exports.SDKLikesService = exports.SDKFileService = exports.SDKBaseService = exports.SDKEnvironmentService = void 0;
18
18
  __exportStar(require("./la-library.module"), exports);
19
19
  var environment_service_1 = require("./services/environment.service");
20
20
  Object.defineProperty(exports, "SDKEnvironmentService", { enumerable: true, get: function () { return environment_service_1.SDKEnvironmentService; } });
@@ -69,8 +69,30 @@ var logs_module_1 = require("./modules/logs/logs.module");
69
69
  Object.defineProperty(exports, "SDKLogsModule", { enumerable: true, get: function () { return logs_module_1.LogsModule; } });
70
70
  var logs_service_1 = require("./modules/logs/logs.service");
71
71
  Object.defineProperty(exports, "SDKLogsService", { enumerable: true, get: function () { return logs_service_1.LogsService; } });
72
+ var logs_dto_1 = require("./modules/logs/logs.dto");
73
+ Object.defineProperty(exports, "SDKLogSerarchDTO", { enumerable: true, get: function () { return logs_dto_1.LogSerarchDTO; } });
74
+ Object.defineProperty(exports, "SDKLogCreateMultipleDTO", { enumerable: true, get: function () { return logs_dto_1.LogCreateMultipleDTO; } });
75
+ Object.defineProperty(exports, "SDKLogCreateSingleDTO", { enumerable: true, get: function () { return logs_dto_1.LogCreateSingleDTO; } });
72
76
  var logs_controller_1 = require("./modules/logs/logs.controller");
73
77
  Object.defineProperty(exports, "SDKLogsController", { enumerable: true, get: function () { return logs_controller_1.LogsController; } });
74
78
  var logs_entity_1 = require("./modules/logs/logs.entity");
75
79
  Object.defineProperty(exports, "SDKLogEntity", { enumerable: true, get: function () { return logs_entity_1.LogEntity; } });
80
+ var authentication_module_1 = require("./modules/authentication/authentication.module");
81
+ Object.defineProperty(exports, "AuthenticationModule", { enumerable: true, get: function () { return authentication_module_1.AuthenticationModule; } });
82
+ var authentication_guard_1 = require("./modules/authentication/authentication.guard");
83
+ Object.defineProperty(exports, "SDKAuthenticationGuard", { enumerable: true, get: function () { return authentication_guard_1.AuthenticationGuard; } });
84
+ Object.defineProperty(exports, "SDKPublicAuth", { enumerable: true, get: function () { return authentication_guard_1.PublicAuth; } });
85
+ var authentication_service_1 = require("./modules/authentication/authentication.service");
86
+ Object.defineProperty(exports, "AuthenticationService", { enumerable: true, get: function () { return authentication_service_1.AuthenticationService; } });
87
+ Object.defineProperty(exports, "AuthenticationSessionService", { enumerable: true, get: function () { return authentication_service_1.AuthenticationSessionService; } });
88
+ var authentication_controller_1 = require("./modules/authentication/authentication.controller");
89
+ Object.defineProperty(exports, "AuthenticationController", { enumerable: true, get: function () { return authentication_controller_1.AuthenticationController; } });
90
+ var authentication_entity_1 = require("./modules/authentication/authentication.entity");
91
+ Object.defineProperty(exports, "AuthEntity", { enumerable: true, get: function () { return authentication_entity_1.AuthEntity; } });
92
+ Object.defineProperty(exports, "AuthSessionEntity", { enumerable: true, get: function () { return authentication_entity_1.AuthSessionEntity; } });
93
+ var authentication_dto_1 = require("./modules/authentication/authentication.dto");
94
+ Object.defineProperty(exports, "LoginDTO", { enumerable: true, get: function () { return authentication_dto_1.LoginDTO; } });
95
+ Object.defineProperty(exports, "LogoutDTO", { enumerable: true, get: function () { return authentication_dto_1.LogoutDTO; } });
96
+ Object.defineProperty(exports, "RegisterDTO", { enumerable: true, get: function () { return authentication_dto_1.RegisterDTO; } });
97
+ Object.defineProperty(exports, "SystemLogoutDTO", { enumerable: true, get: function () { return authentication_dto_1.SystemLogoutDTO; } });
76
98
  //# sourceMappingURL=index.js.map
@@ -1 +1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AoF;AAA3E,oHAAA,cAAc,OAAqB;AAE5C,0DAAyE;AAAhE,4GAAA,UAAU,OAAiB;AACpC,4DAA4E;AAAnE,8GAAA,WAAW,OAAkB;AACtC,oDAIiC;AAH/B,4GAAA,aAAa,OAAoB;AACjC,mHAAA,oBAAoB,OAA2B;AAC/C,iHAAA,kBAAkB,OAAyB;AAE7C,kEAAqF;AAA5E,oHAAA,cAAc,OAAqB;AAC5C,0DAAuE;AAA9D,2GAAA,SAAS,OAAgB;AAElC,wFAA8G;AAArG,6HAAA,oBAAoB,OAAwB;AACrD,sFAGuD;AAFrD,8HAAA,mBAAmB,OAA0B;AAC7C,qHAAA,UAAU,OAAiB;AAE7B,0FAGyD;AAFvD,+HAAA,qBAAqB,OAAyB;AAC9C,sIAAA,4BAA4B,OAAgC;AAE9D,gGAA0H;AAAjH,qIAAA,wBAAwB,OAA4B;AAC7D,wFAGwD;AAFtD,mHAAA,UAAU,OAAc;AACxB,0HAAA,iBAAiB,OAAqB;AAExC,kFAKqD;AAJnD,8GAAA,QAAQ,OAAY;AACpB,+GAAA,SAAS,OAAa;AACtB,iHAAA,WAAW,OAAe;AAC1B,qHAAA,eAAe,OAAmB"}
@@ -0,0 +1,10 @@
1
+ import { AuthenticationService } from './authentication.service';
2
+ import { LoginDTO, LogoutDTO, RegisterDTO, SystemLogoutDTO } from './authentication.dto';
3
+ export declare class AuthenticationController {
4
+ protected readonly service: AuthenticationService;
5
+ constructor(service: AuthenticationService);
6
+ logout(body: LogoutDTO): Promise<boolean>;
7
+ systemLogout(body: SystemLogoutDTO): Promise<boolean>;
8
+ login(body: LoginDTO): Promise<import("./authentication.entity").AuthEntity>;
9
+ register(body: RegisterDTO): Promise<import("./authentication.entity").AuthEntity>;
10
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AuthenticationController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const authentication_service_1 = require("./authentication.service");
18
+ const authentication_dto_1 = require("./authentication.dto");
19
+ const swagger_1 = require("@nestjs/swagger");
20
+ const authentication_guard_1 = require("./authentication.guard");
21
+ let AuthenticationController = class AuthenticationController {
22
+ constructor(service) {
23
+ this.service = service;
24
+ }
25
+ logout(body) {
26
+ return this.service.logout(body);
27
+ }
28
+ systemLogout(body) {
29
+ return this.service.forceLogout(body);
30
+ }
31
+ login(body) {
32
+ return this.service.login(body);
33
+ }
34
+ register(body) {
35
+ return this.service.register(body);
36
+ }
37
+ };
38
+ exports.AuthenticationController = AuthenticationController;
39
+ __decorate([
40
+ (0, common_1.Post)('logout'),
41
+ (0, swagger_1.ApiBearerAuth)(),
42
+ __param(0, (0, common_1.Body)()),
43
+ __metadata("design:type", Function),
44
+ __metadata("design:paramtypes", [authentication_dto_1.LogoutDTO]),
45
+ __metadata("design:returntype", void 0)
46
+ ], AuthenticationController.prototype, "logout", null);
47
+ __decorate([
48
+ (0, common_1.Post)('logout/force'),
49
+ (0, swagger_1.ApiBearerAuth)(),
50
+ (0, common_1.UseGuards)(authentication_guard_1.AuthenticationGuard),
51
+ __param(0, (0, common_1.Body)()),
52
+ __metadata("design:type", Function),
53
+ __metadata("design:paramtypes", [authentication_dto_1.SystemLogoutDTO]),
54
+ __metadata("design:returntype", void 0)
55
+ ], AuthenticationController.prototype, "systemLogout", null);
56
+ __decorate([
57
+ (0, common_1.Post)('login'),
58
+ (0, authentication_guard_1.PublicAuth)(),
59
+ __param(0, (0, common_1.Body)()),
60
+ __metadata("design:type", Function),
61
+ __metadata("design:paramtypes", [authentication_dto_1.LoginDTO]),
62
+ __metadata("design:returntype", void 0)
63
+ ], AuthenticationController.prototype, "login", null);
64
+ __decorate([
65
+ (0, common_1.Post)('register'),
66
+ (0, authentication_guard_1.PublicAuth)(),
67
+ __param(0, (0, common_1.Body)()),
68
+ __metadata("design:type", Function),
69
+ __metadata("design:paramtypes", [authentication_dto_1.RegisterDTO]),
70
+ __metadata("design:returntype", void 0)
71
+ ], AuthenticationController.prototype, "register", null);
72
+ exports.AuthenticationController = AuthenticationController = __decorate([
73
+ (0, swagger_1.ApiTags)(authentication_service_1.AuthenticationService.tag),
74
+ (0, common_1.Controller)(authentication_service_1.AuthenticationService.path),
75
+ __metadata("design:paramtypes", [authentication_service_1.AuthenticationService])
76
+ ], AuthenticationController);
77
+ //# sourceMappingURL=authentication.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,qEAAiE;AACjE,6DAK8B;AAC9B,6CAAyD;AACzD,iEAAyE;AAIlE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAA+B,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;IAAG,CAAC;IAKjE,MAAM,CAAS,IAAe;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAKD,YAAY,CAAS,IAAqB;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAID,KAAK,CAAS,IAAc;QAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAID,QAAQ,CAAS,IAAiB;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AA5BY,4DAAwB;AAMnC;IAHC,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,uBAAa,GAAE;IAER,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,8BAAS;;sDAE7B;AAKD;IAHC,IAAA,aAAI,EAAC,cAAc,CAAC;IACpB,IAAA,uBAAa,GAAE;IACf,IAAA,kBAAS,EAAC,0CAAmB,CAAC;IACjB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,oCAAe;;4DAEzC;AAID;IAFC,IAAA,aAAI,EAAC,OAAO,CAAC;IACb,IAAA,iCAAU,GAAE;IACN,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,6BAAQ;;qDAE3B;AAID;IAFC,IAAA,aAAI,EAAC,UAAU,CAAC;IAChB,IAAA,iCAAU,GAAE;IACH,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,gCAAW;;wDAEjC;mCA3BU,wBAAwB;IAFpC,IAAA,iBAAO,EAAC,8CAAqB,CAAC,GAAG,CAAC;IAClC,IAAA,mBAAU,EAAC,8CAAqB,CAAC,IAAI,CAAC;qCAEG,8CAAqB;GADlD,wBAAwB,CA4BpC"}
@@ -0,0 +1,24 @@
1
+ import { AuthEntity, AuthSessionEntity } from './authentication.entity';
2
+ import { EAuthType, ELogOutType } from './authentication.enum';
3
+ declare class AuthBaseDTO implements Partial<AuthEntity> {
4
+ type?: EAuthType;
5
+ orgID?: string;
6
+ email?: string;
7
+ }
8
+ export declare class RegisterDTO extends AuthBaseDTO implements Partial<AuthEntity> {
9
+ password?: string;
10
+ login: boolean;
11
+ }
12
+ export declare class LoginDTO extends AuthBaseDTO implements Partial<AuthEntity> {
13
+ password?: string;
14
+ }
15
+ export declare class LogoutDTO implements Partial<AuthSessionEntity> {
16
+ token: string;
17
+ logoutReason?: ELogOutType;
18
+ forced?: boolean;
19
+ }
20
+ export declare class SystemLogoutDTO implements Partial<AuthSessionEntity> {
21
+ ownerID: string;
22
+ logoutReason: ELogOutType;
23
+ }
24
+ export {};
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SystemLogoutDTO = exports.LogoutDTO = exports.LoginDTO = exports.RegisterDTO = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const authentication_enum_1 = require("./authentication.enum");
15
+ const swagger_1 = require("@nestjs/swagger");
16
+ const base_sample_1 = require("../../samples/base.sample");
17
+ class AuthBaseDTO {
18
+ }
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ (0, class_validator_1.IsOptional)(),
22
+ (0, swagger_1.ApiProperty)({ type: 'string', default: base_sample_1.Sample.orgID, required: false }),
23
+ __metadata("design:type", String)
24
+ ], AuthBaseDTO.prototype, "orgID", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsEmail)(),
27
+ (0, swagger_1.ApiProperty)({ type: 'string', default: base_sample_1.Sample.email, required: true }),
28
+ __metadata("design:type", String)
29
+ ], AuthBaseDTO.prototype, "email", void 0);
30
+ class RegisterDTO extends AuthBaseDTO {
31
+ }
32
+ exports.RegisterDTO = RegisterDTO;
33
+ __decorate([
34
+ (0, class_validator_1.IsString)(),
35
+ (0, swagger_1.ApiProperty)({ type: 'string', default: base_sample_1.Sample.password, required: true }),
36
+ __metadata("design:type", String)
37
+ ], RegisterDTO.prototype, "password", void 0);
38
+ __decorate([
39
+ (0, class_validator_1.IsBoolean)(),
40
+ (0, class_validator_1.IsOptional)(),
41
+ (0, swagger_1.ApiProperty)({ type: 'boolean', default: true }),
42
+ __metadata("design:type", Boolean)
43
+ ], RegisterDTO.prototype, "login", void 0);
44
+ class LoginDTO extends AuthBaseDTO {
45
+ }
46
+ exports.LoginDTO = LoginDTO;
47
+ __decorate([
48
+ (0, class_validator_1.IsString)(),
49
+ (0, swagger_1.ApiProperty)({ type: 'string', default: base_sample_1.Sample.password, required: true }),
50
+ __metadata("design:type", String)
51
+ ], LoginDTO.prototype, "password", void 0);
52
+ class LogoutDTO {
53
+ }
54
+ exports.LogoutDTO = LogoutDTO;
55
+ __decorate([
56
+ (0, class_validator_1.IsString)(),
57
+ (0, swagger_1.ApiProperty)({ type: 'string', required: true }),
58
+ __metadata("design:type", String)
59
+ ], LogoutDTO.prototype, "token", void 0);
60
+ class SystemLogoutDTO {
61
+ }
62
+ exports.SystemLogoutDTO = SystemLogoutDTO;
63
+ __decorate([
64
+ (0, class_validator_1.IsUUID)(),
65
+ (0, swagger_1.ApiProperty)({ type: 'string', required: true }),
66
+ __metadata("design:type", String)
67
+ ], SystemLogoutDTO.prototype, "ownerID", void 0);
68
+ __decorate([
69
+ (0, class_validator_1.IsEnum)(authentication_enum_1.ELogOutType),
70
+ (0, swagger_1.ApiProperty)({ type: 'string', required: true }),
71
+ __metadata("design:type", String)
72
+ ], SystemLogoutDTO.prototype, "logoutReason", void 0);
73
+ //# sourceMappingURL=authentication.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.dto.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAOyB;AAEzB,+DAA+D;AAC/D,6CAA8C;AAC9C,2DAAmD;AAEnD,MAAM,WAAW;CAShB;AAJC;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;;0CACzD;AAGf;IAFC,IAAA,yBAAO,GAAE;IACT,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACxD;AAGjB,MAAa,WAAY,SAAQ,WAAW;CAQ3C;AARD,kCAQC;AALC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACxD;AAIlB;IAHC,IAAA,2BAAS,GAAE;IACX,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CACjC;AAGjB,MAAa,QAAS,SAAQ,WAAW;CAIxC;AAJD,4BAIC;AADC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACxD;AAGpB,MAAa,SAAS;CAMrB;AAND,8BAMC;AAHC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAClC;AAKhB,MAAa,eAAe;CAO3B;AAPD,0CAOC;AAJC;IAFC,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAChC;AAGhB;IAFC,IAAA,wBAAM,EAAC,iCAAW,CAAC;IACnB,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACtB"}
@@ -0,0 +1,16 @@
1
+ import { BaseEntity } from '../../entities/base.entity';
2
+ import { EAuthType, ELogOutType } from './authentication.enum';
3
+ export declare class AuthEntity extends BaseEntity {
4
+ type?: EAuthType;
5
+ email?: string;
6
+ password?: string;
7
+ token?: string;
8
+ }
9
+ export declare class AuthSessionEntity extends BaseEntity {
10
+ loginDate: number;
11
+ token: string;
12
+ forced: boolean;
13
+ logoutReason: ELogOutType;
14
+ active: boolean;
15
+ logoutDate: number;
16
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthSessionEntity = exports.AuthEntity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const base_enum_1 = require("../../enums/base.enum");
15
+ const base_entity_1 = require("../../entities/base.entity");
16
+ const authentication_enum_1 = require("./authentication.enum");
17
+ let AuthEntity = class AuthEntity extends base_entity_1.BaseEntity {
18
+ };
19
+ exports.AuthEntity = AuthEntity;
20
+ __decorate([
21
+ (0, typeorm_1.Column)({ type: 'enum', enum: authentication_enum_1.EAuthType, default: authentication_enum_1.EAuthType.user }),
22
+ __metadata("design:type", String)
23
+ ], AuthEntity.prototype, "type", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'text' }),
26
+ __metadata("design:type", String)
27
+ ], AuthEntity.prototype, "email", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'text' }),
30
+ __metadata("design:type", String)
31
+ ], AuthEntity.prototype, "password", void 0);
32
+ exports.AuthEntity = AuthEntity = __decorate([
33
+ (0, typeorm_1.Entity)(base_enum_1.ETableName.authentication)
34
+ ], AuthEntity);
35
+ let AuthSessionEntity = class AuthSessionEntity extends base_entity_1.BaseEntity {
36
+ };
37
+ exports.AuthSessionEntity = AuthSessionEntity;
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ type: 'double' }),
40
+ __metadata("design:type", Number)
41
+ ], AuthSessionEntity.prototype, "loginDate", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: 'text' }),
44
+ __metadata("design:type", String)
45
+ ], AuthSessionEntity.prototype, "token", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
48
+ __metadata("design:type", Boolean)
49
+ ], AuthSessionEntity.prototype, "forced", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: 'enum', enum: authentication_enum_1.ELogOutType, nullable: true }),
52
+ __metadata("design:type", String)
53
+ ], AuthSessionEntity.prototype, "logoutReason", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ type: 'boolean', default: true }),
56
+ __metadata("design:type", Boolean)
57
+ ], AuthSessionEntity.prototype, "active", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.Column)({ type: 'double', nullable: true }),
60
+ __metadata("design:type", Number)
61
+ ], AuthSessionEntity.prototype, "logoutDate", void 0);
62
+ exports.AuthSessionEntity = AuthSessionEntity = __decorate([
63
+ (0, typeorm_1.Entity)(base_enum_1.ETableName.authenticationSession)
64
+ ], AuthSessionEntity);
65
+ //# sourceMappingURL=authentication.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.entity.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qDAAmD;AACnD,4DAAwD;AACxD,+DAA+D;AAGxD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,wBAAU;CASzC,CAAA;AATY,gCAAU;AAErB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,+BAAS,EAAE,OAAO,EAAE,+BAAS,CAAC,IAAI,EAAE,CAAC;;wCAClD;AAEjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACV;AAEf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACP;qBANP,UAAU;IADtB,IAAA,gBAAM,EAAC,sBAAU,CAAC,cAAc,CAAC;GACrB,UAAU,CAStB;AAGM,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,wBAAU;CAkBhD,CAAA;AAlBY,8CAAiB;AAE5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;oDACT;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;gDACX;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;iDAC5B;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iCAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDAClC;AAG1B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDAC3B;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACxB;4BAjBR,iBAAiB;IAD7B,IAAA,gBAAM,EAAC,sBAAU,CAAC,qBAAqB,CAAC;GAC5B,iBAAiB,CAkB7B"}
@@ -0,0 +1,9 @@
1
+ export declare enum EAuthType {
2
+ admin = "admin",
3
+ user = "user"
4
+ }
5
+ export declare enum ELogOutType {
6
+ expiration = "expiration",
7
+ user = "user",
8
+ reset = "reset"
9
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ELogOutType = exports.EAuthType = void 0;
4
+ var EAuthType;
5
+ (function (EAuthType) {
6
+ EAuthType["admin"] = "admin";
7
+ EAuthType["user"] = "user";
8
+ })(EAuthType || (exports.EAuthType = EAuthType = {}));
9
+ var ELogOutType;
10
+ (function (ELogOutType) {
11
+ ELogOutType["expiration"] = "expiration";
12
+ ELogOutType["user"] = "user";
13
+ ELogOutType["reset"] = "reset";
14
+ })(ELogOutType || (exports.ELogOutType = ELogOutType = {}));
15
+ //# sourceMappingURL=authentication.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.enum.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,4BAAa,CAAA;IACb,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB"}
@@ -0,0 +1,13 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { TokenService } from '../../services/token.service';
3
+ import { AuthenticationService } from './authentication.service';
4
+ import { Reflector } from '@nestjs/core';
5
+ export declare class AuthenticationGuard implements CanActivate {
6
+ protected tokenService: TokenService;
7
+ protected authS: AuthenticationService;
8
+ private reflector;
9
+ constructor(tokenService: TokenService, authS: AuthenticationService, reflector: Reflector);
10
+ canActivate(context: ExecutionContext): Promise<boolean>;
11
+ private extractTokenFromHeader;
12
+ }
13
+ export declare const PublicAuth: () => import("@nestjs/common").CustomDecorator<string>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.PublicAuth = exports.AuthenticationGuard = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const token_service_1 = require("../../services/token.service");
15
+ const authentication_service_1 = require("./authentication.service");
16
+ const authentication_enum_1 = require("./authentication.enum");
17
+ const common_2 = require("@nestjs/common");
18
+ const core_1 = require("@nestjs/core");
19
+ const environment_service_1 = require("../../services/environment.service");
20
+ let AuthenticationGuard = class AuthenticationGuard {
21
+ constructor(tokenService, authS, reflector) {
22
+ this.tokenService = tokenService;
23
+ this.authS = authS;
24
+ this.reflector = reflector;
25
+ }
26
+ async canActivate(context) {
27
+ const isPublic = this.reflector.getAllAndOverride(IS_PUBLIC_KEY, [
28
+ context.getHandler(),
29
+ context.getClass(),
30
+ ]);
31
+ if (isPublic) {
32
+ return true;
33
+ }
34
+ if (environment_service_1.evt.ENVIRONMENT == 'dev')
35
+ return true;
36
+ const request = context.switchToHttp().getRequest();
37
+ const token = this.extractTokenFromHeader(request);
38
+ if (!token) {
39
+ throw new common_1.UnauthorizedException();
40
+ }
41
+ try {
42
+ const payload = await this.tokenService.decryptToken(token);
43
+ request['user'] = payload;
44
+ }
45
+ catch {
46
+ this.authS.forceLogoutSingle({
47
+ token,
48
+ logoutReason: authentication_enum_1.ELogOutType.expiration,
49
+ });
50
+ throw new common_1.UnauthorizedException();
51
+ }
52
+ return true;
53
+ }
54
+ extractTokenFromHeader(request) {
55
+ const [type, token] = request.headers.authorization?.split(' ') ?? [];
56
+ return type === 'Bearer' ? token : undefined;
57
+ }
58
+ };
59
+ exports.AuthenticationGuard = AuthenticationGuard;
60
+ exports.AuthenticationGuard = AuthenticationGuard = __decorate([
61
+ (0, common_1.Injectable)(),
62
+ __metadata("design:paramtypes", [token_service_1.TokenService,
63
+ authentication_service_1.AuthenticationService,
64
+ core_1.Reflector])
65
+ ], AuthenticationGuard);
66
+ const IS_PUBLIC_KEY = 'isPublic';
67
+ const PublicAuth = () => (0, common_2.SetMetadata)(IS_PUBLIC_KEY, true);
68
+ exports.PublicAuth = PublicAuth;
69
+ //# sourceMappingURL=authentication.guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.guard.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AAExB,gEAA4D;AAC5D,qEAAiE;AACjE,+DAAoD;AACpD,2CAA6C;AAC7C,u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O,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACtE,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,CAAC;CACF,CAAA;AAzCY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAGe,4BAAY;QACnB,8CAAqB;QACnB,gBAAS;GAJnB,mBAAmB,CAyC/B;AAED,MAAM,aAAa,GAAG,UAAU,CAAC;AAC1B,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAApD,QAAA,UAAU,cAA0C"}
@@ -0,0 +1,4 @@
1
+ import { AuthEntity, AuthSessionEntity } from './authentication.entity';
2
+ export declare class AuthenticationModule {
3
+ static entities: (typeof AuthEntity | typeof AuthSessionEntity)[];
4
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AuthenticationModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const authentication_service_1 = require("./authentication.service");
12
+ const authentication_controller_1 = require("./authentication.controller");
13
+ const authentication_entity_1 = require("./authentication.entity");
14
+ const typeorm_1 = require("@nestjs/typeorm");
15
+ const token_service_1 = require("../../services/token.service");
16
+ const jwt_1 = require("@nestjs/jwt");
17
+ const authentication_guard_1 = require("./authentication.guard");
18
+ const providers = [
19
+ jwt_1.JwtService,
20
+ token_service_1.TokenService,
21
+ authentication_service_1.AuthenticationService,
22
+ authentication_service_1.AuthenticationSessionService,
23
+ authentication_guard_1.AuthenticationGuard,
24
+ ];
25
+ const controllers = [authentication_controller_1.AuthenticationController];
26
+ let AuthenticationModule = class AuthenticationModule {
27
+ };
28
+ exports.AuthenticationModule = AuthenticationModule;
29
+ AuthenticationModule.entities = [authentication_entity_1.AuthEntity, authentication_entity_1.AuthSessionEntity];
30
+ exports.AuthenticationModule = AuthenticationModule = __decorate([
31
+ (0, common_1.Module)({
32
+ imports: [typeorm_1.TypeOrmModule.forFeature(AuthenticationModule.entities)],
33
+ providers,
34
+ controllers,
35
+ exports: [...providers],
36
+ })
37
+ ], AuthenticationModule);
38
+ //# sourceMappingURL=authentication.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.module.js","sourceRoot":"","sources":["../../../../../../libs/la-library/src/modules/authentication/authentication.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qEAGkC;AAClC,2EAAuE;AACvE,mEAAwE;AACxE,6CAAgD;AAChD,gEAA4D;AAC5D,qCAAyC;AACzC,iEAA6D;AAE7D,MAAM,SAAS,GAAG;IAChB,gBAAU;IACV,4BAAY;IACZ,8CAAqB;IACrB,qDAA4B;IAC5B,0CAAmB;CACpB,CAAC;AACF,MAAM,WAAW,GAAG,CAAC,oDAAwB,CAAC,CAAC;AAOxC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;;AAApB,oDAAoB;AACxB,6BAAQ,GAAG,CAAC,kCAAU,EAAE,yCAAiB,CAAC,AAAlC,CAAmC;+BADvC,oBAAoB;IANhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QAClE,SAAS;QACT,WAAW;QACX,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;KACxB,CAAC;GACW,oBAAoB,CAEhC"}