@flusys/nestjs-iam 5.3.1 → 5.4.1

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 (32) hide show
  1. package/cjs/entities/action.entity.js +112 -2
  2. package/cjs/entities/index.js +1 -2
  3. package/cjs/entities/permission-base.entity.js +6 -31
  4. package/cjs/entities/permission-with-company.entity.js +2 -2
  5. package/cjs/entities/user-iam-permission.entity.js +3 -14
  6. package/cjs/enums/iam-entity-type.enum.js +17 -0
  7. package/cjs/enums/iam-permission-type.enum.js +17 -0
  8. package/cjs/enums/index.js +2 -0
  9. package/cjs/services/permission.service.js +66 -64
  10. package/entities/action.entity.d.ts +15 -2
  11. package/entities/index.d.ts +3 -4
  12. package/entities/permission-base.entity.d.ts +0 -12
  13. package/entities/user-iam-permission.entity.d.ts +0 -1
  14. package/enums/iam-entity-type.enum.d.ts +6 -0
  15. package/enums/iam-permission-type.enum.d.ts +6 -0
  16. package/enums/index.d.ts +2 -0
  17. package/fesm/entities/action.entity.js +113 -3
  18. package/fesm/entities/index.js +3 -4
  19. package/fesm/entities/permission-base.entity.js +3 -17
  20. package/fesm/entities/permission-with-company.entity.js +2 -2
  21. package/fesm/entities/role-base.entity.js +1 -4
  22. package/fesm/entities/user-iam-permission.entity.js +0 -2
  23. package/fesm/enums/iam-entity-type.enum.js +7 -0
  24. package/fesm/enums/iam-permission-type.enum.js +7 -0
  25. package/fesm/enums/index.js +2 -0
  26. package/fesm/services/action.service.js +1 -1
  27. package/fesm/services/permission.service.js +3 -1
  28. package/package.json +3 -3
  29. package/services/action.service.d.ts +8 -8
  30. package/cjs/entities/action-base.entity.js +0 -130
  31. package/entities/action-base.entity.d.ts +0 -16
  32. package/fesm/entities/action-base.entity.js +0 -123
@@ -1,16 +1,4 @@
1
1
  import { Identity } from '@flusys/nestjs-shared';
2
- export declare enum IamPermissionType {
3
- USER_ROLE = "user_role",
4
- ROLE_ACTION = "role_action",
5
- USER_ACTION = "user_action",
6
- COMPANY_ACTION = "company_action"
7
- }
8
- export declare enum IamEntityType {
9
- USER = "user",
10
- ROLE = "role",
11
- ACTION = "action",
12
- COMPANY = "company"
13
- }
14
2
  export declare abstract class PermissionBase extends Identity {
15
3
  permissionType: string;
16
4
  sourceType: string;
@@ -1,4 +1,3 @@
1
1
  import { PermissionBase } from './permission-base.entity';
2
2
  export declare class UserIamPermission extends PermissionBase {
3
3
  }
4
- export { IamPermissionType, IamEntityType } from './permission-base.entity';
@@ -0,0 +1,6 @@
1
+ export declare enum IamEntityType {
2
+ USER = "user",
3
+ ROLE = "role",
4
+ ACTION = "action",
5
+ COMPANY = "company"
6
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum IamPermissionType {
2
+ USER_ROLE = "user_role",
3
+ ROLE_ACTION = "role_action",
4
+ USER_ACTION = "user_action",
5
+ COMPANY_ACTION = "company_action"
6
+ }
package/enums/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './action-type.enum';
2
+ export * from './iam-entity-type.enum';
3
+ export * from './iam-permission-type.enum';
2
4
  export * from './permission-type.enum';
@@ -1,13 +1,123 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
1
14
  function _ts_decorate(decorators, target, key, desc) {
2
15
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
16
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
17
  else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
18
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
19
  }
7
- import { Entity, Index } from 'typeorm';
8
- import { ActionBase } from './action-base.entity';
9
- export class Action extends ActionBase {
20
+ function _ts_metadata(k, v) {
21
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
+ }
23
+ import { Identity, getJsonColumnType } from '@flusys/nestjs-shared';
24
+ import { Column, Entity, Index, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
25
+ import { ActionType } from '../enums';
26
+ export class Action extends Identity {
27
+ constructor(...args){
28
+ super(...args), _define_property(this, "readOnly", void 0), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "code", void 0), _define_property(this, "actionType", void 0), _define_property(this, "permissionLogic", void 0), _define_property(this, "serial", void 0), _define_property(this, "isActive", void 0), _define_property(this, "parent", void 0), _define_property(this, "parentId", void 0), _define_property(this, "children", void 0);
29
+ }
10
30
  }
31
+ _ts_decorate([
32
+ Column({
33
+ type: 'boolean',
34
+ nullable: false,
35
+ default: false,
36
+ name: 'read_only'
37
+ }),
38
+ _ts_metadata("design:type", Boolean)
39
+ ], Action.prototype, "readOnly", void 0);
40
+ _ts_decorate([
41
+ Column({
42
+ type: 'varchar',
43
+ length: 255,
44
+ nullable: false
45
+ }),
46
+ _ts_metadata("design:type", String)
47
+ ], Action.prototype, "name", void 0);
48
+ _ts_decorate([
49
+ Column({
50
+ type: 'varchar',
51
+ length: 500,
52
+ nullable: true
53
+ }),
54
+ _ts_metadata("design:type", Object)
55
+ ], Action.prototype, "description", void 0);
56
+ _ts_decorate([
57
+ Column({
58
+ type: 'varchar',
59
+ length: 255,
60
+ nullable: true,
61
+ unique: true
62
+ }),
63
+ _ts_metadata("design:type", Object)
64
+ ], Action.prototype, "code", void 0);
65
+ _ts_decorate([
66
+ Column({
67
+ type: 'varchar',
68
+ length: 50,
69
+ nullable: false,
70
+ default: 'BACKEND',
71
+ name: 'action_type'
72
+ }),
73
+ _ts_metadata("design:type", typeof ActionType === "undefined" ? Object : ActionType)
74
+ ], Action.prototype, "actionType", void 0);
75
+ _ts_decorate([
76
+ Column({
77
+ type: getJsonColumnType(),
78
+ nullable: true,
79
+ name: 'permission_logic'
80
+ }),
81
+ _ts_metadata("design:type", Object)
82
+ ], Action.prototype, "permissionLogic", void 0);
83
+ _ts_decorate([
84
+ Column({
85
+ type: 'int',
86
+ nullable: true
87
+ }),
88
+ _ts_metadata("design:type", Object)
89
+ ], Action.prototype, "serial", void 0);
90
+ _ts_decorate([
91
+ Column({
92
+ type: 'boolean',
93
+ nullable: false,
94
+ default: true,
95
+ name: 'is_active'
96
+ }),
97
+ _ts_metadata("design:type", Boolean)
98
+ ], Action.prototype, "isActive", void 0);
99
+ _ts_decorate([
100
+ ManyToOne('Action', 'children', {
101
+ nullable: true,
102
+ onDelete: 'CASCADE'
103
+ }),
104
+ JoinColumn({
105
+ name: 'parent_id'
106
+ }),
107
+ _ts_metadata("design:type", Object)
108
+ ], Action.prototype, "parent", void 0);
109
+ _ts_decorate([
110
+ Column({
111
+ type: 'uuid',
112
+ nullable: true,
113
+ name: 'parent_id'
114
+ }),
115
+ _ts_metadata("design:type", Object)
116
+ ], Action.prototype, "parentId", void 0);
117
+ _ts_decorate([
118
+ OneToMany('Action', 'parent'),
119
+ _ts_metadata("design:type", Array)
120
+ ], Action.prototype, "children", void 0);
11
121
  Action = _ts_decorate([
12
122
  Entity({
13
123
  name: 'action'
@@ -1,16 +1,15 @@
1
- export * from './action-base.entity';
2
1
  export * from './action.entity';
3
2
  export * from './permission-base.entity';
4
- export * from './permission-with-company.entity';
5
3
  export * from './role-base.entity';
4
+ export * from './permission-with-company.entity';
6
5
  export * from './role-with-company.entity';
7
6
  export * from './role.entity';
8
7
  export * from './user-iam-permission.entity';
9
8
  import { Action } from './action.entity';
10
- import { Role } from './role.entity';
9
+ import { UserIamPermissionWithCompany } from './permission-with-company.entity';
11
10
  import { RoleWithCompany } from './role-with-company.entity';
11
+ import { Role } from './role.entity';
12
12
  import { UserIamPermission } from './user-iam-permission.entity';
13
- import { UserIamPermissionWithCompany } from './permission-with-company.entity';
14
13
  // Core entities (no company feature)
15
14
  export const IAMCoreEntities = [
16
15
  Action,
@@ -22,20 +22,6 @@ function _ts_metadata(k, v) {
22
22
  }
23
23
  import { Identity } from '@flusys/nestjs-shared';
24
24
  import { Column } from 'typeorm';
25
- export var IamPermissionType = /*#__PURE__*/ function(IamPermissionType) {
26
- IamPermissionType["USER_ROLE"] = "user_role";
27
- IamPermissionType["ROLE_ACTION"] = "role_action";
28
- IamPermissionType["USER_ACTION"] = "user_action";
29
- IamPermissionType["COMPANY_ACTION"] = "company_action";
30
- return IamPermissionType;
31
- }({});
32
- export var IamEntityType = /*#__PURE__*/ function(IamEntityType) {
33
- IamEntityType["USER"] = "user";
34
- IamEntityType["ROLE"] = "role";
35
- IamEntityType["ACTION"] = "action";
36
- IamEntityType["COMPANY"] = "company";
37
- return IamEntityType;
38
- }({});
39
25
  /**
40
26
  * Permission Base Entity
41
27
  * Core permission fields - always included regardless of company feature
@@ -67,7 +53,7 @@ _ts_decorate([
67
53
  ], PermissionBase.prototype, "sourceType", void 0);
68
54
  _ts_decorate([
69
55
  Column({
70
- type: 'uuid',
56
+ type: 'varchar',
71
57
  length: 150,
72
58
  name: 'source_id'
73
59
  }),
@@ -83,7 +69,7 @@ _ts_decorate([
83
69
  ], PermissionBase.prototype, "targetType", void 0);
84
70
  _ts_decorate([
85
71
  Column({
86
- type: 'uuid',
72
+ type: 'varchar',
87
73
  length: 150,
88
74
  name: 'target_id'
89
75
  }),
@@ -91,7 +77,7 @@ _ts_decorate([
91
77
  ], PermissionBase.prototype, "targetId", void 0);
92
78
  _ts_decorate([
93
79
  Column({
94
- type: 'uuid',
80
+ type: 'varchar',
95
81
  length: 150,
96
82
  nullable: true,
97
83
  name: 'user_id'
@@ -37,7 +37,7 @@ export class UserIamPermissionWithCompany extends PermissionBase {
37
37
  }
38
38
  _ts_decorate([
39
39
  Column({
40
- type: 'uuid',
40
+ type: 'varchar',
41
41
  length: 150,
42
42
  nullable: true,
43
43
  name: 'company_id'
@@ -46,7 +46,7 @@ _ts_decorate([
46
46
  ], UserIamPermissionWithCompany.prototype, "companyId", void 0);
47
47
  _ts_decorate([
48
48
  Column({
49
- type: 'uuid',
49
+ type: 'varchar',
50
50
  length: 150,
51
51
  nullable: true,
52
52
  name: 'branch_id'
@@ -22,10 +22,7 @@ function _ts_metadata(k, v) {
22
22
  }
23
23
  import { Identity } from '@flusys/nestjs-shared';
24
24
  import { Column } from 'typeorm';
25
- /**
26
- * Role Base Entity
27
- * Core role fields - always included regardless of company feature
28
- */ export class RoleBase extends Identity {
25
+ export class RoleBase extends Identity {
29
26
  constructor(...args){
30
27
  super(...args), _define_property(this, "readOnly", void 0), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "isActive", void 0), _define_property(this, "serial", void 0);
31
28
  }
@@ -34,5 +34,3 @@ UserIamPermission = _ts_decorate([
34
34
  'userId'
35
35
  ])
36
36
  ], UserIamPermission);
37
- // Re-export enums for backward compatibility
38
- export { IamPermissionType, IamEntityType } from './permission-base.entity';
@@ -0,0 +1,7 @@
1
+ export var IamEntityType = /*#__PURE__*/ function(IamEntityType) {
2
+ IamEntityType["USER"] = "user";
3
+ IamEntityType["ROLE"] = "role";
4
+ IamEntityType["ACTION"] = "action";
5
+ IamEntityType["COMPANY"] = "company";
6
+ return IamEntityType;
7
+ }({});
@@ -0,0 +1,7 @@
1
+ export var IamPermissionType = /*#__PURE__*/ function(IamPermissionType) {
2
+ IamPermissionType["USER_ROLE"] = "user_role";
3
+ IamPermissionType["ROLE_ACTION"] = "role_action";
4
+ IamPermissionType["USER_ACTION"] = "user_action";
5
+ IamPermissionType["COMPANY_ACTION"] = "company_action";
6
+ return IamPermissionType;
7
+ }({});
@@ -1,2 +1,4 @@
1
1
  export * from './action-type.enum';
2
+ export * from './iam-entity-type.enum';
3
+ export * from './iam-permission-type.enum';
2
4
  export * from './permission-type.enum';
@@ -25,7 +25,7 @@ function _ts_param(paramIndex, decorator) {
25
25
  decorator(target, key, paramIndex);
26
26
  };
27
27
  }
28
- import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
28
+ import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
29
29
  import { UtilsService } from '@flusys/nestjs-shared/modules';
30
30
  import { BadRequestException, Inject, Injectable, Scope } from '@nestjs/common';
31
31
  import { In } from 'typeorm';
@@ -34,7 +34,9 @@ import { Action } from '../entities/action.entity';
34
34
  import { UserIamPermissionWithCompany } from '../entities/permission-with-company.entity';
35
35
  import { RoleWithCompany } from '../entities/role-with-company.entity';
36
36
  import { Role } from '../entities/role.entity';
37
- import { IamEntityType, IamPermissionType, UserIamPermission } from '../entities/user-iam-permission.entity';
37
+ import { UserIamPermission } from '../entities/user-iam-permission.entity';
38
+ import { IamEntityType } from '../enums/iam-entity-type.enum';
39
+ import { IamPermissionType } from '../enums/iam-permission-type.enum';
38
40
  import { ActionType } from '../enums/action-type.enum';
39
41
  import { IAMPermissionMode } from '../enums/permission-type.enum';
40
42
  import { IAMConfigService } from './iam-config.service';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flusys/nestjs-iam",
3
- "version": "5.3.1",
3
+ "version": "5.4.1",
4
4
  "description": "Identity and Access Management (IAM) module for NestJS applications",
5
5
  "main": "cjs/index.js",
6
6
  "module": "fesm/index.js",
@@ -90,7 +90,7 @@
90
90
  "express": "^4.18.0 || ^5.0.0"
91
91
  },
92
92
  "dependencies": {
93
- "@flusys/nestjs-core": "5.3.1",
94
- "@flusys/nestjs-shared": "5.3.1"
93
+ "@flusys/nestjs-core": "5.4.1",
94
+ "@flusys/nestjs-shared": "5.4.1"
95
95
  }
96
96
  }
@@ -1,28 +1,28 @@
1
- import { HybridCache, ApiService } from '@flusys/nestjs-shared/classes';
1
+ import { ApiService, HybridCache } from '@flusys/nestjs-shared/classes';
2
2
  import { ILoggedUserInfo } from '@flusys/nestjs-shared/interfaces';
3
3
  import { UtilsService } from '@flusys/nestjs-shared/modules';
4
4
  import { SelectQueryBuilder } from 'typeorm';
5
5
  import { CreateActionDto, UpdateActionDto } from '../dtos/action.dto';
6
- import { ActionBase } from '../entities/action-base.entity';
6
+ import { Action } from '../entities/action.entity';
7
7
  import { IAction, IActionTree } from '../interfaces/action.interface';
8
8
  import { IAMConfigService } from './iam-config.service';
9
9
  import { IAMDataSourceService } from './iam-datasource.service';
10
10
  import { PermissionService } from './permission.service';
11
- export declare class ActionService extends ApiService<CreateActionDto, UpdateActionDto, IAction, ActionBase> {
11
+ export declare class ActionService extends ApiService<CreateActionDto, UpdateActionDto, IAction, Action> {
12
12
  protected cacheManager: HybridCache;
13
13
  protected utilsService: UtilsService;
14
14
  private readonly iamConfigService;
15
15
  private readonly permissionService;
16
16
  constructor(cacheManager: HybridCache, utilsService: UtilsService, iamConfigService: IAMConfigService, dataSourceProvider: IAMDataSourceService, permissionService: PermissionService);
17
- getSelectQuery(query: SelectQueryBuilder<ActionBase>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
18
- query: SelectQueryBuilder<ActionBase>;
17
+ getSelectQuery(query: SelectQueryBuilder<Action>, _user: ILoggedUserInfo | null, select?: string[]): Promise<{
18
+ query: SelectQueryBuilder<Action>;
19
19
  isRaw: boolean;
20
20
  }>;
21
- protected getGlobalSearchQuery(query: SelectQueryBuilder<ActionBase>, search: string): Promise<{
22
- query: SelectQueryBuilder<ActionBase>;
21
+ protected getGlobalSearchQuery(query: SelectQueryBuilder<Action>, search: string): Promise<{
22
+ query: SelectQueryBuilder<Action>;
23
23
  isRaw: boolean;
24
24
  }>;
25
- protected convertEntityToResponseDto(entity: ActionBase, _isRaw: boolean): IAction;
25
+ protected convertEntityToResponseDto(entity: Action, _isRaw: boolean): IAction;
26
26
  private readonly actionSelectFields;
27
27
  private requireUser;
28
28
  getActionsForPermission(user: ILoggedUserInfo): Promise<IAction[]>;
@@ -1,130 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ActionBase", {
6
- enumerable: true,
7
- get: function() {
8
- return ActionBase;
9
- }
10
- });
11
- const _nestjsshared = require("@flusys/nestjs-shared");
12
- const _typeorm = require("typeorm");
13
- const _enums = require("../enums");
14
- function _define_property(obj, key, value) {
15
- if (key in obj) {
16
- Object.defineProperty(obj, key, {
17
- value: value,
18
- enumerable: true,
19
- configurable: true,
20
- writable: true
21
- });
22
- } else {
23
- obj[key] = value;
24
- }
25
- return obj;
26
- }
27
- function _ts_decorate(decorators, target, key, desc) {
28
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
29
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
30
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
- return c > 3 && r && Object.defineProperty(target, key, r), r;
32
- }
33
- function _ts_metadata(k, v) {
34
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
35
- }
36
- let ActionBase = class ActionBase extends _nestjsshared.Identity {
37
- constructor(...args){
38
- super(...args), _define_property(this, "readOnly", void 0), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "code", void 0), _define_property(this, "actionType", void 0), _define_property(this, "permissionLogic", void 0), _define_property(this, "serial", void 0), _define_property(this, "isActive", void 0), _define_property(this, "parent", void 0), _define_property(this, "parentId", void 0), _define_property(this, "children", void 0);
39
- }
40
- };
41
- _ts_decorate([
42
- (0, _typeorm.Column)({
43
- type: 'boolean',
44
- nullable: false,
45
- default: false,
46
- name: 'read_only'
47
- }),
48
- _ts_metadata("design:type", Boolean)
49
- ], ActionBase.prototype, "readOnly", void 0);
50
- _ts_decorate([
51
- (0, _typeorm.Column)({
52
- type: 'varchar',
53
- length: 255,
54
- nullable: false
55
- }),
56
- _ts_metadata("design:type", String)
57
- ], ActionBase.prototype, "name", void 0);
58
- _ts_decorate([
59
- (0, _typeorm.Column)({
60
- type: 'varchar',
61
- length: 500,
62
- nullable: true
63
- }),
64
- _ts_metadata("design:type", Object)
65
- ], ActionBase.prototype, "description", void 0);
66
- _ts_decorate([
67
- (0, _typeorm.Column)({
68
- type: 'varchar',
69
- length: 255,
70
- nullable: true,
71
- unique: true
72
- }),
73
- _ts_metadata("design:type", Object)
74
- ], ActionBase.prototype, "code", void 0);
75
- _ts_decorate([
76
- (0, _typeorm.Column)({
77
- type: 'varchar',
78
- length: 50,
79
- nullable: false,
80
- default: 'BACKEND',
81
- name: 'action_type'
82
- }),
83
- _ts_metadata("design:type", typeof _enums.ActionType === "undefined" ? Object : _enums.ActionType)
84
- ], ActionBase.prototype, "actionType", void 0);
85
- _ts_decorate([
86
- (0, _typeorm.Column)({
87
- type: (0, _nestjsshared.getJsonColumnType)(),
88
- nullable: true,
89
- name: 'permission_logic'
90
- }),
91
- _ts_metadata("design:type", Object)
92
- ], ActionBase.prototype, "permissionLogic", void 0);
93
- _ts_decorate([
94
- (0, _typeorm.Column)({
95
- type: 'int',
96
- nullable: true
97
- }),
98
- _ts_metadata("design:type", Object)
99
- ], ActionBase.prototype, "serial", void 0);
100
- _ts_decorate([
101
- (0, _typeorm.Column)({
102
- type: 'boolean',
103
- nullable: false,
104
- default: true,
105
- name: 'is_active'
106
- }),
107
- _ts_metadata("design:type", Boolean)
108
- ], ActionBase.prototype, "isActive", void 0);
109
- _ts_decorate([
110
- (0, _typeorm.ManyToOne)('Action', 'children', {
111
- nullable: true,
112
- onDelete: 'CASCADE'
113
- }),
114
- (0, _typeorm.JoinColumn)({
115
- name: 'parent_id'
116
- }),
117
- _ts_metadata("design:type", Object)
118
- ], ActionBase.prototype, "parent", void 0);
119
- _ts_decorate([
120
- (0, _typeorm.Column)({
121
- type: 'uuid',
122
- nullable: true,
123
- name: 'parent_id'
124
- }),
125
- _ts_metadata("design:type", Object)
126
- ], ActionBase.prototype, "parentId", void 0);
127
- _ts_decorate([
128
- (0, _typeorm.OneToMany)('Action', 'parent'),
129
- _ts_metadata("design:type", Array)
130
- ], ActionBase.prototype, "children", void 0);
@@ -1,16 +0,0 @@
1
- import { Identity } from '@flusys/nestjs-shared';
2
- import { ActionType } from '../enums';
3
- import { LogicNode } from '../types';
4
- export declare abstract class ActionBase extends Identity {
5
- readOnly: boolean;
6
- name: string;
7
- description: string | null;
8
- code: string | null;
9
- actionType: ActionType;
10
- permissionLogic: LogicNode | null;
11
- serial: number | null;
12
- isActive: boolean;
13
- parent: ActionBase | null;
14
- parentId: string | null;
15
- children: ActionBase[];
16
- }
@@ -1,123 +0,0 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- function _ts_decorate(decorators, target, key, desc) {
15
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
16
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
17
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
18
- return c > 3 && r && Object.defineProperty(target, key, r), r;
19
- }
20
- function _ts_metadata(k, v) {
21
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22
- }
23
- import { getJsonColumnType, Identity } from '@flusys/nestjs-shared';
24
- import { Column, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
25
- import { ActionType } from '../enums';
26
- /**
27
- * Action Base Entity
28
- * Core action fields for all actions
29
- */ export class ActionBase extends Identity {
30
- constructor(...args){
31
- super(...args), _define_property(this, "readOnly", void 0), _define_property(this, "name", void 0), _define_property(this, "description", void 0), _define_property(this, "code", void 0), _define_property(this, "actionType", void 0), _define_property(this, "permissionLogic", void 0), _define_property(this, "serial", void 0), _define_property(this, "isActive", void 0), _define_property(this, "parent", void 0), _define_property(this, "parentId", void 0), _define_property(this, "children", void 0);
32
- }
33
- }
34
- _ts_decorate([
35
- Column({
36
- type: 'boolean',
37
- nullable: false,
38
- default: false,
39
- name: 'read_only'
40
- }),
41
- _ts_metadata("design:type", Boolean)
42
- ], ActionBase.prototype, "readOnly", void 0);
43
- _ts_decorate([
44
- Column({
45
- type: 'varchar',
46
- length: 255,
47
- nullable: false
48
- }),
49
- _ts_metadata("design:type", String)
50
- ], ActionBase.prototype, "name", void 0);
51
- _ts_decorate([
52
- Column({
53
- type: 'varchar',
54
- length: 500,
55
- nullable: true
56
- }),
57
- _ts_metadata("design:type", Object)
58
- ], ActionBase.prototype, "description", void 0);
59
- _ts_decorate([
60
- Column({
61
- type: 'varchar',
62
- length: 255,
63
- nullable: true,
64
- unique: true
65
- }),
66
- _ts_metadata("design:type", Object)
67
- ], ActionBase.prototype, "code", void 0);
68
- _ts_decorate([
69
- Column({
70
- type: 'varchar',
71
- length: 50,
72
- nullable: false,
73
- default: 'BACKEND',
74
- name: 'action_type'
75
- }),
76
- _ts_metadata("design:type", typeof ActionType === "undefined" ? Object : ActionType)
77
- ], ActionBase.prototype, "actionType", void 0);
78
- _ts_decorate([
79
- Column({
80
- type: getJsonColumnType(),
81
- nullable: true,
82
- name: 'permission_logic'
83
- }),
84
- _ts_metadata("design:type", Object)
85
- ], ActionBase.prototype, "permissionLogic", void 0);
86
- _ts_decorate([
87
- Column({
88
- type: 'int',
89
- nullable: true
90
- }),
91
- _ts_metadata("design:type", Object)
92
- ], ActionBase.prototype, "serial", void 0);
93
- _ts_decorate([
94
- Column({
95
- type: 'boolean',
96
- nullable: false,
97
- default: true,
98
- name: 'is_active'
99
- }),
100
- _ts_metadata("design:type", Boolean)
101
- ], ActionBase.prototype, "isActive", void 0);
102
- _ts_decorate([
103
- ManyToOne('Action', 'children', {
104
- nullable: true,
105
- onDelete: 'CASCADE'
106
- }),
107
- JoinColumn({
108
- name: 'parent_id'
109
- }),
110
- _ts_metadata("design:type", Object)
111
- ], ActionBase.prototype, "parent", void 0);
112
- _ts_decorate([
113
- Column({
114
- type: 'uuid',
115
- nullable: true,
116
- name: 'parent_id'
117
- }),
118
- _ts_metadata("design:type", Object)
119
- ], ActionBase.prototype, "parentId", void 0);
120
- _ts_decorate([
121
- OneToMany('Action', 'parent'),
122
- _ts_metadata("design:type", Array)
123
- ], ActionBase.prototype, "children", void 0);