@vynelix/nestjs-multi-auth 1.0.1 → 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.
Files changed (130) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  3. package/dist/auth/auth.module.js +29 -28
  4. package/dist/auth/auth.module.js.map +1 -1
  5. package/dist/auth/auth.service.js.map +1 -1
  6. package/dist/auth/core/database-otp.provider.js +14 -4
  7. package/dist/auth/core/database-otp.provider.js.map +1 -1
  8. package/dist/auth/decorator/current-user.decorator.d.ts +1 -1
  9. package/dist/auth/interfaces/auth-module-async-options.interface.d.ts +2 -0
  10. package/dist/auth/strategies/local-auth.strategy.js +4 -3
  11. package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
  12. package/dist/database/typeorm/entities/entities.d.ts +1 -1
  13. package/dist/database/typeorm/migrations/auth-entities.d.ts +1 -1
  14. package/dist/database/typeorm/repositories/auth-identifier.repository.js +11 -6
  15. package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -1
  16. package/dist/database/typeorm/repositories/otp-token.repository.js +2 -1
  17. package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -1
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +2 -2
  20. package/dist/auth/auth-type.enum.d.ts +0 -22
  21. package/dist/auth/auth-type.enum.js +0 -32
  22. package/dist/auth/auth-type.enum.js.map +0 -1
  23. package/dist/auth/core/cookie-namespace.resolver.d.ts +0 -8
  24. package/dist/auth/core/cookie-namespace.resolver.js +0 -48
  25. package/dist/auth/core/cookie-namespace.resolver.js.map +0 -1
  26. package/dist/auth/current-user-interface.d.ts +0 -4
  27. package/dist/auth/current-user-interface.js +0 -4
  28. package/dist/auth/current-user-interface.js.map +0 -1
  29. package/dist/auth/current-user.decorator.d.ts +0 -2
  30. package/dist/auth/current-user.decorator.js +0 -16
  31. package/dist/auth/current-user.decorator.js.map +0 -1
  32. package/dist/auth/dto/auth-response.dto.d.ts +0 -17
  33. package/dist/auth/dto/auth-response.dto.js +0 -83
  34. package/dist/auth/dto/auth-response.dto.js.map +0 -1
  35. package/dist/auth/dto/identifier-response.dto.d.ts +0 -8
  36. package/dist/auth/dto/identifier-response.dto.js +0 -46
  37. package/dist/auth/dto/identifier-response.dto.js.map +0 -1
  38. package/dist/auth/dto/login.dto.d.ts +0 -11
  39. package/dist/auth/dto/login.dto.js +0 -68
  40. package/dist/auth/dto/login.dto.js.map +0 -1
  41. package/dist/auth/dto/mfa.dto.d.ts +0 -8
  42. package/dist/auth/dto/mfa.dto.js +0 -51
  43. package/dist/auth/dto/mfa.dto.js.map +0 -1
  44. package/dist/auth/dto/oauth-provider-response.dto.d.ts +0 -5
  45. package/dist/auth/dto/oauth-provider-response.dto.js +0 -30
  46. package/dist/auth/dto/oauth-provider-response.dto.js.map +0 -1
  47. package/dist/auth/dto/refresh-token.dto.d.ts +0 -3
  48. package/dist/auth/dto/refresh-token.dto.js +0 -28
  49. package/dist/auth/dto/refresh-token.dto.js.map +0 -1
  50. package/dist/auth/dto/signup.dto.d.ts +0 -13
  51. package/dist/auth/dto/signup.dto.js +0 -70
  52. package/dist/auth/dto/signup.dto.js.map +0 -1
  53. package/dist/auth/dto/verify.dto.d.ts +0 -7
  54. package/dist/auth/dto/verify.dto.js +0 -48
  55. package/dist/auth/dto/verify.dto.js.map +0 -1
  56. package/dist/auth/entities/auth-identify.entity.d.ts +0 -33
  57. package/dist/auth/entities/auth-identify.entity.js +0 -73
  58. package/dist/auth/entities/auth-identify.entity.js.map +0 -1
  59. package/dist/auth/entities/auth.entity.d.ts +0 -45
  60. package/dist/auth/entities/auth.entity.js +0 -129
  61. package/dist/auth/entities/auth.entity.js.map +0 -1
  62. package/dist/auth/entities/base.entity.d.ts +0 -6
  63. package/dist/auth/entities/base.entity.js +0 -41
  64. package/dist/auth/entities/base.entity.js.map +0 -1
  65. package/dist/auth/entities/entities.d.ts +0 -7
  66. package/dist/auth/entities/entities.js +0 -18
  67. package/dist/auth/entities/entities.js.map +0 -1
  68. package/dist/auth/entities/mfa-method.entity.d.ts +0 -23
  69. package/dist/auth/entities/mfa-method.entity.js +0 -69
  70. package/dist/auth/entities/mfa-method.entity.js.map +0 -1
  71. package/dist/auth/entities/oauth-provider.entity.d.ts +0 -38
  72. package/dist/auth/entities/oauth-provider.entity.js +0 -88
  73. package/dist/auth/entities/oauth-provider.entity.js.map +0 -1
  74. package/dist/auth/entities/otp-token.entity.d.ts +0 -22
  75. package/dist/auth/entities/otp-token.entity.js +0 -61
  76. package/dist/auth/entities/otp-token.entity.js.map +0 -1
  77. package/dist/auth/entities/session.entity.d.ts +0 -21
  78. package/dist/auth/entities/session.entity.js +0 -71
  79. package/dist/auth/entities/session.entity.js.map +0 -1
  80. package/dist/auth/entities/session_log.entity.d.ts +0 -31
  81. package/dist/auth/entities/session_log.entity.js +0 -85
  82. package/dist/auth/entities/session_log.entity.js.map +0 -1
  83. package/dist/auth/interfaces/auth-user-service.interface.d.ts +0 -13
  84. package/dist/auth/interfaces/auth-user-service.interface.js +0 -7
  85. package/dist/auth/interfaces/auth-user-service.interface.js.map +0 -1
  86. package/dist/auth/interfaces/current-user.decorator.d.ts +0 -2
  87. package/dist/auth/interfaces/current-user.decorator.js +0 -16
  88. package/dist/auth/interfaces/current-user.decorator.js.map +0 -1
  89. package/dist/auth/jwt-payload-interface.d.ts +0 -4
  90. package/dist/auth/jwt-payload-interface.js +0 -3
  91. package/dist/auth/jwt-payload-interface.js.map +0 -1
  92. package/dist/auth/jwt.strategy.d.ts +0 -13
  93. package/dist/auth/jwt.strategy.js +0 -60
  94. package/dist/auth/jwt.strategy.js.map +0 -1
  95. package/dist/auth/strategies/company.strategy.d.ts +0 -0
  96. package/dist/auth/strategies/company.strategy.js +0 -1
  97. package/dist/auth/strategies/company.strategy.js.map +0 -1
  98. package/dist/auth/strategies/google.strategy.d.ts +0 -7
  99. package/dist/auth/strategies/google.strategy.js +0 -23
  100. package/dist/auth/strategies/google.strategy.js.map +0 -1
  101. package/dist/auth/strategies/oauth/oauth-strategy.interface.d.ts +0 -14
  102. package/dist/auth/strategies/oauth/oauth-strategy.interface.js +0 -3
  103. package/dist/auth/strategies/oauth/oauth-strategy.interface.js.map +0 -1
  104. package/dist/auth/strategies/otp.strategy.d.ts +0 -7
  105. package/dist/auth/strategies/otp.strategy.js +0 -23
  106. package/dist/auth/strategies/otp.strategy.js.map +0 -1
  107. package/dist/auth/strategies/password.strategy.d.ts +0 -14
  108. package/dist/auth/strategies/password.strategy.js +0 -130
  109. package/dist/auth/strategies/password.strategy.js.map +0 -1
  110. package/dist/migrations/auth-entities.d.ts +0 -7
  111. package/dist/migrations/auth-entities.js +0 -18
  112. package/dist/migrations/auth-entities.js.map +0 -1
  113. package/dist/migrations/auth-schema.initializer.d.ts +0 -9
  114. package/dist/migrations/auth-schema.initializer.js +0 -36
  115. package/dist/migrations/auth-schema.initializer.js.map +0 -1
  116. package/dist/migrations/auth.migration.v1.d.ts +0 -12
  117. package/dist/migrations/auth.migration.v1.js +0 -157
  118. package/dist/migrations/auth.migration.v1.js.map +0 -1
  119. package/dist/migrations/auth.migration.v2.d.ts +0 -8
  120. package/dist/migrations/auth.migration.v2.js +0 -39
  121. package/dist/migrations/auth.migration.v2.js.map +0 -1
  122. package/dist/migrations/auth.migrations.d.ts +0 -2
  123. package/dist/migrations/auth.migrations.js +0 -8
  124. package/dist/migrations/auth.migrations.js.map +0 -1
  125. package/dist/migrations/migration.runner.d.ts +0 -9
  126. package/dist/migrations/migration.runner.js +0 -67
  127. package/dist/migrations/migration.runner.js.map +0 -1
  128. package/dist/migrations/migration.service.d.ts +0 -9
  129. package/dist/migrations/migration.service.js +0 -75
  130. 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,CAAC,CAAC;QAEjE,MAAM,iBAAiB,GAAG,gCAAc,CAAC,MAAM,CAC3C,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,cAAc,CACzC,CAAC;QAEF,KAAK,MAAM,cAAc,IAAI,iBAAiB,EAAE,CAAC;YAC7C,MAAM,SAAS,GAAG,IAAI,cAAc,EAAE,CAAC;YAEvC,MAAM,WAAW,CAAC,gBAAgB,EAAE,CAAC;YAErC,IAAI,CA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