@vynelix/nestjs-multi-auth 1.0.2 → 1.0.3
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 +4 -0
- package/README.md +1 -1
- package/dist/auth/auth.module.js +28 -28
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/core/database-otp.provider.js +14 -4
- package/dist/auth/core/database-otp.provider.js.map +1 -1
- package/dist/auth/decorator/current-user.decorator.d.ts +1 -1
- package/dist/auth/interfaces/auth-module-async-options.interface.d.ts +2 -0
- package/dist/auth/strategies/local-auth.strategy.js +1 -0
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
- package/dist/database/typeorm/entities/entities.d.ts +1 -1
- package/dist/database/typeorm/migrations/auth-entities.d.ts +1 -1
- package/dist/database/typeorm/repositories/auth-identifier.repository.js +11 -6
- package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js +2 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/auth/auth-type.enum.d.ts +0 -22
- package/dist/auth/auth-type.enum.js +0 -32
- package/dist/auth/auth-type.enum.js.map +0 -1
- package/dist/auth/core/cookie-namespace.resolver.d.ts +0 -8
- package/dist/auth/core/cookie-namespace.resolver.js +0 -48
- package/dist/auth/core/cookie-namespace.resolver.js.map +0 -1
- package/dist/auth/current-user-interface.d.ts +0 -4
- package/dist/auth/current-user-interface.js +0 -4
- package/dist/auth/current-user-interface.js.map +0 -1
- package/dist/auth/current-user.decorator.d.ts +0 -2
- package/dist/auth/current-user.decorator.js +0 -16
- package/dist/auth/current-user.decorator.js.map +0 -1
- package/dist/auth/dto/auth-response.dto.d.ts +0 -17
- package/dist/auth/dto/auth-response.dto.js +0 -83
- package/dist/auth/dto/auth-response.dto.js.map +0 -1
- package/dist/auth/dto/identifier-response.dto.d.ts +0 -8
- package/dist/auth/dto/identifier-response.dto.js +0 -46
- package/dist/auth/dto/identifier-response.dto.js.map +0 -1
- package/dist/auth/dto/login.dto.d.ts +0 -11
- package/dist/auth/dto/login.dto.js +0 -68
- package/dist/auth/dto/login.dto.js.map +0 -1
- package/dist/auth/dto/mfa.dto.d.ts +0 -8
- package/dist/auth/dto/mfa.dto.js +0 -51
- package/dist/auth/dto/mfa.dto.js.map +0 -1
- package/dist/auth/dto/oauth-provider-response.dto.d.ts +0 -5
- package/dist/auth/dto/oauth-provider-response.dto.js +0 -30
- package/dist/auth/dto/oauth-provider-response.dto.js.map +0 -1
- package/dist/auth/dto/refresh-token.dto.d.ts +0 -3
- package/dist/auth/dto/refresh-token.dto.js +0 -28
- package/dist/auth/dto/refresh-token.dto.js.map +0 -1
- package/dist/auth/dto/signup.dto.d.ts +0 -13
- package/dist/auth/dto/signup.dto.js +0 -70
- package/dist/auth/dto/signup.dto.js.map +0 -1
- package/dist/auth/dto/verify.dto.d.ts +0 -7
- package/dist/auth/dto/verify.dto.js +0 -48
- package/dist/auth/dto/verify.dto.js.map +0 -1
- package/dist/auth/entities/auth-identify.entity.d.ts +0 -33
- package/dist/auth/entities/auth-identify.entity.js +0 -73
- package/dist/auth/entities/auth-identify.entity.js.map +0 -1
- package/dist/auth/entities/auth.entity.d.ts +0 -45
- package/dist/auth/entities/auth.entity.js +0 -129
- package/dist/auth/entities/auth.entity.js.map +0 -1
- package/dist/auth/entities/base.entity.d.ts +0 -6
- package/dist/auth/entities/base.entity.js +0 -41
- package/dist/auth/entities/base.entity.js.map +0 -1
- package/dist/auth/entities/entities.d.ts +0 -7
- package/dist/auth/entities/entities.js +0 -18
- package/dist/auth/entities/entities.js.map +0 -1
- package/dist/auth/entities/mfa-method.entity.d.ts +0 -23
- package/dist/auth/entities/mfa-method.entity.js +0 -69
- package/dist/auth/entities/mfa-method.entity.js.map +0 -1
- package/dist/auth/entities/oauth-provider.entity.d.ts +0 -38
- package/dist/auth/entities/oauth-provider.entity.js +0 -88
- package/dist/auth/entities/oauth-provider.entity.js.map +0 -1
- package/dist/auth/entities/otp-token.entity.d.ts +0 -22
- package/dist/auth/entities/otp-token.entity.js +0 -61
- package/dist/auth/entities/otp-token.entity.js.map +0 -1
- package/dist/auth/entities/session.entity.d.ts +0 -21
- package/dist/auth/entities/session.entity.js +0 -71
- package/dist/auth/entities/session.entity.js.map +0 -1
- package/dist/auth/entities/session_log.entity.d.ts +0 -31
- package/dist/auth/entities/session_log.entity.js +0 -85
- package/dist/auth/entities/session_log.entity.js.map +0 -1
- package/dist/auth/interfaces/auth-user-service.interface.d.ts +0 -13
- package/dist/auth/interfaces/auth-user-service.interface.js +0 -7
- package/dist/auth/interfaces/auth-user-service.interface.js.map +0 -1
- package/dist/auth/interfaces/current-user.decorator.d.ts +0 -2
- package/dist/auth/interfaces/current-user.decorator.js +0 -16
- package/dist/auth/interfaces/current-user.decorator.js.map +0 -1
- package/dist/auth/jwt-payload-interface.d.ts +0 -4
- package/dist/auth/jwt-payload-interface.js +0 -3
- package/dist/auth/jwt-payload-interface.js.map +0 -1
- package/dist/auth/jwt.strategy.d.ts +0 -13
- package/dist/auth/jwt.strategy.js +0 -60
- package/dist/auth/jwt.strategy.js.map +0 -1
- package/dist/auth/strategies/company.strategy.d.ts +0 -0
- package/dist/auth/strategies/company.strategy.js +0 -1
- package/dist/auth/strategies/company.strategy.js.map +0 -1
- package/dist/auth/strategies/google.strategy.d.ts +0 -7
- package/dist/auth/strategies/google.strategy.js +0 -23
- package/dist/auth/strategies/google.strategy.js.map +0 -1
- package/dist/auth/strategies/oauth/oauth-strategy.interface.d.ts +0 -14
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js +0 -3
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js.map +0 -1
- package/dist/auth/strategies/otp.strategy.d.ts +0 -7
- package/dist/auth/strategies/otp.strategy.js +0 -23
- package/dist/auth/strategies/otp.strategy.js.map +0 -1
- package/dist/auth/strategies/password.strategy.d.ts +0 -14
- package/dist/auth/strategies/password.strategy.js +0 -130
- package/dist/auth/strategies/password.strategy.js.map +0 -1
- package/dist/migrations/auth-entities.d.ts +0 -7
- package/dist/migrations/auth-entities.js +0 -18
- package/dist/migrations/auth-entities.js.map +0 -1
- package/dist/migrations/auth-schema.initializer.d.ts +0 -9
- package/dist/migrations/auth-schema.initializer.js +0 -36
- package/dist/migrations/auth-schema.initializer.js.map +0 -1
- package/dist/migrations/auth.migration.v1.d.ts +0 -12
- package/dist/migrations/auth.migration.v1.js +0 -157
- package/dist/migrations/auth.migration.v1.js.map +0 -1
- package/dist/migrations/auth.migration.v2.d.ts +0 -8
- package/dist/migrations/auth.migration.v2.js +0 -39
- package/dist/migrations/auth.migration.v2.js.map +0 -1
- package/dist/migrations/auth.migrations.d.ts +0 -2
- package/dist/migrations/auth.migrations.js +0 -8
- package/dist/migrations/auth.migrations.js.map +0 -1
- package/dist/migrations/migration.runner.d.ts +0 -9
- package/dist/migrations/migration.runner.js +0 -67
- package/dist/migrations/migration.runner.js.map +0 -1
- package/dist/migrations/migration.service.d.ts +0 -9
- package/dist/migrations/migration.service.js +0 -75
- package/dist/migrations/migration.service.js.map +0 -1
|
@@ -1,75 +0,0 @@
|
|
|
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.AuthMigrationService = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const typeorm_1 = require("typeorm");
|
|
18
|
-
const auth_migrations_1 = require("./auth.migrations");
|
|
19
|
-
let AuthMigrationService = class AuthMigrationService {
|
|
20
|
-
constructor(dataSource) {
|
|
21
|
-
this.dataSource = dataSource;
|
|
22
|
-
}
|
|
23
|
-
async runMigrations() {
|
|
24
|
-
const queryRunner = this.dataSource.createQueryRunner();
|
|
25
|
-
await queryRunner.connect();
|
|
26
|
-
await this.ensureMetaTable(queryRunner);
|
|
27
|
-
const currentVersion = await this.getCurrentVersion(queryRunner);
|
|
28
|
-
const pendingMigrations = auth_migrations_1.AuthMigrations.filter((M) => M.version > currentVersion);
|
|
29
|
-
for (const MigrationClass of pendingMigrations) {
|
|
30
|
-
const migration = new MigrationClass();
|
|
31
|
-
await queryRunner.startTransaction();
|
|
32
|
-
try {
|
|
33
|
-
await migration.up(queryRunner);
|
|
34
|
-
await this.updateVersion(queryRunner, migration.version);
|
|
35
|
-
await queryRunner.commitTransaction();
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
await queryRunner.rollbackTransaction();
|
|
39
|
-
throw err;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
await queryRunner.release();
|
|
43
|
-
}
|
|
44
|
-
async ensureMetaTable(qr) {
|
|
45
|
-
const executor = qr || this.dataSource;
|
|
46
|
-
await executor.query(`
|
|
47
|
-
CREATE TABLE IF NOT EXISTS auth_schema_meta (
|
|
48
|
-
id SERIAL PRIMARY KEY,
|
|
49
|
-
version INT NOT NULL,
|
|
50
|
-
updated_at TIMESTAMP DEFAULT now()
|
|
51
|
-
)
|
|
52
|
-
`);
|
|
53
|
-
}
|
|
54
|
-
async getCurrentVersion(qr) {
|
|
55
|
-
await this.ensureMetaTable(qr);
|
|
56
|
-
const executor = qr || this.dataSource;
|
|
57
|
-
const result = await executor.query(`
|
|
58
|
-
SELECT version FROM auth_schema_meta ORDER BY version DESC LIMIT 1
|
|
59
|
-
`);
|
|
60
|
-
return result.length > 0 ? result[0].version : 0;
|
|
61
|
-
}
|
|
62
|
-
async updateVersion(qr, version) {
|
|
63
|
-
const executor = qr || this.dataSource;
|
|
64
|
-
await executor.query(`
|
|
65
|
-
INSERT INTO auth_schema_meta (version) VALUES ($1)
|
|
66
|
-
`, [version]);
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
exports.AuthMigrationService = AuthMigrationService;
|
|
70
|
-
exports.AuthMigrationService = AuthMigrationService = __decorate([
|
|
71
|
-
(0, common_1.Injectable)(),
|
|
72
|
-
__param(0, (0, common_1.Optional)()),
|
|
73
|
-
__metadata("design:paramtypes", [typeorm_1.DataSource])
|
|
74
|
-
], AuthMigrationService);
|
|
75
|
-
//# sourceMappingURL=migration.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration.service.js","sourceRoot":"","sources":["../../src/migrations/migration.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsD;AACtD,qCAAkD;AAClD,uDAAmD;AAG5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAC7B,YAAgC,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAI,CAAC;IAE3D,KAAK,CAAC,aAAa;QACf,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;QAExD,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QAE5B,MAAM,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAExC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,C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