@flusys/nestjs-auth 5.1.1 → 5.1.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.
@@ -21,6 +21,7 @@ function _ts_metadata(k, v) {
21
21
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
22
  }
23
23
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
24
+ import { Expose } from 'class-transformer';
24
25
  import { IsBoolean, IsEmail, IsNotEmpty, IsObject, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
25
26
  import { IsStrongPassword } from '../validators/password.validator';
26
27
  export class CreateUserDto {
@@ -37,6 +38,7 @@ export class CreateUserDto {
37
38
  }
38
39
  }
39
40
  _ts_decorate([
41
+ Expose(),
40
42
  ApiProperty({
41
43
  example: 'John Doe',
42
44
  description: 'Full name'
@@ -45,6 +47,7 @@ _ts_decorate([
45
47
  _ts_metadata("design:type", String)
46
48
  ], CreateUserDto.prototype, "name", void 0);
47
49
  _ts_decorate([
50
+ Expose(),
48
51
  ApiPropertyOptional({
49
52
  example: '+1234567890',
50
53
  description: 'Phone number'
@@ -54,6 +57,7 @@ _ts_decorate([
54
57
  _ts_metadata("design:type", String)
55
58
  ], CreateUserDto.prototype, "phone", void 0);
56
59
  _ts_decorate([
60
+ Expose(),
57
61
  ApiProperty({
58
62
  example: 'john@example.com',
59
63
  description: 'Email address'
@@ -62,6 +66,7 @@ _ts_decorate([
62
66
  _ts_metadata("design:type", String)
63
67
  ], CreateUserDto.prototype, "email", void 0);
64
68
  _ts_decorate([
69
+ Expose(),
65
70
  ApiProperty({
66
71
  example: 'SecureP@ss123',
67
72
  description: 'Password (must meet complexity requirements)'
@@ -73,6 +78,7 @@ _ts_decorate([
73
78
  _ts_metadata("design:type", String)
74
79
  ], CreateUserDto.prototype, "password", void 0);
75
80
  _ts_decorate([
81
+ Expose(),
76
82
  ApiPropertyOptional({
77
83
  description: 'Profile picture file ID'
78
84
  }),
@@ -81,6 +87,7 @@ _ts_decorate([
81
87
  _ts_metadata("design:type", String)
82
88
  ], CreateUserDto.prototype, "profilePictureId", void 0);
83
89
  _ts_decorate([
90
+ Expose(),
84
91
  ApiPropertyOptional({
85
92
  default: true,
86
93
  description: 'Is user active'
@@ -90,6 +97,7 @@ _ts_decorate([
90
97
  _ts_metadata("design:type", Boolean)
91
98
  ], CreateUserDto.prototype, "isActive", void 0);
92
99
  _ts_decorate([
100
+ Expose(),
93
101
  ApiPropertyOptional({
94
102
  default: false,
95
103
  description: 'Is email verified'
@@ -99,6 +107,7 @@ _ts_decorate([
99
107
  _ts_metadata("design:type", Boolean)
100
108
  ], CreateUserDto.prototype, "emailVerified", void 0);
101
109
  _ts_decorate([
110
+ Expose(),
102
111
  ApiPropertyOptional({
103
112
  default: false,
104
113
  description: 'Is phone verified'
@@ -108,6 +117,7 @@ _ts_decorate([
108
117
  _ts_metadata("design:type", Boolean)
109
118
  ], CreateUserDto.prototype, "phoneVerified", void 0);
110
119
  _ts_decorate([
120
+ Expose(),
111
121
  ApiPropertyOptional({
112
122
  description: 'Additional custom fields'
113
123
  }),
@@ -131,6 +141,7 @@ export class UpdateUserDto {
131
141
  }
132
142
  }
133
143
  _ts_decorate([
144
+ Expose(),
134
145
  ApiProperty({
135
146
  description: 'User ID'
136
147
  }),
@@ -138,6 +149,7 @@ _ts_decorate([
138
149
  _ts_metadata("design:type", String)
139
150
  ], UpdateUserDto.prototype, "id", void 0);
140
151
  _ts_decorate([
152
+ Expose(),
141
153
  ApiPropertyOptional({
142
154
  example: 'John Doe',
143
155
  description: 'Full name'
@@ -147,6 +159,7 @@ _ts_decorate([
147
159
  _ts_metadata("design:type", String)
148
160
  ], UpdateUserDto.prototype, "name", void 0);
149
161
  _ts_decorate([
162
+ Expose(),
150
163
  ApiPropertyOptional({
151
164
  example: '+1234567890',
152
165
  description: 'Phone number'
@@ -156,6 +169,7 @@ _ts_decorate([
156
169
  _ts_metadata("design:type", String)
157
170
  ], UpdateUserDto.prototype, "phone", void 0);
158
171
  _ts_decorate([
172
+ Expose(),
159
173
  ApiPropertyOptional({
160
174
  example: 'john@example.com',
161
175
  description: 'Email address'
@@ -165,6 +179,7 @@ _ts_decorate([
165
179
  _ts_metadata("design:type", String)
166
180
  ], UpdateUserDto.prototype, "email", void 0);
167
181
  _ts_decorate([
182
+ Expose(),
168
183
  ApiPropertyOptional({
169
184
  description: 'New password (must meet complexity requirements)'
170
185
  }),
@@ -175,6 +190,7 @@ _ts_decorate([
175
190
  _ts_metadata("design:type", String)
176
191
  ], UpdateUserDto.prototype, "password", void 0);
177
192
  _ts_decorate([
193
+ Expose(),
178
194
  ApiPropertyOptional({
179
195
  description: 'Current password (required when changing password on own profile)'
180
196
  }),
@@ -183,6 +199,7 @@ _ts_decorate([
183
199
  _ts_metadata("design:type", String)
184
200
  ], UpdateUserDto.prototype, "oldPassword", void 0);
185
201
  _ts_decorate([
202
+ Expose(),
186
203
  ApiPropertyOptional({
187
204
  description: 'Profile picture file ID'
188
205
  }),
@@ -191,6 +208,7 @@ _ts_decorate([
191
208
  _ts_metadata("design:type", String)
192
209
  ], UpdateUserDto.prototype, "profilePictureId", void 0);
193
210
  _ts_decorate([
211
+ Expose(),
194
212
  ApiPropertyOptional({
195
213
  description: 'Is user active'
196
214
  }),
@@ -199,6 +217,7 @@ _ts_decorate([
199
217
  _ts_metadata("design:type", Boolean)
200
218
  ], UpdateUserDto.prototype, "isActive", void 0);
201
219
  _ts_decorate([
220
+ Expose(),
202
221
  ApiPropertyOptional({
203
222
  description: 'Is email verified'
204
223
  }),
@@ -207,6 +226,7 @@ _ts_decorate([
207
226
  _ts_metadata("design:type", Boolean)
208
227
  ], UpdateUserDto.prototype, "emailVerified", void 0);
209
228
  _ts_decorate([
229
+ Expose(),
210
230
  ApiPropertyOptional({
211
231
  description: 'Is phone verified'
212
232
  }),
@@ -215,6 +235,7 @@ _ts_decorate([
215
235
  _ts_metadata("design:type", Boolean)
216
236
  ], UpdateUserDto.prototype, "phoneVerified", void 0);
217
237
  _ts_decorate([
238
+ Expose(),
218
239
  ApiPropertyOptional({
219
240
  description: 'Additional custom fields'
220
241
  }),
@@ -242,18 +263,21 @@ _ts_decorate([
242
263
  }
243
264
  }
244
265
  _ts_decorate([
266
+ Expose(),
245
267
  ApiProperty({
246
268
  example: '550e8400-e29b-41d4-a716-446655440000'
247
269
  }),
248
270
  _ts_metadata("design:type", String)
249
271
  ], UserResponseDto.prototype, "id", void 0);
250
272
  _ts_decorate([
273
+ Expose(),
251
274
  ApiProperty({
252
275
  example: 'John Doe'
253
276
  }),
254
277
  _ts_metadata("design:type", String)
255
278
  ], UserResponseDto.prototype, "name", void 0);
256
279
  _ts_decorate([
280
+ Expose(),
257
281
  ApiPropertyOptional({
258
282
  example: '+1-555-123-4567',
259
283
  nullable: true
@@ -261,12 +285,14 @@ _ts_decorate([
261
285
  _ts_metadata("design:type", Object)
262
286
  ], UserResponseDto.prototype, "phone", void 0);
263
287
  _ts_decorate([
288
+ Expose(),
264
289
  ApiProperty({
265
290
  example: 'john@example.com'
266
291
  }),
267
292
  _ts_metadata("design:type", String)
268
293
  ], UserResponseDto.prototype, "email", void 0);
269
294
  _ts_decorate([
295
+ Expose(),
270
296
  ApiPropertyOptional({
271
297
  example: 'pic_abc123',
272
298
  nullable: true
@@ -274,24 +300,28 @@ _ts_decorate([
274
300
  _ts_metadata("design:type", Object)
275
301
  ], UserResponseDto.prototype, "profilePictureId", void 0);
276
302
  _ts_decorate([
303
+ Expose(),
277
304
  ApiProperty({
278
305
  example: true
279
306
  }),
280
307
  _ts_metadata("design:type", Boolean)
281
308
  ], UserResponseDto.prototype, "isActive", void 0);
282
309
  _ts_decorate([
310
+ Expose(),
283
311
  ApiProperty({
284
312
  example: true
285
313
  }),
286
314
  _ts_metadata("design:type", Boolean)
287
315
  ], UserResponseDto.prototype, "emailVerified", void 0);
288
316
  _ts_decorate([
317
+ Expose(),
289
318
  ApiProperty({
290
319
  example: false
291
320
  }),
292
321
  _ts_metadata("design:type", Boolean)
293
322
  ], UserResponseDto.prototype, "phoneVerified", void 0);
294
323
  _ts_decorate([
324
+ Expose(),
295
325
  ApiPropertyOptional({
296
326
  example: '2024-12-18T10:30:00.000Z',
297
327
  nullable: true
@@ -299,6 +329,7 @@ _ts_decorate([
299
329
  _ts_metadata("design:type", Object)
300
330
  ], UserResponseDto.prototype, "lastLoginAt", void 0);
301
331
  _ts_decorate([
332
+ Expose(),
302
333
  ApiPropertyOptional({
303
334
  example: {
304
335
  department: 'Engineering',
@@ -309,18 +340,21 @@ _ts_decorate([
309
340
  _ts_metadata("design:type", Object)
310
341
  ], UserResponseDto.prototype, "additionalFields", void 0);
311
342
  _ts_decorate([
343
+ Expose(),
312
344
  ApiProperty({
313
345
  example: '2024-01-15T10:30:00.000Z'
314
346
  }),
315
347
  _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
316
348
  ], UserResponseDto.prototype, "createdAt", void 0);
317
349
  _ts_decorate([
350
+ Expose(),
318
351
  ApiProperty({
319
352
  example: '2024-12-18T14:45:00.000Z'
320
353
  }),
321
354
  _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
322
355
  ], UserResponseDto.prototype, "updatedAt", void 0);
323
356
  _ts_decorate([
357
+ Expose(),
324
358
  ApiPropertyOptional({
325
359
  example: null,
326
360
  nullable: true
@@ -25,60 +25,13 @@ function _ts_param(paramIndex, decorator) {
25
25
  decorator(target, key, paramIndex);
26
26
  };
27
27
  }
28
- import { MultiTenantDataSourceService, SYSTEM_MESSAGES } from '@flusys/nestjs-shared';
29
- import { Inject, Injectable, InternalServerErrorException, Optional, Scope } from '@nestjs/common';
28
+ import { MultiTenantDataSourceService } from '@flusys/nestjs-shared';
29
+ import { Inject, Injectable, Optional, Scope } from '@nestjs/common';
30
30
  import { REQUEST } from '@nestjs/core';
31
31
  import { Request } from 'express';
32
32
  import { AuthModuleOptions } from '../interfaces/auth-module-options.interface';
33
33
  import { AUTH_MODULE_OPTIONS } from '../config/auth.constants';
34
34
  export class AuthDataSourceProvider extends MultiTenantDataSourceService {
35
- async getSingleDataSource() {
36
- if (!AuthDataSourceProvider.singleDataSource) {
37
- if (AuthDataSourceProvider.singleConnectionLock) {
38
- return AuthDataSourceProvider.singleConnectionLock;
39
- }
40
- const lockPromise = (async ()=>{
41
- const config = this.getDefaultDatabaseConfig();
42
- if (!config) {
43
- throw new InternalServerErrorException({
44
- message: 'Default database config is not available',
45
- messageKey: SYSTEM_MESSAGES.DATABASE_CONFIG_NOT_AVAILABLE
46
- });
47
- }
48
- const ds = await this.createDataSourceFromConfig(config);
49
- AuthDataSourceProvider.singleDataSource = ds;
50
- AuthDataSourceProvider.initialized = true;
51
- return ds;
52
- })();
53
- AuthDataSourceProvider.singleConnectionLock = lockPromise;
54
- try {
55
- return await lockPromise;
56
- } finally{
57
- AuthDataSourceProvider.singleConnectionLock = null;
58
- }
59
- }
60
- return AuthDataSourceProvider.singleDataSource;
61
- }
62
- async getOrCreateTenantConnection(tenant) {
63
- const existing = AuthDataSourceProvider.tenantConnections.get(tenant.id);
64
- if (existing?.isInitialized) {
65
- return existing;
66
- }
67
- const pendingConnection = AuthDataSourceProvider.connectionLocks.get(tenant.id);
68
- if (pendingConnection) {
69
- return pendingConnection;
70
- }
71
- const config = this.buildTenantDatabaseConfig(tenant);
72
- const connectionPromise = this.createDataSourceFromConfig(config);
73
- AuthDataSourceProvider.connectionLocks.set(tenant.id, connectionPromise);
74
- try {
75
- const dataSource = await connectionPromise;
76
- AuthDataSourceProvider.tenantConnections.set(tenant.id, dataSource);
77
- return dataSource;
78
- } finally{
79
- AuthDataSourceProvider.connectionLocks.delete(tenant.id);
80
- }
81
- }
82
35
  static buildParentOptions(options) {
83
36
  return {
84
37
  bootstrapAppConfig: options.bootstrapAppConfig,
@@ -25,20 +25,14 @@ function _ts_param(paramIndex, decorator) {
25
25
  decorator(target, key, paramIndex);
26
26
  };
27
27
  }
28
- import { HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/classes';
28
+ import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
29
29
  import { UtilsService } from '@flusys/nestjs-shared/modules';
30
30
  import { applyCompanyFilter } from '@flusys/nestjs-shared/utils';
31
31
  import { Inject, Injectable, Scope } from '@nestjs/common';
32
32
  import { CompanyBranch } from '../entities/company-branch.entity';
33
33
  import { AuthConfigService } from './auth-config.service';
34
34
  import { AuthDataSourceProvider } from './auth-datasource.provider';
35
- export class BranchService extends RequestScopedApiService {
36
- resolveEntity() {
37
- return CompanyBranch;
38
- }
39
- getDataSourceProvider() {
40
- return this.dataSourceProvider;
41
- }
35
+ export class BranchService extends ApiService {
42
36
  // Query Customization
43
37
  async getSelectQuery(query, _user, select) {
44
38
  if (!select?.length) {
@@ -46,6 +40,8 @@ export class BranchService extends RequestScopedApiService {
46
40
  'id',
47
41
  'name',
48
42
  'slug',
43
+ 'email',
44
+ 'phone',
49
45
  'isActive',
50
46
  'createdAt'
51
47
  ];
@@ -79,7 +75,7 @@ export class BranchService extends RequestScopedApiService {
79
75
  return result;
80
76
  }
81
77
  constructor(cacheManager, utilsService, dataSourceProvider, authConfig){
82
- super('company_branch', null, cacheManager, utilsService, BranchService.name, true, 'auth'), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), _define_property(this, "authConfig", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider, this.authConfig = authConfig;
78
+ super('company_branch', cacheManager, utilsService, BranchService.name, true, 'auth', CompanyBranch, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "authConfig", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.authConfig = authConfig;
83
79
  }
84
80
  }
85
81
  BranchService = _ts_decorate([
@@ -25,18 +25,12 @@ function _ts_param(paramIndex, decorator) {
25
25
  decorator(target, key, paramIndex);
26
26
  };
27
27
  }
28
- import { HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/classes';
28
+ import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
29
29
  import { UtilsService } from '@flusys/nestjs-shared/modules';
30
30
  import { Inject, Injectable, Scope } from '@nestjs/common';
31
31
  import { Company } from '../entities/company.entity';
32
32
  import { AuthDataSourceProvider } from './auth-datasource.provider';
33
- export class CompanyService extends RequestScopedApiService {
34
- resolveEntity() {
35
- return Company;
36
- }
37
- getDataSourceProvider() {
38
- return this.dataSourceProvider;
39
- }
33
+ export class CompanyService extends ApiService {
40
34
  // Query Customization
41
35
  async getSelectQuery(query, _user, select) {
42
36
  if (!select?.length) {
@@ -44,6 +38,8 @@ export class CompanyService extends RequestScopedApiService {
44
38
  'id',
45
39
  'name',
46
40
  'slug',
41
+ 'email',
42
+ 'phone',
47
43
  'isActive',
48
44
  'createdAt'
49
45
  ];
@@ -64,7 +60,7 @@ export class CompanyService extends RequestScopedApiService {
64
60
  };
65
61
  }
66
62
  constructor(cacheManager, utilsService, dataSourceProvider){
67
- super('company', null, cacheManager, utilsService, CompanyService.name, true, 'auth'), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider;
63
+ super('company', cacheManager, utilsService, CompanyService.name, true, 'auth', Company, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService;
68
64
  }
69
65
  }
70
66
  CompanyService = _ts_decorate([
@@ -26,7 +26,7 @@ function _ts_param(paramIndex, decorator) {
26
26
  };
27
27
  }
28
28
  import { LogAction } from '@flusys/nestjs-shared';
29
- import { createModuleLogger, HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/classes';
29
+ import { createModuleLogger, HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
30
30
  import { SYSTEM_MESSAGES } from '@flusys/nestjs-shared/constants';
31
31
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
32
32
  import { UtilsService } from '@flusys/nestjs-shared/modules';
@@ -40,18 +40,12 @@ import { PermissionType } from '../enums';
40
40
  import { IUserEnricher } from '../interfaces/user-enricher.interface';
41
41
  import { AuthConfigService } from './auth-config.service';
42
42
  import { AuthDataSourceProvider } from './auth-datasource.provider';
43
- export class UserService extends RequestScopedApiService {
44
- resolveEntity() {
45
- return AppUser;
46
- }
47
- getDataSourceProvider() {
48
- return this.dataSourceProvider;
49
- }
50
- async ensureRepositoryInitialized() {
51
- await super.ensureRepositoryInitialized();
43
+ export class UserService extends ApiService {
44
+ async ensureDataSourceRepository() {
45
+ await super.ensureDataSourceRepository();
52
46
  const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
53
47
  if (isCompanyFeatureEnabled && !this.permissionRepository) {
54
- [this.permissionRepository] = await this.initializeAdditionalRepositories([
48
+ [this.permissionRepository] = await this.resolveRepositories([
55
49
  UserCompanyPermission
56
50
  ]);
57
51
  }
@@ -66,7 +60,7 @@ export class UserService extends RequestScopedApiService {
66
60
  messageKey: AUTH_MESSAGES.PROFILE_ACCESS_DENIED
67
61
  });
68
62
  }
69
- await this.ensureRepositoryInitialized();
63
+ await this.ensureDataSourceRepository();
70
64
  const userEntity = await this.repository.findOne({
71
65
  where: {
72
66
  id: userId
@@ -81,7 +75,7 @@ export class UserService extends RequestScopedApiService {
81
75
  return userEntity;
82
76
  }
83
77
  async verifyEmail(id) {
84
- await this.ensureRepositoryInitialized();
78
+ await this.ensureDataSourceRepository();
85
79
  await this.repository.update(id, {
86
80
  emailVerified: true
87
81
  });
@@ -92,7 +86,7 @@ export class UserService extends RequestScopedApiService {
92
86
  ]);
93
87
  }
94
88
  async verifyPhone(id) {
95
- await this.ensureRepositoryInitialized();
89
+ await this.ensureDataSourceRepository();
96
90
  await this.repository.update(id, {
97
91
  phoneVerified: true
98
92
  });
@@ -103,7 +97,7 @@ export class UserService extends RequestScopedApiService {
103
97
  ]);
104
98
  }
105
99
  async updateStatus(id, isActive, user) {
106
- await this.ensureRepositoryInitialized();
100
+ await this.ensureDataSourceRepository();
107
101
  const isCompanyFeatureEnabled = this.authConfig.isCompanyFeatureEnabled();
108
102
  if (isCompanyFeatureEnabled && user?.companyId && this.permissionRepository) {
109
103
  const permission = await this.permissionRepository.findOne({
@@ -444,7 +438,7 @@ export class UserService extends RequestScopedApiService {
444
438
  return 100;
445
439
  }
446
440
  async profile(dto, user) {
447
- await this.ensureRepositoryInitialized();
441
+ await this.ensureDataSourceRepository();
448
442
  if (!this.dataSource) {
449
443
  throw new BadRequestException({
450
444
  message: 'DataSource not available',
@@ -508,7 +502,7 @@ export class UserService extends RequestScopedApiService {
508
502
  }
509
503
  }
510
504
  constructor(cacheManager, utilsService, dataSourceProvider, authConfig, userEnricher){
511
- super('appuser', null, cacheManager, utilsService, UserService.name, true, 'auth'), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "dataSourceProvider", void 0), _define_property(this, "authConfig", void 0), _define_property(this, "userEnricher", void 0), _define_property(this, "permissionRepository", void 0), _define_property(this, "dataSource", void 0), _define_property(this, "logAdapter", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.dataSourceProvider = dataSourceProvider, this.authConfig = authConfig, this.userEnricher = userEnricher, this.logAdapter = createModuleLogger(this.constructor.name);
505
+ super('appuser', cacheManager, utilsService, UserService.name, true, 'auth', AppUser, dataSourceProvider), _define_property(this, "cacheManager", void 0), _define_property(this, "utilsService", void 0), _define_property(this, "authConfig", void 0), _define_property(this, "userEnricher", void 0), _define_property(this, "permissionRepository", void 0), _define_property(this, "dataSource", void 0), _define_property(this, "logAdapter", void 0), this.cacheManager = cacheManager, this.utilsService = utilsService, this.authConfig = authConfig, this.userEnricher = userEnricher, this.logAdapter = createModuleLogger(this.constructor.name);
512
506
  }
513
507
  }
514
508
  _ts_decorate([
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import { AuthConfigService } from '../services/auth-config.service';
4
4
  export declare class ClearToken implements NestInterceptor {
5
5
  private readonly authConfig?;
6
- constructor(authConfig?: AuthConfigService);
6
+ constructor(authConfig?: AuthConfigService | undefined);
7
7
  private get cookieName();
8
8
  intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
9
9
  }
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
3
3
  import { AuthConfigService } from '../services/auth-config.service';
4
4
  export declare class SetToken implements NestInterceptor {
5
5
  private readonly authConfig?;
6
- constructor(authConfig?: AuthConfigService);
6
+ constructor(authConfig?: AuthConfigService | undefined);
7
7
  private get cookieName();
8
8
  private get maxAgeMs();
9
9
  intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-auth",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "Authentication and authorization infrastructure for NestJS applications",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -74,26 +74,26 @@
74
74
  }
75
75
  },
76
76
  "peerDependencies": {
77
- "@nestjs/common": "^10.0.0 || ^11.0.0",
78
- "@nestjs/config": "^3.0.0 || ^4.0.0",
79
- "@nestjs/core": "^10.0.0 || ^11.0.0",
80
- "@nestjs/jwt": "^10.0.0 || ^11.0.0",
81
- "@nestjs/passport": "^10.0.0 || ^11.0.0",
82
- "@nestjs/swagger": "^7.0.0 || ^11.0.0",
83
- "@nestjs/typeorm": "^10.0.0 || ^11.0.0",
84
- "bcrypt": "^5.0.1 || ^6.0.0",
85
- "class-transformer": "^0.5.0",
86
- "class-validator": "^0.14.0",
87
- "nodemailer": "^7.0.0",
77
+ "@nestjs/common": "^11.0.0",
78
+ "@nestjs/config": "^4.0.0",
79
+ "@nestjs/core": "^11.0.0",
80
+ "@nestjs/jwt": "^11.0.0",
81
+ "@nestjs/passport": "^11.0.0",
82
+ "@nestjs/swagger": "^11.0.0",
83
+ "@nestjs/typeorm": "^11.0.0",
84
+ "bcrypt": "^6.0.0",
85
+ "class-transformer": "^0.5.1",
86
+ "class-validator": "^0.14.0 || ^0.15.0",
87
+ "nodemailer": "^7.0.0 || ^8.0.0",
88
88
  "passport": "^0.7.0",
89
89
  "passport-jwt": "^4.0.0",
90
90
  "passport-local": "^1.0.0",
91
91
  "typeorm": "^0.3.0",
92
- "express": "^4.18.0",
92
+ "express": "^4.18.0 || ^5.0.0",
93
93
  "rxjs": "^7.8.0"
94
94
  },
95
95
  "dependencies": {
96
- "@flusys/nestjs-core": "5.1.1",
97
- "@flusys/nestjs-shared": "5.1.1"
96
+ "@flusys/nestjs-core": "5.1.3",
97
+ "@flusys/nestjs-shared": "5.1.3"
98
98
  }
99
99
  }
@@ -12,8 +12,6 @@ export declare class AuthDataSourceProvider extends MultiTenantDataSourceService
12
12
  protected static readonly connectionLocks: Map<string, Promise<DataSource>>;
13
13
  protected static singleConnectionLock: Promise<DataSource> | null;
14
14
  constructor(authOptions: AuthModuleOptions, request?: Request);
15
- protected getSingleDataSource(): Promise<DataSource>;
16
- protected getOrCreateTenantConnection(tenant: ITenantDatabaseConfig): Promise<DataSource>;
17
15
  private static buildParentOptions;
18
16
  isCompanyFeatureEnabled(tenant?: ITenantDatabaseConfig): boolean;
19
17
  isEmailVerificationEnabled(tenant?: ITenantDatabaseConfig): boolean;
@@ -6,7 +6,7 @@ export declare class AuthEmailService {
6
6
  private readonly emailProvider?;
7
7
  private readonly PASSWORD_RESET_EXPIRY;
8
8
  private readonly EMAIL_VERIFICATION_EXPIRY;
9
- constructor(dataSourceProvider?: AuthDataSourceProvider, emailProvider?: IAuthEmailProvider);
9
+ constructor(dataSourceProvider?: AuthDataSourceProvider | undefined, emailProvider?: IAuthEmailProvider | undefined);
10
10
  isEmailEnabled(): boolean;
11
11
  private getRepository;
12
12
  private generateToken;
@@ -20,7 +20,7 @@ export declare class AuthenticationService {
20
20
  private readonly authEmailService?;
21
21
  private readonly userEnricher?;
22
22
  private readonly notificationAdapter?;
23
- constructor(jwtService: JwtService, authConfig: AuthConfigService, cacheManager?: HybridCache, dataSourceProvider?: AuthDataSourceProvider, sessionService?: CompanySelectionSessionService, authEmailService?: AuthEmailService, userEnricher?: IUserEnricher, notificationAdapter?: INotificationAdapter);
23
+ constructor(jwtService: JwtService, authConfig: AuthConfigService, cacheManager?: HybridCache | undefined, dataSourceProvider?: AuthDataSourceProvider | undefined, sessionService?: CompanySelectionSessionService | undefined, authEmailService?: AuthEmailService | undefined, userEnricher?: IUserEnricher | undefined, notificationAdapter?: INotificationAdapter | undefined);
24
24
  private isCompanyFeatureEnabled;
25
25
  private isEmailVerificationEnabled;
26
26
  private getUserRepository;
@@ -1,21 +1,18 @@
1
- import { HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/classes';
1
+ import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
2
2
  import { FilterAndPaginationDto } from '@flusys/nestjs-shared/dtos';
3
3
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
4
4
  import { UtilsService } from '@flusys/nestjs-shared/modules';
5
- import { EntityTarget, SelectQueryBuilder } from 'typeorm';
5
+ import { SelectQueryBuilder } from 'typeorm';
6
6
  import { CreateCompanyBranchDto, UpdateCompanyBranchDto } from '../dtos/company-branch.dto';
7
7
  import { CompanyBranch } from '../entities/company-branch.entity';
8
8
  import { ICompanyBranch } from '../interfaces/company-branch.interface';
9
9
  import { AuthConfigService } from './auth-config.service';
10
10
  import { AuthDataSourceProvider } from './auth-datasource.provider';
11
- export declare class BranchService extends RequestScopedApiService<CreateCompanyBranchDto, UpdateCompanyBranchDto, ICompanyBranch, CompanyBranch> {
11
+ export declare class BranchService extends ApiService<CreateCompanyBranchDto, UpdateCompanyBranchDto, ICompanyBranch, CompanyBranch> {
12
12
  protected cacheManager: HybridCache;
13
13
  protected utilsService: UtilsService;
14
- private readonly dataSourceProvider;
15
14
  private readonly authConfig;
16
15
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider, authConfig: AuthConfigService);
17
- protected resolveEntity(): EntityTarget<CompanyBranch>;
18
- protected getDataSourceProvider(): AuthDataSourceProvider;
19
16
  getSelectQuery(query: SelectQueryBuilder<CompanyBranch>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
20
17
  query: SelectQueryBuilder<CompanyBranch>;
21
18
  isRaw: boolean;
@@ -1,18 +1,15 @@
1
- import { HybridCache, RequestScopedApiService } from '@flusys/nestjs-shared/classes';
1
+ import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
- import { EntityTarget, SelectQueryBuilder } from 'typeorm';
4
+ import { SelectQueryBuilder } from 'typeorm';
5
5
  import { CreateCompanyDto, UpdateCompanyDto } from '../dtos/company.dto';
6
6
  import { Company } from '../entities/company.entity';
7
7
  import { ICompany } from '../interfaces/company.interface';
8
8
  import { AuthDataSourceProvider } from './auth-datasource.provider';
9
- export declare class CompanyService extends RequestScopedApiService<CreateCompanyDto, UpdateCompanyDto, ICompany, Company> {
9
+ export declare class CompanyService extends ApiService<CreateCompanyDto, UpdateCompanyDto, ICompany, Company> {
10
10
  protected cacheManager: HybridCache;
11
11
  protected utilsService: UtilsService;
12
- private readonly dataSourceProvider;
13
12
  constructor(cacheManager: HybridCache, utilsService: UtilsService, dataSourceProvider: AuthDataSourceProvider);
14
- protected resolveEntity(): EntityTarget<Company>;
15
- protected getDataSourceProvider(): AuthDataSourceProvider;
16
13
  getSelectQuery(query: SelectQueryBuilder<Company>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
17
14
  query: SelectQueryBuilder<Company>;
18
15
  isRaw: boolean;