@drax/identity-back 0.37.4 → 0.37.5
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/dist/index.js +11 -3
- package/dist/models/UserLoginFailModel.js +8 -8
- package/dist/models/UserSessionModel.js +8 -8
- package/package.json +3 -3
- package/src/index.ts +22 -2
- package/src/models/UserLoginFailModel.ts +8 -8
- package/src/models/UserSessionModel.ts +8 -8
- package/tsconfig.tsbuildinfo +1 -1
- package/types/index.d.ts +9 -3
- package/types/index.d.ts.map +1 -1
- package/types/models/UserLoginFailModel.d.ts +2 -2
- package/types/models/UserLoginFailModel.d.ts.map +1 -1
- package/types/models/UserSessionModel.d.ts +2 -2
- package/types/models/UserSessionModel.d.ts.map +1 -1
- package/types/schemas/UserLoginFailSchema.d.ts +1 -1
- package/types/schemas/UserSessionSchema.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -30,6 +30,12 @@ import CreateOrUpdateRole from "./setup/CreateOrUpdateRole.js";
|
|
|
30
30
|
import LoadPermissions from "./setup/LoadPermissions.js";
|
|
31
31
|
import LoadIdentityConfigFromEnv from "./setup/LoadIdentityConfigFromEnv.js";
|
|
32
32
|
import RecoveryUserPassword from "./setup/RecoveryUserPassword.js";
|
|
33
|
+
import { RoleModel, RoleMongoSchema } from "./models/RoleModel.js";
|
|
34
|
+
import { TenantModel, TenantMongoSchema } from "./models/TenantModel.js";
|
|
35
|
+
import { UserModel, UserMongoSchema } from "./models/UserModel.js";
|
|
36
|
+
import { UserApiKeyModel, UserApiKeyMongoSchema } from "./models/UserApiKeyModel.js";
|
|
37
|
+
import { UserSessionModel, UserSessionMongoSchema } from "./models/UserSessionModel.js";
|
|
38
|
+
import { UserLoginFailModel, UserLoginFailMongoSchema } from "./models/UserLoginFailModel.js";
|
|
33
39
|
import RoleMongoRepository from "./repository/mongo/RoleMongoRepository.js";
|
|
34
40
|
import TenantMongoRepository from "./repository/mongo/TenantMongoRepository.js";
|
|
35
41
|
import UserMongoRepository from "./repository/mongo/UserMongoRepository.js";
|
|
@@ -52,14 +58,14 @@ import { UserSchema, UserBaseSchema } from "./schemas/UserSchema.js";
|
|
|
52
58
|
import { TenantSchema, TenantBaseSchema } from "./schemas/TenantSchema.js";
|
|
53
59
|
import { RoleSchema, RoleBaseSchema } from "./schemas/RoleSchema.js";
|
|
54
60
|
import { UserApiKeySchema, UserApiKeyBaseSchema } from "./schemas/UserApiKeySchema.js";
|
|
55
|
-
import { UserLoginFailBaseSchema
|
|
56
|
-
import { UserSessionBaseSchema
|
|
61
|
+
import { UserLoginFailBaseSchema } from "./schemas/UserLoginFailSchema.js";
|
|
62
|
+
import { UserSessionBaseSchema } from "./schemas/UserSessionSchema.js";
|
|
57
63
|
const graphqlMergeResult = await GraphqlMerge();
|
|
58
64
|
const identityTypeDefs = await graphqlMergeResult.typeDefs;
|
|
59
65
|
const identityResolvers = await graphqlMergeResult.resolvers;
|
|
60
66
|
export {
|
|
61
67
|
//Schemas
|
|
62
|
-
UserSchema, UserBaseSchema, TenantSchema, TenantBaseSchema, RoleSchema, RoleBaseSchema, UserApiKeyBaseSchema, UserApiKeySchema, UserLoginFailBaseSchema,
|
|
68
|
+
UserSchema, UserBaseSchema, TenantSchema, TenantBaseSchema, RoleSchema, RoleBaseSchema, UserApiKeyBaseSchema, UserApiKeySchema, UserLoginFailBaseSchema, UserSessionBaseSchema,
|
|
63
69
|
//Service
|
|
64
70
|
UserService, RoleService, TenantService, UserApiKeyService, UserSessionService, UserLoginFailService, PermissionService, Rbac,
|
|
65
71
|
//Factories
|
|
@@ -74,6 +80,8 @@ jwtMiddleware, rbacMiddleware, apiKeyMiddleware,
|
|
|
74
80
|
RolePermissions, TenantPermissions, UserPermissions, UserApiKeyPermissions, UserSessionPermissions, UserLoginFailPermissions,
|
|
75
81
|
//Mongo Repositories
|
|
76
82
|
RoleMongoRepository, TenantMongoRepository, UserMongoRepository, UserApiKeyMongoRepository, UserSessionMongoRepository, UserLoginFailMongoRepository,
|
|
83
|
+
//Mongo Models
|
|
84
|
+
RoleModel, TenantModel, UserModel, UserApiKeyModel, UserSessionModel, UserLoginFailModel, RoleMongoSchema, TenantMongoSchema, UserMongoSchema, UserApiKeyMongoSchema, UserSessionMongoSchema, UserLoginFailMongoSchema,
|
|
77
85
|
//Sqlite Repositories
|
|
78
86
|
RoleSqliteRepository, TenantSqliteRepository, UserSqliteRepository, UserApiKeySqliteRepository, UserLoginFailSqliteRepository, UserSessionSqliteRepository,
|
|
79
87
|
//Config
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { mongoose } from '@drax/common-back';
|
|
2
2
|
import uniqueValidator from 'mongoose-unique-validator';
|
|
3
3
|
import mongoosePaginate from 'mongoose-paginate-v2';
|
|
4
|
-
const
|
|
4
|
+
const UserLoginFailMongoSchema = new mongoose.Schema({
|
|
5
5
|
username: { type: String, required: false, index: false, unique: false },
|
|
6
6
|
userAgent: { type: String, required: false, index: false, unique: false },
|
|
7
7
|
ip: { type: String, required: false, index: false, unique: false },
|
|
8
8
|
}, { timestamps: true });
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
UserLoginFailMongoSchema.plugin(uniqueValidator, { message: 'validation.unique' });
|
|
10
|
+
UserLoginFailMongoSchema.plugin(mongoosePaginate);
|
|
11
|
+
UserLoginFailMongoSchema.virtual("id").get(function () {
|
|
12
12
|
return this._id.toString();
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
UserLoginFailMongoSchema.set('toJSON', { getters: true, virtuals: true });
|
|
15
|
+
UserLoginFailMongoSchema.set('toObject', { getters: true, virtuals: true });
|
|
16
16
|
const MODEL_NAME = 'UserLoginFail';
|
|
17
17
|
const COLLECTION_NAME = 'UserLoginFail';
|
|
18
|
-
const UserLoginFailModel = mongoose.model(MODEL_NAME,
|
|
19
|
-
export {
|
|
18
|
+
const UserLoginFailModel = mongoose.model(MODEL_NAME, UserLoginFailMongoSchema, COLLECTION_NAME);
|
|
19
|
+
export { UserLoginFailMongoSchema, UserLoginFailModel };
|
|
20
20
|
export default UserLoginFailModel;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { mongoose } from '@drax/common-back';
|
|
2
2
|
import uniqueValidator from 'mongoose-unique-validator';
|
|
3
3
|
import mongoosePaginate from 'mongoose-paginate-v2';
|
|
4
|
-
const
|
|
4
|
+
const UserSessionMongoSchema = new mongoose.Schema({
|
|
5
5
|
uuid: { type: String, required: true, index: true, unique: false },
|
|
6
6
|
user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, index: true, unique: false },
|
|
7
7
|
userAgent: { type: String, required: false, index: false, unique: false },
|
|
8
8
|
ip: { type: String, required: false, index: false, unique: false },
|
|
9
9
|
}, { timestamps: true });
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
UserSessionMongoSchema.plugin(uniqueValidator, { message: 'validation.unique' });
|
|
11
|
+
UserSessionMongoSchema.plugin(mongoosePaginate);
|
|
12
|
+
UserSessionMongoSchema.virtual("id").get(function () {
|
|
13
13
|
return this._id.toString();
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
UserSessionMongoSchema.set('toJSON', { getters: true, virtuals: true });
|
|
16
|
+
UserSessionMongoSchema.set('toObject', { getters: true, virtuals: true });
|
|
17
17
|
const MODEL_NAME = 'UserSession';
|
|
18
18
|
const COLLECTION_NAME = 'UserSession';
|
|
19
|
-
const UserSessionModel = mongoose.model(MODEL_NAME,
|
|
20
|
-
export {
|
|
19
|
+
const UserSessionModel = mongoose.model(MODEL_NAME, UserSessionMongoSchema, COLLECTION_NAME);
|
|
20
|
+
export { UserSessionMongoSchema, UserSessionModel };
|
|
21
21
|
export default UserSessionModel;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.37.
|
|
6
|
+
"version": "0.37.5",
|
|
7
7
|
"description": "Identity module for user management, authentication and authorization.",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@drax/common-back": "^0.37.2",
|
|
32
|
-
"@drax/crud-back": "^0.37.
|
|
32
|
+
"@drax/crud-back": "^0.37.5",
|
|
33
33
|
"@drax/crud-share": "^0.37.0",
|
|
34
34
|
"@drax/email-back": "^0.37.0",
|
|
35
35
|
"@drax/identity-share": "^0.37.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"debug": "0"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "2fd3d1fa98a875f67691ea4524682985a52cba17"
|
|
67
67
|
}
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,13 @@ import type {IUserApiKeyRepository} from "./interfaces/IUserApiKeyRepository";
|
|
|
44
44
|
import type {IUserLoginFailRepository} from "./interfaces/IUserLoginFailRepository";
|
|
45
45
|
import type {IUserSessionRepository} from "./interfaces/IUserSessionRepository";
|
|
46
46
|
|
|
47
|
+
import {RoleModel, RoleMongoSchema} from "./models/RoleModel.js";
|
|
48
|
+
import {TenantModel, TenantMongoSchema} from "./models/TenantModel.js";
|
|
49
|
+
import {UserModel, UserMongoSchema} from "./models/UserModel.js";
|
|
50
|
+
import {UserApiKeyModel, UserApiKeyMongoSchema} from "./models/UserApiKeyModel.js";
|
|
51
|
+
import {UserSessionModel,UserSessionMongoSchema} from "./models/UserSessionModel.js";
|
|
52
|
+
import {UserLoginFailModel,UserLoginFailMongoSchema} from "./models/UserLoginFailModel.js";
|
|
53
|
+
|
|
47
54
|
|
|
48
55
|
import RoleMongoRepository from "./repository/mongo/RoleMongoRepository.js";
|
|
49
56
|
import TenantMongoRepository from "./repository/mongo/TenantMongoRepository.js";
|
|
@@ -101,9 +108,7 @@ export {
|
|
|
101
108
|
UserApiKeyBaseSchema,
|
|
102
109
|
UserApiKeySchema,
|
|
103
110
|
UserLoginFailBaseSchema,
|
|
104
|
-
UserLoginFailSchema,
|
|
105
111
|
UserSessionBaseSchema,
|
|
106
|
-
UserSessionSchema,
|
|
107
112
|
|
|
108
113
|
//Service
|
|
109
114
|
UserService,
|
|
@@ -158,6 +163,21 @@ export {
|
|
|
158
163
|
UserSessionMongoRepository,
|
|
159
164
|
UserLoginFailMongoRepository,
|
|
160
165
|
|
|
166
|
+
//Mongo Models
|
|
167
|
+
RoleModel,
|
|
168
|
+
TenantModel,
|
|
169
|
+
UserModel,
|
|
170
|
+
UserApiKeyModel,
|
|
171
|
+
UserSessionModel,
|
|
172
|
+
UserLoginFailModel,
|
|
173
|
+
|
|
174
|
+
RoleMongoSchema,
|
|
175
|
+
TenantMongoSchema,
|
|
176
|
+
UserMongoSchema,
|
|
177
|
+
UserApiKeyMongoSchema,
|
|
178
|
+
UserSessionMongoSchema,
|
|
179
|
+
UserLoginFailMongoSchema,
|
|
180
|
+
|
|
161
181
|
//Sqlite Repositories
|
|
162
182
|
RoleSqliteRepository,
|
|
163
183
|
TenantSqliteRepository,
|
|
@@ -4,30 +4,30 @@ import uniqueValidator from 'mongoose-unique-validator';
|
|
|
4
4
|
import mongoosePaginate from 'mongoose-paginate-v2'
|
|
5
5
|
import type {IUserLoginFail} from '@drax/identity-share'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const UserLoginFailMongoSchema = new mongoose.Schema<IUserLoginFail>({
|
|
8
8
|
username: {type: String, required: false, index: false, unique: false },
|
|
9
9
|
userAgent: {type: String, required: false, index: false, unique: false },
|
|
10
10
|
ip: {type: String, required: false, index: false, unique: false },
|
|
11
11
|
}, {timestamps: true});
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
UserLoginFailMongoSchema.plugin(uniqueValidator, {message: 'validation.unique'});
|
|
14
|
+
UserLoginFailMongoSchema.plugin(mongoosePaginate);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
UserLoginFailMongoSchema.virtual("id").get(function () {
|
|
17
17
|
return this._id.toString();
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
UserLoginFailMongoSchema.set('toJSON', {getters: true, virtuals: true});
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
UserLoginFailMongoSchema.set('toObject', {getters: true, virtuals: true});
|
|
24
24
|
|
|
25
25
|
const MODEL_NAME = 'UserLoginFail';
|
|
26
26
|
const COLLECTION_NAME = 'UserLoginFail';
|
|
27
|
-
const UserLoginFailModel = mongoose.model<IUserLoginFail, PaginateModel<IUserLoginFail>>(MODEL_NAME,
|
|
27
|
+
const UserLoginFailModel = mongoose.model<IUserLoginFail, PaginateModel<IUserLoginFail>>(MODEL_NAME, UserLoginFailMongoSchema,COLLECTION_NAME);
|
|
28
28
|
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
UserLoginFailMongoSchema,
|
|
31
31
|
UserLoginFailModel
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -5,31 +5,31 @@ import uniqueValidator from 'mongoose-unique-validator';
|
|
|
5
5
|
import mongoosePaginate from 'mongoose-paginate-v2'
|
|
6
6
|
import type {IUserSession} from '@drax/identity-share'
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const UserSessionMongoSchema = new mongoose.Schema<IUserSession>({
|
|
9
9
|
uuid: {type: String, required: true, index: true, unique: false },
|
|
10
10
|
user: {type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, index: true, unique: false },
|
|
11
11
|
userAgent: {type: String, required: false, index: false, unique: false },
|
|
12
12
|
ip: {type: String, required: false, index: false, unique: false },
|
|
13
13
|
}, {timestamps: true});
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
UserSessionMongoSchema.plugin(uniqueValidator, {message: 'validation.unique'});
|
|
16
|
+
UserSessionMongoSchema.plugin(mongoosePaginate);
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
UserSessionMongoSchema.virtual("id").get(function () {
|
|
19
19
|
return this._id.toString();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
UserSessionMongoSchema.set('toJSON', {getters: true, virtuals: true});
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
UserSessionMongoSchema.set('toObject', {getters: true, virtuals: true});
|
|
26
26
|
|
|
27
27
|
const MODEL_NAME = 'UserSession';
|
|
28
28
|
const COLLECTION_NAME = 'UserSession';
|
|
29
|
-
const UserSessionModel = mongoose.model<IUserSession, PaginateModel<IUserSession>>(MODEL_NAME,
|
|
29
|
+
const UserSessionModel = mongoose.model<IUserSession, PaginateModel<IUserSession>>(MODEL_NAME, UserSessionMongoSchema,COLLECTION_NAME);
|
|
30
30
|
|
|
31
31
|
export {
|
|
32
|
-
|
|
32
|
+
UserSessionMongoSchema,
|
|
33
33
|
UserSessionModel
|
|
34
34
|
}
|
|
35
35
|
|