@anarchitects/auth-nest 0.0.1 → 0.3.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 (55) hide show
  1. package/README.md +217 -18
  2. package/package.json +25 -11
  3. package/src/application/application.module-definition.d.ts +4 -21
  4. package/src/application/application.module-definition.js.map +1 -1
  5. package/src/application/application.module.d.ts +6 -26
  6. package/src/application/application.module.js +47 -24
  7. package/src/application/application.module.js.map +1 -1
  8. package/src/application/index.d.ts +1 -0
  9. package/src/auth.module.d.ts +7 -0
  10. package/src/auth.module.js +60 -0
  11. package/src/auth.module.js.map +1 -0
  12. package/src/config/auth.config.d.ts +16 -0
  13. package/src/config/auth.config.js +44 -7
  14. package/src/config/auth.config.js.map +1 -1
  15. package/src/config/index.d.ts +1 -0
  16. package/src/config/index.js +1 -0
  17. package/src/config/index.js.map +1 -1
  18. package/src/config/module-options.d.ts +57 -0
  19. package/src/config/module-options.js +58 -0
  20. package/src/config/module-options.js.map +1 -0
  21. package/src/index.d.ts +1 -0
  22. package/src/index.js +1 -0
  23. package/src/index.js.map +1 -1
  24. package/src/infrastructure-mailer/adapters/node-mailer.adapter.d.ts +1 -8
  25. package/src/infrastructure-mailer/adapters/node-mailer.adapter.js +2 -19
  26. package/src/infrastructure-mailer/adapters/node-mailer.adapter.js.map +1 -1
  27. package/src/infrastructure-mailer/index.d.ts +1 -1
  28. package/src/infrastructure-mailer/index.js +0 -1
  29. package/src/infrastructure-mailer/index.js.map +1 -1
  30. package/src/infrastructure-mailer/mailer.module.d.ts +5 -1
  31. package/src/infrastructure-mailer/mailer.module.js +36 -17
  32. package/src/infrastructure-mailer/mailer.module.js.map +1 -1
  33. package/src/infrastructure-persistence/index.d.ts +2 -0
  34. package/src/infrastructure-persistence/index.js +1 -0
  35. package/src/infrastructure-persistence/index.js.map +1 -1
  36. package/src/infrastructure-persistence/migrations/{1720200000000-create-invalidated-tokens-cache.table.d.ts → 1720200000000-create-auth-schema.d.ts} +1 -1
  37. package/src/infrastructure-persistence/migrations/1720200000000-create-auth-schema.js +312 -0
  38. package/src/infrastructure-persistence/migrations/1720200000000-create-auth-schema.js.map +1 -0
  39. package/src/infrastructure-persistence/persistence.module-definition.d.ts +4 -9
  40. package/src/infrastructure-persistence/persistence.module-definition.js.map +1 -1
  41. package/src/infrastructure-persistence/persistence.module.d.ts +5 -5
  42. package/src/infrastructure-persistence/persistence.module.js +33 -22
  43. package/src/infrastructure-persistence/persistence.module.js.map +1 -1
  44. package/src/presentation/controllers/auth.controller.d.ts +9 -27
  45. package/src/presentation/controllers/auth.controller.js +18 -30
  46. package/src/presentation/controllers/auth.controller.js.map +1 -1
  47. package/src/presentation/index.d.ts +1 -0
  48. package/src/presentation/presentation.module.d.ts +5 -1
  49. package/src/presentation/presentation.module.js +42 -5
  50. package/src/presentation/presentation.module.js.map +1 -1
  51. package/src/infrastructure-mailer/adapters/mailer.adapter.d.ts +0 -4
  52. package/src/infrastructure-mailer/adapters/mailer.adapter.js +0 -7
  53. package/src/infrastructure-mailer/adapters/mailer.adapter.js.map +0 -1
  54. package/src/infrastructure-persistence/migrations/1720200000000-create-invalidated-tokens-cache.table.js +0 -29
  55. package/src/infrastructure-persistence/migrations/1720200000000-create-invalidated-tokens-cache.table.js.map +0 -1
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CreateAuthSchema1720200000000 = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const schema_1 = require("../schema");
6
+ const USERS_TABLE = `${schema_1.AUTH_SCHEMA}.users`;
7
+ const ROLES_TABLE = `${schema_1.AUTH_SCHEMA}.roles`;
8
+ const PERMISSIONS_TABLE = `${schema_1.AUTH_SCHEMA}.permissions`;
9
+ const USER_ROLES_TABLE = `${schema_1.AUTH_SCHEMA}.user_roles`;
10
+ const ROLE_PERMISSIONS_TABLE = `${schema_1.AUTH_SCHEMA}.role_permissions`;
11
+ const INVALIDATED_TOKENS_TABLE = `${schema_1.AUTH_SCHEMA}.invalidated_tokens`;
12
+ class CreateAuthSchema1720200000000 {
13
+ constructor() {
14
+ this.name = 'CreateAuthSchema1720200000000';
15
+ }
16
+ async up(queryRunner) {
17
+ await queryRunner.createSchema(schema_1.AUTH_SCHEMA, true);
18
+ if (!(await queryRunner.hasTable(USERS_TABLE))) {
19
+ await queryRunner.createTable(new typeorm_1.Table({
20
+ schema: schema_1.AUTH_SCHEMA,
21
+ name: 'users',
22
+ columns: [
23
+ {
24
+ name: 'id',
25
+ type: 'uuid',
26
+ isPrimary: true,
27
+ },
28
+ {
29
+ name: 'email',
30
+ type: 'varchar',
31
+ length: '255',
32
+ isNullable: false,
33
+ isUnique: true,
34
+ },
35
+ {
36
+ name: 'userName',
37
+ type: 'varchar',
38
+ length: '100',
39
+ isNullable: true,
40
+ },
41
+ {
42
+ name: 'passwordHash',
43
+ type: 'varchar',
44
+ length: '255',
45
+ isNullable: false,
46
+ },
47
+ {
48
+ name: 'token',
49
+ type: 'varchar',
50
+ length: '500',
51
+ isNullable: true,
52
+ },
53
+ {
54
+ name: 'isActive',
55
+ type: 'boolean',
56
+ default: false,
57
+ isNullable: false,
58
+ },
59
+ {
60
+ name: 'createdAt',
61
+ type: 'timestamptz',
62
+ default: 'CURRENT_TIMESTAMP',
63
+ isNullable: false,
64
+ },
65
+ {
66
+ name: 'updatedAt',
67
+ type: 'timestamptz',
68
+ default: 'CURRENT_TIMESTAMP',
69
+ isNullable: false,
70
+ },
71
+ ],
72
+ }), true);
73
+ }
74
+ if (!(await queryRunner.hasTable(ROLES_TABLE))) {
75
+ await queryRunner.createTable(new typeorm_1.Table({
76
+ schema: schema_1.AUTH_SCHEMA,
77
+ name: 'roles',
78
+ columns: [
79
+ {
80
+ name: 'id',
81
+ type: 'uuid',
82
+ isPrimary: true,
83
+ },
84
+ {
85
+ name: 'name',
86
+ type: 'varchar',
87
+ length: '100',
88
+ isNullable: false,
89
+ isUnique: true,
90
+ },
91
+ {
92
+ name: 'description',
93
+ type: 'text',
94
+ isNullable: true,
95
+ },
96
+ {
97
+ name: 'createdAt',
98
+ type: 'timestamptz',
99
+ default: 'CURRENT_TIMESTAMP',
100
+ isNullable: false,
101
+ },
102
+ {
103
+ name: 'updatedAt',
104
+ type: 'timestamptz',
105
+ default: 'CURRENT_TIMESTAMP',
106
+ isNullable: false,
107
+ },
108
+ ],
109
+ }), true);
110
+ }
111
+ if (!(await queryRunner.hasTable(PERMISSIONS_TABLE))) {
112
+ await queryRunner.createTable(new typeorm_1.Table({
113
+ schema: schema_1.AUTH_SCHEMA,
114
+ name: 'permissions',
115
+ columns: [
116
+ {
117
+ name: 'id',
118
+ type: 'uuid',
119
+ isPrimary: true,
120
+ },
121
+ {
122
+ name: 'name',
123
+ type: 'varchar',
124
+ length: '100',
125
+ isNullable: false,
126
+ isUnique: true,
127
+ },
128
+ {
129
+ name: 'description',
130
+ type: 'text',
131
+ isNullable: true,
132
+ },
133
+ {
134
+ name: 'action',
135
+ type: 'varchar',
136
+ length: '100',
137
+ isNullable: false,
138
+ },
139
+ {
140
+ name: 'subject',
141
+ type: 'varchar',
142
+ length: '100',
143
+ isNullable: false,
144
+ },
145
+ {
146
+ name: 'conditions',
147
+ type: 'jsonb',
148
+ isNullable: true,
149
+ },
150
+ {
151
+ name: 'fields',
152
+ type: 'jsonb',
153
+ isNullable: true,
154
+ },
155
+ {
156
+ name: 'inverted',
157
+ type: 'boolean',
158
+ default: false,
159
+ isNullable: false,
160
+ },
161
+ {
162
+ name: 'reason',
163
+ type: 'text',
164
+ isNullable: true,
165
+ },
166
+ {
167
+ name: 'createdAt',
168
+ type: 'timestamptz',
169
+ default: 'CURRENT_TIMESTAMP',
170
+ isNullable: false,
171
+ },
172
+ {
173
+ name: 'updatedAt',
174
+ type: 'timestamptz',
175
+ default: 'CURRENT_TIMESTAMP',
176
+ isNullable: false,
177
+ },
178
+ ],
179
+ }), true);
180
+ }
181
+ if (!(await queryRunner.hasTable(USER_ROLES_TABLE))) {
182
+ await queryRunner.createTable(new typeorm_1.Table({
183
+ schema: schema_1.AUTH_SCHEMA,
184
+ name: 'user_roles',
185
+ columns: [
186
+ {
187
+ name: 'user_id',
188
+ type: 'uuid',
189
+ isPrimary: true,
190
+ },
191
+ {
192
+ name: 'role_id',
193
+ type: 'uuid',
194
+ isPrimary: true,
195
+ },
196
+ ],
197
+ foreignKeys: [
198
+ {
199
+ name: 'fk_auth_user_roles_user_id',
200
+ columnNames: ['user_id'],
201
+ referencedTableName: USERS_TABLE,
202
+ referencedColumnNames: ['id'],
203
+ onDelete: 'CASCADE',
204
+ },
205
+ {
206
+ name: 'fk_auth_user_roles_role_id',
207
+ columnNames: ['role_id'],
208
+ referencedTableName: ROLES_TABLE,
209
+ referencedColumnNames: ['id'],
210
+ onDelete: 'CASCADE',
211
+ },
212
+ ],
213
+ }), true);
214
+ }
215
+ if (!(await queryRunner.hasTable(ROLE_PERMISSIONS_TABLE))) {
216
+ await queryRunner.createTable(new typeorm_1.Table({
217
+ schema: schema_1.AUTH_SCHEMA,
218
+ name: 'role_permissions',
219
+ columns: [
220
+ {
221
+ name: 'role_id',
222
+ type: 'uuid',
223
+ isPrimary: true,
224
+ },
225
+ {
226
+ name: 'permission_id',
227
+ type: 'uuid',
228
+ isPrimary: true,
229
+ },
230
+ ],
231
+ foreignKeys: [
232
+ {
233
+ name: 'fk_auth_role_permissions_role_id',
234
+ columnNames: ['role_id'],
235
+ referencedTableName: ROLES_TABLE,
236
+ referencedColumnNames: ['id'],
237
+ onDelete: 'CASCADE',
238
+ },
239
+ {
240
+ name: 'fk_auth_role_permissions_permission_id',
241
+ columnNames: ['permission_id'],
242
+ referencedTableName: PERMISSIONS_TABLE,
243
+ referencedColumnNames: ['id'],
244
+ onDelete: 'CASCADE',
245
+ },
246
+ ],
247
+ }), true);
248
+ }
249
+ if (!(await queryRunner.hasTable(INVALIDATED_TOKENS_TABLE))) {
250
+ await queryRunner.createTable(new typeorm_1.Table({
251
+ schema: schema_1.AUTH_SCHEMA,
252
+ name: 'invalidated_tokens',
253
+ columns: [
254
+ {
255
+ name: 'tokenId',
256
+ type: 'varchar',
257
+ length: '128',
258
+ isPrimary: true,
259
+ },
260
+ {
261
+ name: 'userId',
262
+ type: 'uuid',
263
+ isNullable: true,
264
+ },
265
+ {
266
+ name: 'expires_at',
267
+ type: 'timestamptz',
268
+ isNullable: false,
269
+ },
270
+ {
271
+ name: 'invalidated_at',
272
+ type: 'timestamptz',
273
+ default: 'CURRENT_TIMESTAMP',
274
+ isNullable: false,
275
+ },
276
+ ],
277
+ }), true);
278
+ }
279
+ const invalidatedTokensIndexName = 'invalidated_tokens_expires_at_idx';
280
+ const invalidatedTokensTable = await queryRunner.getTable(INVALIDATED_TOKENS_TABLE);
281
+ const hasInvalidatedTokensIndex = invalidatedTokensTable?.indices.some((index) => index.name === invalidatedTokensIndexName);
282
+ if (!hasInvalidatedTokensIndex) {
283
+ await queryRunner.createIndex(INVALIDATED_TOKENS_TABLE, new typeorm_1.TableIndex({
284
+ name: invalidatedTokensIndexName,
285
+ columnNames: ['expires_at'],
286
+ isUnique: false,
287
+ }));
288
+ }
289
+ }
290
+ async down(queryRunner) {
291
+ if (await queryRunner.hasTable(ROLE_PERMISSIONS_TABLE)) {
292
+ await queryRunner.dropTable(ROLE_PERMISSIONS_TABLE, true, true, true);
293
+ }
294
+ if (await queryRunner.hasTable(USER_ROLES_TABLE)) {
295
+ await queryRunner.dropTable(USER_ROLES_TABLE, true, true, true);
296
+ }
297
+ if (await queryRunner.hasTable(INVALIDATED_TOKENS_TABLE)) {
298
+ await queryRunner.dropTable(INVALIDATED_TOKENS_TABLE, true, true, true);
299
+ }
300
+ if (await queryRunner.hasTable(PERMISSIONS_TABLE)) {
301
+ await queryRunner.dropTable(PERMISSIONS_TABLE, true, true, true);
302
+ }
303
+ if (await queryRunner.hasTable(ROLES_TABLE)) {
304
+ await queryRunner.dropTable(ROLES_TABLE, true, true, true);
305
+ }
306
+ if (await queryRunner.hasTable(USERS_TABLE)) {
307
+ await queryRunner.dropTable(USERS_TABLE, true, true, true);
308
+ }
309
+ }
310
+ }
311
+ exports.CreateAuthSchema1720200000000 = CreateAuthSchema1720200000000;
312
+ //# sourceMappingURL=1720200000000-create-auth-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1720200000000-create-auth-schema.js","sourceRoot":"","sources":["../../../../../../../libs/auth/nest/src/infrastructure-persistence/migrations/1720200000000-create-auth-schema.ts"],"names":[],"mappings":";;;AAAA,qCAA6E;AAC7E,sCAAwC;AAExC,MAAM,WAAW,GAAG,GAAG,oBAAW,QAAQ,CAAC;AAC3C,MAAM,WAAW,GAAG,GAAG,oBAAW,QAAQ,CAAC;AAC3C,MAAM,iBAAiB,GAAG,GAAG,oBAAW,cAAc,CAAC;AACvD,MAAM,gBAAgB,GAAG,GAAG,oBAAW,aAAa,CAAC;AACrD,MAAM,sBAAsB,GAAG,GAAG,oBAAW,mBAAmB,CAAC;AACjE,MAAM,wBAAwB,GAAG,GAAG,oBAAW,qBAAqB,CAAC;AAErE,MAAa,6BAA6B;IAA1C;QACE,SAAI,GAAG,+BAA+B,CAAC;IA+UzC,CAAC;IA7UQ,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,YAAY,CAAC,oBAAW,EAAE,IAAI,CAAC,CAAC;QAElD,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;YAC/C,MAAM,WAAW,CAAC,WAAW,CAC3B,IAAI,eAAK,CAAC;gBACR,MAAM,EAAE,oBAAW;gBACnB,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,MAAM;wBACZ,SAAS,EAAE,IAAI;qBAChB;oBACD;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE,KAAK;wBACb,UAAU,EAAE,KAAK;wBAC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C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,CAAC;YACzD,MAAM,WAAW,CAAC,SAAS,CAAC,wBAAwB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAClD,MAAM,WAAW,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACnE,CAAC;QAED,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,MAAM,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC5C,MAAM,WAAW,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;CACF;AAhVD,sEAgVC"}
@@ -1,13 +1,8 @@
1
- export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<{
2
- persistence: string;
3
- }, "forRoot", "create", {
1
+ import type { ResolvedAuthPersistenceModuleOptions } from '../config';
2
+ export declare const ConfigurableModuleClass: import("@nestjs/common").ConfigurableModuleCls<ResolvedAuthPersistenceModuleOptions, "forRoot", "create", {
4
3
  isGlobal?: boolean;
5
- }>, AUTH_PERSISTENCE_MODULE_OPTIONS: string | symbol, OPTIONS_TYPE: {
6
- persistence: string;
7
- } & Partial<{
4
+ }>, AUTH_PERSISTENCE_MODULE_OPTIONS: string | symbol, OPTIONS_TYPE: ResolvedAuthPersistenceModuleOptions & Partial<{
8
5
  isGlobal?: boolean;
9
- }>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<{
10
- persistence: string;
11
- }, "create"> & Partial<{
6
+ }>, ASYNC_OPTIONS_TYPE: import("@nestjs/common").ConfigurableModuleAsyncOptions<ResolvedAuthPersistenceModuleOptions, "create"> & Partial<{
12
7
  isGlobal?: boolean;
13
8
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.module-definition.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-persistence/persistence.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAE9C,KAKT,IAAI,kCAAyB,EAA2B;KACzD,kBAAkB,CAAC,SAAS,CAAC;KAC7B,SAAS,CACR,EAAE,QAAQ,EAAE,IAAI,EAAE,EAClB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACvB,GAAG,UAAU;IACb,MAAM,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;CACjC,CAAC,CACH;KACA,KAAK,EAAE,EAbR,+BAAuB,+BACD,uCAA+B,4BACrD,oBAAY,oBACZ,0BAAkB,yBAUT"}
1
+ {"version":3,"file":"persistence.module-definition.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-persistence/persistence.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAG9C,KAKT,IAAI,kCAAyB,EAAwC;KACtE,kBAAkB,CAAC,SAAS,CAAC;KAC7B,SAAS,CACR,EAAE,QAAQ,EAAE,IAAI,EAAE,EAClB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACvB,GAAG,UAAU;IACb,MAAM,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;CACjC,CAAC,CACH;KACA,KAAK,EAAE,EAbR,+BAAuB,+BACD,uCAA+B,4BACrD,oBAAY,oBACZ,0BAAkB,yBAUT"}
@@ -1,7 +1,7 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
- import { ConfigurableModuleClass, OPTIONS_TYPE } from './persistence.module-definition';
3
- export declare class PersistenceModule extends ConfigurableModuleClass {
4
- private options;
5
- constructor(options: string | symbol);
6
- static forRoot(options: typeof OPTIONS_TYPE): DynamicModule;
2
+ import { ConfigurableModuleClass } from './persistence.module-definition';
3
+ import type { AuthPersistenceModuleOptions } from '../config';
4
+ export declare class AuthPersistenceModule extends ConfigurableModuleClass {
5
+ static forRoot(options?: AuthPersistenceModuleOptions): DynamicModule;
6
+ static forRootFromConfig(overrides?: AuthPersistenceModuleOptions): DynamicModule;
7
7
  }
@@ -1,26 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PersistenceModule = void 0;
3
+ exports.AuthPersistenceModule = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@nestjs/common");
6
- const auth_user_repository_1 = require("./repositories/auth-user.repository");
7
- const typeorm_auth_user_repository_1 = require("./repositories/typeorm-auth-user.repository");
8
- const persistence_module_definition_1 = require("./persistence.module-definition");
6
+ const config_1 = require("@nestjs/config");
9
7
  const typeorm_1 = require("@nestjs/typeorm");
10
- const user_entity_1 = require("./entities/user.entity");
11
- const role_entity_1 = require("./entities/role.entity");
12
- const permission_entity_1 = require("./entities/permission.entity");
13
8
  const invalidated_token_entity_1 = require("./entities/invalidated-token.entity");
14
- let PersistenceModule = class PersistenceModule extends persistence_module_definition_1.ConfigurableModuleClass {
15
- constructor(options) {
16
- super();
17
- this.options = options;
18
- }
19
- static forRoot(options) {
20
- switch (options.persistence) {
9
+ const permission_entity_1 = require("./entities/permission.entity");
10
+ const role_entity_1 = require("./entities/role.entity");
11
+ const user_entity_1 = require("./entities/user.entity");
12
+ const persistence_module_definition_1 = require("./persistence.module-definition");
13
+ const auth_user_repository_1 = require("./repositories/auth-user.repository");
14
+ const typeorm_auth_user_repository_1 = require("./repositories/typeorm-auth-user.repository");
15
+ const config_2 = require("../config");
16
+ let AuthPersistenceModule = class AuthPersistenceModule extends persistence_module_definition_1.ConfigurableModuleClass {
17
+ static forRoot(options = {}) {
18
+ const resolvedOptions = (0, config_2.resolveAuthPersistenceModuleOptions)(options);
19
+ switch (resolvedOptions.persistence) {
21
20
  case 'typeorm':
22
21
  return {
23
- ...super.forRoot(options),
22
+ ...super.forRoot(resolvedOptions),
24
23
  imports: [
25
24
  typeorm_1.TypeOrmModule.forFeature([
26
25
  user_entity_1.UserEntity,
@@ -39,14 +38,26 @@ let PersistenceModule = class PersistenceModule extends persistence_module_defin
39
38
  exports: [auth_user_repository_1.AuthUserRepository, typeorm_1.TypeOrmModule],
40
39
  };
41
40
  default:
42
- throw new Error(`Unsupported persistence type: ${options.persistence}`);
41
+ throw new Error(`Unsupported persistence type: ${resolvedOptions.persistence}`);
43
42
  }
44
43
  }
44
+ static forRootFromConfig(overrides = {}) {
45
+ const configOptions = (0, config_2.mapAuthConfigToPersistenceModuleOptions)((0, config_2.authConfig)());
46
+ const moduleDefinition = this.forRoot({
47
+ ...configOptions,
48
+ ...overrides,
49
+ });
50
+ return {
51
+ ...moduleDefinition,
52
+ imports: [
53
+ config_1.ConfigModule.forFeature(config_2.authConfig),
54
+ ...(moduleDefinition.imports ?? []),
55
+ ],
56
+ };
57
+ }
45
58
  };
46
- exports.PersistenceModule = PersistenceModule;
47
- exports.PersistenceModule = PersistenceModule = tslib_1.__decorate([
48
- (0, common_1.Module)({}),
49
- tslib_1.__param(0, (0, common_1.Inject)(persistence_module_definition_1.AUTH_PERSISTENCE_MODULE_OPTIONS)),
50
- tslib_1.__metadata("design:paramtypes", [Object])
51
- ], PersistenceModule);
59
+ exports.AuthPersistenceModule = AuthPersistenceModule;
60
+ exports.AuthPersistenceModule = AuthPersistenceModule = tslib_1.__decorate([
61
+ (0, common_1.Module)({})
62
+ ], AuthPersistenceModule);
52
63
  //# sourceMappingURL=persistence.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-persistence/persistence.module.ts"],"names":[],"mappings":";;;;AAAA,2CAA+D;AAC/D,8EAAyE;AACzE,8FAAwF;AACxF,mFAIyC;AACzC,6CAAgD;AAChD,wDAAoD;AACpD,wDAAoD;AACpD,oEAAgE;AAChE,kFAA6E;AAGtE,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,uDAAuB;IAC5D,YACmD,OAAwB;QAEzE,KAAK,EAAE,CAAC;QAFyC,YAAO,GAAP,OAAO,CAAiB;IAG3E,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,OAA4B;QACzC,QAAQ,OAAO,CAAC,WAAW,EAAE,CAAC;YAC5B,KAAK,SAAS;gBACZ,OAAO;oBACL,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;oBACzB,OAAO,EAAE;wBACP,uBAAa,CAAC,UAAU,CAAC;4BACvB,wBAAU;4BACV,wBAAU;4BACV,oCAAgB;4BAChB,iDAAsB;yBACvB,CAAC;qBACH;oBACD,SAAS,EAAE;wBACT,wDAAyB;wBACzB;4BACE,OAAO,EAAE,yCAAkB;4BAC3B,WAAW,EAAE,wDAAyB;yBACvC;qBACF;oBACD,OAAO,EAAE,CAAC,yCAAkB,EAAE,uBAAa,CAAC;iBAC7C,CAAC;YACJ;gBACE,MAAM,IAAI,KAAK,CAAC,iCAAiC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;CACF,CAAA;AAjCY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;IAGN,mBAAA,IAAA,eAAM,EAAC,+DAA+B,CAAC,CAAA;;GAF/B,iBAAiB,CAiC7B"}
1
+ {"version":3,"file":"persistence.module.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-persistence/persistence.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAuD;AACvD,2CAA8C;AAC9C,6CAAgD;AAChD,kFAA6E;AAC7E,oEAAgE;AAChE,wDAAoD;AACpD,wDAAoD;AACpD,mFAGyC;AACzC,8EAAyE;AACzE,8FAAwF;AACxF,sCAImB;AAIZ,IAAM,qB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asswordRequestDTO, ForgotPasswordRequestDTO, LoginRequestDTO, LoginResponseDTO, LogoutRequestDTO, RefreshTokenRequestDTO, RegisterRequestDTO, RegisterResponseDTO, ResetPasswordRequestDTO, UpdateEmailRequestDTO, VerifyEmailRequestDTO } from '@anarchitects/auth-ts/dtos';
2
- import { PolicyRule, User } from '@anarchitects/auth-ts/models';
1
+ import { ActivateUserRequestDTO, ChangePasswordRequestDTO, ForgotPasswordRequestDTO, LoginRequestDTO, LoginResponseDTO, LoggedInUserInfoResponseDTO, LogoutRequestDTO, RefreshTokenRequestDTO, RegisterRequestDTO, RegisterResponseDTO, ResetPasswordRequestDTO, SuccessResponseDTO, UpdateEmailRequestDTO, VerifyEmailRequestDTO } from '@anarchitects/auth-ts/dtos';
3
2
  import { AuthService } from '../../application/services/auth.service';
4
3
  export declare class AuthController {
5
4
  private readonly authService;
6
5
  constructor(authService: AuthService);
7
6
  registerUser(dto: RegisterRequestDTO): Promise<RegisterResponseDTO>;
8
- activateUser(dto: ActivateUserRequestDTO): Promise<{
9
- success: boolean;
10
- }>;
7
+ activateUser(dto: ActivateUserRequestDTO): Promise<SuccessResponseDTO>;
11
8
  login(dto: LoginRequestDTO): Promise<LoginResponseDTO>;
12
- logout(dto: LogoutRequestDTO): Promise<{
13
- success: boolean;
14
- }>;
15
- changePassword(userId: string, dto: ChangePasswordRequestDTO): Promise<{
16
- success: boolean;
17
- }>;
18
- forgotPassword(dto: ForgotPasswordRequestDTO): Promise<{
19
- success: boolean;
20
- }>;
21
- resetPassword(dto: ResetPasswordRequestDTO): Promise<{
22
- success: boolean;
23
- }>;
24
- verifyEmail(dto: VerifyEmailRequestDTO): Promise<{
25
- success: boolean;
26
- }>;
27
- updateEmail(userId: string, dto: UpdateEmailRequestDTO): Promise<{
28
- success: boolean;
29
- }>;
9
+ logout(dto: LogoutRequestDTO): Promise<SuccessResponseDTO>;
10
+ changePassword(userId: string, dto: ChangePasswordRequestDTO): Promise<SuccessResponseDTO>;
11
+ forgotPassword(dto: ForgotPasswordRequestDTO): Promise<SuccessResponseDTO>;
12
+ resetPassword(dto: ResetPasswordRequestDTO): Promise<SuccessResponseDTO>;
13
+ verifyEmail(dto: VerifyEmailRequestDTO): Promise<SuccessResponseDTO>;
14
+ updateEmail(userId: string, dto: UpdateEmailRequestDTO): Promise<SuccessResponseDTO>;
30
15
  refreshTokens(userId: string, dto: RefreshTokenRequestDTO): Promise<LoginResponseDTO>;
31
16
  getLoggedInUserInfo(req: {
32
17
  user: {
33
18
  sub: string;
34
19
  };
35
- }): Promise<{
36
- user: User;
37
- rbac: PolicyRule[];
38
- }>;
20
+ }): Promise<LoggedInUserInfoResponseDTO>;
39
21
  }
@@ -47,6 +47,7 @@ let AuthController = class AuthController {
47
47
  };
48
48
  exports.AuthController = AuthController;
49
49
  tslib_1.__decorate([
50
+ (0, common_1.HttpCode)(200),
50
51
  (0, common_1.Post)('/register'),
51
52
  (0, platform_fastify_1.RouteSchema)({
52
53
  body: dtos_1.RegisterRequestSchema,
@@ -61,9 +62,7 @@ tslib_1.__decorate([
61
62
  (0, common_1.Patch)('/activate'),
62
63
  (0, platform_fastify_1.RouteSchema)({
63
64
  body: dtos_1.ActivateUserRequestSchema,
64
- response: {
65
- 200: { success: { type: 'boolean' } },
66
- },
65
+ response: { 200: dtos_1.SuccessResponseSchema },
67
66
  }),
68
67
  tslib_1.__param(0, (0, common_1.Body)()),
69
68
  tslib_1.__metadata("design:type", Function),
@@ -71,6 +70,7 @@ tslib_1.__decorate([
71
70
  tslib_1.__metadata("design:returntype", Promise)
72
71
  ], AuthController.prototype, "activateUser", null);
73
72
  tslib_1.__decorate([
73
+ (0, common_1.HttpCode)(200),
74
74
  (0, common_1.Post)('/login'),
75
75
  (0, platform_fastify_1.RouteSchema)({
76
76
  body: dtos_1.LoginRequestSchema,
@@ -82,10 +82,11 @@ tslib_1.__decorate([
82
82
  tslib_1.__metadata("design:returntype", Promise)
83
83
  ], AuthController.prototype, "login", null);
84
84
  tslib_1.__decorate([
85
+ (0, common_1.HttpCode)(200),
85
86
  (0, common_1.Post)('/logout'),
86
87
  (0, platform_fastify_1.RouteSchema)({
87
88
  body: dtos_1.LogoutRequestSchema,
88
- response: { 200: { success: { type: 'boolean' } } },
89
+ response: { 200: dtos_1.SuccessResponseSchema },
89
90
  }),
90
91
  tslib_1.__param(0, (0, common_1.Body)()),
91
92
  tslib_1.__metadata("design:type", Function),
@@ -96,10 +97,8 @@ tslib_1.__decorate([
96
97
  (0, common_1.Patch)('/change-password/:userId'),
97
98
  (0, platform_fastify_1.RouteSchema)({
98
99
  body: dtos_1.ChangePasswordRequestSchema,
99
- params: {
100
- userId: { type: 'string' },
101
- },
102
- response: { 200: { success: { type: 'boolean' } } },
100
+ params: dtos_1.UserIdParamsSchema,
101
+ response: { 200: dtos_1.SuccessResponseSchema },
103
102
  }),
104
103
  tslib_1.__param(0, (0, common_1.Param)('userId')),
105
104
  tslib_1.__param(1, (0, common_1.Body)()),
@@ -108,10 +107,11 @@ tslib_1.__decorate([
108
107
  tslib_1.__metadata("design:returntype", Promise)
109
108
  ], AuthController.prototype, "changePassword", null);
110
109
  tslib_1.__decorate([
110
+ (0, common_1.HttpCode)(200),
111
111
  (0, common_1.Post)('/forgot-password'),
112
112
  (0, platform_fastify_1.RouteSchema)({
113
113
  body: dtos_1.ForgotPasswordRequestSchema,
114
- response: { 200: { success: { type: 'boolean' } } },
114
+ response: { 200: dtos_1.SuccessResponseSchema },
115
115
  }),
116
116
  tslib_1.__param(0, (0, common_1.Body)()),
117
117
  tslib_1.__metadata("design:type", Function),
@@ -119,10 +119,11 @@ tslib_1.__decorate([
119
119
  tslib_1.__metadata("design:returntype", Promise)
120
120
  ], AuthController.prototype, "forgotPassword", null);
121
121
  tslib_1.__decorate([
122
+ (0, common_1.HttpCode)(200),
122
123
  (0, common_1.Post)('/reset-password'),
123
124
  (0, platform_fastify_1.RouteSchema)({
124
125
  body: dtos_1.ResetPasswordRequestSchema,
125
- response: { 200: { success: { type: 'boolean' } } },
126
+ response: { 200: dtos_1.SuccessResponseSchema },
126
127
  }),
127
128
  tslib_1.__param(0, (0, common_1.Body)()),
128
129
  tslib_1.__metadata("design:type", Function),
@@ -130,10 +131,11 @@ tslib_1.__decorate([
130
131
  tslib_1.__metadata("design:returntype", Promise)
131
132
  ], AuthController.prototype, "resetPassword", null);
132
133
  tslib_1.__decorate([
134
+ (0, common_1.HttpCode)(200),
133
135
  (0, common_1.Post)('/verify-email'),
134
136
  (0, platform_fastify_1.RouteSchema)({
135
137
  body: dtos_1.VerifyEmailRequestSchema,
136
- response: { 200: { success: { type: 'boolean' } } },
138
+ response: { 200: dtos_1.SuccessResponseSchema },
137
139
  }),
138
140
  tslib_1.__param(0, (0, common_1.Body)()),
139
141
  tslib_1.__metadata("design:type", Function),
@@ -144,10 +146,8 @@ tslib_1.__decorate([
144
146
  (0, common_1.Patch)('/update-email/:userId'),
145
147
  (0, platform_fastify_1.RouteSchema)({
146
148
  body: dtos_1.UpdateEmailRequestSchema,
147
- params: {
148
- userId: { type: 'string' },
149
- },
150
- response: { 200: { success: { type: 'boolean' } } },
149
+ params: dtos_1.UserIdParamsSchema,
150
+ response: { 200: dtos_1.SuccessResponseSchema },
151
151
  }),
152
152
  tslib_1.__param(0, (0, common_1.Param)('userId')),
153
153
  tslib_1.__param(1, (0, common_1.Body)()),
@@ -156,12 +156,11 @@ tslib_1.__decorate([
156
156
  tslib_1.__metadata("design:returntype", Promise)
157
157
  ], AuthController.prototype, "updateEmail", null);
158
158
  tslib_1.__decorate([
159
+ (0, common_1.HttpCode)(200),
159
160
  (0, common_1.Post)('/refresh-tokens/:userId'),
160
161
  (0, platform_fastify_1.RouteSchema)({
161
162
  body: dtos_1.RefreshTokenRequestSchema,
162
- params: {
163
- userId: { type: 'string' },
164
- },
163
+ params: dtos_1.UserIdParamsSchema,
165
164
  response: { 200: dtos_1.LoginResponseSchema },
166
165
  }),
167
166
  tslib_1.__param(0, (0, common_1.Param)('userId')),
@@ -173,18 +172,7 @@ tslib_1.__decorate([
173
172
  tslib_1.__decorate([
174
173
  (0, common_1.Get)('/me'),
175
174
  (0, platform_fastify_1.RouteSchema)({
176
- response: {
177
- 200: {
178
- type: 'object',
179
- properties: {
180
- user: { type: 'object' }, // Define user schema as needed
181
- rbac: {
182
- type: 'array',
183
- items: { type: 'object' }, // Define PolicyRule schema as needed
184
- },
185
- },
186
- },
187
- },
175
+ response: { 200: dtos_1.LoggedInUserInfoResponseSchema },
188
176
  }),
189
177
  tslib_1.__param(0, (0, common_1.Req)()),
190
178
  tslib_1.__metadata("design:type", Function),