ajout de la fenêtre de logs pour le mode développeur + quelques routes sans bdd pour l'instant

This commit is contained in:
batche
2022-10-21 15:38:15 +02:00
parent f162ea2d11
commit a175ef7162
168 changed files with 7444 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ prod:
start_dev:
docker compose -f ${DOCKERCOMPOSEPATH} start dev
docker logs --follow nestjs_api_dev
start_debug:
docker compose -f ${DOCKERCOMPOSEPATH} start debug

View File

@@ -1,4 +1,4 @@
FROM node:19-alpine As development
FROM node:19-alpine AS development
WORKDIR /usr/src/app
@@ -10,7 +10,7 @@ COPY --chown=node:node ./api_back/ ./
USER node
FROM node:19-alpine As build
FROM node:19-alpine AS build
WORKDIR /usr/src/app
@@ -28,11 +28,13 @@ RUN npm ci --only=production && npm cache clean --force
USER node
FROM node:19-alpine As production
FROM node:19-alpine AS production
WORKDIR /usr/src/app
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
USER node
CMD [ "node", "dist/main.js" ]

View File

@@ -0,0 +1,6 @@
import { AppService } from './app.service';
export declare class AppController {
private readonly appService;
constructor(appService: AppService);
getHello(): string;
}

View File

@@ -0,0 +1,34 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppController = void 0;
const common_1 = require("@nestjs/common");
const app_service_1 = require("./app.service");
let AppController = class AppController {
constructor(appService) {
this.appService = appService;
}
getHello() {
return this.appService.getHello();
}
};
__decorate([
(0, common_1.Get)(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", String)
], AppController.prototype, "getHello", null);
AppController = __decorate([
(0, common_1.Controller)(),
__metadata("design:paramtypes", [app_service_1.AppService])
], AppController);
exports.AppController = AppController;
//# sourceMappingURL=app.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AACjD,+CAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IACxB,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAGvD,QAAQ;QACN,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAJC;IAAC,IAAA,YAAG,GAAE;;;;6CAGL;AANU,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAE8B,wBAAU;GADxC,aAAa,CAOzB;AAPY,sCAAa"}

View File

@@ -0,0 +1,2 @@
export declare class AppModule {
}

View File

@@ -0,0 +1,25 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppModule = void 0;
const common_1 = require("@nestjs/common");
const app_controller_1 = require("./app.controller");
const app_service_1 = require("./app.service");
const auth_module_1 = require("./auth/auth.module");
const users_module_1 = require("./users/users.module");
let AppModule = class AppModule {
};
AppModule = __decorate([
(0, common_1.Module)({
imports: [auth_module_1.AuthModule, users_module_1.UsersModule],
controllers: [app_controller_1.AppController],
providers: [app_service_1.AppService],
})
], AppModule);
exports.AppModule = AppModule;
//# sourceMappingURL=app.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AACjD,+CAA2C;AAC3C,oDAAgD;AAChD,uDAAmD;AAO5C,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IALrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,wBAAU,EAAE,0BAAW,CAAC;QAClC,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,wBAAU,CAAC;KACxB,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}

View File

@@ -0,0 +1,3 @@
export declare class AppService {
getHello(): string;
}

View File

@@ -0,0 +1,20 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppService = void 0;
const common_1 = require("@nestjs/common");
let AppService = class AppService {
getHello() {
return 'Hello Toto!';
}
};
AppService = __decorate([
(0, common_1.Injectable)()
], AppService);
exports.AppService = AppService;
//# sourceMappingURL=app.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,QAAQ;QACN,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAA;AAJY,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB;AAJY,gCAAU"}

View File

@@ -0,0 +1,2 @@
export declare class AuthModule {
}

View File

@@ -0,0 +1,22 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthModule = void 0;
const common_1 = require("@nestjs/common");
const auth_service_1 = require("./auth.service");
const users_module_1 = require("../users/users.module");
let AuthModule = class AuthModule {
};
AuthModule = __decorate([
(0, common_1.Module)({
imports: [users_module_1.UsersModule],
providers: [auth_service_1.AuthService],
})
], AuthModule);
exports.AuthModule = AuthModule;
//# sourceMappingURL=auth.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../src/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,wDAAqD;AAM9C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IAJtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,0BAAW,CAAC;QACtB,SAAS,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU"}

View File

@@ -0,0 +1,6 @@
import { UsersService } from '../users/users.service';
export declare class AuthService {
private usersService;
constructor(usersService: UsersService);
validateUser(username: string, pass: string): Promise<any>;
}

View File

@@ -0,0 +1,28 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthService = void 0;
const common_1 = require("@nestjs/common");
const users_service_1 = require("../users/users.service");
let AuthService = class AuthService {
constructor(usersService) {
this.usersService = usersService;
}
async validateUser(username, pass) {
return null;
}
};
AuthService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [users_service_1.UsersService])
], AuthService);
exports.AuthService = AuthService;
//# sourceMappingURL=auth.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,0DAAsD;AAG/C,IAAM,WAAW,GAAjB,MAAM,WAAW;IACvB,YAAqB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAEnD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,IAAY;QAChD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;AANY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEuB,4BAAY;GADnC,WAAW,CAMvB;AANY,kCAAW"}

View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@nestjs/core");
const app_module_1 = require("./app.module");
async function bootstrap() {
const app = await core_1.NestFactory.create(app_module_1.AppModule);
await app.listen(3000);
}
bootstrap();
//# sourceMappingURL=main.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IAEtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,5 @@
export declare class User {
userId: number;
username: string;
password: string;
}

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.User = void 0;
class User {
}
exports.User = User;
//# sourceMappingURL=user.entity.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../src/users/entities/user.entity.ts"],"names":[],"mappings":";;;AAAA,MAAa,IAAI;CAIhB;AAJD,oBAIC"}

View File

@@ -0,0 +1,10 @@
import { UsersService } from './users.service';
export declare class UsersController {
private readonly usersService;
constructor(usersService: UsersService);
findAll(query: any): string;
findOne(id: string): string;
create(body: any): any;
update(id: string, body: any): string;
remove(id: string): string;
}

View File

@@ -0,0 +1,81 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersController = void 0;
const common_1 = require("@nestjs/common");
const users_service_1 = require("./users.service");
let UsersController = class UsersController {
constructor(usersService) {
this.usersService = usersService;
}
findAll(query) {
const { limit, offset } = query;
return `This action returns all users. The limits is ${limit} and the offset is ${offset}`;
}
findOne(id) {
return 'This action returns a single user whose id is ' + id;
}
create(body) {
return body;
}
update(id, body) {
return 'The user whose id is ' + id + ' has been updated';
}
remove(id) {
return 'The user whose id is ' + id + ' has been deleted';
}
};
__decorate([
(0, common_1.Get)(),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], UsersController.prototype, "findAll", null);
__decorate([
(0, common_1.Get)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], UsersController.prototype, "findOne", null);
__decorate([
(0, common_1.Post)(),
(0, common_1.HttpCode)(common_1.HttpStatus.GONE),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], UsersController.prototype, "create", null);
__decorate([
(0, common_1.Patch)(':id'),
__param(0, (0, common_1.Param)('id')),
__param(1, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", void 0)
], UsersController.prototype, "update", null);
__decorate([
(0, common_1.Delete)(':id'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], UsersController.prototype, "remove", null);
UsersController = __decorate([
(0, common_1.Controller)('users'),
__metadata("design:paramtypes", [users_service_1.UsersService])
], UsersController);
exports.UsersController = UsersController;
//# sourceMappingURL=users.controller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"users.controller.js","sourceRoot":"","sources":["../../src/users/users.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAGwB;AAExB,mDAA+C;AAGxC,IAAM,eAAe,GAArB,MAAM,eAAe;IAC3B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAG3D,OAAO,CAAU,KAAK;QACrB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAChC,OAAO,gDAAgD,KAAK,sBAAsB,MAAM,EAAE,CAAC;IAC5F,CAAC;IAGD,OAAO,CAAc,EAAU;QAC9B,OAAO,iDAAiD,GAAG,EAAE,CAAC;IAC/D,CAAC;IAID,MAAM,CAAS,IAAI;QAClB,OAAO,IAAI,CAAC;IACb,CAAC;IAGD,MAAM,CAAc,EAAU,EAAU,IAAI;QAC3C,OAAO,uBAAuB,GAAG,EAAE,GAAG,mBAAmB,CAAC;IAC3D,CAAC;IAGD,MAAM,CAAc,EAAU;QAC7B,OAAO,uBAAuB,GAAG,EAAE,GAAG,mBAAmB,CAAC;IAC3D,CAAC;CACD,CAAA;AA1BA;IAAC,IAAA,YAAG,GAAE;IACG,WAAA,IAAA,cAAK,GAAE,CAAA;;;;8CAGf;AAED;IAAC,IAAA,YAAG,EAAC,KAAK,CAAC;IACF,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;8CAEnB;AAED;IAAC,IAAA,aAAI,GAAE;IACN,IAAA,iBAAQ,EAAC,mBAAU,CAAC,IAAI,CAAC;IAClB,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6CAEb;AAED;IAAC,IAAA,cAAK,EAAC,KAAK,CAAC;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6CAEtC;AAED;IAAC,IAAA,eAAM,EAAC,KAAK,CAAC;IACN,WAAA,IAAA,cAAK,EAAC,IAAI,CAAC,CAAA;;;;6CAElB;AA5BW,eAAe;IAD3B,IAAA,mBAAU,EAAC,OAAO,CAAC;qCAEwB,4BAAY;GAD3C,eAAe,CA6B3B;AA7BY,0CAAe"}

View File

@@ -0,0 +1,2 @@
export declare class UsersModule {
}

View File

@@ -0,0 +1,23 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersModule = void 0;
const common_1 = require("@nestjs/common");
const users_service_1 = require("./users.service");
const users_controller_1 = require("./users.controller");
let UsersModule = class UsersModule {
};
UsersModule = __decorate([
(0, common_1.Module)({
providers: [users_service_1.UsersService],
exports: [users_service_1.UsersService],
controllers: [users_controller_1.UsersController],
})
], UsersModule);
exports.UsersModule = UsersModule;
//# sourceMappingURL=users.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"users.module.js","sourceRoot":"","sources":["../../src/users/users.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAC/C,yDAAqD;AAO9C,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IALvB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,OAAO,EAAE,CAAC,4BAAY,CAAC;QACvB,WAAW,EAAE,CAAC,kCAAe,CAAC;KAC/B,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW"}

View File

@@ -0,0 +1,8 @@
import { User } from './entities/user.entity';
export declare class UsersService {
private users;
findOne(id: number): User;
findAll(): User[];
create(createUserDto: any): void;
update(id: number, updateUserDto: any): void;
}

View File

@@ -0,0 +1,44 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersService = void 0;
const common_1 = require("@nestjs/common");
let UsersService = class UsersService {
constructor() {
this.users = [
{
userId: 1,
username: 'john',
password: 'changeme',
},
{
userId: 2,
username: 'maria',
password: 'guess',
},
];
}
findOne(id) {
return this.users.find(user => user.userId === id);
}
findAll() {
return this.users;
}
create(createUserDto) {
this.users.push(createUserDto);
}
update(id, updateUserDto) {
const index = this.users.findIndex(user => user.userId === id);
this.users[index] = updateUserDto;
}
};
UsersService = __decorate([
(0, common_1.Injectable)()
], UsersService);
exports.UsersService = UsersService;
//# sourceMappingURL=users.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../src/users/users.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAIrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QACE,UAAK,GAAU;YACtB;gBACC,MAAM,EAAE,CAAC;gBACT,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,UAAU;aACpB;YACD;gBACC,MAAM,EAAE,CAAC;gBACT,QAAQ,EAAE,OAAO;gBACjB,QAAQ,EAAE,OAAO;aACjB;SACD,CAAC;IAmBH,CAAC;IAjBA,OAAO,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,OAAO;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,aAAkB;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,aAAkB;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;IACnC,CAAC;CAED,CAAA;AA/BY,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CA+BxB;AA/BY,oCAAY"}

View File

@@ -0,0 +1,2 @@
export declare class AuthModule {
}

View File

@@ -0,0 +1,22 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthModule = void 0;
const common_1 = require("@nestjs/common");
const auth_service_1 = require("./auth.service");
const users_module_1 = require("src/users/users.module");
let AuthModule = class AuthModule {
};
AuthModule = __decorate([
(0, common_1.Module)({
imports: [users_module_1.UsersModule],
providers: [auth_service_1.AuthService],
})
], AuthModule);
exports.AuthModule = AuthModule;
//# sourceMappingURL=auth.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../src/v2/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAC7C,yDAAqD;AAM9C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IAJtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,0BAAW,CAAC;QACtB,SAAS,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU"}

View File

@@ -0,0 +1,6 @@
import { UsersService } from '../users/users.service';
export declare class AuthService {
private usersService;
constructor(usersService: UsersService);
validateUser(username: string, pass: string): Promise<any>;
}

View File

@@ -0,0 +1,44 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthService = void 0;
const common_1 = require("@nestjs/common");
const users_service_1 = require("../users/users.service");
let AuthService = class AuthService {
constructor(usersService) {
this.usersService = usersService;
}
async validateUser(username, pass) {
const user = await this.usersService.findOne(username);
if (user && user.password === pass) {
const { password } = user, result = __rest(user, ["password"]);
return result;
}
return null;
}
};
AuthService = __decorate([
(0, common_1.Injectable)(),
__metadata("design:paramtypes", [users_service_1.UsersService])
], AuthService);
exports.AuthService = AuthService;
//# sourceMappingURL=auth.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../../src/v2/auth/auth.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,0DAAsD;AAG/C,IAAM,WAAW,GAAjB,MAAM,WAAW;IACvB,YAAqB,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAEnD,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,IAAY;QAChD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACvD,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;YACnC,MAAM,EAAC,QAAQ,KAAe,IAAI,EAAd,MAAM,UAAI,IAAI,EAA5B,YAAqB,CAAO,CAAC;YACnC,OAAO,MAAM,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD,CAAA;AAXY,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAEuB,4BAAY;GADnC,WAAW,CAWvB;AAXY,kCAAW"}

View File

@@ -0,0 +1,2 @@
export declare class UsersModule {
}

View File

@@ -0,0 +1,21 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersModule = void 0;
const common_1 = require("@nestjs/common");
const users_service_1 = require("./users.service");
let UsersModule = class UsersModule {
};
UsersModule = __decorate([
(0, common_1.Module)({
providers: [users_service_1.UsersService],
exports: [users_service_1.UsersService],
})
], UsersModule);
exports.UsersModule = UsersModule;
//# sourceMappingURL=users.module.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"users.module.js","sourceRoot":"","sources":["../../../src/v2/users/users.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAMxC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IAJvB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW"}

View File

@@ -0,0 +1,5 @@
export declare type User = any;
export declare class UsersService {
private readonly users;
findOne(username: string): Promise<User | undefined>;
}

View File

@@ -0,0 +1,20 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersService = void 0;
const common_1 = require("@nestjs/common");
let UsersService = class UsersService {
async findOne(username) {
return this.users.find(user => user.username === username);
}
};
UsersService = __decorate([
(0, common_1.Injectable)()
], UsersService);
exports.UsersService = UsersService;
//# sourceMappingURL=users.service.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../../src/v2/users/users.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAMrC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAcxB,KAAK,CAAC,OAAO,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAC5D,CAAC;CACD,CAAA;AAjBY,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAiBxB;AAjBY,oCAAY"}

View File

@@ -1505,6 +1505,15 @@
}
}
},
"node_modules/@nestjs/passport": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@nestjs/passport/-/passport-9.0.0.tgz",
"integrity": "sha512-Gnh8n1wzFPOLSS/94X1sUP4IRAoXTgG4odl7/AO5h+uwscEGXxJFercrZfqdAwkWhqkKWbsntM3j5mRy/6ZQDA==",
"peerDependencies": {
"@nestjs/common": "^8.0.0 || ^9.0.0",
"passport": "^0.4.0 || ^0.5.0 || ^0.6.0"
}
},
"node_modules/@nestjs/platform-express": {
"version": "9.1.4",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-9.1.4.tgz",
@@ -1945,6 +1954,36 @@
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
"dev": true
},
"node_modules/@types/passport": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@types/passport/-/passport-1.0.11.tgz",
"integrity": "sha512-pz1cx9ptZvozyGKKKIPLcVDVHwae4hrH5d6g5J+DkMRRjR3cVETb4jMabhXAUbg3Ov7T22nFHEgaK2jj+5CBpw==",
"dev": true,
"dependencies": {
"@types/express": "*"
}
},
"node_modules/@types/passport-local": {
"version": "1.0.34",
"resolved": "https://registry.npmjs.org/@types/passport-local/-/passport-local-1.0.34.tgz",
"integrity": "sha512-PSc07UdYx+jhadySxxIYWuv6sAnY5e+gesn/5lkPKfBeGuIYn9OPR+AAEDq73VRUh6NBTpvE/iPE62rzZUslog==",
"dev": true,
"dependencies": {
"@types/express": "*",
"@types/passport": "*",
"@types/passport-strategy": "*"
}
},
"node_modules/@types/passport-strategy": {
"version": "0.2.35",
"resolved": "https://registry.npmjs.org/@types/passport-strategy/-/passport-strategy-0.2.35.tgz",
"integrity": "sha512-o5D19Jy2XPFoX2rKApykY15et3Apgax00RRLf0RUotPDUsYrQa7x4howLYr9El2mlUApHmCMv5CZ1IXqKFQ2+g==",
"dev": true,
"dependencies": {
"@types/express": "*",
"@types/passport": "*"
}
},
"node_modules/@types/prettier": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz",
@@ -6364,6 +6403,42 @@
"node": ">= 0.8"
}
},
"node_modules/passport": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/passport/-/passport-0.6.0.tgz",
"integrity": "sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug==",
"dependencies": {
"passport-strategy": "1.x.x",
"pause": "0.0.1",
"utils-merge": "^1.0.1"
},
"engines": {
"node": ">= 0.4.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/jaredhanson"
}
},
"node_modules/passport-local": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/passport-local/-/passport-local-1.0.0.tgz",
"integrity": "sha512-9wCE6qKznvf9mQYYbgJ3sVOHmCWoUNMVFoZzNoznmISbhnNNPhN9xfY3sLmScHMetEJeoY7CXwfhCe7argfQow==",
"dependencies": {
"passport-strategy": "1.x.x"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/passport-strategy": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/passport-strategy/-/passport-strategy-1.0.0.tgz",
"integrity": "sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA==",
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -6410,6 +6485,11 @@
"node": ">=8"
}
},
"node_modules/pause": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz",
"integrity": "sha512-KG8UEiEVkR3wGEb4m5yZkVCzigAD+cVEJck2CzYZO37ZGJfctvVptVO192MwrtPhzONn6go8ylnOdMhKqi4nfg=="
},
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",

View File

@@ -0,0 +1,47 @@
version: 2
aliases:
- &restore-cache
restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- &install-deps
run:
name: Install dependencies
command: npm ci
- &build-packages
run:
name: Build
command: npm run build
jobs:
build:
working_directory: ~/nest
docker:
- image: circleci/node:17
steps:
- checkout
- run:
name: Update NPM version
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm ci
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Build
command: npm run build
- run:
name: Test
command: npm run test
workflows:
version: 2
build-and-test:
jobs:
- build

View File

@@ -0,0 +1,113 @@
name: "\U0001F41B Bug Report"
description: "If something isn't working as expected \U0001F914"
labels: ["needs triage", "bug"]
body:
- type: markdown
attributes:
value: |
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
If you are not sure that your issue is a bug, you could:
- use our [Discord community](https://discord.gg/NestJS)
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
**NOTE:** You don't need to answer questions that you know that aren't relevant.
---
- type: checkboxes
attributes:
label: "Is there an existing issue for this?"
description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the bug you encountered"
options:
- label: "I have searched the existing issues"
required: true
- type: textarea
validations:
required: true
attributes:
label: "Current behavior"
description: "How the issue manifests?"
- type: input
validations:
required: true
attributes:
label: "Minimum reproduction code"
description: "An URL to some git repository or gist that reproduces this issue. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)"
placeholder: "https://github.com/..."
- type: textarea
attributes:
label: "Steps to reproduce"
description: |
How the issue manifests?
You could leave this blank if you alread write this in your reproduction code/repo
placeholder: |
1. `npm i`
2. `npm start:dev`
3. See error...
- type: textarea
validations:
required: true
attributes:
label: "Expected behavior"
description: "A clear and concise description of what you expected to happend (or code)"
- type: markdown
attributes:
value: |
---
- type: input
validations:
required: true
attributes:
label: "Package version"
description: |
Which version of `@nestjs/passport` are you using?
**Tip**: Make sure that all of yours `@nestjs/*` dependencies are in sync!
placeholder: "8.1.3"
- type: input
attributes:
label: "Passport version"
description: |
Which version of `passport` are you using?
placeholder: "0.5.0"
- type: input
attributes:
label: "NestJS version"
description: "Which version of `@nestjs/core` are you using?"
placeholder: "8.1.3"
- type: input
attributes:
label: "Node.js version"
description: "Which version of Node.js are you using?"
placeholder: "14.17.6"
- type: checkboxes
attributes:
label: "In which operating systems have you tested?"
options:
- label: macOS
- label: Windows
- label: Linux
- type: markdown
attributes:
value: |
---
- type: textarea
attributes:
label: "Other"
description: |
Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
**Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in

View File

@@ -0,0 +1,52 @@
name: "\U0001F680 Feature Request"
description: "I have a suggestion \U0001F63B!"
labels: ["feature"]
body:
- type: markdown
attributes:
value: |
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
If you are not sure that your issue is a bug, you could:
- use our [Discord community](https://discord.gg/NestJS)
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
---
- type: checkboxes
attributes:
label: "Is there an existing issue that is already proposing this?"
description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
options:
- label: "I have searched the existing issues"
required: true
- type: textarea
validations:
required: true
attributes:
label: "Is your feature request related to a problem? Please describe it"
description: "A clear and concise description of what the problem is"
placeholder: |
I have an issue when ...
- type: textarea
validations:
required: true
attributes:
label: "Describe the solution you'd like"
description: "A clear and concise description of what you want to happen. Add any considered drawbacks"
- type: textarea
attributes:
label: "Teachability, documentation, adoption, migration strategy"
description: "If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design?"
- type: textarea
validations:
required: true
attributes:
label: "What is the motivation / use case for changing the behavior?"
description: "Describe the motivation or the concrete use case"

View File

@@ -0,0 +1,78 @@
name: "\U0001F4A5 Regression"
description: "Report an unexpected behavior while upgrading your Nest application!"
labels: ["needs triage"]
body:
- type: markdown
attributes:
value: |
## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
If you are not sure that your issue is a bug, you could:
- use our [Discord community](https://discord.gg/NestJS)
- use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
- If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
**NOTE:** You don't need to answer questions that you know that aren't relevant.
---
- type: checkboxes
attributes:
label: "Did you read the migration guide?"
description: "Check out the [migration guide here](https://docs.nestjs.com/migration-guide)!"
options:
- label: "I have read the whole migration guide"
required: false
- type: checkboxes
attributes:
label: "Is there an existing issue that is already proposing this?"
description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
options:
- label: "I have searched the existing issues"
required: true
- type: input
attributes:
label: "Potential Commit/PR that introduced the regression"
description: "If you have time to investigate, what PR/date/version introduced this issue"
placeholder: "PR #123 or commit 5b3c4a4"
- type: input
attributes:
label: "Versions"
description: "From which version of `@nestjs/passport` to which version you are upgrading"
placeholder: "8.1.0 -> 8.1.3"
- type: textarea
validations:
required: true
attributes:
label: "Describe the regression"
description: "A clear and concise description of what the regression is"
- type: textarea
attributes:
label: "Minimum reproduction code"
description: |
Please share a git repo, a gist, or step-by-step instructions. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)
**Tip:** If you leave a minimum repository, we will understand your issue faster!
value: |
```ts
```
- type: textarea
validations:
required: true
attributes:
label: "Expected behavior"
description: "A clear and concise description of what you expected to happend (or code)"
- type: textarea
attributes:
label: "Other"
description: |
Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
**Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in

View File

@@ -0,0 +1,7 @@
## To encourage contributors to use issue templates, we don't allow blank issues
blank_issues_enabled: false
contact_links:
- name: "\u2753 Discord Community of NestJS"
url: "https://discord.gg/NestJS"
about: "Please ask support questions or discuss suggestions/enhancements here."

View File

@@ -0,0 +1,37 @@
## PR Checklist
Please check if your PR fulfills the following requirements:
- [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x". -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Other... Please describe:
## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
Issue Number: N/A
## What is the new behavior?
## Does this PR introduce a breaking change?
- [ ] Yes
- [ ] No
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
## Other information

View File

@@ -0,0 +1,253 @@
# Contributing to Nest
We would love for you to contribute to Nest and help make it even better than it is
today! As a contributor, here are the guidelines we would like you to follow:
- [Code of Conduct](#coc)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
<!-- - [Signing the CLA](#cla) -->
<!-- ## <a name="coc"></a> Code of Conduct
Help us keep Nest open and inclusive. Please read and follow our [Code of Conduct][coc]. -->
## <a name="question"></a> Got a Question or Problem?
**Do not open issues for general support questions as we want to keep GitHub issues for bug reports and feature requests.** You've got much better chances of getting your question answered on [Stack Overflow](https://stackoverflow.com/questions/tagged/nestjs) where the questions should be tagged with tag `nestjs`.
Stack Overflow is a much better place to ask questions since:
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
- questions and answers stay available for public viewing so your question / answer might help someone else
- Stack Overflow's voting system assures that the best answers are prominently visible.
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
## <a name="issue"></a> Found a Bug?
If you find a bug in the source code, you can help us by
[submitting an issue](#submit-issue) to our [GitHub Repository][github]. Even better, you can
[submit a Pull Request](#submit-pr) with a fix.
## <a name="feature"></a> Missing a Feature?
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub
Repository. If you would like to *implement* a new feature, please submit an issue with
a proposal for your work first, to be sure that we can use it.
Please consider what kind of change it is:
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
## <a name="submit"></a> Submission Guidelines
### <a name="submit-issue"></a> Submitting an Issue
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
- version of NestJS used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
<!--
// TODO we need to create a playground, similar to plunkr
A minimal reproduce scenario using a repository or Gist allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. If neither of these are not a suitable way to demonstrate the problem (for example for issues related to our npm packaging), please create a standalone git repository demonstrating the problem. -->
<!-- We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it. -->
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that don't have enough info to be reproduced.
You can file new issues by filling out our [new issue form](https://github.com/nestjs/nest/issues/new).
### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines:
1. Search [GitHub](https://github.com/nestjs/nest/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.
<!-- 1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
We cannot accept code without this. -->
1. Fork the nestjs/nest repo.
1. Make your changes in a new git branch:
```shell
git checkout -b my-fix-branch master
```
1. Create your patch, **including appropriate test cases**.
1. Follow our [Coding Rules](#rules).
1. Run the full Nest test suite, as described in the [developer documentation][dev-doc],
and ensure that all tests pass.
1. Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit). Adherence to these conventions
is necessary because release notes are automatically generated from these messages.
```shell
git commit -a
```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
1. Push your branch to GitHub:
```shell
git push origin my-fix-branch
```
1. In GitHub, send a pull request to `nestjs:master`.
* If we suggest changes then:
* Make the required updates.
* Re-run the Nest test suites to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
```shell
git rebase master -i
git push -f
```
That's it! Thank you for your contribution!
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
```shell
git pull --ff upstream master
```
## <a name="rules"></a> Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
<!--
// We're working on auto-documentation.
* All public API methods **must be documented**. (Details TBC). -->
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
**100 characters**. An automated formatter is available, see
[DEVELOPER.md](docs/DEVELOPER.md#clang-format).
## <a name="commit"></a> Commit Message Guidelines
We have very precise rules over how our git commit messages can be formatted. This leads to **more
readable messages** that are easy to follow when looking through the **project history**. But also,
we use the git commit messages to **generate the Nest change log**.
### Commit Message Format
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:
```
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
```
The **header** is mandatory and the **scope** of the header is optional.
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
to read on GitHub as well as in various git tools.
Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
```
docs(changelog) update change log to beta.5
```
```
fix(@nestjs/core) need to depend on latest rxjs and zone.js
The version in our package.json gets copied to the one we publish, and users need the latest of these.
```
### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
### Type
Must be one of the following:
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* **chroe**: Updating tasks etc; no production code change
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* **docs**: Documentation only changes
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
### Subject
The subject contains succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize first letter
* no dot (.) at the end
### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.
### Footer
The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
A detailed explanation can be found in this [document][commit-message-format].
<!-- ## <a name="cla"></a> Signing the CLA
Please sign our Contributor License Agreement (CLA) before sending pull requests. For any code
changes to be accepted, the CLA must be signed. It's a quick process, we promise!
* For individuals we have a [simple click-through form][individual-cla].
* For corporations we'll need you to
[print, sign and one of scan+email, fax or mail the form][corporate-cla]. -->
<!-- [angular-group]: https://groups.google.com/forum/#!forum/angular -->
<!-- [coc]: https://github.com/angular/code-of-conduct/blob/master/CODE_OF_CONDUCT.md -->
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
[dev-doc]: https://github.com/nestjs/nest/blob/master/docs/DEVELOPER.md
[github]: https://github.com/nestjs/nest
[gitter]: https://gitter.im/nestjs/nest
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[jsfiddle]: http://jsfiddle.net
[plunker]: http://plnkr.co/edit
[runnable]: http://runnable.com
<!-- [stackoverflow]: http://stackoverflow.com/questions/tagged/angular -->

View File

@@ -0,0 +1,22 @@
(The MIT License)
Copyright (c) 2017-2022 Kamil Mysliwiec <https://kamilmysliwiec.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,53 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
## Description
[Passport](http://www.passportjs.org/) utilities module for [Nest](https://github.com/nestjs/nest).
## Installation
```bash
$ npm i --save @nestjs/passport passport
```
## Quick Start
[Overview & Tutorial](https://docs.nestjs.com/techniques/authentication)
## Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
## Stay in touch
* Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
* Website - [https://nestjs.com](https://nestjs.com/)
* Twitter - [@nestframework](https://twitter.com/nestframework)
## License
Nest is [MIT licensed](LICENSE).

View File

@@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1645003432691" clover="3.2.0">
<project timestamp="1645003432691" name="All files">
<metrics statements="164" coveredstatements="130" conditionals="165" coveredconditionals="93" methods="69" coveredmethods="44" elements="398" coveredelements="267" complexity="0" loc="164" ncloc="164" packages="4" files="11" classes="11"/>
<package name="lib">
<metrics statements="104" coveredstatements="81" conditionals="128" coveredconditionals="67" methods="47" coveredmethods="29"/>
<file name="abstract.strategy.ts" path="/Users/Mysliwiec/Projects/passport/lib/abstract.strategy.ts">
<metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="6" count="1" type="stmt"/>
</file>
<file name="auth.guard.ts" path="/Users/Mysliwiec/Projects/passport/lib/auth.guard.ts">
<metrics statements="56" coveredstatements="50" conditionals="67" coveredconditionals="45" methods="29" coveredmethods="24"/>
<line num="2" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="3" count="4" type="cond" truecount="3" falsecount="1"/>
<line num="4" count="4" type="cond" truecount="3" falsecount="1"/>
<line num="5" count="0" type="cond" truecount="0" falsecount="8"/>
<line num="6" count="4" type="cond" truecount="2" falsecount="1"/>
<line num="8" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="9" count="4" type="cond" truecount="3" falsecount="1"/>
<line num="11" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="12" count="2" type="stmt"/>
<line num="14" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="15" count="16" type="cond" truecount="2" falsecount="0"/>
<line num="16" count="8" type="cond" truecount="2" falsecount="0"/>
<line num="17" count="12" type="stmt"/>
<line num="18" count="4" type="stmt"/>
<line num="19" count="20" type="cond" truecount="2" falsecount="0"/>
<line num="20" count="8" type="cond" truecount="2" falsecount="0"/>
<line num="23" count="1" type="stmt"/>
<line num="24" count="1" type="stmt"/>
<line num="26" count="1" type="stmt"/>
<line num="27" count="1" type="stmt"/>
<line num="28" count="1" type="stmt"/>
<line num="29" count="1" type="stmt"/>
<line num="30" count="1" type="stmt"/>
<line num="31" count="1" type="stmt"/>
<line num="32" count="1" type="stmt"/>
<line num="34" count="2" type="stmt"/>
<line num="36" count="4" type="stmt"/>
<line num="37" count="4" type="cond" truecount="4" falsecount="0"/>
<line num="38" count="4" type="cond" truecount="2" falsecount="2"/>
<line num="39" count="0" type="stmt"/>
<line num="43" count="8" type="stmt"/>
<line num="44" count="8" type="stmt"/>
<line num="45" count="8" type="stmt"/>
<line num="49" count="8" type="stmt"/>
<line num="50" count="8" type="cond" truecount="1" falsecount="1"/>
<line num="51" count="4" type="cond" truecount="1" falsecount="1"/>
<line num="52" count="4" type="stmt"/>
<line num="56" count="8" type="stmt"/>
<line num="59" count="8" type="stmt"/>
<line num="62" count="0" type="stmt"/>
<line num="63" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="64" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="68" count="8" type="cond" truecount="4" falsecount="0"/>
<line num="69" count="4" type="cond" truecount="2" falsecount="0"/>
<line num="71" count="4" type="stmt"/>
<line num="74" count="8" type="stmt"/>
<line num="77" count="2" type="stmt"/>
<line num="82" count="2" type="stmt"/>
<line num="86" count="2" type="stmt"/>
<line num="87" count="2" type="stmt"/>
<line num="89" count="8" type="stmt"/>
<line num="90" count="8" type="stmt"/>
<line num="91" count="8" type="stmt"/>
<line num="92" count="8" type="stmt"/>
<line num="95" count="4" type="stmt"/>
<line num="97" count="0" type="cond" truecount="0" falsecount="2"/>
</file>
<file name="index.ts" path="/Users/Mysliwiec/Projects/passport/lib/index.ts">
<metrics statements="14" coveredstatements="12" conditionals="16" coveredconditionals="11" methods="4" coveredmethods="3"/>
<line num="2" count="1" type="cond" truecount="4" falsecount="1"/>
<line num="3" count="6" type="cond" truecount="1" falsecount="1"/>
<line num="4" count="6" type="stmt"/>
<line num="6" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="7" count="0" type="stmt"/>
<line num="9" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="10" count="6" type="cond" truecount="3" falsecount="1"/>
<line num="12" count="1" type="stmt"/>
<line num="13" count="1" type="stmt"/>
<line num="14" count="1" type="stmt"/>
<line num="15" count="1" type="stmt"/>
<line num="16" count="1" type="stmt"/>
<line num="17" count="1" type="stmt"/>
<line num="18" count="1" type="stmt"/>
</file>
<file name="options.ts" path="/Users/Mysliwiec/Projects/passport/lib/options.ts">
<metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="4" count="1" type="stmt"/>
</file>
<file name="passport.module.ts" path="/Users/Mysliwiec/Projects/passport/lib/passport.module.ts">
<metrics statements="28" coveredstatements="13" conditionals="45" coveredconditionals="11" methods="14" coveredmethods="2"/>
<line num="2" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="3" count="1" type="cond" truecount="1" falsecount="3"/>
<line num="4" count="1" type="cond" truecount="3" falsecount="1"/>
<line num="5" count="0" type="cond" truecount="0" falsecount="8"/>
<line num="6" count="1" type="cond" truecount="1" falsecount="2"/>
<line num="8" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="9" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="10" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="11" count="0" type="stmt"/>
<line num="12" count="0" type="stmt"/>
<line num="13" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="14" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="18" count="1" type="stmt"/>
<line num="19" count="1" type="stmt"/>
<line num="20" count="1" type="stmt"/>
<line num="21" count="1" type="stmt"/>
<line num="22" count="1" type="stmt"/>
<line num="24" count="1" type="stmt"/>
<line num="31" count="0" type="stmt"/>
<line num="39" count="0" type="cond" truecount="0" falsecount="4"/>
<line num="40" count="0" type="stmt"/>
<line num="42" count="0" type="stmt"/>
<line num="51" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="52" count="0" type="stmt"/>
<line num="58" count="0" type="stmt"/>
<line num="60" count="0" type="stmt"/>
<line num="65" count="1" type="stmt"/>
<line num="68" count="1" type="stmt"/>
</file>
</package>
<package name="lib.interfaces">
<metrics statements="14" coveredstatements="12" conditionals="16" coveredconditionals="11" methods="4" coveredmethods="2"/>
<file name="auth-module.options.ts" path="/Users/Mysliwiec/Projects/passport/lib/interfaces/auth-module.options.ts">
<metrics statements="3" coveredstatements="3" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="6" count="1" type="stmt"/>
</file>
<file name="index.ts" path="/Users/Mysliwiec/Projects/passport/lib/interfaces/index.ts">
<metrics statements="10" coveredstatements="8" conditionals="16" coveredconditionals="11" methods="4" coveredmethods="2"/>
<line num="2" count="1" type="cond" truecount="4" falsecount="1"/>
<line num="3" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="4" count="1" type="stmt"/>
<line num="6" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="7" count="0" type="stmt"/>
<line num="9" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="10" count="2" type="cond" truecount="3" falsecount="1"/>
<line num="12" count="1" type="stmt"/>
<line num="13" count="1" type="stmt"/>
<line num="14" count="1" type="stmt"/>
</file>
<file name="type.interface.ts" path="/Users/Mysliwiec/Projects/passport/lib/interfaces/type.interface.ts">
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
<line num="2" count="1" type="stmt"/>
</file>
</package>
<package name="lib.passport">
<metrics statements="34" coveredstatements="26" conditionals="15" coveredconditionals="12" methods="16" coveredmethods="11"/>
<file name="passport.serializer.ts" path="/Users/Mysliwiec/Projects/passport/lib/passport/passport.serializer.ts">
<metrics statements="8" coveredstatements="4" conditionals="0" coveredconditionals="0" methods="4" coveredmethods="0"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="4" count="1" type="stmt"/>
<line num="7" count="0" type="stmt"/>
<line num="8" count="0" type="stmt"/>
<line num="9" count="0" type="stmt"/>
<line num="12" count="0" type="stmt"/>
<line num="15" count="1" type="stmt"/>
</file>
<file name="passport.strategy.ts" path="/Users/Mysliwiec/Projects/passport/lib/passport/passport.strategy.ts">
<metrics statements="26" coveredstatements="22" conditionals="15" coveredconditionals="12" methods="12" coveredmethods="11"/>
<line num="2" count="1" type="cond" truecount="3" falsecount="0"/>
<line num="3" count="6" type="cond" truecount="1" falsecount="1"/>
<line num="4" count="6" type="cond" truecount="2" falsecount="0"/>
<line num="5" count="6" type="stmt"/>
<line num="6" count="0" type="stmt"/>
<line num="7" count="12" type="cond" truecount="2" falsecount="0"/>
<line num="8" count="6" type="cond" truecount="2" falsecount="0"/>
<line num="11" count="1" type="stmt"/>
<line num="12" count="1" type="stmt"/>
<line num="13" count="1" type="stmt"/>
<line num="17" count="6" type="stmt"/>
<line num="18" count="6" type="stmt"/>
<line num="19" count="6" type="stmt"/>
<line num="20" count="6" type="stmt"/>
<line num="21" count="6" type="cond" truecount="1" falsecount="1"/>
<line num="22" count="0" type="stmt"/>
<line num="25" count="6" type="stmt"/>
<line num="29" count="0" type="stmt"/>
<line num="43" count="4" type="stmt"/>
<line num="44" count="4" type="stmt"/>
<line num="45" count="4" type="cond" truecount="1" falsecount="1"/>
<line num="46" count="0" type="stmt"/>
<line num="49" count="4" type="stmt"/>
<line num="53" count="4" type="stmt"/>
<line num="56" count="2" type="stmt"/>
<line num="58" count="1" type="stmt"/>
</file>
</package>
<package name="lib.utils">
<metrics statements="12" coveredstatements="11" conditionals="6" coveredconditionals="3" methods="2" coveredmethods="2"/>
<file name="memoize.util.ts" path="/Users/Mysliwiec/Projects/passport/lib/utils/memoize.util.ts">
<metrics statements="12" coveredstatements="11" conditionals="6" coveredconditionals="3" methods="2" coveredmethods="2"/>
<line num="2" count="1" type="stmt"/>
<line num="3" count="1" type="stmt"/>
<line num="4" count="1" type="stmt"/>
<line num="6" count="1" type="stmt"/>
<line num="7" count="1" type="stmt"/>
<line num="8" count="2" type="cond" truecount="1" falsecount="1"/>
<line num="9" count="2" type="cond" truecount="1" falsecount="1"/>
<line num="10" count="0" type="stmt"/>
<line num="13" count="2" type="cond" truecount="1" falsecount="1"/>
<line num="14" count="2" type="stmt"/>
<line num="15" count="2" type="stmt"/>
<line num="19" count="1" type="stmt"/>
</file>
</package>
</project>
</coverage>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,224 @@
body, html {
margin:0; padding: 0;
height: 100%;
}
body {
font-family: Helvetica Neue, Helvetica, Arial;
font-size: 14px;
color:#333;
}
.small { font-size: 12px; }
*, *:after, *:before {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
h1 { font-size: 20px; margin: 0;}
h2 { font-size: 14px; }
pre {
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
margin: 0;
padding: 0;
-moz-tab-size: 2;
-o-tab-size: 2;
tab-size: 2;
}
a { color:#0074D9; text-decoration:none; }
a:hover { text-decoration:underline; }
.strong { font-weight: bold; }
.space-top1 { padding: 10px 0 0 0; }
.pad2y { padding: 20px 0; }
.pad1y { padding: 10px 0; }
.pad2x { padding: 0 20px; }
.pad2 { padding: 20px; }
.pad1 { padding: 10px; }
.space-left2 { padding-left:55px; }
.space-right2 { padding-right:20px; }
.center { text-align:center; }
.clearfix { display:block; }
.clearfix:after {
content:'';
display:block;
height:0;
clear:both;
visibility:hidden;
}
.fl { float: left; }
@media only screen and (max-width:640px) {
.col3 { width:100%; max-width:100%; }
.hide-mobile { display:none!important; }
}
.quiet {
color: #7f7f7f;
color: rgba(0,0,0,0.5);
}
.quiet a { opacity: 0.7; }
.fraction {
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 10px;
color: #555;
background: #E8E8E8;
padding: 4px 5px;
border-radius: 3px;
vertical-align: middle;
}
div.path a:link, div.path a:visited { color: #333; }
table.coverage {
border-collapse: collapse;
margin: 10px 0 0 0;
padding: 0;
}
table.coverage td {
margin: 0;
padding: 0;
vertical-align: top;
}
table.coverage td.line-count {
text-align: right;
padding: 0 5px 0 20px;
}
table.coverage td.line-coverage {
text-align: right;
padding-right: 10px;
min-width:20px;
}
table.coverage td span.cline-any {
display: inline-block;
padding: 0 5px;
width: 100%;
}
.missing-if-branch {
display: inline-block;
margin-right: 5px;
border-radius: 3px;
position: relative;
padding: 0 4px;
background: #333;
color: yellow;
}
.skip-if-branch {
display: none;
margin-right: 10px;
position: relative;
padding: 0 4px;
background: #ccc;
color: white;
}
.missing-if-branch .typ, .skip-if-branch .typ {
color: inherit !important;
}
.coverage-summary {
border-collapse: collapse;
width: 100%;
}
.coverage-summary tr { border-bottom: 1px solid #bbb; }
.keyline-all { border: 1px solid #ddd; }
.coverage-summary td, .coverage-summary th { padding: 10px; }
.coverage-summary tbody { border: 1px solid #bbb; }
.coverage-summary td { border-right: 1px solid #bbb; }
.coverage-summary td:last-child { border-right: none; }
.coverage-summary th {
text-align: left;
font-weight: normal;
white-space: nowrap;
}
.coverage-summary th.file { border-right: none !important; }
.coverage-summary th.pct { }
.coverage-summary th.pic,
.coverage-summary th.abs,
.coverage-summary td.pct,
.coverage-summary td.abs { text-align: right; }
.coverage-summary td.file { white-space: nowrap; }
.coverage-summary td.pic { min-width: 120px !important; }
.coverage-summary tfoot td { }
.coverage-summary .sorter {
height: 10px;
width: 7px;
display: inline-block;
margin-left: 0.5em;
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
}
.coverage-summary .sorted .sorter {
background-position: 0 -20px;
}
.coverage-summary .sorted-desc .sorter {
background-position: 0 -10px;
}
.status-line { height: 10px; }
/* yellow */
.cbranch-no { background: yellow !important; color: #111; }
/* dark red */
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
.low .chart { border:1px solid #C21F39 }
.highlighted,
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
background: #C21F39 !important;
}
/* medium red */
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
/* light red */
.low, .cline-no { background:#FCE1E5 }
/* light green */
.high, .cline-yes { background:rgb(230,245,208) }
/* medium green */
.cstat-yes { background:rgb(161,215,106) }
/* dark green */
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
.high .chart { border:1px solid rgb(77,146,33) }
/* dark yellow (gold) */
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
.medium .chart { border:1px solid #f9cd0b; }
/* light yellow */
.medium { background: #fff4c2; }
.cstat-skip { background: #ddd; color: #111; }
.fstat-skip { background: #ddd; color: #111 !important; }
.cbranch-skip { background: #ddd !important; color: #111; }
span.cline-neutral { background: #eaeaea; }
.coverage-summary td.empty {
opacity: .5;
padding-top: 4px;
padding-bottom: 4px;
line-height: 1;
color: #888;
}
.cover-fill, .cover-empty {
display:inline-block;
height: 12px;
}
.chart {
line-height: 0;
}
.cover-empty {
background: white;
}
.cover-full {
border-right: none !important;
}
pre.prettyprint {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
.com { color: #999 !important; }
.ignore-none { color: #999; font-weight: normal; }
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -48px;
}
.footer, .push {
height: 48px;
}

View File

@@ -0,0 +1,87 @@
/* eslint-disable */
var jumpToCode = (function init() {
// Classes of code we would like to highlight in the file view
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
// Elements to highlight in the file listing view
var fileListingElements = ['td.pct.low'];
// We don't want to select elements that are direct descendants of another match
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
// Selecter that finds elements on the page to which we can jump
var selector =
fileListingElements.join(', ') +
', ' +
notSelector +
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
// The NodeList of matching elements
var missingCoverageElements = document.querySelectorAll(selector);
var currentIndex;
function toggleClass(index) {
missingCoverageElements
.item(currentIndex)
.classList.remove('highlighted');
missingCoverageElements.item(index).classList.add('highlighted');
}
function makeCurrent(index) {
toggleClass(index);
currentIndex = index;
missingCoverageElements.item(index).scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
});
}
function goToPrevious() {
var nextIndex = 0;
if (typeof currentIndex !== 'number' || currentIndex === 0) {
nextIndex = missingCoverageElements.length - 1;
} else if (missingCoverageElements.length > 1) {
nextIndex = currentIndex - 1;
}
makeCurrent(nextIndex);
}
function goToNext() {
var nextIndex = 0;
if (
typeof currentIndex === 'number' &&
currentIndex < missingCoverageElements.length - 1
) {
nextIndex = currentIndex + 1;
}
makeCurrent(nextIndex);
}
return function jump(event) {
if (
document.getElementById('fileSearch') === document.activeElement &&
document.activeElement != null
) {
// if we're currently focused on the search input, we don't want to navigate
return;
}
switch (event.which) {
case 78: // n
case 74: // j
goToNext();
break;
case 66: // b
case 75: // k
case 80: // p
goToPrevious();
break;
}
};
})();
window.addEventListener('keydown', jumpToCode);

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

View File

@@ -0,0 +1,161 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>All files</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">72.98% </span>
<span class="quiet">Statements</span>
<span class='fraction'>154/211</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">56.36% </span>
<span class="quiet">Branches</span>
<span class='fraction'>93/165</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">63.76% </span>
<span class="quiet">Functions</span>
<span class='fraction'>44/69</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">79.26% </span>
<span class="quiet">Lines</span>
<span class='fraction'>130/164</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line medium'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file medium" data-value="lib"><a href="lib/index.html">lib</a></td>
<td data-value="71.73" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 71%"></div><div class="cover-empty" style="width: 29%"></div></div>
</td>
<td data-value="71.73" class="pct medium">71.73%</td>
<td data-value="138" class="abs medium">99/138</td>
<td data-value="52.34" class="pct medium">52.34%</td>
<td data-value="128" class="abs medium">67/128</td>
<td data-value="61.7" class="pct medium">61.7%</td>
<td data-value="47" class="abs medium">29/47</td>
<td data-value="77.88" class="pct medium">77.88%</td>
<td data-value="104" class="abs medium">81/104</td>
</tr>
<tr>
<td class="file medium" data-value="lib/interfaces"><a href="lib/interfaces/index.html">lib/interfaces</a></td>
<td data-value="78.94" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 78%"></div><div class="cover-empty" style="width: 22%"></div></div>
</td>
<td data-value="78.94" class="pct medium">78.94%</td>
<td data-value="19" class="abs medium">15/19</td>
<td data-value="68.75" class="pct medium">68.75%</td>
<td data-value="16" class="abs medium">11/16</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="4" class="abs medium">2/4</td>
<td data-value="85.71" class="pct high">85.71%</td>
<td data-value="14" class="abs high">12/14</td>
</tr>
<tr>
<td class="file medium" data-value="lib/passport"><a href="lib/passport/index.html">lib/passport</a></td>
<td data-value="69.04" class="pic medium">
<div class="chart"><div class="cover-fill" style="width: 69%"></div><div class="cover-empty" style="width: 31%"></div></div>
</td>
<td data-value="69.04" class="pct medium">69.04%</td>
<td data-value="42" class="abs medium">29/42</td>
<td data-value="80" class="pct high">80%</td>
<td data-value="15" class="abs high">12/15</td>
<td data-value="68.75" class="pct medium">68.75%</td>
<td data-value="16" class="abs medium">11/16</td>
<td data-value="76.47" class="pct medium">76.47%</td>
<td data-value="34" class="abs medium">26/34</td>
</tr>
<tr>
<td class="file high" data-value="lib/utils"><a href="lib/utils/index.html">lib/utils</a></td>
<td data-value="91.66" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 91%"></div><div class="cover-empty" style="width: 9%"></div></div>
</td>
<td data-value="91.66" class="pct high">91.66%</td>
<td data-value="12" class="abs high">11/12</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="6" class="abs medium">3/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="91.66" class="pct high">91.66%</td>
<td data-value="12" class="abs high">11/12</td>
</tr>
</tbody>
</table>
</div>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Wed Feb 16 2022 10:23:52 GMT+0100 (Central European Standard Time)
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

View File

@@ -0,0 +1,196 @@
/* eslint-disable */
var addSorting = (function() {
'use strict';
var cols,
currentSort = {
index: 0,
desc: false
};
// returns the summary table element
function getTable() {
return document.querySelector('.coverage-summary');
}
// returns the thead element of the summary table
function getTableHeader() {
return getTable().querySelector('thead tr');
}
// returns the tbody element of the summary table
function getTableBody() {
return getTable().querySelector('tbody');
}
// returns the th element for nth column
function getNthColumn(n) {
return getTableHeader().querySelectorAll('th')[n];
}
function onFilterInput() {
const searchValue = document.getElementById('fileSearch').value;
const rows = document.getElementsByTagName('tbody')[0].children;
for (let i = 0; i < rows.length; i++) {
const row = rows[i];
if (
row.textContent
.toLowerCase()
.includes(searchValue.toLowerCase())
) {
row.style.display = '';
} else {
row.style.display = 'none';
}
}
}
// loads the search box
function addSearchBox() {
var template = document.getElementById('filterTemplate');
var templateClone = template.content.cloneNode(true);
templateClone.getElementById('fileSearch').oninput = onFilterInput;
template.parentElement.appendChild(templateClone);
}
// loads all columns
function loadColumns() {
var colNodes = getTableHeader().querySelectorAll('th'),
colNode,
cols = [],
col,
i;
for (i = 0; i < colNodes.length; i += 1) {
colNode = colNodes[i];
col = {
key: colNode.getAttribute('data-col'),
sortable: !colNode.getAttribute('data-nosort'),
type: colNode.getAttribute('data-type') || 'string'
};
cols.push(col);
if (col.sortable) {
col.defaultDescSort = col.type === 'number';
colNode.innerHTML =
colNode.innerHTML + '<span class="sorter"></span>';
}
}
return cols;
}
// attaches a data attribute to every tr element with an object
// of data values keyed by column name
function loadRowData(tableRow) {
var tableCols = tableRow.querySelectorAll('td'),
colNode,
col,
data = {},
i,
val;
for (i = 0; i < tableCols.length; i += 1) {
colNode = tableCols[i];
col = cols[i];
val = colNode.getAttribute('data-value');
if (col.type === 'number') {
val = Number(val);
}
data[col.key] = val;
}
return data;
}
// loads all row data
function loadData() {
var rows = getTableBody().querySelectorAll('tr'),
i;
for (i = 0; i < rows.length; i += 1) {
rows[i].data = loadRowData(rows[i]);
}
}
// sorts the table using the data for the ith column
function sortByIndex(index, desc) {
var key = cols[index].key,
sorter = function(a, b) {
a = a.data[key];
b = b.data[key];
return a < b ? -1 : a > b ? 1 : 0;
},
finalSorter = sorter,
tableBody = document.querySelector('.coverage-summary tbody'),
rowNodes = tableBody.querySelectorAll('tr'),
rows = [],
i;
if (desc) {
finalSorter = function(a, b) {
return -1 * sorter(a, b);
};
}
for (i = 0; i < rowNodes.length; i += 1) {
rows.push(rowNodes[i]);
tableBody.removeChild(rowNodes[i]);
}
rows.sort(finalSorter);
for (i = 0; i < rows.length; i += 1) {
tableBody.appendChild(rows[i]);
}
}
// removes sort indicators for current column being sorted
function removeSortIndicators() {
var col = getNthColumn(currentSort.index),
cls = col.className;
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
col.className = cls;
}
// adds sort indicators for current column being sorted
function addSortIndicators() {
getNthColumn(currentSort.index).className += currentSort.desc
? ' sorted-desc'
: ' sorted';
}
// adds event listeners for all sorter widgets
function enableUI() {
var i,
el,
ithSorter = function ithSorter(i) {
var col = cols[i];
return function() {
var desc = col.defaultDescSort;
if (currentSort.index === i) {
desc = !currentSort.desc;
}
sortByIndex(i, desc);
removeSortIndicators();
currentSort.index = i;
currentSort.desc = desc;
addSortIndicators();
};
};
for (i = 0; i < cols.length; i += 1) {
if (cols[i].sortable) {
// add the click event handler on the th so users
// dont have to click on those tiny arrows
el = getNthColumn(i).querySelector('.sorter').parentElement;
if (el.addEventListener) {
el.addEventListener('click', ithSorter(i));
} else {
el.attachEvent('onclick', ithSorter(i));
}
}
}
}
// adds sorting functionality to the UI
return function() {
if (!getTable()) {
return;
}
cols = loadColumns();
loadData();
addSearchBox();
addSortIndicators();
enableUI();
};
})();
window.addEventListener('load', addSorting);

View File

@@ -0,0 +1,169 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test/app.controller.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">test</a> app.controller.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">83.87% </span>
<span class="quiet">Statements</span>
<span class='fraction'>26/31</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">65.62% </span>
<span class="quiet">Branches</span>
<span class='fraction'>21/32</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">87.5% </span>
<span class="quiet">Functions</span>
<span class='fraction'>7/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">91.66% </span>
<span class="quiet">Lines</span>
<span class='fraction'>22/24</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
import { AuthGuard } from '../lib';
<span class="branch-1 cbranch-no" title="branch not covered" ></span>
import { AppService } from './app.service';
<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="missing-if-branch" title="else path not taken" >E</span></span></span></span></span>
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@G<span class="missing-if-branch" title="else path not taken" >E</span>et()
getHello() {
return this.appService.getHello();
}
&nbsp;
@UseGuards(AuthGuard('jwt'))
@Get('private')
getPrivateHello() {
return this.appService.getPrivateMessage();
}
&nbsp;
@UseGuards(AuthGuard('local'))
@Post('login')
login(@Req() req: any, @Body() body: Record&lt;string, string&gt;) {
<span class="fstat-no" title="function not covered" > re</span>turn this.appService.getToken({
us<span class="cstat-no" title="statement not covered" >ername: body.username,</span>
id: req.user.id
});
}
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,142 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test/app.module.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">test</a> app.module.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">81.81% </span>
<span class="quiet">Statements</span>
<span class='fraction'>18/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">36.36% </span>
<span class="quiet">Branches</span>
<span class='fraction'>8/22</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>1/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">94.11% </span>
<span class="quiet">Lines</span>
<span class='fraction'>16/17</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { PassportModule } from '../lib';<span class="branch-1 cbranch-no" title="branch not covered" ></span>
import { AppController } from './app.controller';
import { <span class="cstat-no" title="statement not covered" ><span class="missing-if-branch" title="else path not taken" >E</span>AppService } <span class="cstat-no" title="statement not covered" >from './app.service';<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ></span></span></span></span>
import { JwtStrategy<span class="branch-1 cbranch-no" title="branch not covered" > }</span> fr<span class="branch-2 cbranch-no" title="branch not covered" >om './jwt.strategy';</span>
import { LocalStrategy } from './local.strategy';
&nbsp;
@Module({
controllers: [AppController],
imports: [
JwtModule.register({
secret: 's3cr3t'
}),
PassportModule.register({})
],
providers: [AppService, LocalStrategy, JwtStrategy]
})
export class AppModule {}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,226 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test/app.service.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">test</a> app.service.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">83.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>25/30</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">54.54% </span>
<span class="quiet">Branches</span>
<span class='fraction'>18/33</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">87.5% </span>
<span class="quiet">Functions</span>
<span class='fraction'>7/8</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">91.3% </span>
<span class="quiet">Lines</span>
<span class='fraction'>21/23</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a>
<a name='L19'></a><a href='#L19'>19</a>
<a name='L20'></a><a href='#L20'>20</a>
<a name='L21'></a><a href='#L21'>21</a>
<a name='L22'></a><a href='#L22'>22</a>
<a name='L23'></a><a href='#L23'>23</a>
<a name='L24'></a><a href='#L24'>24</a>
<a name='L25'></a><a href='#L25'>25</a>
<a name='L26'></a><a href='#L26'>26</a>
<a name='L27'></a><a href='#L27'>27</a>
<a name='L28'></a><a href='#L28'>28</a>
<a name='L29'></a><a href='#L29'>29</a>
<a name='L30'></a><a href='#L30'>30</a>
<a name='L31'></a><a href='#L31'>31</a>
<a name='L32'></a><a href='#L32'>32</a>
<a name='L33'></a><a href='#L33'>33</a>
<a name='L34'></a><a href='#L34'>34</a>
<a name='L35'></a><a href='#L35'>35</a>
<a name='L36'></a><a href='#L36'>36</a>
<a name='L37'></a><a href='#L37'>37</a>
<a name='L38'></a><a href='#L38'>38</a>
<a name='L39'></a><a href='#L39'>39</a>
<a name='L40'></a><a href='#L40'>40</a>
<a name='L41'></a><a href='#L41'>41</a>
<a name='L42'></a><a href='#L42'>42</a>
<a name='L43'></a><a href='#L43'>43</a>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import {
ForbiddenException,
Injectable,<span class="branch-1 cbranch-no" title="branch not covered" ></span>
UnauthorizedException
} from '@<span class="cstat-no" title="statement not covered" ><span class="missing-if-branch" title="else path not taken" >E</span>nestjs/common<span class="cstat-no" title="statement not covered" >';<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ></span></span></span></span>
import { JwtService <span class="branch-1 cbranch-no" title="branch not covered" >} </span>fro<span class="branch-2 cbranch-no" title="branch not covered" >m '@nestjs/jwt';</span>
&nbsp;
@Injectable()
expo<span class="missing-if-branch" title="else path not taken" >E</span>rt class AppService {
private users = [
{
id: '1',
username: 'test1',
password: 'test'
},
{
id: '2',
username: 'nottest1',
password: 'secret'
}
];
constructor(private readonly jwtService: JwtService) {}
getHello() {
return { message: 'Hello open world!' };
}
&nbsp;
getPrivateMessage() {
return { message: 'Hello secure world!' };
}
&nbsp;
ge<span class="fstat-no" title="function not covered" >tT</span>oken({ username, id }: { username: string; id: string }): {
toke<span class="cstat-no" title="statement not covered" >n: string;</span>
} {
return { token: this.jwtService.sign({ username, id }) };
}
&nbsp;
findUser({ username, password }: { username: string; password: string }): {
id: string;
username: string;
} {
const user = this.users.find((u) =&gt; u.username === username);
if (!user || user.password !== password) {
return null;
}
return user;
}
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,176 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> test</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">83.2% </span>
<span class="quiet">Statements</span>
<span class='fraction'>109/131</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">51.72% </span>
<span class="quiet">Branches</span>
<span class='fraction'>75/145</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">92% </span>
<span class="quiet">Functions</span>
<span class='fraction'>23/25</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">93% </span>
<span class="quiet">Lines</span>
<span class='fraction'>93/100</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="app.controller.ts"><a href="app.controller.ts.html">app.controller.ts</a></td>
<td data-value="83.87" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 83%"></div><div class="cover-empty" style="width: 17%"></div></div>
</td>
<td data-value="83.87" class="pct high">83.87%</td>
<td data-value="31" class="abs high">26/31</td>
<td data-value="65.62" class="pct medium">65.62%</td>
<td data-value="32" class="abs medium">21/32</td>
<td data-value="87.5" class="pct high">87.5%</td>
<td data-value="8" class="abs high">7/8</td>
<td data-value="91.66" class="pct high">91.66%</td>
<td data-value="24" class="abs high">22/24</td>
</tr>
<tr>
<td class="file high" data-value="app.module.ts"><a href="app.module.ts.html">app.module.ts</a></td>
<td data-value="81.81" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 81%"></div><div class="cover-empty" style="width: 19%"></div></div>
</td>
<td data-value="81.81" class="pct high">81.81%</td>
<td data-value="22" class="abs high">18/22</td>
<td data-value="36.36" class="pct low">36.36%</td>
<td data-value="22" class="abs low">8/22</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="1" class="abs high">1/1</td>
<td data-value="94.11" class="pct high">94.11%</td>
<td data-value="17" class="abs high">16/17</td>
</tr>
<tr>
<td class="file high" data-value="app.service.ts"><a href="app.service.ts.html">app.service.ts</a></td>
<td data-value="83.33" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 83%"></div><div class="cover-empty" style="width: 17%"></div></div>
</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="30" class="abs high">25/30</td>
<td data-value="54.54" class="pct medium">54.54%</td>
<td data-value="33" class="abs medium">18/33</td>
<td data-value="87.5" class="pct high">87.5%</td>
<td data-value="8" class="abs high">7/8</td>
<td data-value="91.3" class="pct high">91.3%</td>
<td data-value="23" class="abs high">21/23</td>
</tr>
<tr>
<td class="file high" data-value="jwt.strategy.ts"><a href="jwt.strategy.ts.html">jwt.strategy.ts</a></td>
<td data-value="82.6" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 82%"></div><div class="cover-empty" style="width: 18%"></div></div>
</td>
<td data-value="82.6" class="pct high">82.6%</td>
<td data-value="23" class="abs high">19/23</td>
<td data-value="48.27" class="pct low">48.27%</td>
<td data-value="29" class="abs low">14/29</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="94.11" class="pct high">94.11%</td>
<td data-value="17" class="abs high">16/17</td>
</tr>
<tr>
<td class="file high" data-value="local.strategy.ts"><a href="local.strategy.ts.html">local.strategy.ts</a></td>
<td data-value="84" class="pic high">
<div class="chart"><div class="cover-fill" style="width: 84%"></div><div class="cover-empty" style="width: 16%"></div></div>
</td>
<td data-value="84" class="pct high">84%</td>
<td data-value="25" class="abs high">21/25</td>
<td data-value="48.27" class="pct low">48.27%</td>
<td data-value="29" class="abs low">14/29</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="4" class="abs high">4/4</td>
<td data-value="94.73" class="pct high">94.73%</td>
<td data-value="19" class="abs high">18/19</td>
</tr>
</tbody>
</table>
</div>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,136 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test/jwt.strategy.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">test</a> jwt.strategy.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">82.6% </span>
<span class="quiet">Statements</span>
<span class='fraction'>19/23</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">48.27% </span>
<span class="quiet">Branches</span>
<span class='fraction'>14/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">94.11% </span>
<span class="quiet">Lines</span>
<span class='fraction'>16/17</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a>
<a name='L17'></a><a href='#L17'>17</a>
<a name='L18'></a><a href='#L18'>18</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import { Injectable } from '@nestjs/common';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '../lib';<span class="branch-1 cbranch-no" title="branch not covered" ></span>
&nbsp;
@Injectab<span class="cstat-no" title="statement not covered" ><span class="missing-if-branch" title="else path not taken" >E</span>le()<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ></span></span></span></span>
export class JwtStra<span class="branch-1 cbranch-no" title="branch not covered" >te</span>gy <span class="branch-2 cbranch-no" title="branch not covered" >extends PassportStrategy(Strategy) {</span>
constructor() {
super({
<span class="missing-if-branch" title="else path not taken" >E</span> jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
secretOrKey: 's3cr3t'
});
}
&nbsp;
validate(payload) {
return { id: payload.id, email: payload.email };
}
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,127 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for test/local.strategy.ts</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1><a href="../index.html">All files</a> / <a href="index.html">test</a> local.strategy.ts</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">84% </span>
<span class="quiet">Statements</span>
<span class='fraction'>21/25</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">48.27% </span>
<span class="quiet">Branches</span>
<span class='fraction'>14/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>4/4</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">94.73% </span>
<span class="quiet">Lines</span>
<span class='fraction'>18/19</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span></td><td class="text"><pre class="prettyprint lang-js">import { Injectable } from '@nestjs/common';
import { Strategy } from 'passport-local';
import { PassportStrategy } from '../lib';<span class="branch-1 cbranch-no" title="branch not covered" ></span>
import { AppService } from './app.service';
<span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="cstat-no" title="statement not covered" ><span class="missing-if-branch" title="else path not taken" >E</span></span></span></span></span>
@Injectable()<span class="branch-2 cbranch-no" title="branch not covered" ><span class="branch-1 cbranch-no" title="branch not covered" ></span></span>
export class LocalStrategy extends PassportStrategy(Strategy) {
constructor(private readonly appService: AppService) {
<span class="missing-if-branch" title="else path not taken" >E</span>super();
}
validate(username: string, password: string) {
return this.appService.findUser({ username, password });
}
}
&nbsp;</pre></td></tr></table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at Mon Feb 14 2022 13:46:31 GMT+0100 (Central European Standard Time)
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="../sorter.js"></script>
<script src="../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,566 @@
TN:
SF:lib/abstract.strategy.ts
FNF:0
FNH:0
DA:2,1
DA:3,1
DA:6,1
LF:3
LH:3
BRF:0
BRH:0
end_of_record
TN:
SF:lib/auth.guard.ts
FN:2,(anonymous_0)
FN:8,(anonymous_1)
FN:11,(anonymous_2)
FN:12,(anonymous_3)
FN:14,(anonymous_4)
FN:15,adopt
FN:15,(anonymous_6)
FN:16,(anonymous_7)
FN:17,fulfilled
FN:18,rejected
FN:19,step
FN:33,createAuthGuard
FN:35,(anonymous_12)
FN:42,(anonymous_13)
FN:43,(anonymous_14)
FN:50,(anonymous_15)
FN:55,(anonymous_16)
FN:58,(anonymous_17)
FN:61,(anonymous_18)
FN:62,(anonymous_19)
FN:64,(anonymous_20)
FN:64,(anonymous_21)
FN:67,(anonymous_22)
FN:73,(anonymous_23)
FN:89,(anonymous_24)
FN:89,(anonymous_25)
FN:89,(anonymous_26)
FN:89,(anonymous_27)
FN:97,(anonymous_28)
FNF:29
FNH:24
FNDA:4,(anonymous_0)
FNDA:4,(anonymous_1)
FNDA:2,(anonymous_2)
FNDA:2,(anonymous_3)
FNDA:8,(anonymous_4)
FNDA:16,adopt
FNDA:8,(anonymous_6)
FNDA:8,(anonymous_7)
FNDA:12,fulfilled
FNDA:4,rejected
FNDA:20,step
FNDA:2,createAuthGuard
FNDA:4,(anonymous_12)
FNDA:8,(anonymous_13)
FNDA:8,(anonymous_14)
FNDA:8,(anonymous_15)
FNDA:8,(anonymous_16)
FNDA:8,(anonymous_17)
FNDA:0,(anonymous_18)
FNDA:0,(anonymous_19)
FNDA:0,(anonymous_20)
FNDA:0,(anonymous_21)
FNDA:8,(anonymous_22)
FNDA:8,(anonymous_23)
FNDA:8,(anonymous_24)
FNDA:8,(anonymous_25)
FNDA:8,(anonymous_26)
FNDA:8,(anonymous_27)
FNDA:0,(anonymous_28)
DA:2,1
DA:3,4
DA:4,4
DA:5,0
DA:6,4
DA:8,1
DA:9,4
DA:11,1
DA:12,2
DA:14,1
DA:15,16
DA:16,8
DA:17,12
DA:18,4
DA:19,20
DA:20,8
DA:23,1
DA:24,1
DA:26,1
DA:27,1
DA:28,1
DA:29,1
DA:30,1
DA:31,1
DA:32,1
DA:34,2
DA:36,4
DA:37,4
DA:38,4
DA:39,0
DA:43,8
DA:44,8
DA:45,8
DA:49,8
DA:50,8
DA:51,4
DA:52,4
DA:56,8
DA:59,8
DA:62,0
DA:63,0
DA:64,0
DA:68,8
DA:69,4
DA:71,4
DA:74,8
DA:77,2
DA:82,2
DA:86,2
DA:87,2
DA:89,8
DA:90,8
DA:91,8
DA:92,8
DA:95,4
DA:97,0
LF:56
LH:50
BRDA:2,0,0,1
BRDA:2,0,1,1
BRDA:2,0,2,1
BRDA:3,1,0,2
BRDA:3,1,1,2
BRDA:3,2,0,0
BRDA:3,2,1,2
BRDA:4,3,0,4
BRDA:4,3,1,0
BRDA:4,4,0,4
BRDA:4,4,1,4
BRDA:5,5,0,0
BRDA:5,5,1,0
BRDA:5,6,0,0
BRDA:5,6,1,0
BRDA:5,7,0,0
BRDA:5,7,1,0
BRDA:5,8,0,0
BRDA:5,8,1,0
BRDA:6,9,0,4
BRDA:6,9,1,2
BRDA:6,9,2,0
BRDA:8,10,0,1
BRDA:8,10,1,1
BRDA:8,10,2,1
BRDA:9,11,0,4
BRDA:9,11,1,0
BRDA:9,12,0,4
BRDA:9,12,1,4
BRDA:11,13,0,1
BRDA:11,13,1,1
BRDA:11,13,2,1
BRDA:14,14,0,1
BRDA:14,14,1,1
BRDA:14,14,2,1
BRDA:15,15,0,8
BRDA:15,15,1,8
BRDA:16,16,0,8
BRDA:16,16,1,8
BRDA:19,17,0,4
BRDA:19,17,1,16
BRDA:20,18,0,8
BRDA:20,18,1,8
BRDA:37,19,0,2
BRDA:37,19,1,2
BRDA:37,20,0,4
BRDA:37,20,1,4
BRDA:38,21,0,0
BRDA:38,21,1,4
BRDA:38,22,0,4
BRDA:38,22,1,0
BRDA:50,23,0,8
BRDA:50,23,1,0
BRDA:51,24,0,4
BRDA:51,24,1,0
BRDA:63,25,0,0
BRDA:63,25,1,0
BRDA:64,26,0,0
BRDA:64,26,1,0
BRDA:68,27,0,4
BRDA:68,27,1,4
BRDA:68,28,0,8
BRDA:68,28,1,8
BRDA:69,29,0,4
BRDA:69,29,1,4
BRDA:97,30,0,0
BRDA:97,30,1,0
BRF:67
BRH:45
end_of_record
TN:
SF:lib/index.ts
FN:2,(anonymous_0)
FN:4,(anonymous_1)
FN:5,(anonymous_2)
FN:9,(anonymous_3)
FNF:4
FNH:3
FNDA:6,(anonymous_0)
FNDA:6,(anonymous_1)
FNDA:0,(anonymous_2)
FNDA:6,(anonymous_3)
DA:2,1
DA:3,6
DA:4,6
DA:6,0
DA:7,0
DA:9,1
DA:10,6
DA:12,1
DA:13,1
DA:14,1
DA:15,1
DA:16,1
DA:17,1
DA:18,1
LF:14
LH:12
BRDA:2,0,0,1
BRDA:2,0,1,1
BRDA:2,0,2,1
BRDA:2,1,0,1
BRDA:2,1,1,0
BRDA:3,2,0,6
BRDA:3,2,1,0
BRDA:6,3,0,0
BRDA:6,3,1,0
BRDA:9,4,0,1
BRDA:9,4,1,1
BRDA:9,4,2,1
BRDA:10,5,0,6
BRDA:10,5,1,0
BRDA:10,6,0,6
BRDA:10,6,1,6
BRF:16
BRH:11
end_of_record
TN:
SF:lib/options.ts
FNF:0
FNH:0
DA:2,1
DA:3,1
DA:4,1
LF:3
LH:3
BRF:0
BRH:0
end_of_record
TN:
SF:lib/passport.module.ts
FN:2,(anonymous_0)
FN:8,(anonymous_1)
FN:9,adopt
FN:9,(anonymous_3)
FN:10,(anonymous_4)
FN:11,fulfilled
FN:12,rejected
FN:13,step
FN:23,(anonymous_8)
FN:30,(anonymous_9)
FN:38,(anonymous_10)
FN:50,(anonymous_11)
FN:60,(anonymous_12)
FN:60,(anonymous_13)
FNF:14
FNH:2
FNDA:1,(anonymous_0)
FNDA:0,(anonymous_1)
FNDA:0,adopt
FNDA:0,(anonymous_3)
FNDA:0,(anonymous_4)
FNDA:0,fulfilled
FNDA:0,rejected
FNDA:0,step
FNDA:1,(anonymous_8)
FNDA:0,(anonymous_9)
FNDA:0,(anonymous_10)
FNDA:0,(anonymous_11)
FNDA:0,(anonymous_12)
FNDA:0,(anonymous_13)
DA:2,1
DA:3,1
DA:4,1
DA:5,0
DA:6,1
DA:8,1
DA:9,0
DA:10,0
DA:11,0
DA:12,0
DA:13,0
DA:14,0
DA:18,1
DA:19,1
DA:20,1
DA:21,1
DA:22,1
DA:24,1
DA:31,0
DA:39,0
DA:40,0
DA:42,0
DA:51,0
DA:52,0
DA:58,0
DA:60,0
DA:65,1
DA:68,1
LF:28
LH:13
BRDA:2,0,0,1
BRDA:2,0,1,1
BRDA:2,0,2,1
BRDA:3,1,0,1
BRDA:3,1,1,0
BRDA:3,2,0,0
BRDA:3,2,1,0
BRDA:4,3,0,1
BRDA:4,3,1,0
BRDA:4,4,0,1
BRDA:4,4,1,1
BRDA:5,5,0,0
BRDA:5,5,1,0
BRDA:5,6,0,0
BRDA:5,6,1,0
BRDA:5,7,0,0
BRDA:5,7,1,0
BRDA:5,8,0,0
BRDA:5,8,1,0
BRDA:6,9,0,1
BRDA:6,9,1,0
BRDA:6,9,2,0
BRDA:8,10,0,1
BRDA:8,10,1,1
BRDA:8,10,2,1
BRDA:9,11,0,0
BRDA:9,11,1,0
BRDA:10,12,0,0
BRDA:10,12,1,0
BRDA:13,13,0,0
BRDA:13,13,1,0
BRDA:14,14,0,0
BRDA:14,14,1,0
BRDA:33,15,0,0
BRDA:33,15,1,0
BRDA:39,16,0,0
BRDA:39,16,1,0
BRDA:39,17,0,0
BRDA:39,17,1,0
BRDA:51,18,0,0
BRDA:51,18,1,0
BRDA:55,19,0,0
BRDA:55,19,1,0
BRDA:61,20,0,0
BRDA:61,20,1,0
BRF:45
BRH:11
end_of_record
TN:
SF:lib/interfaces/auth-module.options.ts
FNF:0
FNH:0
DA:2,1
DA:3,1
DA:6,1
LF:3
LH:3
BRF:0
BRH:0
end_of_record
TN:
SF:lib/interfaces/index.ts
FN:2,(anonymous_0)
FN:4,(anonymous_1)
FN:5,(anonymous_2)
FN:9,(anonymous_3)
FNF:4
FNH:2
FNDA:1,(anonymous_0)
FNDA:0,(anonymous_1)
FNDA:0,(anonymous_2)
FNDA:2,(anonymous_3)
DA:2,1
DA:3,1
DA:4,1
DA:6,0
DA:7,0
DA:9,1
DA:10,2
DA:12,1
DA:13,1
DA:14,1
LF:10
LH:8
BRDA:2,0,0,1
BRDA:2,0,1,1
BRDA:2,0,2,1
BRDA:2,1,0,1
BRDA:2,1,1,0
BRDA:3,2,0,1
BRDA:3,2,1,0
BRDA:6,3,0,0
BRDA:6,3,1,0
BRDA:9,4,0,1
BRDA:9,4,1,1
BRDA:9,4,2,1
BRDA:10,5,0,1
BRDA:10,5,1,0
BRDA:10,6,0,1
BRDA:10,6,1,1
BRF:16
BRH:11
end_of_record
TN:
SF:lib/interfaces/type.interface.ts
FNF:0
FNH:0
DA:2,1
LF:1
LH:1
BRF:0
BRH:0
end_of_record
TN:
SF:lib/passport/passport.serializer.ts
FN:6,(anonymous_0)
FN:8,(anonymous_1)
FN:9,(anonymous_2)
FN:11,(anonymous_3)
FNF:4
FNH:0
FNDA:0,(anonymous_0)
FNDA:0,(anonymous_1)
FNDA:0,(anonymous_2)
FNDA:0,(anonymous_3)
DA:2,1
DA:3,1
DA:4,1
DA:7,0
DA:8,0
DA:9,0
DA:12,0
DA:15,1
LF:8
LH:4
BRF:0
BRH:0
end_of_record
TN:
SF:lib/passport/passport.strategy.ts
FN:2,(anonymous_0)
FN:3,adopt
FN:3,(anonymous_2)
FN:4,(anonymous_3)
FN:5,fulfilled
FN:6,rejected
FN:7,step
FN:14,PassportStrategy
FN:16,(anonymous_8)
FN:17,(anonymous_9)
FN:17,(anonymous_10)
FN:52,(anonymous_11)
FNF:12
FNH:11
FNDA:6,(anonymous_0)
FNDA:6,adopt
FNDA:6,(anonymous_2)
FNDA:6,(anonymous_3)
FNDA:6,fulfilled
FNDA:0,rejected
FNDA:12,step
FNDA:2,PassportStrategy
FNDA:4,(anonymous_8)
FNDA:6,(anonymous_9)
FNDA:6,(anonymous_10)
FNDA:4,(anonymous_11)
DA:2,1
DA:3,6
DA:4,6
DA:5,6
DA:6,0
DA:7,12
DA:8,6
DA:11,1
DA:12,1
DA:13,1
DA:17,6
DA:18,6
DA:19,6
DA:20,6
DA:21,6
DA:22,0
DA:25,6
DA:29,0
DA:43,4
DA:44,4
DA:45,4
DA:46,0
DA:49,4
DA:53,4
DA:56,2
DA:58,1
LF:26
LH:22
BRDA:2,0,0,1
BRDA:2,0,1,1
BRDA:2,0,2,1
BRDA:3,1,0,0
BRDA:3,1,1,6
BRDA:4,2,0,6
BRDA:4,2,1,6
BRDA:7,3,0,6
BRDA:7,3,1,6
BRDA:8,4,0,6
BRDA:8,4,1,6
BRDA:21,5,0,0
BRDA:21,5,1,6
BRDA:45,6,0,0
BRDA:45,6,1,4
BRF:15
BRH:12
end_of_record
TN:
SF:lib/utils/memoize.util.ts
FN:5,memoize
FN:7,(anonymous_1)
FNF:2
FNH:2
FNDA:1,memoize
FNDA:2,(anonymous_1)
DA:2,1
DA:3,1
DA:4,1
DA:6,1
DA:7,1
DA:8,2
DA:9,2
DA:10,0
DA:13,2
DA:14,2
DA:15,2
DA:19,1
LF:12
LH:11
BRDA:8,0,0,2
BRDA:8,0,1,0
BRDA:9,1,0,0
BRDA:9,1,1,2
BRDA:13,2,0,0
BRDA:13,2,1,2
BRF:6
BRH:3
end_of_record

View File

@@ -0,0 +1,3 @@
export declare abstract class AbstractStrategy {
abstract validate(...args: any[]): any;
}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractStrategy = void 0;
class AbstractStrategy {
}
exports.AbstractStrategy = AbstractStrategy;

View File

@@ -0,0 +1,11 @@
import { CanActivate, ExecutionContext } from '@nestjs/common';
import { Type } from './interfaces';
import { IAuthModuleOptions } from './interfaces/auth-module.options';
export declare type IAuthGuard = CanActivate & {
logIn<TRequest extends {
logIn: Function;
} = any>(request: TRequest): Promise<void>;
handleRequest<TUser = any>(err: any, user: any, info: any, context: ExecutionContext, status?: any): TUser;
getAuthenticateOptions(context: ExecutionContext): IAuthModuleOptions | undefined;
};
export declare const AuthGuard: (type?: string | string[]) => Type<IAuthGuard>;

View File

@@ -0,0 +1,96 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthGuard = void 0;
const common_1 = require("@nestjs/common");
const passport = require("passport");
const auth_module_options_1 = require("./interfaces/auth-module.options");
const options_1 = require("./options");
const memoize_util_1 = require("./utils/memoize.util");
exports.AuthGuard = (0, memoize_util_1.memoize)(createAuthGuard);
const NO_STRATEGY_ERROR = `In order to use "defaultStrategy", please, ensure to import PassportModule in each place where AuthGuard() is being used. Otherwise, passport won't work correctly.`;
function createAuthGuard(type) {
let MixinAuthGuard = class MixinAuthGuard {
constructor(options) {
this.options = {};
this.options = options !== null && options !== void 0 ? options : this.options;
if (!type && !this.options.defaultStrategy) {
new common_1.Logger('AuthGuard').error(NO_STRATEGY_ERROR);
}
}
canActivate(context) {
return __awaiter(this, void 0, void 0, function* () {
const options = Object.assign(Object.assign(Object.assign({}, options_1.defaultOptions), this.options), (yield this.getAuthenticateOptions(context)));
const [request, response] = [
this.getRequest(context),
this.getResponse(context)
];
const passportFn = createPassportContext(request, response);
const user = yield passportFn(type || this.options.defaultStrategy, options, (err, user, info, status) => this.handleRequest(err, user, info, context, status));
request[options.property || options_1.defaultOptions.property] = user;
return true;
});
}
getRequest(context) {
return context.switchToHttp().getRequest();
}
getResponse(context) {
return context.switchToHttp().getResponse();
}
logIn(request) {
return __awaiter(this, void 0, void 0, function* () {
const user = request[this.options.property || options_1.defaultOptions.property];
yield new Promise((resolve, reject) => request.logIn(user, (err) => (err ? reject(err) : resolve())));
});
}
handleRequest(err, user, info, context, status) {
if (err || !user) {
throw err || new common_1.UnauthorizedException();
}
return user;
}
getAuthenticateOptions(context) {
return undefined;
}
};
__decorate([
(0, common_1.Optional)(),
(0, common_1.Inject)(auth_module_options_1.AuthModuleOptions),
__metadata("design:type", auth_module_options_1.AuthModuleOptions)
], MixinAuthGuard.prototype, "options", void 0);
MixinAuthGuard = __decorate([
__param(0, (0, common_1.Optional)()),
__metadata("design:paramtypes", [auth_module_options_1.AuthModuleOptions])
], MixinAuthGuard);
const guard = (0, common_1.mixin)(MixinAuthGuard);
return guard;
}
const createPassportContext = (request, response) => (type, options, callback) => new Promise((resolve, reject) => passport.authenticate(type, options, (err, user, info, status) => {
try {
request.authInfo = info;
return resolve(callback(err, user, info, status));
}
catch (err) {
reject(err);
}
})(request, response, (err) => (err ? reject(err) : resolve())));

View File

@@ -0,0 +1,6 @@
export * from './abstract.strategy';
export * from './auth.guard';
export * from './interfaces';
export * from './passport.module';
export * from './passport/passport.serializer';
export * from './passport/passport.strategy';

View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./abstract.strategy"), exports);
__exportStar(require("./auth.guard"), exports);
__exportStar(require("./interfaces"), exports);
__exportStar(require("./passport.module"), exports);
__exportStar(require("./passport/passport.serializer"), exports);
__exportStar(require("./passport/passport.strategy"), exports);

View File

@@ -0,0 +1,21 @@
import { ModuleMetadata, Type } from '@nestjs/common';
export interface IAuthModuleOptions<T = any> {
defaultStrategy?: string | string[];
session?: boolean;
property?: string;
[key: string]: any;
}
export interface AuthOptionsFactory {
createAuthOptions(): Promise<IAuthModuleOptions> | IAuthModuleOptions;
}
export interface AuthModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
useExisting?: Type<AuthOptionsFactory>;
useClass?: Type<AuthOptionsFactory>;
useFactory?: (...args: any[]) => Promise<IAuthModuleOptions> | IAuthModuleOptions;
inject?: any[];
}
export declare class AuthModuleOptions implements IAuthModuleOptions {
defaultStrategy?: string | string[];
session?: boolean;
property?: string;
}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthModuleOptions = void 0;
class AuthModuleOptions {
}
exports.AuthModuleOptions = AuthModuleOptions;

View File

@@ -0,0 +1,2 @@
export * from './auth-module.options';
export * from './type.interface';

View File

@@ -0,0 +1,14 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./auth-module.options"), exports);
__exportStar(require("./type.interface"), exports);

View File

@@ -0,0 +1,3 @@
export interface Type<T = any> extends Function {
new (...args: any[]): T;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,4 @@
export declare const defaultOptions: {
session: boolean;
property: string;
};

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultOptions = void 0;
exports.defaultOptions = {
session: false,
property: 'user'
};

View File

@@ -0,0 +1,8 @@
import { DynamicModule } from '@nestjs/common';
import { AuthModuleAsyncOptions, IAuthModuleOptions } from './interfaces/auth-module.options';
export declare class PassportModule {
static register(options: IAuthModuleOptions): DynamicModule;
static registerAsync(options: AuthModuleAsyncOptions): DynamicModule;
private static createAsyncProviders;
private static createAsyncOptionsProvider;
}

View File

@@ -0,0 +1,68 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var PassportModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PassportModule = void 0;
const common_1 = require("@nestjs/common");
const auth_module_options_1 = require("./interfaces/auth-module.options");
let PassportModule = PassportModule_1 = class PassportModule {
static register(options) {
return {
module: PassportModule_1,
providers: [{ provide: auth_module_options_1.AuthModuleOptions, useValue: options }],
exports: [auth_module_options_1.AuthModuleOptions]
};
}
static registerAsync(options) {
return {
module: PassportModule_1,
imports: options.imports || [],
providers: this.createAsyncProviders(options),
exports: [auth_module_options_1.AuthModuleOptions]
};
}
static createAsyncProviders(options) {
if (options.useExisting || options.useFactory) {
return [this.createAsyncOptionsProvider(options)];
}
return [
this.createAsyncOptionsProvider(options),
{
provide: options.useClass,
useClass: options.useClass
}
];
}
static createAsyncOptionsProvider(options) {
if (options.useFactory) {
return {
provide: auth_module_options_1.AuthModuleOptions,
useFactory: options.useFactory,
inject: options.inject || []
};
}
return {
provide: auth_module_options_1.AuthModuleOptions,
useFactory: (optionsFactory) => __awaiter(this, void 0, void 0, function* () { return yield optionsFactory.createAuthOptions(); }),
inject: [options.useExisting || options.useClass]
};
}
};
PassportModule = PassportModule_1 = __decorate([
(0, common_1.Module)({})
], PassportModule);
exports.PassportModule = PassportModule;

View File

@@ -0,0 +1,7 @@
import * as passport from 'passport';
export declare abstract class PassportSerializer {
abstract serializeUser(user: any, done: Function): any;
abstract deserializeUser(payload: any, done: Function): any;
constructor();
getPassportInstance(): passport.PassportStatic;
}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PassportSerializer = void 0;
const passport = require("passport");
class PassportSerializer {
constructor() {
const passportInstance = this.getPassportInstance();
passportInstance.serializeUser((user, done) => this.serializeUser(user, done));
passportInstance.deserializeUser((payload, done) => this.deserializeUser(payload, done));
}
getPassportInstance() {
return passport;
}
}
exports.PassportSerializer = PassportSerializer;

View File

@@ -0,0 +1,4 @@
import { Type } from '../interfaces';
export declare function PassportStrategy<T extends Type<any> = any>(Strategy: T, name?: string | undefined): {
new (...args: any[]): InstanceType<T>;
};

View File

@@ -0,0 +1,47 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PassportStrategy = void 0;
const passport = require("passport");
function PassportStrategy(Strategy, name) {
class MixinStrategy extends Strategy {
constructor(...args) {
const callback = (...params) => __awaiter(this, void 0, void 0, function* () {
const done = params[params.length - 1];
try {
const validateResult = yield this.validate(...params);
if (Array.isArray(validateResult)) {
done(null, ...validateResult);
}
else {
done(null, validateResult);
}
}
catch (err) {
done(err, null);
}
});
super(...args, callback);
const passportInstance = this.getPassportInstance();
if (name) {
passportInstance.use(name, this);
}
else {
passportInstance.use(this);
}
}
getPassportInstance() {
return passport;
}
}
return MixinStrategy;
}
exports.PassportStrategy = PassportStrategy;

View File

@@ -0,0 +1 @@
export declare function memoize(fn: Function): (...args: any[]) => any;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.memoize = void 0;
const defaultKey = 'default';
function memoize(fn) {
const cache = {};
return (...args) => {
const n = args[0] || defaultKey;
if (n in cache) {
return cache[n];
}
else {
const result = fn(n === defaultKey ? undefined : n);
cache[n] = result;
return result;
}
};
}
exports.memoize = memoize;

View File

@@ -0,0 +1 @@
export * from './dist';

View File

@@ -0,0 +1,6 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
exports.__esModule = true;
__export(require("./dist"));

View File

@@ -0,0 +1,11 @@
module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: '.',
testMatch: ['<rootDir>/test/**/*.e2e-spec.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
testEnvironment: 'node',
collectCoverage: true,
collectCoverageFrom: ['lib/**/*.ts']
};

View File

@@ -0,0 +1,70 @@
{
"name": "@nestjs/passport",
"version": "9.0.0",
"description": "Nest - modern, fast, powerful node.js web framework (@passport)",
"author": "Kamil Mysliwiec",
"license": "MIT",
"scripts": {
"build": "rimraf dist && tsc -p tsconfig.build.json",
"format": "prettier --write \"lib/**/*.ts\"",
"lint": "eslint 'lib/**/*.ts' --fix",
"precommit": "lint-staged",
"prepublish:npm": "npm run build",
"publish:npm": "npm publish --access public",
"prerelease": "npm run build",
"release": "release-it",
"test": "jest"
},
"peerDependencies": {
"@nestjs/common": "^8.0.0 || ^9.0.0",
"passport": "^0.4.0 || ^0.5.0 || ^0.6.0"
},
"devDependencies": {
"@commitlint/cli": "17.0.3",
"@commitlint/config-angular": "17.0.3",
"@nestjs/common": "9.0.1",
"@types/node": "17.0.17",
"@nestjs/core": "9.0.1",
"@nestjs/jwt": "8.0.1",
"@nestjs/platform-express": "9.0.1",
"@nestjs/testing": "9.0.1",
"@types/jest": "28.1.4",
"@types/passport": "1.0.9",
"@types/passport-jwt": "3.0.6",
"@types/passport-local": "1.0.34",
"@typescript-eslint/eslint-plugin": "5.30.5",
"@typescript-eslint/parser": "5.30.5",
"eslint": "8.19.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"husky": "8.0.1",
"lint-staged": "13.0.3",
"jest": "28.1.2",
"pactum": "3.1.11",
"passport": "0.6.0",
"passport-jwt": "4.0.0",
"passport-local": "1.0.0",
"prettier": "2.7.1",
"reflect-metadata": "0.1.13",
"release-it": "15.1.1",
"rimraf": "3.0.2",
"rxjs": "7.5.5",
"ts-jest": "28.0.5",
"typescript": "4.7.4"
},
"lint-staged": {
"*.ts": [
"prettier --write"
]
},
"husky": {
"hooks": {
"commit-msg": "commitlint -c .commitlintrc.json -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
},
"repository": {
"type": "git",
"url": "https://github.com/nestjs/passport"
}
}

View File

@@ -0,0 +1,10 @@
{
"semanticCommits": true,
"packageRules": [{
"depTypeList": ["devDependencies"],
"automerge": true
}],
"extends": [
"config:base"
]
}

View File

@@ -0,0 +1,28 @@
import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
import { AuthGuard } from '../../lib';
import { AppService } from './app.service';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello() {
return this.appService.getHello();
}
@UseGuards(AuthGuard('jwt'))
@Get('private')
getPrivateHello() {
return this.appService.getPrivateMessage();
}
@UseGuards(AuthGuard('local'))
@Post('login')
login(@Req() req: any, @Body() body: Record<string, string>) {
return this.appService.getToken({
username: body.username,
id: req.user.id
});
}
}

Some files were not shown because too many files have changed in this diff Show More