@ackplus/nest-auth 0.0.28 → 0.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ackplus/nest-auth",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "type": "commonjs",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -4,8 +4,6 @@ import { AccessKey } from '../user/entities/access-key.entity';
4
4
  import { Tenant } from '../tenant/entities/tenant.entity';
5
5
  import { Role } from '../role/entities/role.entity';
6
6
  import { Permission } from '../role/entities/permission.entity';
7
- import { RolePermission } from '../role/entities/role-permission.entity';
8
- import { UserRole } from '../role/entities/user-role.entity';
9
7
  import { MFASecret } from '../auth/entities/mfa-secret.entity';
10
8
  import { OTP } from '../auth/entities/otp.entity';
11
9
  import { Session } from '../session/entities/session.entity';
@@ -15,9 +13,7 @@ export * from '../user/entities/access-key.entity';
15
13
  export * from '../tenant/entities/tenant.entity';
16
14
  export * from '../role/entities/role.entity';
17
15
  export * from '../role/entities/permission.entity';
18
- export * from '../role/entities/role-permission.entity';
19
- export * from '../role/entities/user-role.entity';
20
16
  export * from '../auth/entities/mfa-secret.entity';
21
17
  export * from '../auth/entities/otp.entity';
22
18
  export * from '../session/entities/session.entity';
23
- export declare const NestAuthEntities: (typeof Tenant | typeof AuthIdentity | typeof User | typeof Session | typeof Permission | typeof RolePermission | typeof Role | typeof UserRole | typeof OTP | typeof MFASecret | typeof AccessKey)[];
19
+ export declare const NestAuthEntities: (typeof Tenant | typeof AuthIdentity | typeof User | typeof Session | typeof OTP | typeof MFASecret | typeof Permission | typeof Role | typeof AccessKey)[];
@@ -8,8 +8,6 @@ const access_key_entity_1 = require("../user/entities/access-key.entity");
8
8
  const tenant_entity_1 = require("../tenant/entities/tenant.entity");
9
9
  const role_entity_1 = require("../role/entities/role.entity");
10
10
  const permission_entity_1 = require("../role/entities/permission.entity");
11
- const role_permission_entity_1 = require("../role/entities/role-permission.entity");
12
- const user_role_entity_1 = require("../role/entities/user-role.entity");
13
11
  const mfa_secret_entity_1 = require("../auth/entities/mfa-secret.entity");
14
12
  const otp_entity_1 = require("../auth/entities/otp.entity");
15
13
  const session_entity_1 = require("../session/entities/session.entity");
@@ -19,8 +17,6 @@ tslib_1.__exportStar(require("../user/entities/access-key.entity"), exports);
19
17
  tslib_1.__exportStar(require("../tenant/entities/tenant.entity"), exports);
20
18
  tslib_1.__exportStar(require("../role/entities/role.entity"), exports);
21
19
  tslib_1.__exportStar(require("../role/entities/permission.entity"), exports);
22
- tslib_1.__exportStar(require("../role/entities/role-permission.entity"), exports);
23
- tslib_1.__exportStar(require("../role/entities/user-role.entity"), exports);
24
20
  tslib_1.__exportStar(require("../auth/entities/mfa-secret.entity"), exports);
25
21
  tslib_1.__exportStar(require("../auth/entities/otp.entity"), exports);
26
22
  tslib_1.__exportStar(require("../session/entities/session.entity"), exports);
@@ -29,8 +25,6 @@ exports.NestAuthEntities = [
29
25
  auth_identity_entity_1.AuthIdentity,
30
26
  role_entity_1.Role,
31
27
  permission_entity_1.Permission,
32
- role_permission_entity_1.RolePermission,
33
- user_role_entity_1.UserRole,
34
28
  tenant_entity_1.Tenant,
35
29
  mfa_secret_entity_1.MFASecret,
36
30
  session_entity_1.Session,
@@ -1 +1 @@
1
- {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../../../packages/nest-auth/src/lib/core/entities.ts"],"names":[],"mappings":";;;;AAAA,8DAAoD;AACpD,gFAAqE;AACrE,0EAA+D;AAC/D,oEAA0D;AAC1D,8DAAoD;AACpD,0EAAgE;AAChE,oFAAyE;AACzE,wEAA6D;AAC7D,0EAA+D;AAC/D,4DAAkD;AAClD,uEAA6D;AAE7D,uEAA6C;AAC7C,gFAAsD;AACtD,6EAAmD;AACnD,2EAAiD;AACjD,uEAA6C;AAC7C,6EAAmD;AACnD,kFAAwD;AACxD,4EAAkD;AAClD,6EAAmD;AACnD,sEAA4C;AAC5C,6EAAmD;AAEtC,QAAA,gBAAgB,GAAG;IAC5B,kBAAI;IACJ,mCAAY;IACZ,kBAAI;IACJ,8BAAU;IACV,uCAAc;IACd,2BAAQ;IACR,sBAAM;IACN,6BAAS;IACT,wBAAO;IACP,gBAAG;IACH,6BAAS;CACZ,CAAC"}
1
+ {"version":3,"file":"entities.js","sourceRoot":"","sources":["../../../../../../packages/nest-auth/src/lib/core/entities.ts"],"names":[],"mappings":";;;;AAAA,8DAAoD;AACpD,gFAAqE;AACrE,0EAA+D;AAC/D,oEAA0D;AAC1D,8DAAoD;AACpD,0EAAgE;AAChE,0EAA+D;AAC/D,4DAAkD;AAClD,uEAA6D;AAE7D,uEAA6C;AAC7C,gFAAsD;AACtD,6EAAmD;AACnD,2EAAiD;AACjD,uEAA6C;AAC7C,6EAAmD;AACnD,6EAAmD;AACnD,sEAA4C;AAC5C,6EAAmD;AAEtC,QAAA,gBAAgB,GAAG;IAC5B,kBAAI;IACJ,mCAAY;IACZ,kBAAI;IACJ,8BAAU;IACV,sBAAM;IACN,6BAAS;IACT,wBAAO;IACP,gBAAG;IACH,6BAAS;CACZ,CAAC"}
@@ -1,10 +1,11 @@
1
- import { RolePermission } from "./role-permission.entity";
2
- export declare class Permission {
1
+ import { BaseEntity } from "typeorm";
2
+ import { Role } from "./role.entity";
3
+ export declare class Permission extends BaseEntity {
3
4
  id: string;
4
5
  name: string;
5
6
  description: string;
6
7
  guard: string;
7
8
  createdAt: Date;
8
9
  updatedAt: Date;
9
- rolePermissions: RolePermission[];
10
+ roles: Role[];
10
11
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Permission = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const typeorm_1 = require("typeorm");
6
- const role_permission_entity_1 = require("./role-permission.entity");
6
+ const role_entity_1 = require("./role.entity");
7
7
  const auth_constants_1 = require("../../auth.constants");
8
- let Permission = class Permission {
8
+ let Permission = class Permission extends typeorm_1.BaseEntity {
9
9
  };
10
10
  exports.Permission = Permission;
11
11
  tslib_1.__decorate([
@@ -33,9 +33,9 @@ tslib_1.__decorate([
33
33
  tslib_1.__metadata("design:type", Date)
34
34
  ], Permission.prototype, "updatedAt", void 0);
35
35
  tslib_1.__decorate([
36
- (0, typeorm_1.OneToMany)(() => role_permission_entity_1.RolePermission, rolePermission => rolePermission.permission),
36
+ (0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.permissions),
37
37
  tslib_1.__metadata("design:type", Array)
38
- ], Permission.prototype, "rolePermissions", void 0);
38
+ ], Permission.prototype, "roles", void 0);
39
39
  exports.Permission = Permission = tslib_1.__decorate([
40
40
  (0, typeorm_1.Entity)('nest_auth_permissions')
41
41
  ], Permission);
@@ -1 +1 @@
1
- {"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/permission.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAAgH;AAChH,qEAA0D;AAC1D,yDAA0D;AAGnD,IAAM,UAAU,GAAhB,MAAM,UAAU;CAqBtB,CAAA;AArBY,gCAAU;AAEnB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAGX;IADC,IAAA,gBAAM,GAAE;;wCACI;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACP;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,mCAAkB,EAAE,CAAC;;yCAC1C;AAGd;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;6CAAC;AAGhB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;6CAAC;AAGhB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,EAAE,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC;;mDAC3C;qBApBzB,UAAU;IADtB,IAAA,gBAAM,EAAC,uBAAuB,CAAC;GACnB,UAAU,CAqBtB"}
1
+ {"version":3,"file":"permission.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/permission.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAA6H;AAC7H,+CAAqC;AACrC,yDAA0D;AAGnD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,oBAAU;CAqBzC,CAAA;AArBY,gCAAU;AAEnB;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;sCACpB;AAGX;IADC,IAAA,gBAAM,GAAE;;wCACI;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACP;AAGpB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,mCAAkB,EAAE,CAAC;;yCAC1C;AAGd;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;6CAAC;AAGhB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;6CAAC;AAGhB;IADC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;;yCACnC;qBApBL,UAAU;IADtB,IAAA,gBAAM,EAAC,uBAAuB,CAAC;GACnB,UAAU,CAqBtB"}
@@ -1,7 +1,7 @@
1
1
  import { BaseEntity } from "typeorm";
2
- import { UserRole } from "./user-role.entity";
3
- import { RolePermission } from "./role-permission.entity";
4
2
  import { Tenant } from "../../tenant/entities/tenant.entity";
3
+ import { User } from "../../user/entities/user.entity";
4
+ import { Permission } from "./permission.entity";
5
5
  export declare class Role extends BaseEntity {
6
6
  id: string;
7
7
  name: string;
@@ -12,8 +12,8 @@ export declare class Role extends BaseEntity {
12
12
  isActive: boolean;
13
13
  createdAt: Date;
14
14
  updatedAt: Date;
15
- rolePermissions: RolePermission[];
16
- userRoles: UserRole[];
15
+ permissions: Permission[];
16
+ users: User[];
17
17
  static createRole(name: string, guard: string, isSystem: boolean, tenantId: string): Promise<Role>;
18
18
  syncPermissions(permissionIds: string | string[]): Promise<void>;
19
19
  removePermissions(permissionIds: string | string[]): Promise<void>;
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Role = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const typeorm_1 = require("typeorm");
7
- const user_role_entity_1 = require("./user-role.entity");
8
- const role_permission_entity_1 = require("./role-permission.entity");
9
7
  const lodash_1 = require("lodash");
10
8
  const auth_constants_1 = require("../../auth.constants");
11
9
  const tenant_entity_1 = require("../../tenant/entities/tenant.entity");
12
10
  const common_1 = require("@nestjs/common");
11
+ const user_entity_1 = require("../../user/entities/user.entity");
12
+ const permission_entity_1 = require("./permission.entity");
13
13
  let Role = Role_1 = class Role extends typeorm_1.BaseEntity {
14
14
  static async createRole(name, guard = auth_constants_1.DEFAULT_GUARD_NAME, isSystem = false, tenantId) {
15
15
  const existingSystemRole = await Role_1.findOne({
@@ -28,26 +28,23 @@ let Role = Role_1 = class Role extends typeorm_1.BaseEntity {
28
28
  }
29
29
  async syncPermissions(permissionIds) {
30
30
  const newPermissions = Array.isArray(permissionIds) ? permissionIds : [permissionIds];
31
- this.rolePermissions = newPermissions.map(permissionId => role_permission_entity_1.RolePermission.create({
32
- role: this,
33
- permissionId
31
+ this.permissions = newPermissions.map(permissionId => permission_entity_1.Permission.create({
32
+ id: permissionId,
34
33
  }));
35
34
  }
36
35
  async removePermissions(permissionIds) {
37
36
  const removingPermissions = Array.isArray(permissionIds) ? permissionIds : [permissionIds];
38
- this.rolePermissions = this.rolePermissions.filter(rolePermission => !removingPermissions.includes(rolePermission.permissionId));
37
+ this.permissions = this.permissions.filter(permission => !removingPermissions.includes(permission.id));
39
38
  }
40
39
  async attachPermissions(permissionsIds) {
41
- const existingPermissions = await this.rolePermissions.map(rolePermission => role_permission_entity_1.RolePermission.create({
42
- role: this,
43
- permissionId: rolePermission.permissionId
40
+ const existingPermissions = await this.permissions.map(permission => permission_entity_1.Permission.create({
41
+ id: permission.id,
44
42
  }));
45
43
  const newPermissions = Array.isArray(permissionsIds) ? permissionsIds : [permissionsIds];
46
- const newRolePermissions = newPermissions.map(permissionId => role_permission_entity_1.RolePermission.create({
47
- role: this,
48
- permissionId
44
+ const newPermissionsEntities = newPermissions.map(permissionId => permission_entity_1.Permission.create({
45
+ id: permissionId,
49
46
  }));
50
- this.rolePermissions = (0, lodash_1.uniqBy)([...existingPermissions, ...newRolePermissions], 'permissionId');
47
+ this.permissions = (0, lodash_1.uniqBy)([...existingPermissions, ...newPermissionsEntities], 'id');
51
48
  }
52
49
  };
53
50
  exports.Role = Role;
@@ -89,13 +86,19 @@ tslib_1.__decorate([
89
86
  tslib_1.__metadata("design:type", Date)
90
87
  ], Role.prototype, "updatedAt", void 0);
91
88
  tslib_1.__decorate([
92
- (0, typeorm_1.OneToMany)(() => role_permission_entity_1.RolePermission, rolePermission => rolePermission.role),
89
+ (0, typeorm_1.ManyToMany)(() => permission_entity_1.Permission, permission => permission.roles),
90
+ (0, typeorm_1.JoinTable)({
91
+ name: 'nest_auth_role_nest_auth_permissions'
92
+ }),
93
93
  tslib_1.__metadata("design:type", Array)
94
- ], Role.prototype, "rolePermissions", void 0);
94
+ ], Role.prototype, "permissions", void 0);
95
95
  tslib_1.__decorate([
96
- (0, typeorm_1.OneToMany)(() => user_role_entity_1.UserRole, userRole => userRole.role),
96
+ (0, typeorm_1.ManyToMany)(() => user_entity_1.User, user => user.roles),
97
+ (0, typeorm_1.JoinTable)({
98
+ name: 'nest_auth_role_nest_auth_users'
99
+ }),
97
100
  tslib_1.__metadata("design:type", Array)
98
- ], Role.prototype, "userRoles", void 0);
101
+ ], Role.prototype, "users", void 0);
99
102
  exports.Role = Role = Role_1 = tslib_1.__decorate([
100
103
  (0, typeorm_1.Entity)('nest_auth_roles'),
101
104
  (0, typeorm_1.Unique)(['name', 'guard', 'tenantId'])
@@ -1 +1 @@
1
- {"version":3,"file":"role.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/role.entity.ts"],"names":[],"mappings":";;;;;AAAA,qCAA2J;AAC3J,yDAA8C;AAC9C,qEAA0D;AAC1D,mCAAgC;AAChC,yDAA0D;AAC1D,uEAA6D;AAC7D,2CAAmD;AAI5C,IAAM,IAAI,YAAV,MAAM,IAAK,SAAQ,oBAAU;IAmChC,MAAM,CAAC,KAAK,CAAC,UAAU,CACnB,IAAY,EACZ,QAAgB,mCAAkB,EAClC,WAAoB,KAAK,EACzB,QAAgB;QAIhB,MAAM,kBAAkB,GAAG,MAAM,MAAI,CAAC,OAAO,CAAC;YAC1C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;SAClC,CAAC,CAAC;QACH,IAAI,kBAAkB,EAAE,CAAC;YACrB,MAAM,IAAI,0BAAiB,CAAC,iCAAiC,IAAI,sCAAsC,CAAC,CAAC;QAC7G,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,MAAI,EAAE,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,aAAgC;QAClD,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QACtF,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,uCAAc,CAAC,MAAM,CAAC;YAC5E,IAAI,EAAE,IAAI;YACV,YAAY;SACf,CAAC,CAAC,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1C;AAId;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,IAAA,oBAAU,EAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC;;sCACvB;AAGjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;sCAChB,sBAAM;oCAAC;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;sCACT;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;sCACR;AAGlB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;uCAAC;AAGhB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;uCAAC;AAGhB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,uCAAc,EAAE,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC;;6CACrC;AAGlC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,2BAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;;uCAC/B;eAjCb,IAAI;IAFhB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;IACzB,IAAA,gBAAM,EAAC,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;GACzB,IAAI,CAsFhB"}
1
+ {"version":3,"file":"role.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/role.entity.ts"],"names":[],"mappings":";;;;;AAAA,qCAAkL;AAClL,mCAAgC;AAChC,yDAA0D;AAC1D,uEAA6D;AAC7D,2CAAmD;AACnD,iEAAuD;AACvD,2DAAiD;AAI1C,IAAM,IAAI,YAAV,MAAM,IAAK,SAAQ,oBAAU;IAyChC,MAAM,CAAC,KAAK,CAAC,UAAU,CACnB,IAAY,EACZ,QAAgB,mCAAkB,EAClC,WAAoB,KA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AAGlB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;uCAAC;AAGhB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;uCAAC;AAMhB;IAJC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,8BAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;IAC5D,IAAA,mBAAS,EAAC;QACP,IAAI,EAAE,sCAAsC;KAC/C,CAAC;;yCACwB;AAM1B;IAJC,IAAA,oBAAU,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;IAC1C,IAAA,mBAAS,EAAC;QACP,IAAI,EAAE,gCAAgC;KACzC,CAAC;;mCACY;eAvCL,IAAI;IAFhB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;IACzB,IAAA,gBAAM,EAAC,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;GACzB,IAAI,CAyFhB"}
@@ -7,15 +7,13 @@ const typeorm_1 = require("@nestjs/typeorm");
7
7
  const role_entity_1 = require("./entities/role.entity");
8
8
  const permission_entity_1 = require("./entities/permission.entity");
9
9
  const role_service_1 = require("./services/role.service");
10
- const user_role_entity_1 = require("./entities/user-role.entity");
11
- const role_permission_entity_1 = require("./entities/role-permission.entity");
12
10
  let RoleModule = class RoleModule {
13
11
  };
14
12
  exports.RoleModule = RoleModule;
15
13
  exports.RoleModule = RoleModule = tslib_1.__decorate([
16
14
  (0, common_1.Module)({
17
15
  imports: [
18
- typeorm_1.TypeOrmModule.forFeature([role_entity_1.Role, permission_entity_1.Permission, user_role_entity_1.UserRole, role_permission_entity_1.RolePermission]),
16
+ typeorm_1.TypeOrmModule.forFeature([role_entity_1.Role, permission_entity_1.Permission]),
19
17
  ],
20
18
  providers: [role_service_1.RoleService],
21
19
  exports: [role_service_1.RoleService],
@@ -1 +1 @@
1
- {"version":3,"file":"role.module.js","sourceRoot":"","sources":["../../../../../../packages/nest-auth/src/lib/role/role.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,wDAA8C;AAC9C,oEAA0D;AAC1D,0DAAsD;AACtD,kEAAuD;AACvD,8EAAmE;AAS5D,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAI,CAAA;AAAd,gCAAU;qBAAV,UAAU;IAPtB,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,uBAAa,CAAC,UAAU,CAAC,CAAC,kBAAI,EAAE,8BAAU,EAAE,2BAAQ,EAAE,uCAAc,CAAC,CAAC;SACzE;QACD,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAI"}
1
+ {"version":3,"file":"role.module.js","sourceRoot":"","sources":["../../../../../../packages/nest-auth/src/lib/role/role.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,wDAA8C;AAC9C,oEAA0D;AAC1D,0DAAsD;AAS/C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAI,CAAA;AAAd,gCAAU;qBAAV,UAAU;IAPtB,IAAA,eAAM,EAAC;QACJ,OAAO,EAAE;YACL,uBAAa,CAAC,UAAU,CAAC,CAAC,kBAAI,EAAE,8BAAU,CAAC,CAAC;SAC/C;QACD,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,UAAU,CAAI"}
@@ -2,9 +2,9 @@ import { BaseEntity } from "typeorm";
2
2
  import { Tenant } from "../../tenant";
3
3
  import { AuthIdentity } from "./auth-identity.entity";
4
4
  import { Session } from "../../session/entities/session.entity";
5
- import { UserRole } from "../../role/entities/user-role.entity";
6
5
  import { OTP } from "../../auth/entities/otp.entity";
7
6
  import { MFASecret } from "../../auth/entities/mfa-secret.entity";
7
+ import { Role } from "../../role/entities/role.entity";
8
8
  export declare class User extends BaseEntity {
9
9
  id: string;
10
10
  email: string;
@@ -25,7 +25,7 @@ export declare class User extends BaseEntity {
25
25
  mfaSecrets: MFASecret[];
26
26
  sessions: Session[];
27
27
  otps: OTP[];
28
- userRoles: UserRole[];
28
+ roles: Role[];
29
29
  emailTenant: string;
30
30
  phoneTenant: string;
31
31
  updateTenantFields(): void;
@@ -7,25 +7,25 @@ const bcrypt_1 = tslib_1.__importDefault(require("bcrypt"));
7
7
  const tenant_1 = require("../../tenant");
8
8
  const auth_identity_entity_1 = require("./auth-identity.entity");
9
9
  const session_entity_1 = require("../../session/entities/session.entity");
10
- const user_role_entity_1 = require("../../role/entities/user-role.entity");
11
10
  const lodash_1 = require("lodash");
12
11
  const otp_entity_1 = require("../../auth/entities/otp.entity");
13
12
  const mfa_secret_entity_1 = require("../../auth/entities/mfa-secret.entity");
13
+ const role_entity_1 = require("../../role/entities/role.entity");
14
14
  let User = class User extends typeorm_1.BaseEntity {
15
15
  updateTenantFields() {
16
16
  this.emailTenant = this.email ? `${this.email}:${this.tenantId || 'global'}` : null;
17
17
  this.phoneTenant = this.phone ? `${this.phone}:${this.tenantId || 'global'}` : null;
18
18
  }
19
19
  getPermissions() {
20
- return (0, lodash_1.chain)(this.userRoles)
21
- .map(role => (0, lodash_1.map)(role.role.rolePermissions, 'permission.name'))
20
+ return (0, lodash_1.chain)(this.roles)
21
+ .map(role => (0, lodash_1.map)(role.permissions, 'name'))
22
22
  .flatten()
23
23
  .uniq()
24
24
  .value();
25
25
  }
26
26
  getRoles() {
27
- return (0, lodash_1.chain)(this.userRoles)
28
- .map(role => role.role.name)
27
+ return (0, lodash_1.chain)(this.roles)
28
+ .map(role => role.name)
29
29
  .uniq()
30
30
  .value();
31
31
  }
@@ -121,9 +121,9 @@ tslib_1.__decorate([
121
121
  tslib_1.__metadata("design:type", Array)
122
122
  ], User.prototype, "otps", void 0);
123
123
  tslib_1.__decorate([
124
- (0, typeorm_1.OneToMany)(() => user_role_entity_1.UserRole, userRole => userRole.user),
124
+ (0, typeorm_1.ManyToMany)(() => role_entity_1.Role, role => role.users),
125
125
  tslib_1.__metadata("design:type", Array)
126
- ], User.prototype, "userRoles", void 0);
126
+ ], User.prototype, "roles", void 0);
127
127
  tslib_1.__decorate([
128
128
  (0, typeorm_1.Index)('IDX_USER_EMAIL_TENANT', { unique: true }),
129
129
  (0, typeorm_1.Column)({ nullable: true }),
@@ -1 +1 @@
1
- {"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/user/entities/user.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAYiB;AACjB,4DAA4B;AAC5B,yCAAsC;AACtC,iEAAsD;AACtD,0EAAgE;AAChE,2EAAgE;AAChE,mCAAoC;AACpC,+DAAqD;AACrD,6EAAkE;AAG3D,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,oBAAU;IA2EhC,kBAAkB;QACd,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACpF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxF,CAAC;IAED,cAAc;QACV,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,SAAS,CAAC;aACvB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,YAAG,EAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;aAC9D,OAAO,EAAE;aACT,IAAI,EAAE;aACN,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,SAAS,CAAC;aACvB,GAAG,CAAC,IAAI,C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A,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACP;AAIpB;IAFC,IAAA,eAAK,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChD,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACP;AAIpB;IAFC,IAAA,sBAAY,GAAE;IACd,IAAA,sBAAY,GAAE;;;;8CAId;eA9EQ,IAAI;IADhB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;GACb,IAAI,CAwGhB"}
1
+ {"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/user/entities/user.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAciB;AACjB,4DAA4B;AAC5B,yCAAsC;AACtC,iEAAsD;AACtD,0EAAgE;AAChE,mCAAoC;AACpC,+DAAqD;AACrD,6EAAkE;AAClE,iEAAuD;AAGhD,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,oBAAU;IA2EhC,kBAAkB;QACd,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACpF,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACxF,CAAC;IAED,cAAc;QACV,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,KAAK,CAAC;aACnB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,YAAG,EAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;aAC1C,OAAO,EAAE;aACT,IAAI,EAAE;aACN,KAAK,EAAE,CAAC;IACjB,CAAC;IA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AAK,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChD,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACP;AAIpB;IAFC,IAAA,eAAK,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAChD,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACP;AAIpB;IAFC,IAAA,sBAAY,GAAE;IACd,IAAA,sBAAY,GAAE;;;;8CAId;eA9EQ,IAAI;IADhB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;GACb,IAAI,CAwGhB"}
@@ -1,9 +0,0 @@
1
- import { BaseEntity } from "typeorm";
2
- import { Role } from "./role.entity";
3
- import { Permission } from "./permission.entity";
4
- export declare class RolePermission extends BaseEntity {
5
- roleId: string;
6
- permissionId: string;
7
- role: Role;
8
- permission: Permission;
9
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RolePermission = void 0;
4
- const tslib_1 = require("tslib");
5
- const typeorm_1 = require("typeorm");
6
- const role_entity_1 = require("./role.entity");
7
- const permission_entity_1 = require("./permission.entity");
8
- let RolePermission = class RolePermission extends typeorm_1.BaseEntity {
9
- };
10
- exports.RolePermission = RolePermission;
11
- tslib_1.__decorate([
12
- (0, typeorm_1.PrimaryColumn)('uuid'),
13
- tslib_1.__metadata("design:type", String)
14
- ], RolePermission.prototype, "roleId", void 0);
15
- tslib_1.__decorate([
16
- (0, typeorm_1.PrimaryColumn)('uuid'),
17
- tslib_1.__metadata("design:type", String)
18
- ], RolePermission.prototype, "permissionId", void 0);
19
- tslib_1.__decorate([
20
- (0, typeorm_1.ManyToOne)(() => role_entity_1.Role, role => role.rolePermissions, { onDelete: 'CASCADE' }),
21
- tslib_1.__metadata("design:type", role_entity_1.Role)
22
- ], RolePermission.prototype, "role", void 0);
23
- tslib_1.__decorate([
24
- (0, typeorm_1.ManyToOne)(() => permission_entity_1.Permission, permission => permission.rolePermissions, { onDelete: 'CASCADE' }),
25
- tslib_1.__metadata("design:type", permission_entity_1.Permission)
26
- ], RolePermission.prototype, "permission", void 0);
27
- exports.RolePermission = RolePermission = tslib_1.__decorate([
28
- (0, typeorm_1.Entity)('nest_auth_role_permissions')
29
- ], RolePermission);
30
- //# sourceMappingURL=role-permission.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role-permission.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/role-permission.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAAuE;AACvE,+CAAqC;AACrC,2DAAiD;AAG1C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,oBAAU;CAY7C,CAAA;AAZY,wCAAc;AAEvB;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;8CACP;AAGf;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;oDACD;AAGrB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;sCACvE,kBAAI;4CAAC;AAGX;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,8BAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;sCACnF,8BAAU;kDAAC;yBAXd,cAAc;IAD1B,IAAA,gBAAM,EAAC,4BAA4B,CAAC;GACxB,cAAc,CAY1B"}
@@ -1,13 +0,0 @@
1
- import { User } from "../../user/entities/user.entity";
2
- import { Role } from "./role.entity";
3
- import { Tenant } from "../../tenant/entities/tenant.entity";
4
- export declare class UserRole {
5
- userId: string;
6
- roleId: string;
7
- tenantId: string;
8
- user: User;
9
- role: Role;
10
- tenant: Tenant;
11
- createdAt: Date;
12
- updatedAt: Date;
13
- }
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserRole = void 0;
4
- const tslib_1 = require("tslib");
5
- const typeorm_1 = require("typeorm");
6
- const user_entity_1 = require("../../user/entities/user.entity");
7
- const role_entity_1 = require("./role.entity");
8
- const tenant_entity_1 = require("../../tenant/entities/tenant.entity");
9
- let UserRole = class UserRole {
10
- };
11
- exports.UserRole = UserRole;
12
- tslib_1.__decorate([
13
- (0, typeorm_1.PrimaryColumn)('uuid'),
14
- tslib_1.__metadata("design:type", String)
15
- ], UserRole.prototype, "userId", void 0);
16
- tslib_1.__decorate([
17
- (0, typeorm_1.PrimaryColumn)('uuid'),
18
- tslib_1.__metadata("design:type", String)
19
- ], UserRole.prototype, "roleId", void 0);
20
- tslib_1.__decorate([
21
- (0, typeorm_1.PrimaryColumn)('uuid'),
22
- tslib_1.__metadata("design:type", String)
23
- ], UserRole.prototype, "tenantId", void 0);
24
- tslib_1.__decorate([
25
- (0, typeorm_1.ManyToOne)(() => user_entity_1.User, user => user.userRoles, { onDelete: 'CASCADE' }),
26
- tslib_1.__metadata("design:type", user_entity_1.User)
27
- ], UserRole.prototype, "user", void 0);
28
- tslib_1.__decorate([
29
- (0, typeorm_1.ManyToOne)(() => role_entity_1.Role, role => role.userRoles, { onDelete: 'CASCADE' }),
30
- tslib_1.__metadata("design:type", role_entity_1.Role)
31
- ], UserRole.prototype, "role", void 0);
32
- tslib_1.__decorate([
33
- (0, typeorm_1.ManyToOne)(() => tenant_entity_1.Tenant),
34
- tslib_1.__metadata("design:type", tenant_entity_1.Tenant)
35
- ], UserRole.prototype, "tenant", void 0);
36
- tslib_1.__decorate([
37
- (0, typeorm_1.CreateDateColumn)(),
38
- tslib_1.__metadata("design:type", Date)
39
- ], UserRole.prototype, "createdAt", void 0);
40
- tslib_1.__decorate([
41
- (0, typeorm_1.UpdateDateColumn)(),
42
- tslib_1.__metadata("design:type", Date)
43
- ], UserRole.prototype, "updatedAt", void 0);
44
- exports.UserRole = UserRole = tslib_1.__decorate([
45
- (0, typeorm_1.Entity)('nest_auth_user_roles')
46
- ], UserRole);
47
- //# sourceMappingURL=user-role.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-role.entity.js","sourceRoot":"","sources":["../../../../../../../packages/nest-auth/src/lib/role/entities/user-role.entity.ts"],"names":[],"mappings":";;;;AAAA,qCAA+F;AAC/F,iEAAuD;AACvD,+CAAqC;AACrC,uEAA6D;AAGtD,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAwBpB,CAAA;AAxBY,4BAAQ;AAEjB;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;wCACP;AAGf;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;wCACP;AAGf;IADC,IAAA,uBAAa,EAAC,MAAM,CAAC;;0CACL;AAGjB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;sCACjE,kBAAI;sCAAC;AAGX;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;sCACjE,kBAAI;sCAAC;AAGX;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC;sCAChB,sBAAM;wCAAC;AAGf;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;2CAAC;AAGhB;IADC,IAAA,0BAAgB,GAAE;sCACR,IAAI;2CAAC;mBAvBP,QAAQ;IADpB,IAAA,gBAAM,EAAC,sBAAsB,CAAC;GAClB,QAAQ,CAwBpB"}