@drax/identity-back 0.1.0 → 0.1.2

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 (72) hide show
  1. package/dist/services/TenantService.js +42 -11
  2. package/dist/services/UserApiKeyService.js +36 -11
  3. package/dist/services/UserService.js +34 -8
  4. package/package.json +2 -2
  5. package/src/services/TenantService.ts +49 -17
  6. package/src/services/UserApiKeyService.ts +42 -17
  7. package/src/services/UserService.ts +74 -48
  8. package/tsconfig.tsbuildinfo +1 -1
  9. package/types/config/IdentityConfig.d.ts +12 -0
  10. package/types/config/IdentityConfig.d.ts.map +1 -0
  11. package/types/errors/BadCredentialsError.d.ts +6 -0
  12. package/types/errors/BadCredentialsError.d.ts.map +1 -0
  13. package/types/errors/UnauthorizedError.d.ts +6 -0
  14. package/types/errors/UnauthorizedError.d.ts.map +1 -0
  15. package/types/factory/RoleServiceFactory.d.ts +4 -0
  16. package/types/factory/TenantServiceFactory.d.ts +4 -0
  17. package/types/factory/UserApiKeyServiceFactory.d.ts +4 -0
  18. package/types/factory/UserServiceFactory.d.ts +4 -0
  19. package/types/graphql/index.d.ts +6 -0
  20. package/types/graphql/resolvers/role.resolvers.d.ts +52 -0
  21. package/types/graphql/resolvers/tenant.resolvers.d.ts +49 -0
  22. package/types/graphql/resolvers/user-api-key.resolvers.d.ts +37 -0
  23. package/types/graphql/resolvers/user.resolvers.d.ts +67 -0
  24. package/types/index.d.ts +35 -0
  25. package/types/interfaces/IRoleRepository.d.ts +9 -0
  26. package/types/interfaces/ITenantRepository.d.ts +9 -0
  27. package/types/interfaces/IUserApiKeyRepository.d.ts +7 -0
  28. package/types/interfaces/IUserRepository.d.ts +10 -0
  29. package/types/middleware/apiKeyMiddleware.d.ts +4 -0
  30. package/types/middleware/jwtMiddleware.d.ts +4 -0
  31. package/types/middleware/rbacMiddleware.d.ts +4 -0
  32. package/types/models/RoleModel.d.ts +16 -0
  33. package/types/models/TenantModel.d.ts +16 -0
  34. package/types/models/UserApiKeyModel.d.ts +16 -0
  35. package/types/models/UserGroupModel.d.ts +16 -0
  36. package/types/models/UserModel.d.ts +16 -0
  37. package/types/permissions/IdentityPermissions.d.ts +27 -0
  38. package/types/permissions/IdentityPermissions.d.ts.map +1 -0
  39. package/types/repository/mongo/RoleMongoRepository.d.ts +14 -0
  40. package/types/repository/mongo/TenantMongoRepository.d.ts +14 -0
  41. package/types/repository/mongo/UserApiKeyMongoRepository.d.ts +14 -0
  42. package/types/repository/mongo/UserMongoRepository.d.ts +17 -0
  43. package/types/repository/sqlite/RoleSqliteRepository.d.ts +22 -0
  44. package/types/repository/sqlite/TenantSqliteRepository.d.ts +19 -0
  45. package/types/repository/sqlite/UserSqliteRepository.d.ts +25 -0
  46. package/types/routes/RoleRoutes.d.ts +4 -0
  47. package/types/routes/TenantRoutes.d.ts +4 -0
  48. package/types/routes/UserApiKeyRoutes.d.ts +4 -0
  49. package/types/routes/UserAvatarRoutes.d.ts +4 -0
  50. package/types/routes/UserRoutes.d.ts +4 -0
  51. package/types/services/PermissionService.d.ts +9 -0
  52. package/types/services/PermissionService.d.ts.map +1 -0
  53. package/types/services/RoleService.d.ts +16 -0
  54. package/types/services/TenantService.d.ts +16 -0
  55. package/types/services/TenantService.d.ts.map +1 -1
  56. package/types/services/UserApiKeyService.d.ts +15 -0
  57. package/types/services/UserApiKeyService.d.ts.map +1 -1
  58. package/types/services/UserService.d.ts +21 -0
  59. package/types/services/UserService.d.ts.map +1 -1
  60. package/types/setup/CreateOrUpdateRole.d.ts +5 -0
  61. package/types/setup/CreateUserIfNotExist.d.ts +5 -0
  62. package/types/setup/LoadIdentityConfigFromEnv.d.ts +4 -0
  63. package/types/setup/LoadPermissions.d.ts +4 -0
  64. package/types/setup/LoadPermissions.d.ts.map +1 -0
  65. package/types/setup/RecoveryUserPassword.d.ts +4 -0
  66. package/types/utils/AuthUtils.d.ts +18 -0
  67. package/types/zod/RoleZod.d.ts +10 -0
  68. package/types/zod/RoleZod.d.ts.map +1 -0
  69. package/types/zod/TenantZod.d.ts +10 -0
  70. package/types/zod/TenantZod.d.ts.map +1 -0
  71. package/types/zod/UserZod.d.ts +53 -0
  72. package/types/zod/UserZod.d.ts.map +1 -0
@@ -0,0 +1,12 @@
1
+ declare enum IdentityConfig {
2
+ JwtSecret = "DRAX_JWT_SECRET",
3
+ JwtExpiration = "DRAX_JWT_EXPIRATION",
4
+ JwtIssuer = "DRAX_JWT_ISSUER",
5
+ ApiKeySecret = "DRAX_APIKEY_SECRET",
6
+ ApiKeyCacheTTL = "DRAX_APIKEY_CACHE_TTL",
7
+ RbacCacheTTL = "DRAX_RBAC_CACHE_TTL",
8
+ AvatarDir = "DRAX_AVATAR_DIR"
9
+ }
10
+ export default IdentityConfig;
11
+ export { IdentityConfig };
12
+ //# sourceMappingURL=IdentityConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentityConfig.d.ts","sourceRoot":"","sources":["../../src/config/IdentityConfig.ts"],"names":[],"mappings":"AAAA,aAAK,cAAc;IAIf,SAAS,oBAAoB;IAC7B,aAAa,wBAAwB;IACrC,SAAS,oBAAoB;IAE7B,YAAY,uBAAuB;IACnC,cAAc,0BAA0B;IAExC,YAAY,wBAAwB;IAEpC,SAAS,oBAAoB;CAGhC;AAED,eAAe,cAAc,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare class BadCredentialsError extends Error {
2
+ constructor();
3
+ get statusCode(): number;
4
+ }
5
+ export default BadCredentialsError;
6
+ //# sourceMappingURL=BadCredentialsError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadCredentialsError.d.ts","sourceRoot":"","sources":["../../src/errors/BadCredentialsError.ts"],"names":[],"mappings":"AAAA,cAAM,mBAAoB,SAAQ,KAAK;;IAMnC,IAAI,UAAU,WAEb;CAEJ;AAED,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,6 @@
1
+ declare class UnauthorizedError extends Error {
2
+ constructor();
3
+ get statusCode(): number;
4
+ }
5
+ export default UnauthorizedError;
6
+ //# sourceMappingURL=UnauthorizedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnauthorizedError.d.ts","sourceRoot":"","sources":["../../src/errors/UnauthorizedError.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAkB,SAAQ,KAAK;;IAMjC,IAAI,UAAU,WAEb;CAEJ;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import RoleService from "../services/RoleService.js";
2
+ declare const RoleServiceFactory: (verbose?: boolean) => RoleService;
3
+ export default RoleServiceFactory;
4
+ //# sourceMappingURL=RoleServiceFactory.d.ts.map
@@ -0,0 +1,4 @@
1
+ import TenantService from "../services/TenantService.js";
2
+ declare const TenantServiceFactory: (verbose?: boolean) => TenantService;
3
+ export default TenantServiceFactory;
4
+ //# sourceMappingURL=TenantServiceFactory.d.ts.map
@@ -0,0 +1,4 @@
1
+ import UserApiKeyService from "../services/UserApiKeyService.js";
2
+ declare const UserApiKeyServiceFactory: (verbose?: boolean) => UserApiKeyService;
3
+ export default UserApiKeyServiceFactory;
4
+ //# sourceMappingURL=UserApiKeyServiceFactory.d.ts.map
@@ -0,0 +1,4 @@
1
+ import UserService from "../services/UserService.js";
2
+ declare const UserServiceFactory: (verbose?: boolean) => UserService;
3
+ export default UserServiceFactory;
4
+ //# sourceMappingURL=UserServiceFactory.d.ts.map
@@ -0,0 +1,6 @@
1
+ declare const _default: () => Promise<{
2
+ typeDefs: Promise<import("@graphql-tools/utils").TypeSource>;
3
+ resolvers: Promise<import("@graphql-tools/utils").IResolvers>;
4
+ }>;
5
+ export default _default;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,52 @@
1
+ declare const _default: {
2
+ Query: {
3
+ findRoleById: (_: any, { id }: {
4
+ id: any;
5
+ }, { rbac }: {
6
+ rbac: any;
7
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IRole>;
8
+ findRoleByName: (_: any, { name }: {
9
+ name: any;
10
+ }, { rbac }: {
11
+ rbac: any;
12
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IRole>;
13
+ fetchRole: (_: any, {}: {}, { rbac }: {
14
+ rbac: any;
15
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IRole[]>;
16
+ fetchPermissions: (_: any, {}: {}, { rbac }: {
17
+ rbac: any;
18
+ }) => Promise<string[]>;
19
+ paginateRole: (_: any, { options }: {
20
+ options?: {
21
+ page: number;
22
+ limit: number;
23
+ orderBy: string;
24
+ orderDesc: boolean;
25
+ search: string;
26
+ filters: any[];
27
+ };
28
+ }, { rbac }: {
29
+ rbac: any;
30
+ }) => Promise<import("packages/common/common-share/types/index.js").IDraxPaginateResult<import("packages/identity/identity-share/types/index.js").IRole>>;
31
+ };
32
+ Mutation: {
33
+ createRole: (_: any, { input }: {
34
+ input: any;
35
+ }, { rbac }: {
36
+ rbac: any;
37
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IRole>;
38
+ updateRole: (_: any, { id, input }: {
39
+ id: any;
40
+ input: any;
41
+ }, { rbac }: {
42
+ rbac: any;
43
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IRole>;
44
+ deleteRole: (_: any, { id }: {
45
+ id: any;
46
+ }, { rbac }: {
47
+ rbac: any;
48
+ }) => Promise<boolean>;
49
+ };
50
+ };
51
+ export default _default;
52
+ //# sourceMappingURL=role.resolvers.d.ts.map
@@ -0,0 +1,49 @@
1
+ declare const _default: {
2
+ Query: {
3
+ findTenantById: (_: any, { id }: {
4
+ id: any;
5
+ }, { rbac }: {
6
+ rbac: any;
7
+ }) => Promise<import("packages/identity/identity-share/types/index.js").ITenant>;
8
+ findTenantByName: (_: any, { name }: {
9
+ name: any;
10
+ }, { rbac }: {
11
+ rbac: any;
12
+ }) => Promise<import("packages/identity/identity-share/types/index.js").ITenant>;
13
+ fetchTenant: (_: any, {}: {}, { rbac }: {
14
+ rbac: any;
15
+ }) => Promise<import("packages/identity/identity-share/types/index.js").ITenant[]>;
16
+ paginateTenant: (_: any, { options }: {
17
+ options?: {
18
+ page: number;
19
+ limit: number;
20
+ orderBy: string;
21
+ orderDesc: boolean;
22
+ search: string;
23
+ filters: any[];
24
+ };
25
+ }, { rbac }: {
26
+ rbac: any;
27
+ }) => Promise<import("packages/common/common-share/types/index.js").IDraxPaginateResult<import("packages/identity/identity-share/types/index.js").ITenant>>;
28
+ };
29
+ Mutation: {
30
+ createTenant: (_: any, { input }: {
31
+ input: any;
32
+ }, { rbac }: {
33
+ rbac: any;
34
+ }) => Promise<import("packages/identity/identity-share/types/index.js").ITenant>;
35
+ updateTenant: (_: any, { id, input }: {
36
+ id: any;
37
+ input: any;
38
+ }, { rbac }: {
39
+ rbac: any;
40
+ }) => Promise<import("packages/identity/identity-share/types/index.js").ITenant>;
41
+ deleteTenant: (_: any, { id }: {
42
+ id: any;
43
+ }, { rbac }: {
44
+ rbac: any;
45
+ }) => Promise<boolean>;
46
+ };
47
+ };
48
+ export default _default;
49
+ //# sourceMappingURL=tenant.resolvers.d.ts.map
@@ -0,0 +1,37 @@
1
+ declare const _default: {
2
+ Query: {
3
+ paginateUserApiKey: (_: any, { options }: {
4
+ options?: {
5
+ page: number;
6
+ limit: number;
7
+ orderBy: string;
8
+ orderDesc: boolean;
9
+ search: string;
10
+ filters: any[];
11
+ };
12
+ }, { rbac, authUser }: {
13
+ rbac: any;
14
+ authUser: any;
15
+ }) => Promise<import("packages/common/common-share/types/index.js").IDraxPaginateResult<import("packages/identity/identity-share/types/index.js").IUserApiKey>>;
16
+ };
17
+ Mutation: {
18
+ createUserApiKey: (_: any, { input }: {
19
+ input: any;
20
+ }, { rbac }: {
21
+ rbac: any;
22
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUserApiKey>;
23
+ updateUserApiKey: (_: any, { id, input }: {
24
+ id: any;
25
+ input: any;
26
+ }, { rbac }: {
27
+ rbac: any;
28
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUserApiKey>;
29
+ deleteUserApiKey: (_: any, { id }: {
30
+ id: any;
31
+ }, { rbac }: {
32
+ rbac: any;
33
+ }) => Promise<boolean>;
34
+ };
35
+ };
36
+ export default _default;
37
+ //# sourceMappingURL=user-api-key.resolvers.d.ts.map
@@ -0,0 +1,67 @@
1
+ declare const _default: {
2
+ Query: {
3
+ me: (_: any, {}: {}, { authUser }: {
4
+ authUser: any;
5
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUser>;
6
+ findUserById: (_: any, { id }: {
7
+ id: any;
8
+ }, { rbac }: {
9
+ rbac: any;
10
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUser>;
11
+ paginateUser: (_: any, { options }: {
12
+ options?: {
13
+ page: number;
14
+ limit: number;
15
+ orderBy: string;
16
+ orderDesc: boolean;
17
+ search: string;
18
+ filters: any[];
19
+ };
20
+ }, { rbac }: {
21
+ rbac: any;
22
+ }) => Promise<import("packages/common/common-share/types/index.js").IDraxPaginateResult<import("packages/identity/identity-share/types/index.js").IUser>>;
23
+ };
24
+ Mutation: {
25
+ auth: (_: any, { input }: {
26
+ input: any;
27
+ }) => Promise<{
28
+ accessToken: string;
29
+ }>;
30
+ createUser: (_: any, { input }: {
31
+ input: any;
32
+ }, { rbac }: {
33
+ rbac: any;
34
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUser>;
35
+ updateUser: (_: any, { id, input }: {
36
+ id: any;
37
+ input: any;
38
+ }, { rbac }: {
39
+ rbac: any;
40
+ }) => Promise<import("packages/identity/identity-share/types/index.js").IUser>;
41
+ deleteUser: (_: any, { id }: {
42
+ id: any;
43
+ }, { rbac }: {
44
+ rbac: any;
45
+ }) => Promise<boolean>;
46
+ changeOwnPassword: (_: any, { currentPassword, newPassword }: {
47
+ currentPassword: any;
48
+ newPassword: any;
49
+ }, { authUser }: {
50
+ authUser: any;
51
+ }) => Promise<boolean>;
52
+ changeUserPassword: (_: any, { userId, newPassword }: {
53
+ userId: any;
54
+ newPassword: any;
55
+ }, { rbac }: {
56
+ rbac: any;
57
+ }) => Promise<boolean>;
58
+ changeAvatar: (_: any, { file }: {
59
+ file: any;
60
+ }, { rbac, authUser }: {
61
+ rbac: any;
62
+ authUser: any;
63
+ }) => Promise<boolean>;
64
+ };
65
+ };
66
+ export default _default;
67
+ //# sourceMappingURL=user.resolvers.d.ts.map
@@ -0,0 +1,35 @@
1
+ import UserServiceFactory from "./factory/UserServiceFactory.js";
2
+ import RoleServiceFactory from "./factory/RoleServiceFactory.js";
3
+ import TenantServiceFactory from "./factory/TenantServiceFactory.js";
4
+ import RoleService from "./services/RoleService.js";
5
+ import UserService from "./services/UserService.js";
6
+ import TenantService from "./services/TenantService.js";
7
+ import PermissionService from "./services/PermissionService.js";
8
+ import Rbac from "./rbac/Rbac.js";
9
+ import { UserRoutes } from "./routes/UserRoutes.js";
10
+ import { UserAvatarRoutes } from "./routes/UserAvatarRoutes.js";
11
+ import { RoleRoutes } from "./routes/RoleRoutes.js";
12
+ import { TenantRoutes } from "./routes/TenantRoutes.js";
13
+ import { UserApiKeyRoutes } from "./routes/UserApiKeyRoutes.js";
14
+ import AuthUtils from "./utils/AuthUtils.js";
15
+ import { jwtMiddleware } from "./middleware/jwtMiddleware.js";
16
+ import { rbacMiddleware } from "./middleware/rbacMiddleware.js";
17
+ import { apiKeyMiddleware } from "./middleware/apiKeyMiddleware.js";
18
+ import IdentityPermissions from "./permissions/IdentityPermissions.js";
19
+ import IdentityConfig from "./config/IdentityConfig.js";
20
+ import UnauthorizedError from "./errors/UnauthorizedError.js";
21
+ import BadCredentialsError from "./errors/BadCredentialsError.js";
22
+ import CreateUserIfNotExist from "./setup/CreateUserIfNotExist.js";
23
+ import CreateOrUpdateRole from "./setup/CreateOrUpdateRole.js";
24
+ import LoadPermissions from "./setup/LoadPermissions.js";
25
+ import LoadIdentityConfigFromEnv from "./setup/LoadIdentityConfigFromEnv.js";
26
+ import RecoveryUserPassword from "./setup/RecoveryUserPassword.js";
27
+ import type { IRoleRepository } from "./interfaces/IRoleRepository";
28
+ import type { ITenantRepository } from "./interfaces/ITenantRepository";
29
+ import type { IUserRepository } from "./interfaces/IUserRepository";
30
+ import type { IUserApiKeyRepository } from "./interfaces/IUserApiKeyRepository";
31
+ declare const identityTypeDefs: import("@graphql-tools/utils").TypeSource;
32
+ declare const identityResolvers: import("@graphql-tools/utils").IResolvers;
33
+ export type { IRoleRepository, ITenantRepository, IUserRepository, IUserApiKeyRepository };
34
+ export { UserService, RoleService, TenantService, PermissionService, Rbac, UserServiceFactory, RoleServiceFactory, TenantServiceFactory, identityTypeDefs, identityResolvers, UserRoutes, RoleRoutes, TenantRoutes, UserAvatarRoutes, UserApiKeyRoutes, AuthUtils, jwtMiddleware, rbacMiddleware, apiKeyMiddleware, IdentityPermissions, IdentityConfig, UnauthorizedError, BadCredentialsError, LoadIdentityConfigFromEnv, LoadPermissions, CreateOrUpdateRole, CreateUserIfNotExist, RecoveryUserPassword };
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { IRole, IRoleBase } from "@drax/identity-share";
2
+ import { IDraxCrud } from "@drax/common-share";
3
+ interface IRoleRepository extends IDraxCrud<IRole, IRoleBase, IRoleBase> {
4
+ findById(id: string): Promise<IRole | null>;
5
+ findByName(name: string): Promise<IRole | null>;
6
+ fetchAll(): Promise<IRole[]>;
7
+ }
8
+ export { IRoleRepository };
9
+ //# sourceMappingURL=IRoleRepository.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { ITenant, ITenantBase } from '@drax/identity-share';
2
+ import { IDraxCrud } from "@drax/common-share";
3
+ interface ITenantRepository extends IDraxCrud<ITenant, ITenantBase, ITenantBase> {
4
+ findById(id: string): Promise<ITenant | null>;
5
+ findByName(name: string): Promise<ITenant | null>;
6
+ fetchAll(): Promise<ITenant[]>;
7
+ }
8
+ export { ITenantRepository };
9
+ //# sourceMappingURL=ITenantRepository.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { IUserApiKey, IUserApiKeyBase } from '@drax/identity-share';
2
+ import { IDraxCrud } from "@drax/common-share";
3
+ interface IUserApiKeyRepository extends IDraxCrud<IUserApiKey, IUserApiKeyBase, IUserApiKeyBase> {
4
+ findBySecret(username: string): Promise<IUserApiKey | null>;
5
+ }
6
+ export { IUserApiKeyRepository };
7
+ //# sourceMappingURL=IUserApiKeyRepository.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { IUser, IUserCreate, IUserUpdate } from '@drax/identity-share';
2
+ import { IDraxCrud } from "@drax/common-share";
3
+ interface IUserRepository extends IDraxCrud<IUser, IUserCreate, IUserUpdate> {
4
+ findById(id: string): Promise<IUser | null>;
5
+ findByUsername(username: string): Promise<IUser | null>;
6
+ changePassword(id: string, password: string): Promise<Boolean>;
7
+ changeAvatar(id: string, avatarUrl: string): Promise<Boolean>;
8
+ }
9
+ export { IUserRepository };
10
+ //# sourceMappingURL=IUserRepository.d.ts.map
@@ -0,0 +1,4 @@
1
+ declare function apiKeyMiddleware(request: any, reply: any): Promise<void>;
2
+ export default apiKeyMiddleware;
3
+ export { apiKeyMiddleware };
4
+ //# sourceMappingURL=apiKeyMiddleware.d.ts.map
@@ -0,0 +1,4 @@
1
+ declare function jwtMiddleware(request: any, reply: any, done: any): void;
2
+ export default jwtMiddleware;
3
+ export { jwtMiddleware };
4
+ //# sourceMappingURL=jwtMiddleware.d.ts.map
@@ -0,0 +1,4 @@
1
+ declare function rbacMiddleware(request: any, reply: any): Promise<void>;
2
+ export default rbacMiddleware;
3
+ export { rbacMiddleware };
4
+ //# sourceMappingURL=rbacMiddleware.d.ts.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/types.js" />
3
+ /// <reference types="mongoose/types/models.js" />
4
+ /// <reference types="mongoose/types/schemaoptions.js" />
5
+ /// <reference types="mongoose/types/utility.js" />
6
+ import { mongoose } from '@drax/common-back';
7
+ import { IRole } from '@drax/identity-share';
8
+ declare const RoleSchema: mongoose.Schema<IRole, mongoose.Model<IRole, any, any, any, mongoose.Document<unknown, any, IRole> & IRole & {
9
+ _id: mongoose.Types.ObjectId;
10
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IRole, mongoose.Document<unknown, {}, mongoose.FlatRecord<IRole>> & mongoose.FlatRecord<IRole> & {
11
+ _id: mongoose.Types.ObjectId;
12
+ }>;
13
+ declare const RoleModel: mongoose.PaginateModel<IRole, {}, {}>;
14
+ export { RoleSchema, RoleModel };
15
+ export default RoleModel;
16
+ //# sourceMappingURL=RoleModel.d.ts.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/types.js" />
3
+ /// <reference types="mongoose/types/models.js" />
4
+ /// <reference types="mongoose/types/schemaoptions.js" />
5
+ /// <reference types="mongoose/types/utility.js" />
6
+ import { mongoose } from '@drax/common-back';
7
+ import { ITenant } from '@drax/identity-share';
8
+ declare const TenantSchema: mongoose.Schema<ITenant, mongoose.Model<ITenant, any, any, any, mongoose.Document<unknown, any, ITenant> & ITenant & {
9
+ _id: mongoose.Types.ObjectId;
10
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ITenant, mongoose.Document<unknown, {}, mongoose.FlatRecord<ITenant>> & mongoose.FlatRecord<ITenant> & {
11
+ _id: mongoose.Types.ObjectId;
12
+ }>;
13
+ declare const TenantModel: mongoose.PaginateModel<ITenant, {}, {}>;
14
+ export { TenantSchema, TenantModel };
15
+ export default TenantModel;
16
+ //# sourceMappingURL=TenantModel.d.ts.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/types.js" />
3
+ /// <reference types="mongoose/types/models.js" />
4
+ /// <reference types="mongoose/types/schemaoptions.js" />
5
+ /// <reference types="mongoose/types/utility.js" />
6
+ import { mongoose } from '@drax/common-back';
7
+ import { IUserApiKey } from "@drax/identity-share";
8
+ declare const UserApiKeySchema: mongoose.Schema<IUserApiKey, mongoose.Model<IUserApiKey, any, any, any, mongoose.Document<unknown, any, IUserApiKey> & IUserApiKey & {
9
+ _id: mongoose.Types.ObjectId;
10
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IUserApiKey, mongoose.Document<unknown, {}, mongoose.FlatRecord<IUserApiKey>> & mongoose.FlatRecord<IUserApiKey> & {
11
+ _id: mongoose.Types.ObjectId;
12
+ }>;
13
+ declare const UserApiKeyModel: mongoose.PaginateModel<IUserApiKey, {}, {}>;
14
+ export { UserApiKeySchema, UserApiKeyModel };
15
+ export default UserApiKeyModel;
16
+ //# sourceMappingURL=UserApiKeyModel.d.ts.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/types.js" />
3
+ /// <reference types="mongoose/types/models.js" />
4
+ /// <reference types="mongoose/types/schemaoptions.js" />
5
+ /// <reference types="mongoose/types/utility.js" />
6
+ import { mongoose } from '@drax/common-back';
7
+ import { IUserGroup } from "@drax/identity-share";
8
+ declare const UserGroupSchema: mongoose.Schema<IUserGroup, mongoose.Model<IUserGroup, any, any, any, mongoose.Document<unknown, any, IUserGroup> & IUserGroup & {
9
+ _id: mongoose.Types.ObjectId;
10
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IUserGroup, mongoose.Document<unknown, {}, mongoose.FlatRecord<IUserGroup>> & mongoose.FlatRecord<IUserGroup> & {
11
+ _id: mongoose.Types.ObjectId;
12
+ }>;
13
+ declare const UserGroupModel: mongoose.PaginateModel<IUserGroup, {}, {}>;
14
+ export { UserGroupSchema, UserGroupModel };
15
+ export default UserGroupModel;
16
+ //# sourceMappingURL=UserGroupModel.d.ts.map
@@ -0,0 +1,16 @@
1
+ /// <reference types="mongoose/types/document.js" />
2
+ /// <reference types="mongoose/types/types.js" />
3
+ /// <reference types="mongoose/types/models.js" />
4
+ /// <reference types="mongoose/types/schemaoptions.js" />
5
+ /// <reference types="mongoose/types/utility.js" />
6
+ import { mongoose } from '@drax/common-back';
7
+ import { IUser } from "@drax/identity-share";
8
+ declare const UserSchema: mongoose.Schema<IUser, mongoose.Model<IUser, any, any, any, mongoose.Document<unknown, any, IUser> & IUser & {
9
+ _id: mongoose.Types.ObjectId;
10
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IUser, mongoose.Document<unknown, {}, mongoose.FlatRecord<IUser>> & mongoose.FlatRecord<IUser> & {
11
+ _id: mongoose.Types.ObjectId;
12
+ }>;
13
+ declare const UserModel: mongoose.PaginateModel<IUser, {}, {}>;
14
+ export { UserSchema, UserModel };
15
+ export default UserModel;
16
+ //# sourceMappingURL=UserModel.d.ts.map
@@ -0,0 +1,27 @@
1
+ declare enum IdentityPermissions {
2
+ CreateUser = "user:create",
3
+ UpdateUser = "user:update",
4
+ DeleteUser = "user:delete",
5
+ ViewUser = "user:view",
6
+ ManageUser = "user:manage",
7
+ CreateUserApiKey = "userApiKey:create",
8
+ UpdateUserApiKey = "userApiKey:update",
9
+ DeleteUserApiKey = "userApiKey:delete",
10
+ ViewUserApiKey = "userApiKey:view",
11
+ ViewMyUserApiKey = "userApiKey:myView",
12
+ ManageUserApiKey = "userApiKey:manage",
13
+ CreateRole = "role:create",
14
+ UpdateRole = "role:update",
15
+ DeleteRole = "role:delete",
16
+ ViewRole = "role:view",
17
+ ManageRole = "role:manage",
18
+ PermissionsRole = "role:permissions",
19
+ CreateTenant = "tenant:create",
20
+ UpdateTenant = "tenant:update",
21
+ DeleteTenant = "tenant:delete",
22
+ ViewTenant = "tenant:view",
23
+ ManageTenant = "tenant:manage"
24
+ }
25
+ export default IdentityPermissions;
26
+ export { IdentityPermissions };
27
+ //# sourceMappingURL=IdentityPermissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IdentityPermissions.d.ts","sourceRoot":"","sources":["../../src/permissions/IdentityPermissions.ts"],"names":[],"mappings":"AAAA,aAAK,mBAAmB;IAGpB,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;IACtB,UAAU,gBAAgB;IAE1B,gBAAgB,sBAAsB;IACtC,gBAAgB,sBAAsB;IACtC,gBAAgB,sBAAsB;IACtC,cAAc,oBAAoB;IAClC,gBAAgB,sBAAsB;IACtC,gBAAgB,sBAAsB;IAEtC,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;IACtB,UAAU,gBAAgB;IAC1B,eAAe,qBAAqB;IAGpC,YAAY,kBAAkB;IAC9B,YAAY,kBAAkB;IAC9B,YAAY,kBAAkB;IAC9B,UAAU,gBAAgB;IAC1B,YAAY,kBAAkB;CAEjC;AAED,eAAe,mBAAmB,CAAC;AACnC,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { IRoleRepository } from '../../interfaces/IRoleRepository';
2
+ import { IDraxPaginateOptions, IDraxPaginateResult } from "@drax/common-share";
3
+ import { IRoleBase, IRole } from "@drax/identity-share";
4
+ declare class RoleMongoRepository implements IRoleRepository {
5
+ create(roleData: IRoleBase): Promise<IRole>;
6
+ update(id: string, roleData: IRoleBase): Promise<IRole>;
7
+ delete(id: string): Promise<boolean>;
8
+ findById(id: string): Promise<IRole | null>;
9
+ findByName(name: string): Promise<IRole | null>;
10
+ fetchAll(): Promise<IRole[]>;
11
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<IRole>>;
12
+ }
13
+ export default RoleMongoRepository;
14
+ //# sourceMappingURL=RoleMongoRepository.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { ITenantRepository } from '../../interfaces/ITenantRepository';
2
+ import { IDraxPaginateOptions, IDraxPaginateResult } from "@drax/common-share";
3
+ import { ITenant, ITenantBase } from "@drax/identity-share";
4
+ declare class TenantMongoRepository implements ITenantRepository {
5
+ create(tenantData: ITenantBase): Promise<ITenant>;
6
+ update(id: string, tenantData: ITenantBase): Promise<ITenant>;
7
+ delete(id: string): Promise<boolean>;
8
+ findById(id: string): Promise<ITenant | null>;
9
+ findByName(name: string): Promise<ITenant | null>;
10
+ fetchAll(): Promise<ITenant[]>;
11
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<ITenant>>;
12
+ }
13
+ export default TenantMongoRepository;
14
+ //# sourceMappingURL=TenantMongoRepository.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { IUserApiKey, IUserApiKeyBase } from "@drax/identity-share";
2
+ import { IDraxPaginateOptions, IDraxPaginateResult } from "@drax/common-share";
3
+ import { IUserApiKeyRepository } from "../../interfaces/IUserApiKeyRepository";
4
+ declare class UserMongoRepository implements IUserApiKeyRepository {
5
+ constructor();
6
+ create(data: IUserApiKeyBase): Promise<IUserApiKey>;
7
+ update(id: string, data: IUserApiKeyBase): Promise<IUserApiKey>;
8
+ delete(id: string): Promise<boolean>;
9
+ findById(id: string): Promise<IUserApiKey>;
10
+ findBySecret(secret: string): Promise<IUserApiKey>;
11
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUserApiKey>>;
12
+ }
13
+ export default UserMongoRepository;
14
+ //# sourceMappingURL=UserApiKeyMongoRepository.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { IUser, IUserCreate, IUserUpdate } from "@drax/identity-share";
2
+ import type { IUserRepository } from "../../interfaces/IUserRepository";
3
+ import { IDraxPaginateOptions, IDraxPaginateResult } from "@drax/common-share";
4
+ declare class UserMongoRepository implements IUserRepository {
5
+ private roleRepository;
6
+ constructor();
7
+ create(userData: IUserCreate): Promise<IUser>;
8
+ update(id: string, userData: IUserUpdate): Promise<IUser>;
9
+ delete(id: string): Promise<boolean>;
10
+ findById(id: string): Promise<IUser>;
11
+ findByUsername(username: string): Promise<IUser>;
12
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUser>>;
13
+ changePassword(id: string, password: string): Promise<boolean>;
14
+ changeAvatar(id: string, avatar: string): Promise<boolean>;
15
+ }
16
+ export default UserMongoRepository;
17
+ //# sourceMappingURL=UserMongoRepository.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { IRoleRepository } from '../../interfaces/IRoleRepository';
2
+ import { IDraxPaginateResult, IDraxPaginateOptions } from "@drax/common-share";
3
+ import { IRole, IRoleBase } from "@drax/identity-share";
4
+ declare class RoleSqliteRepository implements IRoleRepository {
5
+ private db;
6
+ private dataBaseFile;
7
+ constructor(dataBaseFile: string, verbose?: boolean);
8
+ table(): void;
9
+ normalizeData(roleData: IRoleBase): void;
10
+ create(roleData: IRoleBase): Promise<IRole>;
11
+ update(id: string, roleData: IRoleBase): Promise<IRole>;
12
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<IRole>>;
13
+ delete(id: string): Promise<boolean>;
14
+ deleteAll(): Promise<boolean>;
15
+ findById(id: string): Promise<IRole | null>;
16
+ findByName(name: string): Promise<IRole | null>;
17
+ fetchAll(): Promise<IRole[]>;
18
+ findWithoutPopulateById(id: string): Promise<IRole | null>;
19
+ populateRole(role: any): Promise<any>;
20
+ }
21
+ export default RoleSqliteRepository;
22
+ //# sourceMappingURL=RoleSqliteRepository.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { ITenant, ITenantBase } from '@drax/identity-share';
2
+ import { ITenantRepository } from '../../interfaces/ITenantRepository';
3
+ import { IDraxPaginateResult, IDraxPaginateOptions } from "@drax/common-share";
4
+ declare class TenantSqliteRepository implements ITenantRepository {
5
+ private db;
6
+ private dataBaseFile;
7
+ constructor(dataBaseFile: string, verbose?: boolean);
8
+ table(): void;
9
+ create(tenantData: ITenantBase): Promise<ITenant>;
10
+ findById(id: string): Promise<ITenant | null>;
11
+ findByName(name: string): Promise<ITenant | null>;
12
+ update(id: string, tenantData: ITenantBase): Promise<ITenant>;
13
+ delete(id: string): Promise<boolean>;
14
+ deleteAll(): Promise<boolean>;
15
+ fetchAll(): Promise<ITenant[]>;
16
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<ITenant>>;
17
+ }
18
+ export default TenantSqliteRepository;
19
+ //# sourceMappingURL=TenantSqliteRepository.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { IUser, IUserCreate, IUserUpdate } from "@drax/identity-share";
2
+ import { IUserRepository } from "../../interfaces/IUserRepository";
3
+ import { IDraxPaginateResult, IDraxPaginateOptions } from "@drax/common-share";
4
+ declare class UserSqliteRepository implements IUserRepository {
5
+ private db;
6
+ private roleRepository;
7
+ private tenantRepository;
8
+ private dataBaseFile;
9
+ constructor(dataBaseFile: string, verbose?: boolean);
10
+ table(): void;
11
+ normalizeData(userData: IUserCreate | IUserUpdate): void;
12
+ create(userData: IUserCreate): Promise<IUser>;
13
+ update(id: string, userData: IUserUpdate): Promise<IUser>;
14
+ delete(id: string): Promise<boolean>;
15
+ deleteAll(): Promise<boolean>;
16
+ findById(id: string): Promise<IUser>;
17
+ findByUsername(username: string): Promise<IUser>;
18
+ paginate({ page, limit, orderBy, orderDesc, search, filters }: IDraxPaginateOptions): Promise<IDraxPaginateResult<IUser>>;
19
+ findRoleById(id: string): Promise<import("@drax/identity-share").IRole>;
20
+ findTenantById(id: string): Promise<import("@drax/identity-share").ITenant>;
21
+ changePassword(id: string, password: string): Promise<boolean>;
22
+ changeAvatar(id: string, avatar: string): Promise<boolean>;
23
+ }
24
+ export default UserSqliteRepository;
25
+ //# sourceMappingURL=UserSqliteRepository.d.ts.map