@vynelix/nestjs-multi-auth 0.3.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +309 -18
- package/dist/auth/auth.controller.d.ts +3 -2
- package/dist/auth/auth.controller.js +32 -5
- package/dist/auth/auth.controller.js.map +1 -1
- package/dist/auth/auth.module.js +116 -68
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/auth.service.d.ts +52 -25
- package/dist/auth/auth.service.js +238 -327
- package/dist/auth/auth.service.js.map +1 -1
- package/dist/auth/core/auth-mapper.d.ts +1 -1
- package/dist/auth/core/database-otp.provider.d.ts +12 -0
- package/dist/auth/core/database-otp.provider.js +122 -0
- package/dist/auth/core/database-otp.provider.js.map +1 -0
- package/dist/auth/dto/requests/magic-link.dto.d.ts +1 -0
- package/dist/auth/dto/requests/magic-link.dto.js +6 -0
- package/dist/auth/dto/requests/magic-link.dto.js.map +1 -1
- package/dist/auth/dto/requests/mfa.dto.d.ts +5 -1
- package/dist/auth/dto/requests/mfa.dto.js +29 -8
- package/dist/auth/dto/requests/mfa.dto.js.map +1 -1
- package/dist/auth/enums/identifier-type.enum.d.ts +11 -0
- package/dist/auth/enums/identifier-type.enum.js +17 -0
- package/dist/auth/enums/identifier-type.enum.js.map +1 -0
- package/dist/auth/enums/mfa-type.enum.d.ts +5 -0
- package/dist/auth/enums/mfa-type.enum.js +10 -0
- package/dist/auth/enums/mfa-type.enum.js.map +1 -0
- package/dist/auth/enums/otp-purpose.enum.d.ts +8 -0
- package/dist/auth/enums/otp-purpose.enum.js +13 -0
- package/dist/auth/enums/otp-purpose.enum.js.map +1 -0
- package/dist/auth/enums/session-event.enum.d.ts +7 -0
- package/dist/auth/enums/session-event.enum.js +12 -0
- package/dist/auth/enums/session-event.enum.js.map +1 -0
- package/dist/auth/interfaces/auth-module-options.interface.d.ts +36 -1
- package/dist/auth/interfaces/auth-notification-provider.interface.d.ts +7 -1
- package/dist/auth/interfaces/auth-otp-provider.interface.d.ts +60 -0
- package/dist/auth/interfaces/auth-otp-provider.interface.js +7 -0
- package/dist/auth/interfaces/auth-otp-provider.interface.js.map +1 -0
- package/dist/auth/interfaces/models.interface.d.ts +91 -0
- package/dist/auth/interfaces/models.interface.js +3 -0
- package/dist/auth/interfaces/models.interface.js.map +1 -0
- package/dist/auth/interfaces/oauth-strategy.interface.d.ts +2 -2
- package/dist/auth/interfaces/repositories.interface.d.ts +70 -0
- package/dist/auth/interfaces/repositories.interface.js +3 -0
- package/dist/auth/interfaces/repositories.interface.js.map +1 -0
- package/dist/auth/interfaces/repository-tokens.d.ts +7 -0
- package/dist/auth/interfaces/repository-tokens.js +11 -0
- package/dist/auth/interfaces/repository-tokens.js.map +1 -0
- package/dist/auth/interfaces/signup-event-body.interface.d.ts +1 -1
- package/dist/auth/strategies/local-auth.strategy.d.ts +3 -5
- package/dist/auth/strategies/local-auth.strategy.js +64 -99
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/apple.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/apple.strategy.js +57 -70
- package/dist/auth/strategies/oauth/apple.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/facebook.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/facebook.strategy.js +58 -71
- package/dist/auth/strategies/oauth/facebook.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/google.strategy.d.ts +4 -6
- package/dist/auth/strategies/oauth/google.strategy.js +84 -155
- package/dist/auth/strategies/oauth/google.strategy.js.map +1 -1
- package/dist/auth/strategies/oauth/oauth.strategy.d.ts +2 -2
- package/dist/database/prisma/prisma-auth.adapter.d.ts +11 -0
- package/dist/database/prisma/prisma-auth.adapter.js +64 -0
- package/dist/database/prisma/prisma-auth.adapter.js.map +1 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.d.ts +16 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.js +41 -0
- package/dist/database/prisma/repositories/auth-identifier.repository.js.map +1 -0
- package/dist/database/prisma/repositories/auth.repository.d.ts +19 -0
- package/dist/database/prisma/repositories/auth.repository.js +49 -0
- package/dist/database/prisma/repositories/auth.repository.js.map +1 -0
- package/dist/database/prisma/repositories/index.d.ts +7 -0
- package/dist/database/prisma/repositories/index.js +24 -0
- package/dist/database/prisma/repositories/index.js.map +1 -0
- package/dist/database/prisma/repositories/mfa-method.repository.d.ts +11 -0
- package/dist/database/prisma/repositories/mfa-method.repository.js +33 -0
- package/dist/database/prisma/repositories/mfa-method.repository.js.map +1 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.d.ts +14 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.js +39 -0
- package/dist/database/prisma/repositories/oauth-provider.repository.js.map +1 -0
- package/dist/database/prisma/repositories/otp-token.repository.d.ts +13 -0
- package/dist/database/prisma/repositories/otp-token.repository.js +52 -0
- package/dist/database/prisma/repositories/otp-token.repository.js.map +1 -0
- package/dist/database/prisma/repositories/session-log.repository.d.ts +12 -0
- package/dist/database/prisma/repositories/session-log.repository.js +42 -0
- package/dist/database/prisma/repositories/session-log.repository.js.map +1 -0
- package/dist/database/prisma/repositories/session.repository.d.ts +16 -0
- package/dist/database/prisma/repositories/session.repository.js +41 -0
- package/dist/database/prisma/repositories/session.repository.js.map +1 -0
- package/dist/database/typeorm/entities/auth-identify.entity.d.ts +23 -0
- package/dist/database/typeorm/entities/auth-identify.entity.js +61 -0
- package/dist/database/typeorm/entities/auth-identify.entity.js.map +1 -0
- package/dist/database/typeorm/entities/auth.entity.d.ts +45 -0
- package/dist/database/typeorm/entities/auth.entity.js +129 -0
- package/dist/database/typeorm/entities/auth.entity.js.map +1 -0
- package/dist/database/typeorm/entities/base.entity.d.ts +7 -0
- package/dist/database/typeorm/entities/base.entity.js +44 -0
- package/dist/database/typeorm/entities/base.entity.js.map +1 -0
- package/dist/database/typeorm/entities/entities.d.ts +7 -0
- package/dist/database/typeorm/entities/entities.js +18 -0
- package/dist/database/typeorm/entities/entities.js.map +1 -0
- package/dist/database/typeorm/entities/mfa-method.entity.d.ts +10 -0
- package/dist/database/typeorm/entities/mfa-method.entity.js +47 -0
- package/dist/database/typeorm/entities/mfa-method.entity.js.map +1 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.d.ts +38 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.js +88 -0
- package/dist/database/typeorm/entities/oauth-provider.entity.js.map +1 -0
- package/dist/database/typeorm/entities/otp-token.entity.d.ts +15 -0
- package/dist/database/typeorm/entities/otp-token.entity.js +53 -0
- package/dist/database/typeorm/entities/otp-token.entity.js.map +1 -0
- package/dist/database/typeorm/entities/session.entity.d.ts +21 -0
- package/dist/database/typeorm/entities/session.entity.js +71 -0
- package/dist/database/typeorm/entities/session.entity.js.map +1 -0
- package/dist/database/typeorm/entities/session_log.entity.d.ts +25 -0
- package/dist/database/typeorm/entities/session_log.entity.js +78 -0
- package/dist/database/typeorm/entities/session_log.entity.js.map +1 -0
- package/dist/database/typeorm/migrations/auth-entities.d.ts +7 -0
- package/dist/database/typeorm/migrations/auth-entities.js +18 -0
- package/dist/database/typeorm/migrations/auth-entities.js.map +1 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.d.ts +9 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.js +36 -0
- package/dist/database/typeorm/migrations/auth-schema.initializer.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.d.ts +12 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.js +157 -0
- package/dist/database/typeorm/migrations/auth.migration.v1.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.d.ts +8 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.js +23 -0
- package/dist/database/typeorm/migrations/auth.migration.v2.js.map +1 -0
- package/dist/database/typeorm/migrations/auth.migrations.d.ts +2 -0
- package/dist/database/typeorm/migrations/auth.migrations.js +10 -0
- package/dist/database/typeorm/migrations/auth.migrations.js.map +1 -0
- package/dist/database/typeorm/migrations/migration.service.d.ts +9 -0
- package/dist/database/typeorm/migrations/migration.service.js +75 -0
- package/dist/database/typeorm/migrations/migration.service.js.map +1 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.d.ts +18 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.js +64 -0
- package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/auth.repository.d.ts +21 -0
- package/dist/database/typeorm/repositories/auth.repository.js +71 -0
- package/dist/database/typeorm/repositories/auth.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/index.d.ts +7 -0
- package/dist/database/typeorm/repositories/index.js +24 -0
- package/dist/database/typeorm/repositories/index.js.map +1 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.d.ts +13 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.js +46 -0
- package/dist/database/typeorm/repositories/mfa-method.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.d.ts +16 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.js +52 -0
- package/dist/database/typeorm/repositories/oauth-provider.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/otp-token.repository.d.ts +13 -0
- package/dist/database/typeorm/repositories/otp-token.repository.js +52 -0
- package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/session-log.repository.d.ts +12 -0
- package/dist/database/typeorm/repositories/session-log.repository.js +47 -0
- package/dist/database/typeorm/repositories/session-log.repository.js.map +1 -0
- package/dist/database/typeorm/repositories/session.repository.d.ts +18 -0
- package/dist/database/typeorm/repositories/session.repository.js +84 -0
- package/dist/database/typeorm/repositories/session.repository.js.map +1 -0
- package/dist/database/typeorm/typeorm-auth.adapter.d.ts +2 -0
- package/dist/database/typeorm/typeorm-auth.adapter.js +50 -0
- package/dist/database/typeorm/typeorm-auth.adapter.js.map +1 -0
- package/dist/index.d.ts +11 -9
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/fix-imports.js +46 -0
- package/fix-syntax.js +66 -0
- package/package.json +22 -20
- package/patch-local-specs.js +52 -0
- package/patch-oauth-specs.js +41 -0
- package/patch-specs.js +36 -0
- package/prompts/database_adapter.md +157 -0
- package/prompts/otp_provider.md +292 -0
- package/scratch/create-prisma-repos-final.js +139 -0
- package/scratch/create-prisma-repos.js +280 -0
- package/scratch/fix-events-spec.js +12 -0
- package/scratch/fix-imports.js +53 -0
- package/scratch/fix-prisma-interfaces.js +41 -0
- package/scratch/fix-prisma-interfaces2.js +36 -0
- package/scratch/fix-prisma-interfaces3.js +26 -0
- package/scratch/fix-prisma.js +28 -0
- package/scratch/fix-test-imports.js +51 -0
- package/scratch/fix-tests-advanced.js +68 -0
- package/scratch/fix-tests-advanced2.js +23 -0
- package/scratch/fix-tests-concrete.js +40 -0
- package/scratch/fix-tests-final.js +35 -0
- package/scratch/fix-tests-final2.js +28 -0
- package/scratch/fix-tests-final3.js +26 -0
- package/scratch/fix-tests-methods.js +40 -0
- package/scratch/fix-tests-proxy.js +67 -0
- package/scratch/fix-tests-types.js +24 -0
- package/scratch/rewrite-tests.js +110 -0
- package/tsc_errors.txt +60 -0
- package/tsc_errors2.txt +93 -0
- package/tmp-cv-test/package-lock.json +0 -250
- package/tmp-cv-test/package.json +0 -17
- package/tmp-cv-test/test.ts +0 -11
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TypeOrmOAuthProviderRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const oauth_provider_entity_1 = require("../entities/oauth-provider.entity");
|
|
20
|
+
let TypeOrmOAuthProviderRepository = class TypeOrmOAuthProviderRepository {
|
|
21
|
+
constructor(repo) {
|
|
22
|
+
this.repo = repo;
|
|
23
|
+
}
|
|
24
|
+
async create(data) {
|
|
25
|
+
return this.repo.create(data);
|
|
26
|
+
}
|
|
27
|
+
async findByProviderUserId(provider, providerUserId) {
|
|
28
|
+
return this.repo.findOne({ where: { provider, providerUserId } });
|
|
29
|
+
}
|
|
30
|
+
async findWithAuthByProviderUserId(provider, providerUserId) {
|
|
31
|
+
const result = await this.repo.findOne({
|
|
32
|
+
where: { provider: provider, providerUserId },
|
|
33
|
+
relations: ['auth', 'auth.identifiers'],
|
|
34
|
+
});
|
|
35
|
+
if (!result || !result.auth)
|
|
36
|
+
return null;
|
|
37
|
+
return { provider: result, auth: result.auth };
|
|
38
|
+
}
|
|
39
|
+
async save(provider) {
|
|
40
|
+
return this.repo.save(provider);
|
|
41
|
+
}
|
|
42
|
+
async update(id, data) {
|
|
43
|
+
await this.repo.update(id, data);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.TypeOrmOAuthProviderRepository = TypeOrmOAuthProviderRepository;
|
|
47
|
+
exports.TypeOrmOAuthProviderRepository = TypeOrmOAuthProviderRepository = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__param(0, (0, typeorm_1.InjectRepository)(oauth_provider_entity_1.OAuthProvider)),
|
|
50
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
51
|
+
], TypeOrmOAuthProviderRepository);
|
|
52
|
+
//# sourceMappingURL=oauth-provider.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-provider.repository.js","sourceRoot":"","sources":["../../../../src/database/typeorm/repositories/oauth-provider.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AAGrC,6EAAkE;AAG3D,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACzC,YAEmB,IAA+B;QAA/B,SAAI,GAAJ,IAAI,CAA2B;IAC/C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,IAAgC;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,QAAa,EAAE,cAAsB;QAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,4BAA4B,CAAC,QAAgB,EAAE,cAAsB;QACzE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACrC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAe,EAAE,cAAc,EAAE;YACpD,SAAS,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC;SACxC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA2B;QACpC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAgC;QACvD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;CACF,CAAA;AA9BY,wEAA8B;yCAA9B,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,qCAAa,CAAC,CAAA;qCACT,oBAAU;GAHxB,8BAA8B,CA8B1C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { OtpTokenRepository } from '../../../auth/interfaces/repositories.interface';
|
|
3
|
+
import { OtpToken as CoreOtpToken } from '../../../auth/interfaces/models.interface';
|
|
4
|
+
import { OtpToken } from '../entities/otp-token.entity';
|
|
5
|
+
export declare class TypeOrmOtpTokenRepository implements OtpTokenRepository {
|
|
6
|
+
private readonly repo;
|
|
7
|
+
constructor(repo: Repository<OtpToken>);
|
|
8
|
+
create(data: Partial<CoreOtpToken>): Promise<CoreOtpToken>;
|
|
9
|
+
findLatestUnused(uid: string): Promise<CoreOtpToken | null>;
|
|
10
|
+
findLatestUnusedByPurpose(uid: string, purpose: any): Promise<CoreOtpToken | null>;
|
|
11
|
+
save(token: CoreOtpToken): Promise<CoreOtpToken>;
|
|
12
|
+
deleteByUid(uid: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TypeOrmOtpTokenRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const otp_token_entity_1 = require("../entities/otp-token.entity");
|
|
20
|
+
let TypeOrmOtpTokenRepository = class TypeOrmOtpTokenRepository {
|
|
21
|
+
constructor(repo) {
|
|
22
|
+
this.repo = repo;
|
|
23
|
+
}
|
|
24
|
+
async create(data) {
|
|
25
|
+
return this.repo.create(data);
|
|
26
|
+
}
|
|
27
|
+
async findLatestUnused(uid) {
|
|
28
|
+
return this.repo.findOne({
|
|
29
|
+
where: { requestUserId: uid, isUsed: false },
|
|
30
|
+
order: { createdAt: 'DESC' },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async findLatestUnusedByPurpose(uid, purpose) {
|
|
34
|
+
return this.repo.findOne({
|
|
35
|
+
where: { requestUserId: uid, purpose, isUsed: false },
|
|
36
|
+
order: { createdAt: 'DESC' },
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async save(token) {
|
|
40
|
+
return this.repo.save(token);
|
|
41
|
+
}
|
|
42
|
+
async deleteByUid(uid) {
|
|
43
|
+
await this.repo.delete({ requestUserId: uid });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.TypeOrmOtpTokenRepository = TypeOrmOtpTokenRepository;
|
|
47
|
+
exports.TypeOrmOtpTokenRepository = TypeOrmOtpTokenRepository = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__param(0, (0, typeorm_1.InjectRepository)(otp_token_entity_1.OtpToken)),
|
|
50
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
51
|
+
], TypeOrmOtpTokenRepository);
|
|
52
|
+
//# sourceMappingURL=otp-token.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"otp-token.repository.js","sourceRoot":"","sources":["../../../../src/database/typeorm/repositories/otp-token.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AAGrC,mEAAwD;AAGjD,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAEmB,IAA0B;QAA1B,SAAI,GAAJ,IAAI,CAAsB;IAC1C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,IAA2B;QACtC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,GAAW;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE;YAC5C,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,yBAAyB,CAAC,GAAW,EAAE,OAAY;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE;YACrD,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAmB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAW;QAC3B,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AA/BY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,2BAAQ,CAAC,CAAA;qCACJ,oBAAU;GAHxB,yBAAyB,CA+BrC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { SessionLogRepository } from '../../../auth/interfaces/repositories.interface';
|
|
3
|
+
import { SessionLog as CoreSessionLog } from '../../../auth/interfaces/models.interface';
|
|
4
|
+
import { SessionLog } from '../entities/session_log.entity';
|
|
5
|
+
export declare class TypeOrmSessionLogRepository implements SessionLogRepository {
|
|
6
|
+
private readonly repo;
|
|
7
|
+
constructor(repo: Repository<SessionLog>);
|
|
8
|
+
create(data: Partial<CoreSessionLog>): Promise<CoreSessionLog>;
|
|
9
|
+
save(log: CoreSessionLog): Promise<CoreSessionLog>;
|
|
10
|
+
saveMany(logs: CoreSessionLog[]): Promise<CoreSessionLog[]>;
|
|
11
|
+
findByUidAndNamespace(uid: string, namespace?: string): Promise<CoreSessionLog[]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.TypeOrmSessionLogRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
18
|
+
const typeorm_2 = require("typeorm");
|
|
19
|
+
const session_log_entity_1 = require("../entities/session_log.entity");
|
|
20
|
+
let TypeOrmSessionLogRepository = class TypeOrmSessionLogRepository {
|
|
21
|
+
constructor(repo) {
|
|
22
|
+
this.repo = repo;
|
|
23
|
+
}
|
|
24
|
+
async create(data) {
|
|
25
|
+
return this.repo.create(data);
|
|
26
|
+
}
|
|
27
|
+
async save(log) {
|
|
28
|
+
return this.repo.save(log);
|
|
29
|
+
}
|
|
30
|
+
async saveMany(logs) {
|
|
31
|
+
return this.repo.save(logs);
|
|
32
|
+
}
|
|
33
|
+
async findByUidAndNamespace(uid, namespace) {
|
|
34
|
+
const where = { uid };
|
|
35
|
+
if (namespace !== undefined) {
|
|
36
|
+
where.namespace = namespace;
|
|
37
|
+
}
|
|
38
|
+
return this.repo.find({ where });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.TypeOrmSessionLogRepository = TypeOrmSessionLogRepository;
|
|
42
|
+
exports.TypeOrmSessionLogRepository = TypeOrmSessionLogRepository = __decorate([
|
|
43
|
+
(0, common_1.Injectable)(),
|
|
44
|
+
__param(0, (0, typeorm_1.InjectRepository)(session_log_entity_1.SessionLog)),
|
|
45
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
46
|
+
], TypeOrmSessionLogRepository);
|
|
47
|
+
//# sourceMappingURL=session-log.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-log.repository.js","sourceRoot":"","sources":["../../../../src/database/typeorm/repositories/session-log.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AAGrC,uEAA4D;AAGrD,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACtC,YAEmB,IAA4B;QAA5B,SAAI,GAAJ,IAAI,CAAwB;IAC5C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,IAA6B;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAmB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAsB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,GAAW,EAAE,SAAkB;QACzD,MAAM,KAAK,GAAQ,EAAE,GAAG,EAAE,CAAC;QAC3B,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,CAAC;CACF,CAAA;AAzBY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,+BAAU,CAAC,CAAA;qCACN,oBAAU;GAHxB,2BAA2B,CAyBvC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { SessionRepository } from '../../../auth/interfaces/repositories.interface';
|
|
3
|
+
import { Session as CoreSession } from '../../../auth/interfaces/models.interface';
|
|
4
|
+
import { Session } from '../entities/session.entity';
|
|
5
|
+
export declare class TypeOrmSessionRepository implements SessionRepository {
|
|
6
|
+
private readonly repo;
|
|
7
|
+
constructor(repo: Repository<Session>);
|
|
8
|
+
create(data: Partial<CoreSession>): Promise<CoreSession>;
|
|
9
|
+
findById(id: string): Promise<CoreSession | null>;
|
|
10
|
+
findDeviceSession(uid: string, namespace: string | undefined, deviceFingerprint: string): Promise<CoreSession | null>;
|
|
11
|
+
findByUid(uid: string): Promise<CoreSession[]>;
|
|
12
|
+
findByIdWithDetails(id: string, namespace?: string): Promise<CoreSession | null>;
|
|
13
|
+
save(session: CoreSession): Promise<CoreSession>;
|
|
14
|
+
update(id: string, data: Partial<CoreSession>): Promise<void>;
|
|
15
|
+
delete(id: string): Promise<void>;
|
|
16
|
+
deleteByUid(uid: string): Promise<void>;
|
|
17
|
+
transaction(runInTransaction: (repo: SessionRepository) => Promise<void>): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var TypeOrmSessionRepository_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TypeOrmSessionRepository = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
19
|
+
const typeorm_2 = require("typeorm");
|
|
20
|
+
const session_entity_1 = require("../entities/session.entity");
|
|
21
|
+
let TypeOrmSessionRepository = TypeOrmSessionRepository_1 = class TypeOrmSessionRepository {
|
|
22
|
+
constructor(repo) {
|
|
23
|
+
this.repo = repo;
|
|
24
|
+
}
|
|
25
|
+
async create(data) {
|
|
26
|
+
return this.repo.create(data);
|
|
27
|
+
}
|
|
28
|
+
async findById(id) {
|
|
29
|
+
return this.repo.findOne({ where: { id } });
|
|
30
|
+
}
|
|
31
|
+
async findDeviceSession(uid, namespace, deviceFingerprint) {
|
|
32
|
+
const where = { uid, deviceFingerprint };
|
|
33
|
+
if (namespace !== undefined) {
|
|
34
|
+
where.namespace = namespace;
|
|
35
|
+
}
|
|
36
|
+
return this.repo.findOne({ where });
|
|
37
|
+
}
|
|
38
|
+
async findByUid(uid) {
|
|
39
|
+
return this.repo.find({ where: { uid } });
|
|
40
|
+
}
|
|
41
|
+
async findByIdWithDetails(id, namespace) {
|
|
42
|
+
const where = { id };
|
|
43
|
+
if (namespace !== undefined) {
|
|
44
|
+
where.namespace = namespace;
|
|
45
|
+
}
|
|
46
|
+
return this.repo.findOne({
|
|
47
|
+
where,
|
|
48
|
+
select: [
|
|
49
|
+
'id',
|
|
50
|
+
'uid',
|
|
51
|
+
'refreshTokenHash',
|
|
52
|
+
'expiresAt',
|
|
53
|
+
'deviceFingerprint',
|
|
54
|
+
'ipAddress',
|
|
55
|
+
'namespace',
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async save(session) {
|
|
60
|
+
return this.repo.save(session);
|
|
61
|
+
}
|
|
62
|
+
async update(id, data) {
|
|
63
|
+
await this.repo.update(id, data);
|
|
64
|
+
}
|
|
65
|
+
async delete(id) {
|
|
66
|
+
await this.repo.delete(id);
|
|
67
|
+
}
|
|
68
|
+
async deleteByUid(uid) {
|
|
69
|
+
await this.repo.delete({ uid });
|
|
70
|
+
}
|
|
71
|
+
async transaction(runInTransaction) {
|
|
72
|
+
await this.repo.manager.transaction(async (manager) => {
|
|
73
|
+
const transactionalRepo = new TypeOrmSessionRepository_1(manager.getRepository(session_entity_1.Session));
|
|
74
|
+
await runInTransaction(transactionalRepo);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.TypeOrmSessionRepository = TypeOrmSessionRepository;
|
|
79
|
+
exports.TypeOrmSessionRepository = TypeOrmSessionRepository = TypeOrmSessionRepository_1 = __decorate([
|
|
80
|
+
(0, common_1.Injectable)(),
|
|
81
|
+
__param(0, (0, typeorm_1.InjectRepository)(session_entity_1.Session)),
|
|
82
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
83
|
+
], TypeOrmSessionRepository);
|
|
84
|
+
//# sourceMappingURL=session.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.repository.js","sourceRoot":"","sources":["../../../../src/database/typeorm/repositories/session.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,qCAAqC;AAGrC,+DAAqD;AAG9C,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IACnC,YAEmB,IAAyB;QAAzB,SAAI,GAAJ,IAAI,CAAqB;IACzC,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,IAA0B;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,GAAW,EAAE,SAA6B,EAAE,iBAAyB;QAC3F,MAAM,KAAK,GAAQ,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC;QAC9C,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAW;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU,EAAE,SAAkB;QACtD,MAAM,KAAK,GAAQ,EAAE,EAAE,EAAE,CAAC;QAC1B,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;YACvB,KAAK;YACL,MAAM,EAAE;gBACN,IAAI;gBACJ,KAAK;gBACL,kBAAkB;gBAClB,WAAW;gBACX,mBAAmB;gBACnB,WAAW;gBACX,WAAW;aACZ;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAA0B;QACjD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAAW;QAC3B,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,gBAA4D;QAC5E,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACpD,MAAM,iBAAiB,GAAG,IAAI,0BAAwB,CAAC,OAAO,CAAC,aAAa,CAAC,wBAAO,CAAC,CAAC,CAAC;YACvF,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAnEY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,wBAAO,CAAC,CAAA;qCACH,oBAAU;GAHxB,wBAAwB,CAmEpC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TypeOrmAuthAdapter = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
12
|
+
const auth_entity_1 = require("./entities/auth.entity");
|
|
13
|
+
const auth_identify_entity_1 = require("./entities/auth-identify.entity");
|
|
14
|
+
const oauth_provider_entity_1 = require("./entities/oauth-provider.entity");
|
|
15
|
+
const otp_token_entity_1 = require("./entities/otp-token.entity");
|
|
16
|
+
const mfa_method_entity_1 = require("./entities/mfa-method.entity");
|
|
17
|
+
const session_entity_1 = require("./entities/session.entity");
|
|
18
|
+
const session_log_entity_1 = require("./entities/session_log.entity");
|
|
19
|
+
const repositories_1 = require("./repositories");
|
|
20
|
+
const repository_tokens_1 = require("../../auth/interfaces/repository-tokens");
|
|
21
|
+
const entities = [
|
|
22
|
+
auth_entity_1.Auth,
|
|
23
|
+
auth_identify_entity_1.AuthIdentifier,
|
|
24
|
+
oauth_provider_entity_1.OAuthProvider,
|
|
25
|
+
otp_token_entity_1.OtpToken,
|
|
26
|
+
mfa_method_entity_1.MfaMethod,
|
|
27
|
+
session_entity_1.Session,
|
|
28
|
+
session_log_entity_1.SessionLog,
|
|
29
|
+
];
|
|
30
|
+
const providers = [
|
|
31
|
+
{ provide: repository_tokens_1.AUTH_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmAuthRepository },
|
|
32
|
+
{ provide: repository_tokens_1.AUTH_IDENTIFIER_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmAuthIdentifierRepository },
|
|
33
|
+
{ provide: repository_tokens_1.OAUTH_PROVIDER_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmOAuthProviderRepository },
|
|
34
|
+
{ provide: repository_tokens_1.OTP_TOKEN_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmOtpTokenRepository },
|
|
35
|
+
{ provide: repository_tokens_1.MFA_METHOD_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmMfaMethodRepository },
|
|
36
|
+
{ provide: repository_tokens_1.SESSION_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmSessionRepository },
|
|
37
|
+
{ provide: repository_tokens_1.SESSION_LOG_REPOSITORY_TOKEN, useClass: repositories_1.TypeOrmSessionLogRepository },
|
|
38
|
+
];
|
|
39
|
+
let TypeOrmAuthAdapter = class TypeOrmAuthAdapter {
|
|
40
|
+
};
|
|
41
|
+
exports.TypeOrmAuthAdapter = TypeOrmAuthAdapter;
|
|
42
|
+
exports.TypeOrmAuthAdapter = TypeOrmAuthAdapter = __decorate([
|
|
43
|
+
(0, common_1.Global)(),
|
|
44
|
+
(0, common_1.Module)({
|
|
45
|
+
imports: [typeorm_1.TypeOrmModule.forFeature(entities)],
|
|
46
|
+
providers: providers,
|
|
47
|
+
exports: providers,
|
|
48
|
+
})
|
|
49
|
+
], TypeOrmAuthAdapter);
|
|
50
|
+
//# sourceMappingURL=typeorm-auth.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-auth.adapter.js","sourceRoot":"","sources":["../../../src/database/typeorm/typeorm-auth.adapter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA+D;AAC/D,6CAAgD;AAChD,wDAA8C;AAC9C,0EAAiE;AACjE,4EAAiE;AACjE,kEAAuD;AACvD,oEAAyD;AACzD,8DAAoD;AACpD,sEAA2D;AAE3D,iDAQwB;AAExB,+EAQiD;AAEjD,MAAM,QAAQ,GAAG;IACf,kBAAI;IACJ,qCAAc;IACd,qCAAa;IACb,2BAAQ;IACR,6BAAS;IACT,wBAAO;IACP,+BAAU;CACX,CAAC;AAEF,MAAM,SAAS,GAAG;IAChB,EAAE,OAAO,EAAE,yCAAqB,EAAE,QAAQ,EAAE,oCAAqB,EAAE;IACnE,EAAE,OAAO,EAAE,oDAAgC,EAAE,QAAQ,EAAE,8CAA+B,EAAE;IACxF,EAAE,OAAO,EAAE,mDAA+B,EAAE,QAAQ,EAAE,6CAA8B,EAAE;IACtF,EAAE,OAAO,EAAE,8CAA0B,EAAE,QAAQ,EAAE,wCAAyB,EAAE;IAC5E,EAAE,OAAO,EAAE,+CAA2B,EAAE,QAAQ,EAAE,yCAA0B,EAAE;IAC9E,EAAE,OAAO,EAAE,4CAAwB,EAAE,QAAQ,EAAE,uCAAwB,EAAE;IACzE,EAAE,OAAO,EAAE,gDAA4B,EAAE,QAAQ,EAAE,0CAA2B,EAAE;CACjF,CAAC;AAQK,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAN9B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC7C,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,SAAS;KACnB,CAAC;GACW,kBAAkB,CAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,21 +6,23 @@ export type { AuthCredential } from './auth/interfaces/current-user-interface';
|
|
|
6
6
|
export * from './auth/decorator/public.decorator';
|
|
7
7
|
export * from './auth/decorator/optional.decorator';
|
|
8
8
|
export * from './auth/enums/auth-type.enum';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
9
|
+
export { Auth as TypeOrmAuth } from './database/typeorm/entities/auth.entity';
|
|
10
|
+
export { Session as TypeOrmSession } from './database/typeorm/entities/session.entity';
|
|
11
|
+
export { MfaMethod as TypeOrmMfaMethod } from './database/typeorm/entities/mfa-method.entity';
|
|
12
|
+
export { OAuthProvider as TypeOrmOAuthProvider } from './database/typeorm/entities/oauth-provider.entity';
|
|
13
|
+
export { OtpToken as TypeOrmOtpToken } from './database/typeorm/entities/otp-token.entity';
|
|
14
|
+
export { BaseEntity as TypeOrmBaseEntity } from './database/typeorm/entities/base.entity';
|
|
15
15
|
export * from './auth/dto/requests/login.dto';
|
|
16
16
|
export * from './auth/dto/requests/signup.dto';
|
|
17
17
|
export * from './auth/dto/requests/refresh-token.dto';
|
|
18
18
|
export * from './auth/guards/jwt-auth.guard';
|
|
19
19
|
export * from './auth/guards/optional-auth.guard';
|
|
20
|
-
export * from './migrations/auth-schema.initializer';
|
|
21
|
-
export * from './migrations/migration.service';
|
|
20
|
+
export * from './database/typeorm/migrations/auth-schema.initializer';
|
|
21
|
+
export * from './database/typeorm/migrations/migration.service';
|
|
22
22
|
export * from './auth/enums/auth.events';
|
|
23
|
-
export * from './auth/
|
|
23
|
+
export * from './auth/interfaces/models.interface';
|
|
24
24
|
export * from './auth/interfaces/auth-notification-provider.interface';
|
|
25
25
|
export * from './auth/interfaces/signin-event-body.interface';
|
|
26
26
|
export * from './auth/interfaces/signup-event-body.interface';
|
|
27
|
+
export * from './database/typeorm/typeorm-auth.adapter';
|
|
28
|
+
export * from './database/prisma/prisma-auth.adapter';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AUTH_MODULE_OPTIONS = void 0;
|
|
17
|
+
exports.TypeOrmBaseEntity = exports.TypeOrmOtpToken = exports.TypeOrmOAuthProvider = exports.TypeOrmMfaMethod = exports.TypeOrmSession = exports.TypeOrmAuth = exports.AUTH_MODULE_OPTIONS = void 0;
|
|
18
18
|
__exportStar(require("./auth/auth.module"), exports);
|
|
19
19
|
__exportStar(require("./auth/auth.service"), exports);
|
|
20
20
|
var auth_module_options_interface_1 = require("./auth/interfaces/auth-module-options.interface");
|
|
@@ -23,22 +23,30 @@ __exportStar(require("./auth/decorator/current-user.decorator"), exports);
|
|
|
23
23
|
__exportStar(require("./auth/decorator/public.decorator"), exports);
|
|
24
24
|
__exportStar(require("./auth/decorator/optional.decorator"), exports);
|
|
25
25
|
__exportStar(require("./auth/enums/auth-type.enum"), exports);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
var auth_entity_1 = require("./database/typeorm/entities/auth.entity");
|
|
27
|
+
Object.defineProperty(exports, "TypeOrmAuth", { enumerable: true, get: function () { return auth_entity_1.Auth; } });
|
|
28
|
+
var session_entity_1 = require("./database/typeorm/entities/session.entity");
|
|
29
|
+
Object.defineProperty(exports, "TypeOrmSession", { enumerable: true, get: function () { return session_entity_1.Session; } });
|
|
30
|
+
var mfa_method_entity_1 = require("./database/typeorm/entities/mfa-method.entity");
|
|
31
|
+
Object.defineProperty(exports, "TypeOrmMfaMethod", { enumerable: true, get: function () { return mfa_method_entity_1.MfaMethod; } });
|
|
32
|
+
var oauth_provider_entity_1 = require("./database/typeorm/entities/oauth-provider.entity");
|
|
33
|
+
Object.defineProperty(exports, "TypeOrmOAuthProvider", { enumerable: true, get: function () { return oauth_provider_entity_1.OAuthProvider; } });
|
|
34
|
+
var otp_token_entity_1 = require("./database/typeorm/entities/otp-token.entity");
|
|
35
|
+
Object.defineProperty(exports, "TypeOrmOtpToken", { enumerable: true, get: function () { return otp_token_entity_1.OtpToken; } });
|
|
36
|
+
var base_entity_1 = require("./database/typeorm/entities/base.entity");
|
|
37
|
+
Object.defineProperty(exports, "TypeOrmBaseEntity", { enumerable: true, get: function () { return base_entity_1.BaseEntity; } });
|
|
32
38
|
__exportStar(require("./auth/dto/requests/login.dto"), exports);
|
|
33
39
|
__exportStar(require("./auth/dto/requests/signup.dto"), exports);
|
|
34
40
|
__exportStar(require("./auth/dto/requests/refresh-token.dto"), exports);
|
|
35
41
|
__exportStar(require("./auth/guards/jwt-auth.guard"), exports);
|
|
36
42
|
__exportStar(require("./auth/guards/optional-auth.guard"), exports);
|
|
37
|
-
__exportStar(require("./migrations/auth-schema.initializer"), exports);
|
|
38
|
-
__exportStar(require("./migrations/migration.service"), exports);
|
|
43
|
+
__exportStar(require("./database/typeorm/migrations/auth-schema.initializer"), exports);
|
|
44
|
+
__exportStar(require("./database/typeorm/migrations/migration.service"), exports);
|
|
39
45
|
__exportStar(require("./auth/enums/auth.events"), exports);
|
|
40
|
-
__exportStar(require("./auth/
|
|
46
|
+
__exportStar(require("./auth/interfaces/models.interface"), exports);
|
|
41
47
|
__exportStar(require("./auth/interfaces/auth-notification-provider.interface"), exports);
|
|
42
48
|
__exportStar(require("./auth/interfaces/signin-event-body.interface"), exports);
|
|
43
49
|
__exportStar(require("./auth/interfaces/signup-event-body.interface"), exports);
|
|
50
|
+
__exportStar(require("./database/typeorm/typeorm-auth.adapter"), exports);
|
|
51
|
+
__exportStar(require("./database/prisma/prisma-auth.adapter"), exports);
|
|
44
52
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,iGAAyG;AAAhG,oIAAA,mBAAmB,OAAA;AAC5B,0EAAwD;AAExD,oEAAkD;AAClD,sEAAoD;AACpD,8DAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,sDAAoC;AACpC,iGAAyG;AAAhG,oIAAA,mBAAmB,OAAA;AAC5B,0EAAwD;AAExD,oEAAkD;AAClD,sEAAoD;AACpD,8DAA4C;AAC5C,uEAA8E;AAArE,0GAAA,IAAI,OAAe;AAC5B,6EAAuF;AAA9E,gHAAA,OAAO,OAAkB;AAClC,mFAA8F;AAArF,qHAAA,SAAS,OAAoB;AACtC,2FAA0G;AAAjG,6HAAA,aAAa,OAAwB;AAC9C,iFAA2F;AAAlF,mHAAA,QAAQ,OAAmB;AACpC,uEAA0F;AAAjF,gHAAA,UAAU,OAAqB;AACxC,gEAA8C;AAC9C,iEAA+C;AAC/C,wEAAsD;AACtD,+DAA6C;AAC7C,oEAAkD;AAClD,wFAAsE;AACtE,kFAAgE;AAChE,2DAAyC;AACzC,qEAAmD;AACnD,yFAAuE;AACvE,gFAA8D;AAC9D,gFAA8D;AAE9D,0EAAwD;AACxD,wEAAsD"}
|