@serene-dev/la-nest-library 0.0.11 → 0.0.12
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/dist/libs/la-library/src/dtos/base.dto.js +1 -1
- package/dist/libs/la-library/src/dtos/base.dto.js.map +1 -1
- package/dist/libs/la-library/src/enums/base.enum.d.ts +2 -1
- package/dist/libs/la-library/src/enums/base.enum.js +1 -0
- package/dist/libs/la-library/src/enums/base.enum.js.map +1 -1
- package/dist/libs/la-library/src/index.d.ts +7 -0
- package/dist/libs/la-library/src/index.js +14 -1
- package/dist/libs/la-library/src/index.js.map +1 -1
- package/dist/libs/la-library/src/modules/authentication/authentication.module.d.ts +2 -0
- package/dist/libs/la-library/src/modules/authentication/authentication.module.js +39 -0
- package/dist/libs/la-library/src/modules/authentication/authentication.module.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.d.ts +16 -0
- package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.js +62 -0
- package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/dtos/authentication.dto.d.ts +10 -0
- package/dist/libs/la-library/src/modules/authentication/dtos/authentication.dto.js +55 -0
- package/dist/libs/la-library/src/modules/authentication/dtos/authentication.dto.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/entities/user.entity.d.ts +14 -0
- package/dist/libs/la-library/src/modules/authentication/entities/user.entity.js +63 -0
- package/dist/libs/la-library/src/modules/authentication/entities/user.entity.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/guards/jwt-auth.guard.d.ts +4 -0
- package/dist/libs/la-library/src/modules/authentication/guards/jwt-auth.guard.js +18 -0
- package/dist/libs/la-library/src/modules/authentication/guards/jwt-auth.guard.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/interfaces/authentication.interface.d.ts +8 -0
- package/dist/libs/la-library/src/modules/authentication/interfaces/authentication.interface.js +14 -0
- package/dist/libs/la-library/src/modules/authentication/interfaces/authentication.interface.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/passport/jwt.strategy.d.ts +15 -0
- package/dist/libs/la-library/src/modules/authentication/passport/jwt.strategy.js +35 -0
- package/dist/libs/la-library/src/modules/authentication/passport/jwt.strategy.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/passport/local.strategy.d.ts +9 -0
- package/dist/libs/la-library/src/modules/authentication/passport/local.strategy.js +35 -0
- package/dist/libs/la-library/src/modules/authentication/passport/local.strategy.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/services/authentication.service.d.ts +17 -0
- package/dist/libs/la-library/src/modules/authentication/services/authentication.service.js +47 -0
- package/dist/libs/la-library/src/modules/authentication/services/authentication.service.js.map +1 -0
- package/dist/libs/la-library/src/modules/authentication/services/users.service.d.ts +7 -0
- package/dist/libs/la-library/src/modules/authentication/services/users.service.js +34 -0
- package/dist/libs/la-library/src/modules/authentication/services/users.service.js.map +1 -0
- package/package.json +12 -5
|
@@ -29,7 +29,7 @@ __decorate([
|
|
|
29
29
|
(0, swagger_1.ApiProperty)({
|
|
30
30
|
default: base_sample_1.Sample.orgID,
|
|
31
31
|
required: false,
|
|
32
|
-
description: `This is the unique id for the organisation using the resource
|
|
32
|
+
description: `This is the unique id for the organisation using the resource.`,
|
|
33
33
|
}),
|
|
34
34
|
__metadata("design:type", String)
|
|
35
35
|
], BaseDto.prototype, "orgID", void 0);
|
|
@@ -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,
|
|
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,IAAA,yBAAO,EAAC,EAAE,CAAC;IACX,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,8BAAY,CAAC,YAAY,EAAE,CAAC;KACrE,CAAC;;2CACa"}
|
|
@@ -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,
|
|
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,UAKX;AALD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,kCAAoB,CAAA;IACpB,2BAAa,CAAA;AACf,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAED,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,wBAAa,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
|
|
@@ -20,3 +20,10 @@ export { IFileID } from './interfaces/file.interface';
|
|
|
20
20
|
export * from './interfaces/search.interface';
|
|
21
21
|
export { Sample as SDKSample } from './samples/base.sample';
|
|
22
22
|
export { FileController as SDKFileController } from './controllers/file.controller';
|
|
23
|
+
export * from './modules/authentication/authentication.module';
|
|
24
|
+
export { AuthService } from './modules/authentication/services/authentication.service';
|
|
25
|
+
export { UsersService } from './modules/authentication/services/users.service';
|
|
26
|
+
export { LocalStrategy } from './modules/authentication/passport/local.strategy';
|
|
27
|
+
export { AuthenticationController } from './modules/authentication/controllers/authentication.controller';
|
|
28
|
+
export { UserEntity } from './modules/authentication/entities/user.entity';
|
|
29
|
+
export { JwtStrategy } from './modules/authentication/passport/jwt.strategy';
|
|
@@ -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.SDKFileController = 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.SDKEnvironmentService = void 0;
|
|
17
|
+
exports.JwtStrategy = exports.UserEntity = exports.AuthenticationController = exports.LocalStrategy = exports.UsersService = exports.AuthService = exports.SDKFileController = 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.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; } });
|
|
@@ -61,4 +61,17 @@ var base_sample_1 = require("./samples/base.sample");
|
|
|
61
61
|
Object.defineProperty(exports, "SDKSample", { enumerable: true, get: function () { return base_sample_1.Sample; } });
|
|
62
62
|
var file_controller_1 = require("./controllers/file.controller");
|
|
63
63
|
Object.defineProperty(exports, "SDKFileController", { enumerable: true, get: function () { return file_controller_1.FileController; } });
|
|
64
|
+
__exportStar(require("./modules/authentication/authentication.module"), exports);
|
|
65
|
+
var authentication_service_1 = require("./modules/authentication/services/authentication.service");
|
|
66
|
+
Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return authentication_service_1.AuthService; } });
|
|
67
|
+
var users_service_1 = require("./modules/authentication/services/users.service");
|
|
68
|
+
Object.defineProperty(exports, "UsersService", { enumerable: true, get: function () { return users_service_1.UsersService; } });
|
|
69
|
+
var local_strategy_1 = require("./modules/authentication/passport/local.strategy");
|
|
70
|
+
Object.defineProperty(exports, "LocalStrategy", { enumerable: true, get: function () { return local_strategy_1.LocalStrategy; } });
|
|
71
|
+
var authentication_controller_1 = require("./modules/authentication/controllers/authentication.controller");
|
|
72
|
+
Object.defineProperty(exports, "AuthenticationController", { enumerable: true, get: function () { return authentication_controller_1.AuthenticationController; } });
|
|
73
|
+
var user_entity_1 = require("./modules/authentication/entities/user.entity");
|
|
74
|
+
Object.defineProperty(exports, "UserEntity", { enumerable: true, get: function () { return user_entity_1.UserEntity; } });
|
|
75
|
+
var jwt_strategy_1 = require("./modules/authentication/passport/jwt.strategy");
|
|
76
|
+
Object.defineProperty(exports, "JwtStrategy", { enumerable: true, get: function () { return jwt_strategy_1.JwtStrategy; } });
|
|
64
77
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/la-library/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,sEAGwC;AAFtC,4HAAA,qBAAqB,OAAA;AAIvB,wDAAwE;AAA/D,8GAAA,WAAW,OAAkB;AACtC,0DAA2E;AAAlE,gHAAA,YAAY,OAAmB;AACxC,4DAA2D;AAAlD,wGAAA,MAAM,OAAA;AAAE,wGAAA,MAAM,OAAA;AACvB,4DAA8E;AAArE,kHAAA,aAAa,OAAoB;AAC1C,0DAA2E;AAAlE,gHAAA,YAAY,OAAmB;AACxC,8DAA6E;AAApE,kHAAA,YAAY,OAAmB;AAExC,sDAAoD;AAA3C,yGAAA,UAAU,OAAA;AACnB,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,8DAA2D;AAAlD,gHAAA,aAAa,OAAA;AACtB,sDAAoD;AAA3C,yGAAA,UAAU,OAAA;AAEnB,4CAAwD;AAA/C,sGAAA,OAAO,OAAc;AAC9B,4CAKyB;AAJvB,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AAEnC,gDAAmD;AAA1C,4GAAA,cAAc,OAAA;AAEvB,+CAI2B;AAHzB,6GAAA,aAAa,OAAoB;AACjC,uGAAA,OAAO,OAAc;AACrB,0GAAA,UAAU,OAAiB;AAE7B,mDAAmE;AAA1D,+GAAA,gBAAgB,OAAA;AAAE,yGAAA,UAAU,OAAA;AAErC,8DAA4C;AAE5C,gEAA8C;AAE9C,qDAA4D;AAAnD,wGAAA,MAAM,OAAa;AAE5B,iEAAoF;AAA3E,oHAAA,cAAc,OAAqB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/la-library/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,sEAGwC;AAFtC,4HAAA,qBAAqB,OAAA;AAIvB,wDAAwE;AAA/D,8GAAA,WAAW,OAAkB;AACtC,0DAA2E;AAAlE,gHAAA,YAAY,OAAmB;AACxC,4DAA2D;AAAlD,wGAAA,MAAM,OAAA;AAAE,wGAAA,MAAM,OAAA;AACvB,4DAA8E;AAArE,kHAAA,aAAa,OAAoB;AAC1C,0DAA2E;AAAlE,gHAAA,YAAY,OAAmB;AACxC,8DAA6E;AAApE,kHAAA,YAAY,OAAmB;AAExC,sDAAoD;AAA3C,yGAAA,UAAU,OAAA;AACnB,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,8DAA2D;AAAlD,gHAAA,aAAa,OAAA;AACtB,sDAAoD;AAA3C,yGAAA,UAAU,OAAA;AAEnB,4CAAwD;AAA/C,sGAAA,OAAO,OAAc;AAC9B,4CAKyB;AAJvB,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AACjC,4GAAA,aAAa,OAAoB;AAEnC,gDAAmD;AAA1C,4GAAA,cAAc,OAAA;AAEvB,+CAI2B;AAHzB,6GAAA,aAAa,OAAoB;AACjC,uGAAA,OAAO,OAAc;AACrB,0GAAA,UAAU,OAAiB;AAE7B,mDAAmE;AAA1D,+GAAA,gBAAgB,OAAA;AAAE,yGAAA,UAAU,OAAA;AAErC,8DAA4C;AAE5C,gEAA8C;AAE9C,qDAA4D;AAAnD,wGAAA,MAAM,OAAa;AAE5B,iEAAoF;AAA3E,oHAAA,cAAc,OAAqB;AAG5C,iFAA+D;AAC/D,mGAAuF;AAA9E,qHAAA,WAAW,OAAA;AACpB,iFAA+E;AAAtE,6GAAA,YAAY,OAAA;AACrB,mFAAiF;AAAxE,+GAAA,aAAa,OAAA;AACtB,4GAA0G;AAAjG,qIAAA,wBAAwB,OAAA;AACjC,6EAA2E;AAAlE,yGAAA,UAAU,OAAA;AACnB,+EAA6E;AAApE,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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("./services/authentication.service");
|
|
12
|
+
const users_service_1 = require("./services/users.service");
|
|
13
|
+
const local_strategy_1 = require("./passport/local.strategy");
|
|
14
|
+
const authentication_controller_1 = require("./controllers/authentication.controller");
|
|
15
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
16
|
+
const user_entity_1 = require("./entities/user.entity");
|
|
17
|
+
const passport_1 = require("@nestjs/passport");
|
|
18
|
+
const jwt_strategy_1 = require("./passport/jwt.strategy");
|
|
19
|
+
const environment_service_1 = require("../../services/environment.service");
|
|
20
|
+
const token_service_1 = require("../../services/token.service");
|
|
21
|
+
const providers = [
|
|
22
|
+
authentication_service_1.default,
|
|
23
|
+
users_service_1.UsersService,
|
|
24
|
+
local_strategy_1.LocalStrategy,
|
|
25
|
+
token_service_1.TokenService,
|
|
26
|
+
jwt_strategy_1.JwtStrategy,
|
|
27
|
+
];
|
|
28
|
+
let AuthenticationModule = class AuthenticationModule {
|
|
29
|
+
};
|
|
30
|
+
exports.AuthenticationModule = AuthenticationModule;
|
|
31
|
+
exports.AuthenticationModule = AuthenticationModule = __decorate([
|
|
32
|
+
(0, common_1.Module)({
|
|
33
|
+
exports: providers,
|
|
34
|
+
providers: [...providers, environment_service_1.SDKEnvironmentService],
|
|
35
|
+
imports: [typeorm_1.TypeOrmModule.forFeature([user_entity_1.UserEntity]), passport_1.PassportModule],
|
|
36
|
+
controllers: [authentication_controller_1.AuthenticationController],
|
|
37
|
+
})
|
|
38
|
+
], AuthenticationModule);
|
|
39
|
+
//# 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,8EAA4D;AAC5D,4DAAwD;AACxD,8DAA0D;AAC1D,uFAAmF;AACnF,6CAAgD;AAChD,wDAAoD;AACpD,+CAAkD;AAClD,0DAAsD;AACtD,4EAA2E;AAC3E,gEAA4D;AAE5D,MAAM,SAAS,GAAG;IAChB,gCAAW;IACX,4BAAY;IACZ,8BAAa;IACb,4BAAY;IACZ,0BAAW;CACZ,CAAC;AAOK,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IANhC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,SAAS;QAClB,SAAS,EAAE,CAAC,GAAG,SAAS,EAAE,2CAAqB,CAAC;QAChD,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,wBAAU,CAAC,CAAC,EAAE,yBAAc,CAAC;QACjE,WAAW,EAAE,CAAC,oDAAwB,CAAC;KACxC,CAAC;GACW,oBAAoB,CAAG"}
|
package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import AuthService from '../services/authentication.service';
|
|
2
|
+
import { LoginDto, SignUpDto } from '../dtos/authentication.dto';
|
|
3
|
+
export declare class AuthenticationController {
|
|
4
|
+
protected readonly authService: AuthService;
|
|
5
|
+
constructor(authService: AuthService);
|
|
6
|
+
login(data: LoginDto): Promise<{
|
|
7
|
+
data: {
|
|
8
|
+
access_token: string;
|
|
9
|
+
};
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
12
|
+
signup(data: SignUpDto): Promise<{
|
|
13
|
+
data: import("../entities/user.entity").UserEntity & SignUpDto;
|
|
14
|
+
message: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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 swagger_1 = require("@nestjs/swagger");
|
|
18
|
+
const authentication_service_1 = require("../services/authentication.service");
|
|
19
|
+
const authentication_dto_1 = require("../dtos/authentication.dto");
|
|
20
|
+
const utility_service_1 = require("../../../services/utility.service");
|
|
21
|
+
const subject = `User`;
|
|
22
|
+
const idParam = `userID`;
|
|
23
|
+
let AuthenticationController = class AuthenticationController {
|
|
24
|
+
constructor(authService) {
|
|
25
|
+
this.authService = authService;
|
|
26
|
+
}
|
|
27
|
+
async login(data) {
|
|
28
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
29
|
+
data: await this.authService.login(data),
|
|
30
|
+
message: `${subject} logged in`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async signup(data) {
|
|
34
|
+
return utility_service_1.UtilityClass.handleSuccess({
|
|
35
|
+
data: await this.authService.signup(data),
|
|
36
|
+
message: `${subject} signed up`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.AuthenticationController = AuthenticationController;
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, common_1.Post)('login'),
|
|
43
|
+
(0, swagger_1.ApiBody)({ type: authentication_dto_1.LoginDto, required: true }),
|
|
44
|
+
__param(0, (0, common_1.Body)()),
|
|
45
|
+
__metadata("design:type", Function),
|
|
46
|
+
__metadata("design:paramtypes", [authentication_dto_1.LoginDto]),
|
|
47
|
+
__metadata("design:returntype", Promise)
|
|
48
|
+
], AuthenticationController.prototype, "login", null);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, common_1.Post)('signup'),
|
|
51
|
+
(0, swagger_1.ApiBody)({ type: authentication_dto_1.SignUpDto, required: true }),
|
|
52
|
+
__param(0, (0, common_1.Body)()),
|
|
53
|
+
__metadata("design:type", Function),
|
|
54
|
+
__metadata("design:paramtypes", [authentication_dto_1.SignUpDto]),
|
|
55
|
+
__metadata("design:returntype", Promise)
|
|
56
|
+
], AuthenticationController.prototype, "signup", null);
|
|
57
|
+
exports.AuthenticationController = AuthenticationController = __decorate([
|
|
58
|
+
(0, swagger_1.ApiTags)('auth'),
|
|
59
|
+
(0, common_1.Controller)('auth'),
|
|
60
|
+
__metadata("design:paramtypes", [authentication_service_1.default])
|
|
61
|
+
], AuthenticationController);
|
|
62
|
+
//# sourceMappingURL=authentication.controller.js.map
|
package/dist/libs/la-library/src/modules/authentication/controllers/authentication.controller.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.controller.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/controllers/authentication.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAmD;AACnD,+EAA6D;AAC7D,mEAAiE;AACjE,uEAAiE;AAEjE,MAAM,OAAO,GAAG,MAAM,CAAC;AACvB,MAAM,OAAO,GAAG,QAAQ,CAAC;AAIlB,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,YAA+B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAIrD,AAAN,KAAK,CAAC,KAAK,CAAS,IAAc;QAChC,OAAO,8BAAY,CAAC,aAAa,CAAC;YAChC,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;YACxC,OAAO,EAAE,GAAG,OAAO,YAAY;SAChC,CAAC,CAAC;IACL,CAAC;IAIK,AAAN,KAAK,CAAC,MAAM,CAAS,IAAe;QAClC,OAAO,8BAAY,CAAC,aAAa,CAAC;YAChC,IAAI,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YACzC,OAAO,EAAE,GAAG,OAAO,YAAY;SAChC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AApBY,4DAAwB;AAK7B;IAFL,IAAA,aAAI,EAAC,OAAO,CAAC;IACb,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,6BAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/B,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,6BAAQ;;qDAKjC;AAIK;IAFL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,iBAAO,EAAC,EAAE,IAAI,EAAE,8BAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/B,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,8BAAS;;sDAKnC;mCAnBU,wBAAwB;IAFpC,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAE2B,gCAAW;GAD5C,wBAAwB,CAoBpC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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.SignUpDto = exports.LoginDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class LoginDto {
|
|
16
|
+
}
|
|
17
|
+
exports.LoginDto = LoginDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, class_validator_1.IsEmail)(),
|
|
20
|
+
(0, class_validator_1.IsOptional)(),
|
|
21
|
+
(0, swagger_1.ApiProperty)({ type: 'string' }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], LoginDto.prototype, "email", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.IsOptional)(),
|
|
27
|
+
(0, swagger_1.ApiProperty)({ type: 'string' }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], LoginDto.prototype, "username", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_validator_1.IsString)(),
|
|
32
|
+
(0, swagger_1.ApiProperty)({ type: 'string', required: true }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], LoginDto.prototype, "password", void 0);
|
|
35
|
+
class SignUpDto {
|
|
36
|
+
}
|
|
37
|
+
exports.SignUpDto = SignUpDto;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_validator_1.IsEmail)(),
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
(0, swagger_1.ApiProperty)({ type: 'string' }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], SignUpDto.prototype, "email", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_validator_1.IsString)(),
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, swagger_1.ApiProperty)({ type: 'string' }),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], SignUpDto.prototype, "username", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, class_validator_1.IsString)(),
|
|
52
|
+
(0, swagger_1.ApiProperty)({ type: 'string', required: true }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], SignUpDto.prototype, "password", void 0);
|
|
55
|
+
//# sourceMappingURL=authentication.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.dto.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/dtos/authentication.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAgE;AAEhE,MAAa,QAAQ;CAYpB;AAZD,4BAYC;AARC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;uCAClB;AAId;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;0CACf;AAGjB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC/B;AAGnB,MAAa,SAAS;CAYrB;AAZD,8BAYC;AARC;IAHC,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;wCAClB;AAId;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;;2CACf;AAGjB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CAC/B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EGender, ESignUpType } from '../interfaces/authentication.interface';
|
|
2
|
+
import { BaseEntity } from 'libs/la-library/src/entities/base.entity';
|
|
3
|
+
export declare class UserEntity extends BaseEntity {
|
|
4
|
+
email: string;
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
firstname: string;
|
|
8
|
+
lastname: string;
|
|
9
|
+
phoneNumber: string;
|
|
10
|
+
signUpType: ESignUpType;
|
|
11
|
+
gender: EGender;
|
|
12
|
+
dob: string;
|
|
13
|
+
socialId: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.UserEntity = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const authentication_interface_1 = require("../interfaces/authentication.interface");
|
|
15
|
+
const base_enum_1 = require("libs/la-library/src/enums/base.enum");
|
|
16
|
+
const base_entity_1 = require("libs/la-library/src/entities/base.entity");
|
|
17
|
+
let UserEntity = class UserEntity extends base_entity_1.BaseEntity {
|
|
18
|
+
};
|
|
19
|
+
exports.UserEntity = UserEntity;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, typeorm_1.Column)({ type: 'text', unique: true }),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], UserEntity.prototype, "email", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ type: 'text', unique: true }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], UserEntity.prototype, "username", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], UserEntity.prototype, "password", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], UserEntity.prototype, "firstname", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
38
|
+
__metadata("design:type", String)
|
|
39
|
+
], UserEntity.prototype, "lastname", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], UserEntity.prototype, "phoneNumber", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ type: 'enum', default: authentication_interface_1.ESignUpType.email, enum: authentication_interface_1.ESignUpType }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], UserEntity.prototype, "signUpType", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: authentication_interface_1.EGender, nullable: true }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], UserEntity.prototype, "gender", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], UserEntity.prototype, "dob", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], UserEntity.prototype, "socialId", void 0);
|
|
60
|
+
exports.UserEntity = UserEntity = __decorate([
|
|
61
|
+
(0, typeorm_1.Entity)(base_enum_1.ETableName.user)
|
|
62
|
+
], UserEntity);
|
|
63
|
+
//# sourceMappingURL=user.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAyC;AACzC,qFAA8E;AAC9E,mEAAiE;AACjE,0EAAsE;AAG/D,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,wBAAU;CAYzC,CAAA;AAZY,gCAAU;AACmB;IAAvC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;yCAAe;AACd;IAAvC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;4CAAkB;AAC/B;IAAzB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAkB;AACjB;IAAzB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAmB;AAClB;IAAzB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAkB;AACD;IAAzC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CAAqB;AAE9D;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,sCAAW,CAAC,KAAK,EAAE,IAAI,EAAE,sCAAW,EAAE,CAAC;;8CAChD;AACiC;IAAxD,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAAiB;AAC1B;IAA9C,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAAa;AACjB;IAAzC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAAkB;qBAXhD,UAAU;IADtB,IAAA,gBAAM,EAAC,sBAAU,CAAC,IAAI,CAAC;GACX,UAAU,CAYtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.JwtAuthGuard = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const passport_1 = require("@nestjs/passport");
|
|
12
|
+
let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
|
|
13
|
+
};
|
|
14
|
+
exports.JwtAuthGuard = JwtAuthGuard;
|
|
15
|
+
exports.JwtAuthGuard = JwtAuthGuard = __decorate([
|
|
16
|
+
(0, common_1.Injectable)()
|
|
17
|
+
], JwtAuthGuard);
|
|
18
|
+
//# sourceMappingURL=jwt-auth.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-auth.guard.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/guards/jwt-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"}
|
package/dist/libs/la-library/src/modules/authentication/interfaces/authentication.interface.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EGender = exports.ESignUpType = void 0;
|
|
4
|
+
var ESignUpType;
|
|
5
|
+
(function (ESignUpType) {
|
|
6
|
+
ESignUpType["email"] = "email";
|
|
7
|
+
})(ESignUpType || (exports.ESignUpType = ESignUpType = {}));
|
|
8
|
+
var EGender;
|
|
9
|
+
(function (EGender) {
|
|
10
|
+
EGender["male"] = "Male";
|
|
11
|
+
EGender["female"] = "Female";
|
|
12
|
+
EGender["others"] = "Others";
|
|
13
|
+
})(EGender || (exports.EGender = EGender = {}));
|
|
14
|
+
//# sourceMappingURL=authentication.interface.js.map
|
package/dist/libs/la-library/src/modules/authentication/interfaces/authentication.interface.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.interface.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/interfaces/authentication.interface.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAEX;AAFD,WAAY,WAAW;IACrB,8BAAe,CAAA;AACjB,CAAC,EAFW,WAAW,2BAAX,WAAW,QAEtB;AAED,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,4BAAiB,CAAA;IACjB,4BAAiB,CAAA;AACnB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Strategy } from 'passport-jwt';
|
|
2
|
+
import { SDKEnvironmentService } from 'libs/la-library/src/services/environment.service';
|
|
3
|
+
declare const JwtStrategy_base: new (...args: any[]) => Strategy;
|
|
4
|
+
export declare class JwtStrategy extends JwtStrategy_base {
|
|
5
|
+
protected environmentService: SDKEnvironmentService;
|
|
6
|
+
constructor(environmentService: SDKEnvironmentService);
|
|
7
|
+
validate(payload: {
|
|
8
|
+
sub: any;
|
|
9
|
+
username: any;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
userId: any;
|
|
12
|
+
username: any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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.JwtStrategy = void 0;
|
|
13
|
+
const passport_jwt_1 = require("passport-jwt");
|
|
14
|
+
const passport_1 = require("@nestjs/passport");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
const environment_service_1 = require("libs/la-library/src/services/environment.service");
|
|
17
|
+
let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
|
|
18
|
+
constructor(environmentService) {
|
|
19
|
+
super({
|
|
20
|
+
jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
21
|
+
ignoreExpiration: false,
|
|
22
|
+
secretOrKey: environment_service_1.evt.JWT_SECRET,
|
|
23
|
+
});
|
|
24
|
+
this.environmentService = environmentService;
|
|
25
|
+
}
|
|
26
|
+
async validate(payload) {
|
|
27
|
+
return { userId: payload.sub, username: payload.username };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.JwtStrategy = JwtStrategy;
|
|
31
|
+
exports.JwtStrategy = JwtStrategy = __decorate([
|
|
32
|
+
(0, common_1.Injectable)(),
|
|
33
|
+
__metadata("design:paramtypes", [environment_service_1.SDKEnvironmentService])
|
|
34
|
+
], JwtStrategy);
|
|
35
|
+
//# sourceMappingURL=jwt.strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/passport/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAoD;AACpD,+CAAoD;AACpD,2CAA4C;AAC5C,0FAG0D;AAGnD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IACzD,YAAsB,kBAAyC;QAC7D,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,2BAA2B,EAAE;YACxD,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,yBAAG,CAAC,UAAU;SAC5B,CAAC,CAAC;QALiB,uBAAkB,GAAlB,kBAAkB,CAAuB;IAM/D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAA0B;QACvC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;CACF,CAAA;AAZY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAE+B,2CAAqB;GADpD,WAAW,CAYvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Strategy } from 'passport-local';
|
|
2
|
+
import { AuthService } from '../services/authentication.service';
|
|
3
|
+
declare const LocalStrategy_base: new (...args: any[]) => Strategy;
|
|
4
|
+
export declare class LocalStrategy extends LocalStrategy_base {
|
|
5
|
+
private authService;
|
|
6
|
+
constructor(authService: AuthService);
|
|
7
|
+
validate(username: string, password: string): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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.LocalStrategy = void 0;
|
|
13
|
+
const passport_local_1 = require("passport-local");
|
|
14
|
+
const passport_1 = require("@nestjs/passport");
|
|
15
|
+
const common_1 = require("@nestjs/common");
|
|
16
|
+
const authentication_service_1 = require("../services/authentication.service");
|
|
17
|
+
let LocalStrategy = class LocalStrategy extends (0, passport_1.PassportStrategy)(passport_local_1.Strategy) {
|
|
18
|
+
constructor(authService) {
|
|
19
|
+
super();
|
|
20
|
+
this.authService = authService;
|
|
21
|
+
}
|
|
22
|
+
async validate(username, password) {
|
|
23
|
+
const user = await this.authService.validateUser(username, password);
|
|
24
|
+
if (!user) {
|
|
25
|
+
throw new common_1.UnauthorizedException();
|
|
26
|
+
}
|
|
27
|
+
return user;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.LocalStrategy = LocalStrategy;
|
|
31
|
+
exports.LocalStrategy = LocalStrategy = __decorate([
|
|
32
|
+
(0, common_1.Injectable)(),
|
|
33
|
+
__metadata("design:paramtypes", [authentication_service_1.AuthService])
|
|
34
|
+
], LocalStrategy);
|
|
35
|
+
//# sourceMappingURL=local.strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local.strategy.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/passport/local.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAA0C;AAC1C,+CAAoD;AACpD,2CAAmE;AACnE,+EAAiE;AAG1D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,IAAA,2BAAgB,EAAC,yBAAQ,CAAC;IAC3D,YAAoB,WAAwB;QAC1C,KAAK,EAAE,CAAC;QADU,gBAAW,GAAX,WAAW,CAAa;IAE5C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,QAAgB;QAC/C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA;AAZY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAEsB,oCAAW;GADjC,aAAa,CAYzB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { UsersService } from './users.service';
|
|
3
|
+
import { LoginDto, SignUpDto } from '../dtos/authentication.dto';
|
|
4
|
+
import { UserEntity } from '../entities/user.entity';
|
|
5
|
+
import { TokenService } from '../../../services/token.service';
|
|
6
|
+
export declare class AuthService {
|
|
7
|
+
protected readonly repository: Repository<UserEntity>;
|
|
8
|
+
protected readonly tokenService: TokenService;
|
|
9
|
+
private usersService;
|
|
10
|
+
constructor(repository: Repository<UserEntity>, tokenService: TokenService, usersService: UsersService);
|
|
11
|
+
validateUser: (username: string, pass: string) => Promise<boolean>;
|
|
12
|
+
signup(data: SignUpDto): Promise<UserEntity & SignUpDto>;
|
|
13
|
+
login(data: LoginDto): Promise<{
|
|
14
|
+
access_token: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export default AuthService;
|
|
@@ -0,0 +1,47 @@
|
|
|
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.AuthService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const users_service_1 = require("./users.service");
|
|
20
|
+
const user_entity_1 = require("../entities/user.entity");
|
|
21
|
+
const token_service_1 = require("../../../services/token.service");
|
|
22
|
+
let AuthService = class AuthService {
|
|
23
|
+
constructor(repository, tokenService, usersService) {
|
|
24
|
+
this.repository = repository;
|
|
25
|
+
this.tokenService = tokenService;
|
|
26
|
+
this.usersService = usersService;
|
|
27
|
+
}
|
|
28
|
+
async signup(data) {
|
|
29
|
+
const user = Object.assign(new user_entity_1.UserEntity(), data);
|
|
30
|
+
return await this.repository.save(user);
|
|
31
|
+
}
|
|
32
|
+
async login(data) {
|
|
33
|
+
return {
|
|
34
|
+
access_token: await this.tokenService.generateToken(data),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.AuthService = AuthService;
|
|
39
|
+
exports.AuthService = AuthService = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__param(0, (0, typeorm_1.InjectRepository)(user_entity_1.UserEntity)),
|
|
42
|
+
__metadata("design:paramtypes", [typeorm_2.Repository,
|
|
43
|
+
token_service_1.TokenService,
|
|
44
|
+
users_service_1.UsersService])
|
|
45
|
+
], AuthService);
|
|
46
|
+
exports.default = AuthService;
|
|
47
|
+
//# sourceMappingURL=authentication.service.js.map
|
package/dist/libs/la-library/src/modules/authentication/services/authentication.service.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/services/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,mDAA+C;AAE/C,yDAAqD;AACrD,mEAA+D;AAGxD,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YAEqB,UAAkC,EAClC,YAA0B,EACrC,YAA0B;QAFf,eAAU,GAAV,UAAU,CAAwB;QAClC,iBAAY,GAAZ,YAAY,CAAc;QACrC,iBAAY,GAAZ,YAAY,CAAc;IACjC,CAAC;IAIJ,KAAK,CAAC,MAAM,CAAC,IAAe;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,wBAAU,EAAE,EAAE,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,IAAc;QACxB,OAAO;YACL,YAAY,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC;SAC1D,CAAC;IACJ,CAAC;CACF,CAAA;AApBY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,wBAAU,CAAC,CAAA;qCACE,oBAAU;QACR,4BAAY;QACvB,4BAAY;GALzB,WAAW,CAoBvB;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { UserEntity } from '../entities/user.entity';
|
|
3
|
+
export declare class UsersService {
|
|
4
|
+
protected readonly repository: Repository<UserEntity>;
|
|
5
|
+
constructor(repository: Repository<UserEntity>);
|
|
6
|
+
findOne(username: string): Promise<UserEntity | undefined>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.UsersService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const user_entity_1 = require("../entities/user.entity");
|
|
20
|
+
let UsersService = class UsersService {
|
|
21
|
+
constructor(repository) {
|
|
22
|
+
this.repository = repository;
|
|
23
|
+
}
|
|
24
|
+
async findOne(username) {
|
|
25
|
+
return this.repository.findOneBy({ username });
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.UsersService = UsersService;
|
|
29
|
+
exports.UsersService = UsersService = __decorate([
|
|
30
|
+
(0, common_1.Injectable)(),
|
|
31
|
+
__param(0, (0, typeorm_1.InjectRepository)(user_entity_1.UserEntity)),
|
|
32
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
33
|
+
], UsersService);
|
|
34
|
+
//# sourceMappingURL=users.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../../../../../../libs/la-library/src/modules/authentication/services/users.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AACrC,yDAAqD;AAG9C,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YAEqB,UAAkC;QAAlC,eAAU,GAAV,UAAU,CAAwB;IACpD,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC5B,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AATY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,wBAAU,CAAC,CAAA;qCACE,oBAAU;GAHhC,YAAY,CASxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serene-dev/la-nest-library",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,12 @@
|
|
|
42
42
|
"@serene-dev/ts-helpers": "^0.0.29",
|
|
43
43
|
"@nestjs/swagger": "^7.1.11",
|
|
44
44
|
"@nestjs/typeorm": "^10.0.0",
|
|
45
|
+
"@nestjs/passport": "10.0.3",
|
|
45
46
|
"class-transformer": "^0.5.1",
|
|
46
47
|
"class-validator": "^0.14.0",
|
|
48
|
+
"passport": "^0.7.0",
|
|
49
|
+
"passport-jwt": "^4.0.1",
|
|
50
|
+
"passport-local": "^1.0.0",
|
|
47
51
|
"cors": "^2.8.5",
|
|
48
52
|
"helmet": "^7.0.0",
|
|
49
53
|
"reflect-metadata": "^0.1.13",
|
|
@@ -61,7 +65,11 @@
|
|
|
61
65
|
"@nestjs/platform-express": "^10.0.0",
|
|
62
66
|
"@serene-dev/ts-helpers": "^0.0.29",
|
|
63
67
|
"@nestjs/swagger": "^7.1.11",
|
|
68
|
+
"@nestjs/passport": "10.0.3",
|
|
64
69
|
"@nestjs/typeorm": "^10.0.0",
|
|
70
|
+
"passport": "^0.7.0",
|
|
71
|
+
"passport-jwt": "^4.0.1",
|
|
72
|
+
"passport-local": "^1.0.0",
|
|
65
73
|
"class-transformer": "^0.5.1",
|
|
66
74
|
"class-validator": "^0.14.0",
|
|
67
75
|
"cors": "^2.8.5",
|
|
@@ -81,6 +89,8 @@
|
|
|
81
89
|
"@types/express": "^4.17.17",
|
|
82
90
|
"@types/jest": "^29.5.2",
|
|
83
91
|
"@types/lodash": "4.14.202",
|
|
92
|
+
"@types/passport-jwt": "^3.0.13",
|
|
93
|
+
"@types/passport-local": "^1.0.38",
|
|
84
94
|
"@types/multer": "^1.4.11",
|
|
85
95
|
"@types/node": "^20.3.1",
|
|
86
96
|
"@types/supertest": "^2.0.12",
|
|
@@ -119,9 +129,6 @@
|
|
|
119
129
|
"roots": [
|
|
120
130
|
"<rootDir>/src/",
|
|
121
131
|
"<rootDir>/libs/"
|
|
122
|
-
]
|
|
123
|
-
"moduleNameMapper": {
|
|
124
|
-
"^@app/la-library(|/.*)$": "<rootDir>/libs/la-library/src/$1"
|
|
125
|
-
}
|
|
132
|
+
]
|
|
126
133
|
}
|
|
127
134
|
}
|