@vynelix/nestjs-multi-auth 0.3.1 → 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.
Files changed (196) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +309 -18
  3. package/dist/auth/auth.controller.d.ts +3 -2
  4. package/dist/auth/auth.controller.js +32 -5
  5. package/dist/auth/auth.controller.js.map +1 -1
  6. package/dist/auth/auth.module.js +116 -68
  7. package/dist/auth/auth.module.js.map +1 -1
  8. package/dist/auth/auth.service.d.ts +53 -26
  9. package/dist/auth/auth.service.js +239 -328
  10. package/dist/auth/auth.service.js.map +1 -1
  11. package/dist/auth/core/auth-mapper.d.ts +1 -1
  12. package/dist/auth/core/database-otp.provider.d.ts +12 -0
  13. package/dist/auth/core/database-otp.provider.js +122 -0
  14. package/dist/auth/core/database-otp.provider.js.map +1 -0
  15. package/dist/auth/dto/requests/magic-link.dto.d.ts +1 -0
  16. package/dist/auth/dto/requests/magic-link.dto.js +6 -0
  17. package/dist/auth/dto/requests/magic-link.dto.js.map +1 -1
  18. package/dist/auth/dto/requests/mfa.dto.d.ts +5 -1
  19. package/dist/auth/dto/requests/mfa.dto.js +29 -8
  20. package/dist/auth/dto/requests/mfa.dto.js.map +1 -1
  21. package/dist/auth/enums/identifier-type.enum.d.ts +11 -0
  22. package/dist/auth/enums/identifier-type.enum.js +17 -0
  23. package/dist/auth/enums/identifier-type.enum.js.map +1 -0
  24. package/dist/auth/enums/mfa-type.enum.d.ts +5 -0
  25. package/dist/auth/enums/mfa-type.enum.js +10 -0
  26. package/dist/auth/enums/mfa-type.enum.js.map +1 -0
  27. package/dist/auth/enums/otp-purpose.enum.d.ts +8 -0
  28. package/dist/auth/enums/otp-purpose.enum.js +13 -0
  29. package/dist/auth/enums/otp-purpose.enum.js.map +1 -0
  30. package/dist/auth/enums/session-event.enum.d.ts +7 -0
  31. package/dist/auth/enums/session-event.enum.js +12 -0
  32. package/dist/auth/enums/session-event.enum.js.map +1 -0
  33. package/dist/auth/interfaces/auth-module-options.interface.d.ts +36 -1
  34. package/dist/auth/interfaces/auth-notification-provider.interface.d.ts +7 -1
  35. package/dist/auth/interfaces/auth-otp-provider.interface.d.ts +60 -0
  36. package/dist/auth/interfaces/auth-otp-provider.interface.js +7 -0
  37. package/dist/auth/interfaces/auth-otp-provider.interface.js.map +1 -0
  38. package/dist/auth/interfaces/models.interface.d.ts +91 -0
  39. package/dist/auth/interfaces/models.interface.js +3 -0
  40. package/dist/auth/interfaces/models.interface.js.map +1 -0
  41. package/dist/auth/interfaces/oauth-strategy.interface.d.ts +2 -2
  42. package/dist/auth/interfaces/repositories.interface.d.ts +70 -0
  43. package/dist/auth/interfaces/repositories.interface.js +3 -0
  44. package/dist/auth/interfaces/repositories.interface.js.map +1 -0
  45. package/dist/auth/interfaces/repository-tokens.d.ts +7 -0
  46. package/dist/auth/interfaces/repository-tokens.js +11 -0
  47. package/dist/auth/interfaces/repository-tokens.js.map +1 -0
  48. package/dist/auth/interfaces/signup-event-body.interface.d.ts +1 -1
  49. package/dist/auth/strategies/local-auth.strategy.d.ts +3 -5
  50. package/dist/auth/strategies/local-auth.strategy.js +64 -99
  51. package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
  52. package/dist/auth/strategies/oauth/apple.strategy.d.ts +4 -6
  53. package/dist/auth/strategies/oauth/apple.strategy.js +57 -70
  54. package/dist/auth/strategies/oauth/apple.strategy.js.map +1 -1
  55. package/dist/auth/strategies/oauth/facebook.strategy.d.ts +4 -6
  56. package/dist/auth/strategies/oauth/facebook.strategy.js +58 -71
  57. package/dist/auth/strategies/oauth/facebook.strategy.js.map +1 -1
  58. package/dist/auth/strategies/oauth/google.strategy.d.ts +4 -6
  59. package/dist/auth/strategies/oauth/google.strategy.js +84 -155
  60. package/dist/auth/strategies/oauth/google.strategy.js.map +1 -1
  61. package/dist/auth/strategies/oauth/oauth.strategy.d.ts +2 -2
  62. package/dist/database/prisma/prisma-auth.adapter.d.ts +11 -0
  63. package/dist/database/prisma/prisma-auth.adapter.js +64 -0
  64. package/dist/database/prisma/prisma-auth.adapter.js.map +1 -0
  65. package/dist/database/prisma/repositories/auth-identifier.repository.d.ts +16 -0
  66. package/dist/database/prisma/repositories/auth-identifier.repository.js +41 -0
  67. package/dist/database/prisma/repositories/auth-identifier.repository.js.map +1 -0
  68. package/dist/database/prisma/repositories/auth.repository.d.ts +19 -0
  69. package/dist/database/prisma/repositories/auth.repository.js +49 -0
  70. package/dist/database/prisma/repositories/auth.repository.js.map +1 -0
  71. package/dist/database/prisma/repositories/index.d.ts +7 -0
  72. package/dist/database/prisma/repositories/index.js +24 -0
  73. package/dist/database/prisma/repositories/index.js.map +1 -0
  74. package/dist/database/prisma/repositories/mfa-method.repository.d.ts +11 -0
  75. package/dist/database/prisma/repositories/mfa-method.repository.js +33 -0
  76. package/dist/database/prisma/repositories/mfa-method.repository.js.map +1 -0
  77. package/dist/database/prisma/repositories/oauth-provider.repository.d.ts +14 -0
  78. package/dist/database/prisma/repositories/oauth-provider.repository.js +39 -0
  79. package/dist/database/prisma/repositories/oauth-provider.repository.js.map +1 -0
  80. package/dist/database/prisma/repositories/otp-token.repository.d.ts +13 -0
  81. package/dist/database/prisma/repositories/otp-token.repository.js +52 -0
  82. package/dist/database/prisma/repositories/otp-token.repository.js.map +1 -0
  83. package/dist/database/prisma/repositories/session-log.repository.d.ts +12 -0
  84. package/dist/database/prisma/repositories/session-log.repository.js +42 -0
  85. package/dist/database/prisma/repositories/session-log.repository.js.map +1 -0
  86. package/dist/database/prisma/repositories/session.repository.d.ts +16 -0
  87. package/dist/database/prisma/repositories/session.repository.js +41 -0
  88. package/dist/database/prisma/repositories/session.repository.js.map +1 -0
  89. package/dist/database/typeorm/entities/auth-identify.entity.d.ts +23 -0
  90. package/dist/database/typeorm/entities/auth-identify.entity.js +61 -0
  91. package/dist/database/typeorm/entities/auth-identify.entity.js.map +1 -0
  92. package/dist/database/typeorm/entities/auth.entity.d.ts +45 -0
  93. package/dist/database/typeorm/entities/auth.entity.js +129 -0
  94. package/dist/database/typeorm/entities/auth.entity.js.map +1 -0
  95. package/dist/database/typeorm/entities/base.entity.d.ts +7 -0
  96. package/dist/database/typeorm/entities/base.entity.js +44 -0
  97. package/dist/database/typeorm/entities/base.entity.js.map +1 -0
  98. package/dist/database/typeorm/entities/entities.d.ts +7 -0
  99. package/dist/database/typeorm/entities/entities.js +18 -0
  100. package/dist/database/typeorm/entities/entities.js.map +1 -0
  101. package/dist/database/typeorm/entities/mfa-method.entity.d.ts +10 -0
  102. package/dist/database/typeorm/entities/mfa-method.entity.js +47 -0
  103. package/dist/database/typeorm/entities/mfa-method.entity.js.map +1 -0
  104. package/dist/database/typeorm/entities/oauth-provider.entity.d.ts +38 -0
  105. package/dist/database/typeorm/entities/oauth-provider.entity.js +88 -0
  106. package/dist/database/typeorm/entities/oauth-provider.entity.js.map +1 -0
  107. package/dist/database/typeorm/entities/otp-token.entity.d.ts +15 -0
  108. package/dist/database/typeorm/entities/otp-token.entity.js +53 -0
  109. package/dist/database/typeorm/entities/otp-token.entity.js.map +1 -0
  110. package/dist/database/typeorm/entities/session.entity.d.ts +21 -0
  111. package/dist/database/typeorm/entities/session.entity.js +71 -0
  112. package/dist/database/typeorm/entities/session.entity.js.map +1 -0
  113. package/dist/database/typeorm/entities/session_log.entity.d.ts +25 -0
  114. package/dist/database/typeorm/entities/session_log.entity.js +78 -0
  115. package/dist/database/typeorm/entities/session_log.entity.js.map +1 -0
  116. package/dist/database/typeorm/migrations/auth-entities.d.ts +7 -0
  117. package/dist/database/typeorm/migrations/auth-entities.js +18 -0
  118. package/dist/database/typeorm/migrations/auth-entities.js.map +1 -0
  119. package/dist/database/typeorm/migrations/auth-schema.initializer.d.ts +9 -0
  120. package/dist/database/typeorm/migrations/auth-schema.initializer.js +36 -0
  121. package/dist/database/typeorm/migrations/auth-schema.initializer.js.map +1 -0
  122. package/dist/database/typeorm/migrations/auth.migration.v1.d.ts +12 -0
  123. package/dist/database/typeorm/migrations/auth.migration.v1.js +157 -0
  124. package/dist/database/typeorm/migrations/auth.migration.v1.js.map +1 -0
  125. package/dist/database/typeorm/migrations/auth.migration.v2.d.ts +8 -0
  126. package/dist/database/typeorm/migrations/auth.migration.v2.js +23 -0
  127. package/dist/database/typeorm/migrations/auth.migration.v2.js.map +1 -0
  128. package/dist/database/typeorm/migrations/auth.migrations.d.ts +2 -0
  129. package/dist/database/typeorm/migrations/auth.migrations.js +10 -0
  130. package/dist/database/typeorm/migrations/auth.migrations.js.map +1 -0
  131. package/dist/database/typeorm/migrations/migration.service.d.ts +9 -0
  132. package/dist/database/typeorm/migrations/migration.service.js +75 -0
  133. package/dist/database/typeorm/migrations/migration.service.js.map +1 -0
  134. package/dist/database/typeorm/repositories/auth-identifier.repository.d.ts +18 -0
  135. package/dist/database/typeorm/repositories/auth-identifier.repository.js +64 -0
  136. package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -0
  137. package/dist/database/typeorm/repositories/auth.repository.d.ts +21 -0
  138. package/dist/database/typeorm/repositories/auth.repository.js +71 -0
  139. package/dist/database/typeorm/repositories/auth.repository.js.map +1 -0
  140. package/dist/database/typeorm/repositories/index.d.ts +7 -0
  141. package/dist/database/typeorm/repositories/index.js +24 -0
  142. package/dist/database/typeorm/repositories/index.js.map +1 -0
  143. package/dist/database/typeorm/repositories/mfa-method.repository.d.ts +13 -0
  144. package/dist/database/typeorm/repositories/mfa-method.repository.js +46 -0
  145. package/dist/database/typeorm/repositories/mfa-method.repository.js.map +1 -0
  146. package/dist/database/typeorm/repositories/oauth-provider.repository.d.ts +16 -0
  147. package/dist/database/typeorm/repositories/oauth-provider.repository.js +52 -0
  148. package/dist/database/typeorm/repositories/oauth-provider.repository.js.map +1 -0
  149. package/dist/database/typeorm/repositories/otp-token.repository.d.ts +13 -0
  150. package/dist/database/typeorm/repositories/otp-token.repository.js +52 -0
  151. package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -0
  152. package/dist/database/typeorm/repositories/session-log.repository.d.ts +12 -0
  153. package/dist/database/typeorm/repositories/session-log.repository.js +47 -0
  154. package/dist/database/typeorm/repositories/session-log.repository.js.map +1 -0
  155. package/dist/database/typeorm/repositories/session.repository.d.ts +18 -0
  156. package/dist/database/typeorm/repositories/session.repository.js +84 -0
  157. package/dist/database/typeorm/repositories/session.repository.js.map +1 -0
  158. package/dist/database/typeorm/typeorm-auth.adapter.d.ts +2 -0
  159. package/dist/database/typeorm/typeorm-auth.adapter.js +50 -0
  160. package/dist/database/typeorm/typeorm-auth.adapter.js.map +1 -0
  161. package/dist/index.d.ts +11 -9
  162. package/dist/index.js +18 -10
  163. package/dist/index.js.map +1 -1
  164. package/dist/tsconfig.tsbuildinfo +1 -1
  165. package/fix-imports.js +46 -0
  166. package/fix-syntax.js +66 -0
  167. package/package.json +22 -20
  168. package/patch-local-specs.js +52 -0
  169. package/patch-oauth-specs.js +41 -0
  170. package/patch-specs.js +36 -0
  171. package/prompts/database_adapter.md +157 -0
  172. package/prompts/otp_provider.md +292 -0
  173. package/scratch/create-prisma-repos-final.js +139 -0
  174. package/scratch/create-prisma-repos.js +280 -0
  175. package/scratch/fix-events-spec.js +12 -0
  176. package/scratch/fix-imports.js +53 -0
  177. package/scratch/fix-prisma-interfaces.js +41 -0
  178. package/scratch/fix-prisma-interfaces2.js +36 -0
  179. package/scratch/fix-prisma-interfaces3.js +26 -0
  180. package/scratch/fix-prisma.js +28 -0
  181. package/scratch/fix-test-imports.js +51 -0
  182. package/scratch/fix-tests-advanced.js +68 -0
  183. package/scratch/fix-tests-advanced2.js +23 -0
  184. package/scratch/fix-tests-concrete.js +40 -0
  185. package/scratch/fix-tests-final.js +35 -0
  186. package/scratch/fix-tests-final2.js +28 -0
  187. package/scratch/fix-tests-final3.js +26 -0
  188. package/scratch/fix-tests-methods.js +40 -0
  189. package/scratch/fix-tests-proxy.js +67 -0
  190. package/scratch/fix-tests-types.js +24 -0
  191. package/scratch/rewrite-tests.js +110 -0
  192. package/tsc_errors.txt +60 -0
  193. package/tsc_errors2.txt +93 -0
  194. package/tmp-cv-test/package-lock.json +0 -250
  195. package/tmp-cv-test/package.json +0 -17
  196. package/tmp-cv-test/test.ts +0 -11
@@ -0,0 +1,40 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Replace the proxy function with just a standard mock object creator
12
+ const concreteCode = `
13
+ const createMockRepo = () => ({
14
+ findOne: jest.fn(),
15
+ create: jest.fn(),
16
+ save: jest.fn(),
17
+ delete: jest.fn(),
18
+ update: jest.fn(),
19
+ findWithAuthByProviderUserId: jest.fn(),
20
+ findWithAuthByValue: jest.fn(),
21
+ findByUidAndEnabled: jest.fn(),
22
+ findAllByUid: jest.fn(),
23
+ findByUid: jest.fn(),
24
+ findLatestUnusedByPurpose: jest.fn(),
25
+ issue: jest.fn(),
26
+ verify: jest.fn(),
27
+ resend: jest.fn(),
28
+ deleteByUid: jest.fn(),
29
+ findById: jest.fn(),
30
+ findByUidAndNamespace: jest.fn(),
31
+ findByStrategyAndValue: jest.fn()
32
+ });
33
+ `;
34
+
35
+ content = content.replace(/const createMockRepo = \(\) => new Proxy\(\{\}, \{[\s\S]*?\}\);/g, concreteCode);
36
+
37
+ fs.writeFileSync(filePath, content, 'utf8');
38
+ });
39
+
40
+ console.log('Replaced proxy with concrete objects.');
@@ -0,0 +1,35 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Replace Repository<Entity> with any
12
+ content = content.replace(/let (authRepo|oauthProviderRepo|identifierRepo|otpRepo|sessionRepo|mfaRepo|sessionLogRepo):\s*Repository<[^>]+>;/g, "let $1: any;");
13
+
14
+ // Fix mock dependencies in Test.createTestingModule
15
+ // If AUTH_REPOSITORY_TOKEN is provided but AUTH_IDENTIFIER_REPOSITORY_TOKEN is missing
16
+ if (content.includes('AUTH_REPOSITORY_TOKEN') && !content.includes('AUTH_IDENTIFIER_REPOSITORY_TOKEN')) {
17
+ content = content.replace(/\{\s*provide:\s*AUTH_REPOSITORY_TOKEN,\s*useValue:\s*([^ }]+)\s*\}/,
18
+ "{ provide: AUTH_REPOSITORY_TOKEN, useValue: $1 }, { provide: AUTH_IDENTIFIER_REPOSITORY_TOKEN, useValue: { findWithAuthByValue: jest.fn(), save: jest.fn() } }");
19
+ content = content.replace(/\{\s*provide:\s*AUTH_REPOSITORY_TOKEN,\s*useClass:\s*([^ }]+)\s*\}/,
20
+ "{ provide: AUTH_REPOSITORY_TOKEN, useClass: $1 }, { provide: AUTH_IDENTIFIER_REPOSITORY_TOKEN, useValue: { findWithAuthByValue: jest.fn(), save: jest.fn() } }");
21
+ }
22
+
23
+ // Same for AUTH_OTP_PROVIDER
24
+ if (content.includes('AUTH_REPOSITORY_TOKEN') && !content.includes('AUTH_OTP_PROVIDER')) {
25
+ content = content.replace(/\{\s*provide:\s*AUTH_REPOSITORY_TOKEN,\s*useValue:\s*([^ }]+)\s*\}/,
26
+ "{ provide: AUTH_REPOSITORY_TOKEN, useValue: $1 }, { provide: 'AUTH_OTP_PROVIDER', useValue: { issue: jest.fn(), verify: jest.fn(), resend: jest.fn() } }");
27
+ }
28
+
29
+ // Remove `import { Repository } from 'typeorm';` if present
30
+ content = content.replace(/import\s*{\s*Repository\s*}\s*from\s*['"]typeorm['"];?\n?/g, '');
31
+
32
+ fs.writeFileSync(filePath, content, 'utf8');
33
+ });
34
+
35
+ console.log('Fixed dependencies');
@@ -0,0 +1,28 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ if (file === 'repro-phone-login.spec.ts' || file === 'linking.spec.ts') {
12
+ if (!content.includes("import { IdentifierType }")) {
13
+ content = "import { IdentifierType } from '../../enums/identifier-type.enum';\n" + content;
14
+ }
15
+ }
16
+
17
+ if (file === 'local-auth.strategy.spec.ts') {
18
+ // Expected 3 arguments but got 4.
19
+ // The arguments are: authRepo, identifierRepo, options.
20
+ // Previously maybe it had something else.
21
+ // Let's replace the constructor call to pass only 3
22
+ content = content.replace(/new LocalAuthStrategy\(\s*mockAuthRepo as any,\s*mockIdentifierRepo as any,\s*([^,]+),\s*([^)]+)\)/g, "new LocalAuthStrategy(mockAuthRepo as any, mockIdentifierRepo as any, $2)");
23
+ }
24
+
25
+ fs.writeFileSync(filePath, content, 'utf8');
26
+ });
27
+
28
+ console.log('Fixed final TS errors.');
@@ -0,0 +1,26 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Fix wrong import path for IdentifierType
12
+ content = content.replace(/import \{ IdentifierType \} from '\.\.\/\.\.\/enums\/identifier-type\.enum';/g, "import { IdentifierType } from '../enums/identifier-type.enum';");
13
+
14
+ // Fix LocalAuthStrategy arguments
15
+ if (file === 'local-auth.strategy.spec.ts') {
16
+ content = content.replace(/new LocalAuthStrategy\([\s\S]*?\)/g, "new LocalAuthStrategy(mockAuthRepo as any, mockIdentifierRepo as any, { allowedPhonePrefixes: ['+1'] } as any)");
17
+ // Restore the options passed explicitly
18
+ content = content.replace(/new LocalAuthStrategy\(mockAuthRepo as any, mockIdentifierRepo as any, \{ allowedPhonePrefixes: \['\+1'\] \} as any\)/g, "new LocalAuthStrategy(mockAuthRepo as any, mockIdentifierRepo as any, { allowedPhonePrefixes: ['+1'] } as any)");
19
+ // But wait, there are multiple tests that pass different options!
20
+ // Let me just manually edit local-auth.strategy.spec.ts
21
+ }
22
+
23
+ fs.writeFileSync(filePath, content, 'utf8');
24
+ });
25
+
26
+ console.log('Fixed imports again.');
@@ -0,0 +1,40 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Add all new methods to mockRepo
12
+ content = content.replace(/const mockRepo = \{\s*findOne: jest\.fn\(\),\s*create: jest\.fn\(\),\s*save: jest\.fn\(\),\s*delete: jest\.fn\(\),\s*\};/g,
13
+ `const mockRepo = {
14
+ findOne: jest.fn(),
15
+ create: jest.fn(),
16
+ save: jest.fn(),
17
+ delete: jest.fn(),
18
+ findWithAuthByProviderUserId: jest.fn(),
19
+ findWithAuthByValue: jest.fn(),
20
+ findByUidAndEnabled: jest.fn(),
21
+ findAllByUid: jest.fn(),
22
+ findLatestUnusedByPurpose: jest.fn()
23
+ };`);
24
+
25
+ content = content.replace(/let mockRepo: any;/g, `let mockRepo: any = {
26
+ findOne: jest.fn(),
27
+ create: jest.fn(),
28
+ save: jest.fn(),
29
+ delete: jest.fn(),
30
+ findWithAuthByProviderUserId: jest.fn(),
31
+ findWithAuthByValue: jest.fn(),
32
+ findByUidAndEnabled: jest.fn(),
33
+ findAllByUid: jest.fn(),
34
+ findLatestUnusedByPurpose: jest.fn()
35
+ };`);
36
+
37
+ fs.writeFileSync(filePath, content, 'utf8');
38
+ });
39
+
40
+ console.log('Fixed mockRepo methods.');
@@ -0,0 +1,67 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Replace all the huge mockRepo objects with a simple proxy
12
+ content = content.replace(/const mockRepo = \{[\s\S]*?\};\n/g, "");
13
+ content = content.replace(/let mockRepo: any = \{[\s\S]*?\};\n/g, "");
14
+
15
+ const proxyCode = `
16
+ const createMockRepo = () => new Proxy({}, {
17
+ get: (target, prop) => {
18
+ if (prop === 'then') return undefined; // Promise resolution
19
+ if (typeof prop === 'symbol') return undefined;
20
+ if (!target[prop]) {
21
+ target[prop] = jest.fn();
22
+ }
23
+ return target[prop];
24
+ }
25
+ });
26
+ let mockRepo: any = createMockRepo();
27
+ `;
28
+
29
+ // We need to insert this proxyCode after the imports.
30
+ // Find the last import
31
+ const lastImportIndex = content.lastIndexOf('import ');
32
+ const nextLineIndex = content.indexOf('\n', lastImportIndex) + 1;
33
+
34
+ if (!content.includes('createMockRepo')) {
35
+ content = content.slice(0, nextLineIndex) + proxyCode + content.slice(nextLineIndex);
36
+ }
37
+
38
+ // Also fix mockIdentifierRepo, mockOtpProvider, mockSessionRepo, mockAuthRepo, etc if they exist
39
+ // We can just replace their declarations with `createMockRepo()`
40
+ const repoNames = [
41
+ 'mockIdentifierRepo',
42
+ 'mockOtpProvider',
43
+ 'mockSessionRepo',
44
+ 'mockSessionLogRepo',
45
+ 'mockAuthRepo',
46
+ 'mockOtpRepo',
47
+ 'mockMfaRepo',
48
+ 'oauthProviderRepo',
49
+ 'identifierRepo',
50
+ 'authRepo',
51
+ 'sessionRepo'
52
+ ];
53
+
54
+ repoNames.forEach(repoName => {
55
+ // Replace const mockRepoName = { ... };
56
+ const regexConst = new RegExp(`const\\s+${repoName}\\s*=\\s*\\{[\\s\\S]*?\\};`, 'g');
57
+ content = content.replace(regexConst, `const ${repoName} = createMockRepo();`);
58
+
59
+ // Replace let mockRepoName: any;
60
+ const regexLet = new RegExp(`let\\s+${repoName}:\\s*any;`, 'g');
61
+ content = content.replace(regexLet, `let ${repoName}: any = createMockRepo();`);
62
+ });
63
+
64
+ fs.writeFileSync(filePath, content, 'utf8');
65
+ });
66
+
67
+ console.log('Added generic Proxy mocks.');
@@ -0,0 +1,24 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // Fix type inference for createMockRepo()
12
+ content = content.replace(/const\s+(mock[a-zA-Z]+|oauthProviderRepo|identifierRepo|authRepo|sessionRepo)\s*=\s*createMockRepo\(\);/g, "const $1: any = createMockRepo();");
13
+
14
+ // Fix IdentifierType missing import in linking.spec.ts
15
+ if (file === 'linking.spec.ts' && !content.includes('IdentifierType')) {
16
+ content = "import { IdentifierType } from '../../enums/identifier-type.enum';\n" + content;
17
+ }
18
+
19
+ // Same for any other missing enums, we'll see if it complains.
20
+
21
+ fs.writeFileSync(filePath, content, 'utf8');
22
+ });
23
+
24
+ console.log('Fixed proxy types.');
@@ -0,0 +1,110 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const specsDir = path.join(__dirname, '../src/auth/specs');
5
+ const files = fs.readdirSync(specsDir).filter(f => f.endsWith('.ts'));
6
+
7
+ files.forEach(file => {
8
+ const filePath = path.join(specsDir, file);
9
+ let content = fs.readFileSync(filePath, 'utf8');
10
+
11
+ // 1. Remove getRepositoryToken import
12
+ content = content.replace(/import\s*{\s*getRepositoryToken\s*}\s*from\s*['"]@nestjs\/typeorm['"];?\n?/g, '');
13
+
14
+ // Remove the old Entity imports that were used as values
15
+ content = content.replace(/import\s*{\s*Auth\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
16
+ content = content.replace(/import\s*{\s*Session\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
17
+ content = content.replace(/import\s*{\s*OtpToken\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
18
+ content = content.replace(/import\s*{\s*MfaMethod\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
19
+ content = content.replace(/import\s*{\s*SessionLog\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
20
+ content = content.replace(/import\s*{\s*AuthIdentifier\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
21
+ content = content.replace(/import\s*{\s*OAuthProvider\s*}\s*from\s*['"]\.\.\/interfaces\/models\.interface['"];?\n?/g, '');
22
+
23
+ // 2. Replace token usage
24
+ content = content.replace(/getRepositoryToken\(\s*Auth\s*\)/g, 'AUTH_REPOSITORY_TOKEN');
25
+ content = content.replace(/getRepositoryToken\(\s*Session\s*\)/g, 'SESSION_REPOSITORY_TOKEN');
26
+ content = content.replace(/getRepositoryToken\(\s*OtpToken\s*\)/g, 'AUTH_OTP_PROVIDER');
27
+ content = content.replace(/getRepositoryToken\(\s*MfaMethod\s*\)/g, 'MFA_METHOD_REPOSITORY_TOKEN');
28
+ content = content.replace(/getRepositoryToken\(\s*SessionLog\s*\)/g, 'SESSION_LOG_REPOSITORY_TOKEN');
29
+ content = content.replace(/getRepositoryToken\(\s*AuthIdentifier\s*\)/g, 'AUTH_IDENTIFIER_REPOSITORY_TOKEN');
30
+ content = content.replace(/getRepositoryToken\(\s*OAuthProvider\s*\)/g, 'OAUTH_PROVIDER_REPOSITORY_TOKEN');
31
+
32
+ // 3. Rename mockOtpRepo to mockOtpProvider in setups
33
+ content = content.replace(/mockOtpRepo/g, 'mockOtpProvider');
34
+
35
+ // If the file has mockOtpProvider = { ... }, we need to change it to have issue, verify, resend.
36
+ content = content.replace(/const mockOtpProvider = {[\s\S]*?};/g, (match) => {
37
+ if (match.includes('issue:') && match.includes('verify:')) return match; // Already fixed
38
+ return `const mockOtpProvider = {
39
+ issue: jest.fn(),
40
+ verify: jest.fn(),
41
+ resend: jest.fn(),
42
+ };`;
43
+ });
44
+
45
+ // If the file has entity === Auth, etc inside a factory
46
+ content = content.replace(/entity\s*===\s*Auth/g, "entity === AUTH_REPOSITORY_TOKEN");
47
+ content = content.replace(/entity\s*===\s*OAuthProvider/g, "entity === OAUTH_PROVIDER_REPOSITORY_TOKEN");
48
+ content = content.replace(/entity\s*===\s*AuthIdentifier/g, "entity === AUTH_IDENTIFIER_REPOSITORY_TOKEN");
49
+
50
+ // 4. Update assertions: expect(mockOtpProvider.save) -> expect(mockOtpProvider.issue)
51
+ content = content.replace(/expect\(mockOtpProvider\.save\)/g, 'expect(mockOtpProvider.issue)');
52
+ content = content.replace(/expect\(mockOtpProvider\.create\)/g, 'expect(mockOtpProvider.issue)');
53
+
54
+ // 5. Add required imports for tokens
55
+ const tokenImports = [];
56
+ if (content.includes('AUTH_REPOSITORY_TOKEN')) tokenImports.push('AUTH_REPOSITORY_TOKEN');
57
+ if (content.includes('SESSION_REPOSITORY_TOKEN')) tokenImports.push('SESSION_REPOSITORY_TOKEN');
58
+ if (content.includes('MFA_METHOD_REPOSITORY_TOKEN')) tokenImports.push('MFA_METHOD_REPOSITORY_TOKEN');
59
+ if (content.includes('SESSION_LOG_REPOSITORY_TOKEN')) tokenImports.push('SESSION_LOG_REPOSITORY_TOKEN');
60
+ if (content.includes('AUTH_IDENTIFIER_REPOSITORY_TOKEN')) tokenImports.push('AUTH_IDENTIFIER_REPOSITORY_TOKEN');
61
+ if (content.includes('OAUTH_PROVIDER_REPOSITORY_TOKEN')) tokenImports.push('OAUTH_PROVIDER_REPOSITORY_TOKEN');
62
+
63
+ if (tokenImports.length > 0) {
64
+ const importStatement = `import { ${tokenImports.join(', ')} } from '../interfaces/repository-tokens';\n`;
65
+ if (!content.includes(importStatement)) {
66
+ content = importStatement + content;
67
+ }
68
+ }
69
+
70
+ if (content.includes('AUTH_OTP_PROVIDER')) {
71
+ const otpImport = `import { AUTH_OTP_PROVIDER } from '../interfaces/auth-otp-provider.interface';\n`;
72
+ if (!content.includes(otpImport)) {
73
+ content = otpImport + content;
74
+ }
75
+ }
76
+
77
+ // Handle specific AuthService mock instantiation replacements
78
+ if (file === 'auth.service.spec.ts') {
79
+ content = content.replace(/new AuthService\(\s*mockJwtService as any,\s*mockPasswordStrategy as any,\s*mockOAuthStrategy as any,\s*mockSessionRepo as any,\s*mockSessionLogRepo as any,\s*mockAuthRepo as any,\s*mockOtpProvider as any,\s*mockMfaRepo as any,\s*([^)]+)\);/g,
80
+ `new AuthService(
81
+ mockJwtService as any,
82
+ mockPasswordStrategy as any,
83
+ mockOAuthStrategy as any,
84
+ mockSessionRepo as any,
85
+ mockSessionLogRepo as any,
86
+ mockAuthRepo as any,
87
+ mockIdentifierRepo as any,
88
+ mockOtpProvider as any,
89
+ mockMfaRepo as any,
90
+ $1
91
+ );`);
92
+
93
+ if (!content.includes('mockIdentifierRepo')) {
94
+ content = content.replace('const mockAuthRepo = {', `const mockIdentifierRepo = { findWithAuthByValue: jest.fn(), save: jest.fn() };\n const mockAuthRepo = {`);
95
+ }
96
+
97
+ // Add AUTH_IDENTIFIER_REPOSITORY_TOKEN to providers if missing
98
+ if (!content.includes('{ provide: AUTH_IDENTIFIER_REPOSITORY_TOKEN')) {
99
+ content = content.replace(/\{ provide: AUTH_REPOSITORY_TOKEN, useValue: mockAuthRepo \},/g, `{ provide: AUTH_REPOSITORY_TOKEN, useValue: mockAuthRepo },\n { provide: AUTH_IDENTIFIER_REPOSITORY_TOKEN, useValue: mockIdentifierRepo },`);
100
+ }
101
+
102
+ // Fix the otpProvider.verify expectation in verifyCode test
103
+ content = content.replace(/mockOtpProvider\.findOne\.mockResolvedValue\({\s*codeHash: hash,\s*expiresAt: new Date\(Date\.now\(\) \+ 15 \* 60 \* 1000\),[\s\S]*?requestUserId: uid,\s*}\);/g, `mockOtpProvider.verify.mockResolvedValue({ success: true, authId: 1 });`);
104
+ content = content.replace(/mockOtpProvider\.findOne\.mockResolvedValue\({\s*createdAt: new Date\(Date\.now\(\) - 30 \* 1000\),[\s\S]*?}\);/g, `mockOtpProvider.resend.mockResolvedValue({ handledDelivery: true });`);
105
+ }
106
+
107
+ fs.writeFileSync(filePath, content, 'utf8');
108
+ });
109
+
110
+ console.log('Done rewriting tests');
package/tsc_errors.txt ADDED
@@ -0,0 +1,60 @@
1
+ src/auth/auth.controller.ts(35,22): error TS2307: Cannot find module './entities/auth.entity' or its corresponding type declarations.
2
+ src/auth/auth.controller.ts(233,61): error TS2741: Property 'email' is missing in type '{ token: string; }' but required in type 'MagicLinkVerifyDto'.
3
+ src/auth/auth.module.ts(18,39): error TS2307: Cannot find module '../migrations/auth-schema.initializer' or its corresponding type declarations.
4
+ src/auth/auth.module.ts(19,38): error TS2307: Cannot find module '../migrations/migration.service' or its corresponding type declarations.
5
+ src/auth/auth.module.ts(80,39): error TS2339: Property 'register' does not exist on type 'typeof TypeOrmAuthAdapter'.
6
+ src/auth/auth.service.ts(32,22): error TS2307: Cannot find module './entities/auth.entity' or its corresponding type declarations.
7
+ src/auth/auth.service.ts(33,25): error TS2307: Cannot find module './entities/session.entity' or its corresponding type declarations.
8
+ src/auth/auth.service.ts(34,38): error TS2307: Cannot find module './entities/otp-token.entity' or its corresponding type declarations.
9
+ src/auth/auth.service.ts(35,36): error TS2307: Cannot find module './entities/mfa-method.entity' or its corresponding type declarations.
10
+ src/auth/auth.service.ts(47,48): error TS2307: Cannot find module './entities/auth-identify.entity' or its corresponding type declarations.
11
+ src/auth/auth.service.ts(49,42): error TS2307: Cannot find module './entities/session_log.entity' or its corresponding type declarations.
12
+ src/auth/auth.service.ts(175,36): error TS2345: Argument of type 'Promise<SessionLog>' is not assignable to parameter of type 'SessionLog'.
13
+ Type 'Promise<SessionLog>' is missing the following properties from type 'SessionLog': id, sessionId, uid, event, and 2 more.
14
+ src/auth/auth.service.ts(279,42): error TS2339: Property 'findOne' does not exist on type 'MfaMethodRepository'.
15
+ src/auth/auth.service.ts(356,42): error TS2339: Property 'findOne' does not exist on type 'MfaMethodRepository'.
16
+ src/auth/auth.service.ts(714,28): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
17
+ src/auth/auth.service.ts(727,32): error TS2345: Argument of type '{ uid: string; }' is not assignable to parameter of type 'string'.
18
+ src/auth/auth.service.ts(734,16): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
19
+ src/auth/auth.service.ts(893,16): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
20
+ src/auth/core/auth-mapper.ts(3,22): error TS2307: Cannot find module '../entities/auth.entity' or its corresponding type declarations.
21
+ src/auth/dto/requests/mfa.dto.ts(3,25): error TS2307: Cannot find module '../../entities/mfa-method.entity' or its corresponding type declarations.
22
+ src/auth/interfaces/oauth-strategy.interface.ts(3,22): error TS2307: Cannot find module '../entities/auth.entity' or its corresponding type declarations.
23
+ src/auth/interfaces/oauth-strategy.interface.ts(4,32): error TS2307: Cannot find module '../entities/auth-identify.entity' or its corresponding type declarations.
24
+ src/auth/interfaces/signup-event-body.interface.ts(2,32): error TS2307: Cannot find module '../entities/auth-identify.entity' or its corresponding type declarations.
25
+ src/auth/strategies/local-auth.strategy.ts(17,22): error TS2307: Cannot find module '../entities/auth.entity' or its corresponding type declarations.
26
+ src/auth/strategies/local-auth.strategy.ts(21,8): error TS2307: Cannot find module '../entities/auth-identify.entity' or its corresponding type declarations.
27
+ src/auth/strategies/oauth/apple.strategy.ts(6,22): error TS2307: Cannot find module '../../entities/auth.entity' or its corresponding type declarations.
28
+ src/auth/strategies/oauth/apple.strategy.ts(7,31): error TS2307: Cannot find module '../../entities/oauth-provider.entity' or its corresponding type declarations.
29
+ src/auth/strategies/oauth/apple.strategy.ts(8,66): error TS2307: Cannot find module '../../entities/auth-identify.entity' or its corresponding type declarations.
30
+ src/auth/strategies/oauth/facebook.strategy.ts(6,22): error TS2307: Cannot find module '../../entities/auth.entity' or its corresponding type declarations.
31
+ src/auth/strategies/oauth/facebook.strategy.ts(7,31): error TS2307: Cannot find module '../../entities/oauth-provider.entity' or its corresponding type declarations.
32
+ src/auth/strategies/oauth/facebook.strategy.ts(8,66): error TS2307: Cannot find module '../../entities/auth-identify.entity' or its corresponding type declarations.
33
+ src/auth/strategies/oauth/google.strategy.ts(6,22): error TS2307: Cannot find module '../../entities/auth.entity' or its corresponding type declarations.
34
+ src/auth/strategies/oauth/google.strategy.ts(7,31): error TS2307: Cannot find module '../../entities/oauth-provider.entity' or its corresponding type declarations.
35
+ src/auth/strategies/oauth/google.strategy.ts(8,66): error TS2307: Cannot find module '../../entities/auth-identify.entity' or its corresponding type declarations.
36
+ src/auth/strategies/oauth/oauth.strategy.ts(4,22): error TS2307: Cannot find module '../../entities/auth.entity' or its corresponding type declarations.
37
+ src/auth/strategies/oauth/oauth.strategy.ts(5,32): error TS2307: Cannot find module '../../entities/auth-identify.entity' or its corresponding type declarations.
38
+ src/database/typeorm/migrations/auth-entities.ts(1,22): error TS2307: Cannot find module '../auth/entities/auth.entity' or its corresponding type declarations.
39
+ src/database/typeorm/migrations/auth-entities.ts(2,32): error TS2307: Cannot find module '../auth/entities/auth-identify.entity' or its corresponding type declarations.
40
+ src/database/typeorm/migrations/auth-entities.ts(3,31): error TS2307: Cannot find module '../auth/entities/oauth-provider.entity' or its corresponding type declarations.
41
+ src/database/typeorm/migrations/auth-entities.ts(4,27): error TS2307: Cannot find module '../auth/entities/mfa-method.entity' or its corresponding type declarations.
42
+ src/database/typeorm/migrations/auth-entities.ts(5,26): error TS2307: Cannot find module '../auth/entities/otp-token.entity' or its corresponding type declarations.
43
+ src/database/typeorm/migrations/auth-entities.ts(6,25): error TS2307: Cannot find module '../auth/entities/session.entity' or its corresponding type declarations.
44
+ src/database/typeorm/migrations/auth-schema.initializer.ts(3,37): error TS2307: Cannot find module '../auth/auth.module' or its corresponding type declarations.
45
+ src/database/typeorm/migrations/auth-schema.initializer.ts(4,35): error TS2307: Cannot find module '../auth/interfaces/auth-module-options.interface' or its corresponding type declarations.
46
+ src/database/typeorm/repositories/mfa-method.repository.ts(16,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
47
+ src/database/typeorm/repositories/mfa-method.repository.ts(20,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
48
+ src/database/typeorm/repositories/mfa-method.repository.ts(24,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
49
+ src/database/typeorm/repositories/otp-token.repository.ts(16,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
50
+ src/database/typeorm/repositories/otp-token.repository.ts(20,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
51
+ src/database/typeorm/repositories/otp-token.repository.ts(27,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
52
+ src/index.ts(9,15): error TS2307: Cannot find module './auth/entities/auth.entity' or its corresponding type declarations.
53
+ src/index.ts(10,15): error TS2307: Cannot find module './auth/entities/session.entity' or its corresponding type declarations.
54
+ src/index.ts(11,15): error TS2307: Cannot find module './auth/entities/mfa-method.entity' or its corresponding type declarations.
55
+ src/index.ts(12,15): error TS2307: Cannot find module './auth/entities/oauth-provider.entity' or its corresponding type declarations.
56
+ src/index.ts(13,15): error TS2307: Cannot find module './auth/entities/otp-token.entity' or its corresponding type declarations.
57
+ src/index.ts(14,15): error TS2307: Cannot find module './auth/entities/base.entity' or its corresponding type declarations.
58
+ src/index.ts(20,15): error TS2307: Cannot find module './migrations/auth-schema.initializer' or its corresponding type declarations.
59
+ src/index.ts(21,15): error TS2307: Cannot find module './migrations/migration.service' or its corresponding type declarations.
60
+ src/index.ts(23,15): error TS2307: Cannot find module './auth/entities/entities' or its corresponding type declarations.
@@ -0,0 +1,93 @@
1
+ src/auth/auth.controller.ts(233,61): error TS2741: Property 'email' is missing in type '{ token: string; }' but required in type 'MagicLinkVerifyDto'.
2
+ src/auth/auth.module.ts(18,39): error TS2307: Cannot find module '../migrations/auth-schema.initializer' or its corresponding type declarations.
3
+ src/auth/auth.module.ts(19,38): error TS2307: Cannot find module '../migrations/migration.service' or its corresponding type declarations.
4
+ src/auth/auth.module.ts(80,39): error TS2339: Property 'register' does not exist on type 'typeof TypeOrmAuthAdapter'.
5
+ src/auth/auth.service.ts(34,20): error TS2459: Module '"./interfaces/models.interface"' declares 'OtpPurpose' locally, but it is not exported.
6
+ src/auth/auth.service.ts(35,21): error TS2459: Module '"./interfaces/models.interface"' declares 'MfaType' locally, but it is not exported.
7
+ src/auth/auth.service.ts(47,26): error TS2459: Module '"./interfaces/models.interface"' declares 'IdentifierType' locally, but it is not exported.
8
+ src/auth/auth.service.ts(49,10): error TS2459: Module '"./interfaces/models.interface"' declares 'SessionEvent' locally, but it is not exported.
9
+ src/auth/auth.service.ts(123,7): error TS2740: Type 'Promise<Session>' is missing the following properties from type 'Session': id, uid, refreshTokenHash, expiresAt, and 2 more.
10
+ src/auth/auth.service.ts(175,36): error TS2345: Argument of type 'Promise<SessionLog>' is not assignable to parameter of type 'SessionLog'.
11
+ Type 'Promise<SessionLog>' is missing the following properties from type 'SessionLog': id, sessionId, uid, event, and 2 more.
12
+ src/auth/auth.service.ts(279,42): error TS2339: Property 'findOne' does not exist on type 'MfaMethodRepository'.
13
+ src/auth/auth.service.ts(356,42): error TS2339: Property 'findOne' does not exist on type 'MfaMethodRepository'.
14
+ src/auth/auth.service.ts(714,28): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
15
+ src/auth/auth.service.ts(727,32): error TS2345: Argument of type '{ uid: string; }' is not assignable to parameter of type 'string'.
16
+ src/auth/auth.service.ts(734,16): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
17
+ src/auth/auth.service.ts(893,16): error TS2339: Property 'otpRepo' does not exist on type 'AuthService'.
18
+ src/auth/auth.service.ts(926,89): error TS2693: 'Session' only refers to a type, but is being used as a value here.
19
+ src/auth/auth.service.ts(928,48): error TS2693: 'Session' only refers to a type, but is being used as a value here.
20
+ src/auth/auth.service.ts(941,44): error TS2693: 'SessionLog' only refers to a type, but is being used as a value here.
21
+ src/auth/dto/requests/mfa.dto.ts(3,10): error TS2459: Module '"../../interfaces/models.interface"' declares 'MfaType' locally, but it is not exported.
22
+ src/auth/strategies/local-auth.strategy.ts(20,3): error TS2459: Module '"../interfaces/models.interface"' declares 'IdentifierType' locally, but it is not exported.
23
+ src/auth/strategies/local-auth.strategy.ts(33,23): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
24
+ src/auth/strategies/local-auth.strategy.ts(34,23): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
25
+ src/auth/strategies/local-auth.strategy.ts(107,5): error TS2322: Type '{ auth: ObjectLiteral; identifier: any; }' is not assignable to type '{ auth: Auth; identifier?: AuthIdentifier; }'.
26
+ Types of property 'auth' are incompatible.
27
+ Type 'ObjectLiteral' is missing the following properties from type 'Auth': uid, strategy, isPrimary, isVerified, and 5 more.
28
+ src/auth/strategies/local-auth.strategy.ts(108,56): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
29
+ src/auth/strategies/local-auth.strategy.ts(109,46): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
30
+ src/auth/strategies/local-auth.strategy.ts(156,11): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
31
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
32
+ src/auth/strategies/local-auth.strategy.ts(165,11): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
33
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
34
+ src/auth/strategies/local-auth.strategy.ts(174,11): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
35
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
36
+ src/auth/strategies/oauth/apple.strategy.ts(8,26): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierSource' locally, but it is not exported.
37
+ src/auth/strategies/oauth/apple.strategy.ts(8,44): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierType' locally, but it is not exported.
38
+ src/auth/strategies/oauth/apple.strategy.ts(22,27): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
39
+ src/auth/strategies/oauth/apple.strategy.ts(23,27): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
40
+ src/auth/strategies/oauth/apple.strategy.ts(91,9): error TS2322: Type '{ auth: ObjectLiteral; identifier: any; }' is not assignable to type '{ auth: Auth; identifier?: AuthIdentifier; }'.
41
+ Types of property 'auth' are incompatible.
42
+ Type 'ObjectLiteral' is missing the following properties from type 'Auth': uid, strategy, isPrimary, isVerified, and 5 more.
43
+ src/auth/strategies/oauth/apple.strategy.ts(92,52): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
44
+ src/auth/strategies/oauth/apple.strategy.ts(93,61): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
45
+ src/auth/strategies/oauth/apple.strategy.ts(94,58): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
46
+ src/auth/strategies/oauth/apple.strategy.ts(129,21): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
47
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
48
+ src/auth/strategies/oauth/facebook.strategy.ts(8,26): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierSource' locally, but it is not exported.
49
+ src/auth/strategies/oauth/facebook.strategy.ts(8,44): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierType' locally, but it is not exported.
50
+ src/auth/strategies/oauth/facebook.strategy.ts(18,27): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
51
+ src/auth/strategies/oauth/facebook.strategy.ts(19,27): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
52
+ src/auth/strategies/oauth/facebook.strategy.ts(62,9): error TS2322: Type '{ auth: ObjectLiteral; identifier: any; }' is not assignable to type '{ auth: Auth; identifier?: AuthIdentifier; }'.
53
+ Types of property 'auth' are incompatible.
54
+ Type 'ObjectLiteral' is missing the following properties from type 'Auth': uid, strategy, isPrimary, isVerified, and 5 more.
55
+ src/auth/strategies/oauth/facebook.strategy.ts(63,52): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
56
+ src/auth/strategies/oauth/facebook.strategy.ts(64,61): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
57
+ src/auth/strategies/oauth/facebook.strategy.ts(65,58): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
58
+ src/auth/strategies/oauth/facebook.strategy.ts(100,21): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
59
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
60
+ src/auth/strategies/oauth/google.strategy.ts(8,26): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierSource' locally, but it is not exported.
61
+ src/auth/strategies/oauth/google.strategy.ts(8,44): error TS2459: Module '"../../interfaces/models.interface"' declares 'IdentifierType' locally, but it is not exported.
62
+ src/auth/strategies/oauth/google.strategy.ts(22,23): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
63
+ src/auth/strategies/oauth/google.strategy.ts(23,23): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
64
+ src/auth/strategies/oauth/google.strategy.ts(54,5): error TS2322: Type '{ auth: ObjectLiteral; identifier: any; }' is not assignable to type '{ auth: Auth; identifier?: AuthIdentifier; }'.
65
+ Types of property 'auth' are incompatible.
66
+ Type 'ObjectLiteral' is missing the following properties from type 'Auth': uid, strategy, isPrimary, isVerified, and 5 more.
67
+ src/auth/strategies/oauth/google.strategy.ts(55,46): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
68
+ src/auth/strategies/oauth/google.strategy.ts(56,55): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
69
+ src/auth/strategies/oauth/google.strategy.ts(57,52): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
70
+ src/auth/strategies/oauth/google.strategy.ts(92,11): error TS2345: Argument of type 'ObjectLiteral' is not assignable to parameter of type 'AuthIdentifier'.
71
+ Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
72
+ src/auth/strategies/oauth/google.strategy.ts(161,47): error TS2693: 'OAuthProvider' only refers to a type, but is being used as a value here.
73
+ src/auth/strategies/oauth/google.strategy.ts(162,46): error TS2693: 'Auth' only refers to a type, but is being used as a value here.
74
+ src/auth/strategies/oauth/google.strategy.ts(163,52): error TS2693: 'AuthIdentifier' only refers to a type, but is being used as a value here.
75
+ src/auth/strategies/oauth/google.strategy.ts(203,9): error TS2740: Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
76
+ src/auth/strategies/oauth/google.strategy.ts(211,11): error TS2740: Type 'ObjectLiteral' is missing the following properties from type 'AuthIdentifier': type, value, isVerified, source, and 4 more.
77
+ src/database/typeorm/migrations/auth-schema.initializer.ts(3,37): error TS2307: Cannot find module '../auth/auth.module' or its corresponding type declarations.
78
+ src/database/typeorm/migrations/auth-schema.initializer.ts(4,35): error TS2307: Cannot find module '../auth/interfaces/auth-module-options.interface' or its corresponding type declarations.
79
+ src/database/typeorm/repositories/mfa-method.repository.ts(16,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
80
+ src/database/typeorm/repositories/mfa-method.repository.ts(20,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
81
+ src/database/typeorm/repositories/mfa-method.repository.ts(24,5): error TS2741: Property 'updatedAt' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/mfa-method.entity").MfaMethod' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").MfaMethod'.
82
+ src/database/typeorm/repositories/otp-token.repository.ts(16,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
83
+ src/database/typeorm/repositories/otp-token.repository.ts(20,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
84
+ src/database/typeorm/repositories/otp-token.repository.ts(27,5): error TS2741: Property 'toMap' is missing in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/database/typeorm/entities/otp-token.entity").OtpToken' but required in type 'import("/home/isaiah/devspace/my-open-source-projects/nestjs-multi-auth/src/auth/interfaces/models.interface").OtpToken'.
85
+ src/index.ts(9,15): error TS2307: Cannot find module './auth/entities/auth.entity' or its corresponding type declarations.
86
+ src/index.ts(10,15): error TS2307: Cannot find module './auth/entities/session.entity' or its corresponding type declarations.
87
+ src/index.ts(11,15): error TS2307: Cannot find module './auth/entities/mfa-method.entity' or its corresponding type declarations.
88
+ src/index.ts(12,15): error TS2307: Cannot find module './auth/entities/oauth-provider.entity' or its corresponding type declarations.
89
+ src/index.ts(13,15): error TS2307: Cannot find module './auth/entities/otp-token.entity' or its corresponding type declarations.
90
+ src/index.ts(14,15): error TS2307: Cannot find module './auth/entities/base.entity' or its corresponding type declarations.
91
+ src/index.ts(20,15): error TS2307: Cannot find module './migrations/auth-schema.initializer' or its corresponding type declarations.
92
+ src/index.ts(21,15): error TS2307: Cannot find module './migrations/migration.service' or its corresponding type declarations.
93
+ src/index.ts(23,15): error TS2307: Cannot find module './auth/entities/entities' or its corresponding type declarations.