@flusys/nestjs-auth 5.3.1 → 5.4.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.
- package/README.md +2 -2
- package/cjs/entities/index.js +3 -3
- package/cjs/modules/auth.module.js +1 -1
- package/cjs/services/auth-datasource.provider.js +3 -3
- package/entities/index.d.ts +1 -1
- package/fesm/entities/index.js +1 -1
- package/fesm/modules/auth.module.js +2 -2
- package/fesm/services/auth-datasource.provider.js +3 -3
- package/modules/auth.module.d.ts +2 -2
- package/package.json +3 -3
- package/services/auth-datasource.provider.d.ts +1 -1
package/README.md
CHANGED
|
@@ -174,11 +174,11 @@ AuthModule.forRootAsync({
|
|
|
174
174
|
Pass auth entities to your TypeORM setup using the static helper:
|
|
175
175
|
|
|
176
176
|
```typescript
|
|
177
|
-
import {
|
|
177
|
+
import { getAuthEntitiesByConfig } from '@flusys/nestjs-auth/entities';
|
|
178
178
|
|
|
179
179
|
TypeOrmModule.forRoot({
|
|
180
180
|
entities: [
|
|
181
|
-
...
|
|
181
|
+
...getAuthEntitiesByConfig({
|
|
182
182
|
enableCompanyFeature: true,
|
|
183
183
|
enableEmailVerification: false,
|
|
184
184
|
}),
|
package/cjs/entities/index.js
CHANGED
|
@@ -15,8 +15,8 @@ _export(exports, {
|
|
|
15
15
|
get UserCompanyPermission () {
|
|
16
16
|
return _usercompanypermissionentity.UserCompanyPermission;
|
|
17
17
|
},
|
|
18
|
-
get
|
|
19
|
-
return
|
|
18
|
+
get getAuthEntitiesByConfig () {
|
|
19
|
+
return getAuthEntitiesByConfig;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _appuserentity = _export_star(require("./app-user.entity"), exports);
|
|
@@ -50,7 +50,7 @@ const CompanyEntities = [
|
|
|
50
50
|
_companybranchentity.CompanyBranch,
|
|
51
51
|
_usercompanypermissionentity.UserCompanyPermission
|
|
52
52
|
];
|
|
53
|
-
function
|
|
53
|
+
function getAuthEntitiesByConfig(config) {
|
|
54
54
|
const { enableCompanyFeature = false, enableEmailVerification = true } = config;
|
|
55
55
|
const entities = [
|
|
56
56
|
...BaseEntities
|
|
@@ -190,7 +190,7 @@ let AuthModule = class AuthModule {
|
|
|
190
190
|
];
|
|
191
191
|
}
|
|
192
192
|
static getEntities(config) {
|
|
193
|
-
return (0, _entities.
|
|
193
|
+
return (0, _entities.getAuthEntitiesByConfig)({
|
|
194
194
|
enableCompanyFeature: config.enableCompanyFeature ?? false,
|
|
195
195
|
enableEmailVerification: config.enableEmailVerification ?? true
|
|
196
196
|
});
|
|
@@ -12,8 +12,8 @@ const _nestjsshared = require("@flusys/nestjs-shared");
|
|
|
12
12
|
const _common = require("@nestjs/common");
|
|
13
13
|
const _core = require("@nestjs/core");
|
|
14
14
|
const _express = require("express");
|
|
15
|
-
const _authmoduleoptionsinterface = require("../interfaces/auth-module-options.interface");
|
|
16
15
|
const _authconstants = require("../config/auth.constants");
|
|
16
|
+
const _authmoduleoptionsinterface = require("../interfaces/auth-module-options.interface");
|
|
17
17
|
function _define_property(obj, key, value) {
|
|
18
18
|
if (key in obj) {
|
|
19
19
|
Object.defineProperty(obj, key, {
|
|
@@ -100,8 +100,8 @@ let AuthDataSourceProvider = class AuthDataSourceProvider extends _nestjsshared.
|
|
|
100
100
|
return effectiveTenant?.enableEmailVerification ?? this.authOptions.bootstrapAppConfig?.enableEmailVerification ?? true;
|
|
101
101
|
}
|
|
102
102
|
async getAuthEntities() {
|
|
103
|
-
const {
|
|
104
|
-
return
|
|
103
|
+
const { getAuthEntitiesByConfig } = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("../entities")));
|
|
104
|
+
return getAuthEntitiesByConfig({
|
|
105
105
|
enableCompanyFeature: this.isCompanyFeatureEnabled(),
|
|
106
106
|
enableEmailVerification: this.isEmailVerificationEnabled()
|
|
107
107
|
});
|
package/entities/index.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export interface IAuthEntitiesConfig {
|
|
|
17
17
|
enableCompanyFeature?: boolean;
|
|
18
18
|
enableEmailVerification?: boolean;
|
|
19
19
|
}
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function getAuthEntitiesByConfig(config: IAuthEntitiesConfig): ((typeof BaseEntities)[number] | (typeof EmailEntities)[number] | (typeof CompanyEntities)[number])[];
|
package/fesm/entities/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const CompanyEntities = [
|
|
|
22
22
|
CompanyBranch,
|
|
23
23
|
UserCompanyPermission
|
|
24
24
|
];
|
|
25
|
-
export function
|
|
25
|
+
export function getAuthEntitiesByConfig(config) {
|
|
26
26
|
const { enableCompanyFeature = false, enableEmailVerification = true } = config;
|
|
27
27
|
const entities = [
|
|
28
28
|
...BaseEntities
|
|
@@ -11,7 +11,7 @@ import { PassportModule } from '@nestjs/passport';
|
|
|
11
11
|
import { JwtAuthGuard } from '@flusys/nestjs-shared/guards';
|
|
12
12
|
import { AUTH_MODULE_OPTIONS } from '../config/auth.constants';
|
|
13
13
|
import { AuthenticationController, BranchController, CompanyController, CompanySelectionController, EmailVerificationController, UserController, UserPermissionController } from '../controllers';
|
|
14
|
-
import {
|
|
14
|
+
import { getAuthEntitiesByConfig } from '../entities';
|
|
15
15
|
import { ClearToken } from '../interceptors/clear-token.interceptor';
|
|
16
16
|
import { SetToken } from '../interceptors/set-token.interceptor';
|
|
17
17
|
import { AuthEmailService, AuthenticationService, BranchService, CompanySelectionSessionService, CompanyService, UserPermissionService, UserService } from '../services';
|
|
@@ -180,7 +180,7 @@ export class AuthModule {
|
|
|
180
180
|
];
|
|
181
181
|
}
|
|
182
182
|
static getEntities(config) {
|
|
183
|
-
return
|
|
183
|
+
return getAuthEntitiesByConfig({
|
|
184
184
|
enableCompanyFeature: config.enableCompanyFeature ?? false,
|
|
185
185
|
enableEmailVerification: config.enableEmailVerification ?? true
|
|
186
186
|
});
|
|
@@ -29,8 +29,8 @@ import { MultiTenantDataSourceService } from '@flusys/nestjs-shared';
|
|
|
29
29
|
import { Inject, Injectable, Optional, Scope } from '@nestjs/common';
|
|
30
30
|
import { REQUEST } from '@nestjs/core';
|
|
31
31
|
import { Request } from 'express';
|
|
32
|
-
import { AuthModuleOptions } from '../interfaces/auth-module-options.interface';
|
|
33
32
|
import { AUTH_MODULE_OPTIONS } from '../config/auth.constants';
|
|
33
|
+
import { AuthModuleOptions } from '../interfaces/auth-module-options.interface';
|
|
34
34
|
export class AuthDataSourceProvider extends MultiTenantDataSourceService {
|
|
35
35
|
static buildParentOptions(options) {
|
|
36
36
|
return {
|
|
@@ -49,8 +49,8 @@ export class AuthDataSourceProvider extends MultiTenantDataSourceService {
|
|
|
49
49
|
return effectiveTenant?.enableEmailVerification ?? this.authOptions.bootstrapAppConfig?.enableEmailVerification ?? true;
|
|
50
50
|
}
|
|
51
51
|
async getAuthEntities() {
|
|
52
|
-
const {
|
|
53
|
-
return
|
|
52
|
+
const { getAuthEntitiesByConfig } = await import('../entities');
|
|
53
|
+
return getAuthEntitiesByConfig({
|
|
54
54
|
enableCompanyFeature: this.isCompanyFeatureEnabled(),
|
|
55
55
|
enableEmailVerification: this.isEmailVerificationEnabled()
|
|
56
56
|
});
|
package/modules/auth.module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IBootstrapAppConfig } from '@flusys/nestjs-core';
|
|
2
2
|
import { DynamicModule } from '@nestjs/common';
|
|
3
|
-
import {
|
|
3
|
+
import { getAuthEntitiesByConfig } from '../entities';
|
|
4
4
|
import { AuthModuleAsyncOptions, AuthModuleOptions } from '../interfaces/auth-module-options.interface';
|
|
5
5
|
export declare class AuthModule {
|
|
6
6
|
static forRoot(options: AuthModuleOptions): DynamicModule;
|
|
@@ -12,5 +12,5 @@ export declare class AuthModule {
|
|
|
12
12
|
private static buildProviders;
|
|
13
13
|
private static buildExports;
|
|
14
14
|
private static createAsyncProviders;
|
|
15
|
-
static getEntities(config: IBootstrapAppConfig): ReturnType<typeof
|
|
15
|
+
static getEntities(config: IBootstrapAppConfig): ReturnType<typeof getAuthEntitiesByConfig>;
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-auth",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Authentication and authorization infrastructure for NestJS applications",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "fesm/index.js",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"rxjs": "^7.8.0"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@flusys/nestjs-core": "5.
|
|
97
|
-
"@flusys/nestjs-shared": "5.
|
|
96
|
+
"@flusys/nestjs-core": "5.4.0",
|
|
97
|
+
"@flusys/nestjs-shared": "5.4.0"
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MultiTenantDataSourceService } from '@flusys/nestjs-shared';
|
|
2
1
|
import { IDatabaseConfig, ITenantDatabaseConfig } from '@flusys/nestjs-core';
|
|
2
|
+
import { MultiTenantDataSourceService } from '@flusys/nestjs-shared';
|
|
3
3
|
import { Request } from 'express';
|
|
4
4
|
import { DataSource } from 'typeorm';
|
|
5
5
|
import { AuthModuleOptions } from '../interfaces/auth-module-options.interface';
|