@nest-omni/core 4.1.3-20 → 4.1.3-23

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 (107) hide show
  1. package/audit/audit.module.d.ts +1 -0
  2. package/audit/audit.module.js +5 -3
  3. package/audit/controllers/audit.controller.d.ts +3 -11
  4. package/audit/controllers/audit.controller.js +12 -19
  5. package/audit/decorators/audit-operation.decorator.d.ts +0 -7
  6. package/audit/decorators/audit-operation.decorator.js +0 -7
  7. package/audit/dto/audit-action-query.dto.d.ts +13 -0
  8. package/audit/dto/audit-action-query.dto.js +77 -0
  9. package/audit/dto/index.d.ts +1 -0
  10. package/audit/dto/index.js +1 -0
  11. package/audit/entities/entity-audit-log.entity.d.ts +1 -4
  12. package/audit/entities/entity-audit-log.entity.js +1 -17
  13. package/audit/entities/manual-operation-log.entity.d.ts +0 -2
  14. package/audit/entities/manual-operation-log.entity.js +0 -8
  15. package/audit/enums/audit.enums.d.ts +0 -8
  16. package/audit/enums/audit.enums.js +1 -10
  17. package/audit/examples/decorator-value-mapping.example.d.ts +70 -0
  18. package/audit/examples/decorator-value-mapping.example.js +414 -0
  19. package/audit/index.d.ts +1 -0
  20. package/audit/index.js +5 -1
  21. package/audit/interceptors/audit.interceptor.d.ts +1 -0
  22. package/audit/interceptors/audit.interceptor.js +19 -11
  23. package/audit/interfaces/audit.interfaces.d.ts +2 -17
  24. package/audit/services/audit-context.service.d.ts +9 -0
  25. package/audit/services/entity-audit.service.d.ts +65 -24
  26. package/audit/services/entity-audit.service.js +280 -93
  27. package/audit/services/manual-audit-log.service.d.ts +0 -1
  28. package/audit/services/manual-audit-log.service.js +1 -3
  29. package/audit/subscribers/entity-audit.subscriber.d.ts +1 -0
  30. package/audit/subscribers/entity-audit.subscriber.js +22 -5
  31. package/cache/cache.module.d.ts +7 -2
  32. package/cache/cache.module.js +9 -7
  33. package/cache/cache.service.d.ts +4 -4
  34. package/cache/cache.service.js +5 -5
  35. package/cache/entities/index.d.ts +1 -0
  36. package/cache/entities/index.js +17 -0
  37. package/cache/entities/typeorm-cache.entity.d.ts +71 -0
  38. package/cache/entities/typeorm-cache.entity.js +110 -0
  39. package/cache/index.d.ts +2 -1
  40. package/cache/index.js +19 -2
  41. package/cache/providers/index.d.ts +2 -1
  42. package/cache/providers/index.js +2 -1
  43. package/cache/providers/lrucache.provider.d.ts +76 -0
  44. package/cache/providers/lrucache.provider.js +226 -0
  45. package/cache/providers/typeorm-cache.provider.d.ts +211 -0
  46. package/cache/providers/typeorm-cache.provider.js +483 -0
  47. package/common/boilerplate.polyfill.d.ts +1 -0
  48. package/common/boilerplate.polyfill.js +17 -0
  49. package/common/helpers/validation-metadata-helper.d.ts +55 -0
  50. package/common/helpers/validation-metadata-helper.js +60 -0
  51. package/common/index.d.ts +1 -0
  52. package/common/index.js +4 -0
  53. package/decorators/field.decorators.d.ts +71 -2
  54. package/decorators/field.decorators.js +147 -18
  55. package/decorators/transform.decorators.d.ts +0 -2
  56. package/decorators/transform.decorators.js +0 -23
  57. package/filters/bad-request.filter.js +19 -4
  58. package/http-client/examples/axios-config-extended.example.d.ts +17 -0
  59. package/http-client/examples/axios-config-extended.example.js +313 -0
  60. package/http-client/examples/index.d.ts +2 -0
  61. package/http-client/examples/index.js +2 -0
  62. package/http-client/examples/ssl-certificate.example.d.ts +47 -0
  63. package/http-client/examples/ssl-certificate.example.js +431 -0
  64. package/http-client/index.d.ts +1 -1
  65. package/http-client/interfaces/http-client-config.interface.d.ts +73 -0
  66. package/http-client/services/http-client.service.js +46 -5
  67. package/http-client/utils/context-extractor.util.js +2 -0
  68. package/ip-filter/constants.d.ts +21 -0
  69. package/ip-filter/constants.js +24 -0
  70. package/ip-filter/decorators/index.d.ts +1 -0
  71. package/ip-filter/decorators/index.js +17 -0
  72. package/ip-filter/decorators/ip-filter.decorator.d.ts +58 -0
  73. package/ip-filter/decorators/ip-filter.decorator.js +79 -0
  74. package/ip-filter/guards/index.d.ts +1 -0
  75. package/ip-filter/guards/index.js +17 -0
  76. package/ip-filter/guards/ip-filter.guard.d.ts +62 -0
  77. package/ip-filter/guards/ip-filter.guard.js +174 -0
  78. package/ip-filter/index.d.ts +7 -0
  79. package/ip-filter/index.js +23 -0
  80. package/ip-filter/interfaces/index.d.ts +4 -0
  81. package/ip-filter/interfaces/index.js +20 -0
  82. package/ip-filter/interfaces/ip-filter-async-options.interface.d.ts +15 -0
  83. package/ip-filter/interfaces/ip-filter-async-options.interface.js +2 -0
  84. package/ip-filter/interfaces/ip-filter-metadata.interface.d.ts +26 -0
  85. package/ip-filter/interfaces/ip-filter-metadata.interface.js +2 -0
  86. package/ip-filter/interfaces/ip-filter-options.interface.d.ts +34 -0
  87. package/ip-filter/interfaces/ip-filter-options.interface.js +2 -0
  88. package/ip-filter/interfaces/ip-rule.interface.d.ts +36 -0
  89. package/ip-filter/interfaces/ip-rule.interface.js +2 -0
  90. package/ip-filter/ip-filter.module.d.ts +55 -0
  91. package/ip-filter/ip-filter.module.js +105 -0
  92. package/ip-filter/services/index.d.ts +1 -0
  93. package/ip-filter/services/index.js +17 -0
  94. package/ip-filter/services/ip-filter.service.d.ts +92 -0
  95. package/ip-filter/services/ip-filter.service.js +238 -0
  96. package/ip-filter/utils/index.d.ts +1 -0
  97. package/ip-filter/utils/index.js +17 -0
  98. package/ip-filter/utils/ip-utils.d.ts +61 -0
  99. package/ip-filter/utils/ip-utils.js +162 -0
  100. package/package.json +23 -24
  101. package/providers/context.provider.d.ts +9 -0
  102. package/providers/context.provider.js +13 -0
  103. package/setup/bootstrap.setup.d.ts +1 -1
  104. package/setup/bootstrap.setup.js +1 -1
  105. package/shared/service-registry.module.js +0 -1
  106. package/cache/providers/memory-cache.provider.d.ts +0 -69
  107. package/cache/providers/memory-cache.provider.js +0 -237
@@ -4,6 +4,7 @@ import { AuditConfig } from './interfaces';
4
4
  * 审计模块
5
5
  */
6
6
  export declare class AuditModule {
7
+ private static readonly logger;
7
8
  /**
8
9
  * 注册审计模块
9
10
  * @param config 审计配置
@@ -37,9 +37,10 @@ let AuditModule = AuditModule_1 = class AuditModule {
37
37
  var _a, _b;
38
38
  const auditConnectionName = ((_a = config === null || config === void 0 ? void 0 : config.connections) === null || _a === void 0 ? void 0 : _a.audit) || 'default';
39
39
  const monitoredConnections = ((_b = config === null || config === void 0 ? void 0 : config.connections) === null || _b === void 0 ? void 0 : _b.monitored) || ['default'];
40
- console.log('[AuditModule] auditConnectionName:', auditConnectionName);
41
- console.log('[AuditModule] monitoredConnections:', monitoredConnections);
42
- console.log('[AuditModule] config:', JSON.stringify(config === null || config === void 0 ? void 0 : config.connections));
40
+ if (process.env.NODE_ENV !== 'prod') {
41
+ this.logger.log(`Initializing AuditModule with connection: ${auditConnectionName}`);
42
+ this.logger.log(`Monitoring connections: ${monitoredConnections.join(', ')}`);
43
+ }
43
44
  // 创建多个订阅者提供者,每个监听的数据库连接一个
44
45
  const subscriberProviders = monitoredConnections.map((connectionName) => ({
45
46
  provide: `AUDIT_SUBSCRIBER_${connectionName}`,
@@ -287,6 +288,7 @@ let AuditModule = AuditModule_1 = class AuditModule {
287
288
  }
288
289
  };
289
290
  exports.AuditModule = AuditModule;
291
+ AuditModule.logger = new common_1.Logger(AuditModule_1.name);
290
292
  exports.AuditModule = AuditModule = AuditModule_1 = __decorate([
291
293
  (0, common_1.Global)(),
292
294
  (0, common_1.Module)({})
@@ -1,6 +1,6 @@
1
1
  import { EntityAuditService } from '../services/entity-audit.service';
2
2
  import { TransactionAuditService } from '../services/transaction-audit.service';
3
- import { AuditLogQueryDto, CompareEntitiesDto, RestoreEntityDto, PreCheckRestoreDto, BeginTransactionDto } from '../dto';
3
+ import { AuditLogQueryDto, AuditActionQueryDto, CompareEntitiesDto, RestoreEntityDto, PreCheckRestoreDto, BeginTransactionDto } from '../dto';
4
4
  import { EntityAuditLogEntity } from '../entities';
5
5
  import { EntityDifference, PreCheckResult, RestoreResult } from '../interfaces';
6
6
  import { PageDto } from '../../common/dto';
@@ -44,7 +44,7 @@ export declare class AuditController {
44
44
  /**
45
45
  * 查询审计动作汇总记录
46
46
  */
47
- getAuditActions(userId?: string, username?: string, actionName?: string, success?: string, startTime?: string, endTime?: string, page?: number, limit?: number): Promise<PageDto<import("../entities").AuditActionSummaryEntity>>;
47
+ getAuditActions(query: AuditActionQueryDto): Promise<PageDto<import("../entities").AuditActionSummaryEntity>>;
48
48
  /**
49
49
  * 查询单个审计动作的详细信息
50
50
  */
@@ -81,15 +81,7 @@ export declare class AuditController {
81
81
  createdAt: Date;
82
82
  oldValue: Record<string, any>;
83
83
  newValue: Record<string, any>;
84
- fieldChanges: {
85
- field: string;
86
- fieldLabel: string;
87
- oldValue: any;
88
- newValue: any;
89
- changeType: "added" | "removed" | "modified" | "unchanged";
90
- displayOldValue?: string;
91
- displayNewValue?: string;
92
- }[];
84
+ changeDetails: import("../interfaces").ChangeDetail[];
93
85
  changedFieldsCount: number;
94
86
  changedFields: string[];
95
87
  }[];
@@ -96,17 +96,17 @@ let AuditController = class AuditController {
96
96
  /**
97
97
  * 查询审计动作汇总记录
98
98
  */
99
- getAuditActions(userId_1, username_1, actionName_1, success_1, startTime_1, endTime_1) {
100
- return __awaiter(this, arguments, void 0, function* (userId, username, actionName, success, startTime, endTime, page = 1, limit = 20) {
99
+ getAuditActions(query) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
101
  return this.entityAuditService.getAuditActions({
102
- userId,
103
- username,
104
- actionName,
105
- success: success ? success === 'true' : undefined,
106
- startTime: startTime ? new Date(startTime) : undefined,
107
- endTime: endTime ? new Date(endTime) : undefined,
108
- page,
109
- limit,
102
+ userId: query.userId,
103
+ username: query.username,
104
+ actionName: query.actionName,
105
+ success: query.success,
106
+ startTime: query.startTime ? new Date(query.startTime) : undefined,
107
+ endTime: query.endTime ? new Date(query.endTime) : undefined,
108
+ page: query.page,
109
+ limit: query.limit,
110
110
  });
111
111
  });
112
112
  }
@@ -187,16 +187,9 @@ __decorate([
187
187
  (0, common_1.Get)('actions'),
188
188
  (0, swagger_1.ApiOperation)({ summary: '查询审计动作汇总记录' }),
189
189
  (0, swagger_1.ApiResponse)({ status: 200, description: '返回审计动作汇总列表' }),
190
- __param(0, (0, common_1.Query)('userId')),
191
- __param(1, (0, common_1.Query)('username')),
192
- __param(2, (0, common_1.Query)('actionName')),
193
- __param(3, (0, common_1.Query)('success')),
194
- __param(4, (0, common_1.Query)('startTime')),
195
- __param(5, (0, common_1.Query)('endTime')),
196
- __param(6, (0, common_1.Query)('page')),
197
- __param(7, (0, common_1.Query)('limit')),
190
+ __param(0, (0, common_1.Query)()),
198
191
  __metadata("design:type", Function),
199
- __metadata("design:paramtypes", [String, String, String, String, String, String, Number, Number]),
192
+ __metadata("design:paramtypes", [dto_1.AuditActionQueryDto]),
200
193
  __metadata("design:returntype", Promise)
201
194
  ], AuditController.prototype, "getAuditActions", null);
202
195
  __decorate([
@@ -7,7 +7,6 @@ export declare const AUDIT_OPERATION_OPTIONS: unique symbol;
7
7
  * 用于手动记录业务操作的审计日志,支持:
8
8
  * - 自定义操作模板
9
9
  * - 动态描述参数
10
- * - 回滚操作定义
11
10
  * - 自动事务管理
12
11
  *
13
12
  * @param options 审计操作选项
@@ -20,12 +19,6 @@ export declare const AUDIT_OPERATION_OPTIONS: unique symbol;
20
19
  * username: args[0].username,
21
20
  * approver: result.approver
22
21
  * }),
23
- * rollbackActions: (args, result) => [{
24
- * type: RollbackActionType.UPDATE,
25
- * action: 'reject',
26
- * params: { userId: args[0].id },
27
- * order: 1
28
- * }],
29
22
  * autoTransaction: true
30
23
  * })
31
24
  * async approveUser(user: User): Promise<ApprovalResult> {
@@ -13,7 +13,6 @@ exports.AUDIT_OPERATION_OPTIONS = Symbol('AUDIT_OPERATION_OPTIONS');
13
13
  * 用于手动记录业务操作的审计日志,支持:
14
14
  * - 自定义操作模板
15
15
  * - 动态描述参数
16
- * - 回滚操作定义
17
16
  * - 自动事务管理
18
17
  *
19
18
  * @param options 审计操作选项
@@ -26,12 +25,6 @@ exports.AUDIT_OPERATION_OPTIONS = Symbol('AUDIT_OPERATION_OPTIONS');
26
25
  * username: args[0].username,
27
26
  * approver: result.approver
28
27
  * }),
29
- * rollbackActions: (args, result) => [{
30
- * type: RollbackActionType.UPDATE,
31
- * action: 'reject',
32
- * params: { userId: args[0].id },
33
- * order: 1
34
- * }],
35
28
  * autoTransaction: true
36
29
  * })
37
30
  * async approveUser(user: User): Promise<ApprovalResult> {
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 审计动作查询 DTO
3
+ */
4
+ export declare class AuditActionQueryDto {
5
+ page?: number;
6
+ limit?: number;
7
+ userId?: string;
8
+ username?: string;
9
+ actionName?: string;
10
+ success?: boolean;
11
+ startTime?: string;
12
+ endTime?: string;
13
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuditActionQueryDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ const class_transformer_1 = require("class-transformer");
16
+ /**
17
+ * 审计动作查询 DTO
18
+ */
19
+ class AuditActionQueryDto {
20
+ constructor() {
21
+ this.page = 1;
22
+ this.limit = 20;
23
+ }
24
+ }
25
+ exports.AuditActionQueryDto = AuditActionQueryDto;
26
+ __decorate([
27
+ (0, swagger_1.ApiPropertyOptional)({ description: '页码', default: 1 }),
28
+ (0, class_validator_1.IsOptional)(),
29
+ (0, class_transformer_1.Type)(() => Number),
30
+ (0, class_validator_1.Min)(1),
31
+ __metadata("design:type", Number)
32
+ ], AuditActionQueryDto.prototype, "page", void 0);
33
+ __decorate([
34
+ (0, swagger_1.ApiPropertyOptional)({ description: '每页数量', default: 20 }),
35
+ (0, class_validator_1.IsOptional)(),
36
+ (0, class_transformer_1.Type)(() => Number),
37
+ (0, class_validator_1.Min)(1),
38
+ (0, class_validator_1.Max)(100),
39
+ __metadata("design:type", Number)
40
+ ], AuditActionQueryDto.prototype, "limit", void 0);
41
+ __decorate([
42
+ (0, swagger_1.ApiPropertyOptional)({ description: '用户ID' }),
43
+ (0, class_validator_1.IsOptional)(),
44
+ (0, class_validator_1.IsString)(),
45
+ __metadata("design:type", String)
46
+ ], AuditActionQueryDto.prototype, "userId", void 0);
47
+ __decorate([
48
+ (0, swagger_1.ApiPropertyOptional)({ description: '用户名' }),
49
+ (0, class_validator_1.IsOptional)(),
50
+ (0, class_validator_1.IsString)(),
51
+ __metadata("design:type", String)
52
+ ], AuditActionQueryDto.prototype, "username", void 0);
53
+ __decorate([
54
+ (0, swagger_1.ApiPropertyOptional)({ description: '动作名称' }),
55
+ (0, class_validator_1.IsOptional)(),
56
+ (0, class_validator_1.IsString)(),
57
+ __metadata("design:type", String)
58
+ ], AuditActionQueryDto.prototype, "actionName", void 0);
59
+ __decorate([
60
+ (0, swagger_1.ApiPropertyOptional)({ description: '是否成功' }),
61
+ (0, class_validator_1.IsOptional)(),
62
+ (0, class_transformer_1.Type)(() => Boolean),
63
+ (0, class_validator_1.IsBoolean)(),
64
+ __metadata("design:type", Boolean)
65
+ ], AuditActionQueryDto.prototype, "success", void 0);
66
+ __decorate([
67
+ (0, swagger_1.ApiPropertyOptional)({ description: '开始时间' }),
68
+ (0, class_validator_1.IsOptional)(),
69
+ (0, class_validator_1.IsDateString)(),
70
+ __metadata("design:type", String)
71
+ ], AuditActionQueryDto.prototype, "startTime", void 0);
72
+ __decorate([
73
+ (0, swagger_1.ApiPropertyOptional)({ description: '结束时间' }),
74
+ (0, class_validator_1.IsOptional)(),
75
+ (0, class_validator_1.IsDateString)(),
76
+ __metadata("design:type", String)
77
+ ], AuditActionQueryDto.prototype, "endTime", void 0);
@@ -1,4 +1,5 @@
1
1
  export * from './audit-log-query.dto';
2
+ export * from './audit-action-query.dto';
2
3
  export * from './compare-entities.dto';
3
4
  export * from './restore-entity.dto';
4
5
  export * from './pre-check-restore.dto';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./audit-log-query.dto"), exports);
18
+ __exportStar(require("./audit-action-query.dto"), exports);
18
19
  __exportStar(require("./compare-entities.dto"), exports);
19
20
  __exportStar(require("./restore-entity.dto"), exports);
20
21
  __exportStar(require("./pre-check-restore.dto"), exports);
@@ -1,6 +1,6 @@
1
1
  import { AbstractUuidPrimaryEntity } from '../../common/abstract.entity';
2
2
  import { AuditOperation } from '../enums';
3
- import { ChangeDetail, RollbackAction } from '../interfaces';
3
+ import { ChangeDetail } from '../interfaces';
4
4
  /**
5
5
  * 实体审计日志
6
6
  */
@@ -11,19 +11,16 @@ export declare class EntityAuditLogEntity extends AbstractUuidPrimaryEntity {
11
11
  oldValue: Record<string, any>;
12
12
  newValue: Record<string, any>;
13
13
  changedFields: string[];
14
- changedFieldPaths: string;
15
14
  userId: string;
16
15
  username: string;
17
16
  requestId: string;
18
17
  requestIp: string;
19
18
  userAgent: string;
20
19
  description: string;
21
- hashChain: Record<string, any>;
22
20
  auditActionId: string;
23
21
  auditActionName: string;
24
22
  sequenceInAction: number;
25
23
  operationTemplateKey: string;
26
24
  descriptionParams: Record<string, any>;
27
25
  changeDetails: ChangeDetail[];
28
- rollbackActions: RollbackAction[];
29
26
  }
@@ -40,13 +40,9 @@ __decorate([
40
40
  __metadata("design:type", Object)
41
41
  ], EntityAuditLogEntity.prototype, "newValue", void 0);
42
42
  __decorate([
43
- (0, typeorm_1.Column)({ type: 'json', nullable: true, comment: '变更的字段' }),
43
+ (0, typeorm_1.Column)({ type: 'json', nullable: true, comment: '变更的字段列表' }),
44
44
  __metadata("design:type", Array)
45
45
  ], EntityAuditLogEntity.prototype, "changedFields", void 0);
46
- __decorate([
47
- (0, typeorm_1.Column)({ type: 'text', nullable: true, comment: '变更字段路径' }),
48
- __metadata("design:type", String)
49
- ], EntityAuditLogEntity.prototype, "changedFieldPaths", void 0);
50
46
  __decorate([
51
47
  (0, typeorm_1.Column)({ nullable: true, comment: '操作用户ID' }),
52
48
  __metadata("design:type", String)
@@ -71,10 +67,6 @@ __decorate([
71
67
  (0, typeorm_1.Column)({ type: 'text', nullable: true, comment: '操作描述' }),
72
68
  __metadata("design:type", String)
73
69
  ], EntityAuditLogEntity.prototype, "description", void 0);
74
- __decorate([
75
- (0, typeorm_1.Column)({ type: 'json', nullable: true, comment: '哈希链' }),
76
- __metadata("design:type", Object)
77
- ], EntityAuditLogEntity.prototype, "hashChain", void 0);
78
70
  __decorate([
79
71
  (0, typeorm_1.Column)({ nullable: true, comment: '审计动作ID,用于关联同一业务操作的多个实体变化' }),
80
72
  __metadata("design:type", String)
@@ -107,14 +99,6 @@ __decorate([
107
99
  }),
108
100
  __metadata("design:type", Array)
109
101
  ], EntityAuditLogEntity.prototype, "changeDetails", void 0);
110
- __decorate([
111
- (0, typeorm_1.Column)({
112
- type: 'json',
113
- nullable: true,
114
- comment: '回滚操作列表',
115
- }),
116
- __metadata("design:type", Array)
117
- ], EntityAuditLogEntity.prototype, "rollbackActions", void 0);
118
102
  exports.EntityAuditLogEntity = EntityAuditLogEntity = __decorate([
119
103
  (0, typeorm_1.Entity)('entity_audit_log')
120
104
  // 单字段索引
@@ -1,6 +1,5 @@
1
1
  import { AbstractUuidPrimaryEntity } from '../../common/abstract.entity';
2
2
  import { EntityTransactionEntity } from './entity-transaction.entity';
3
- import { RollbackAction } from '../interfaces';
4
3
  /**
5
4
  * 手动操作记录表
6
5
  * 用于记录跨实体的复杂业务操作
@@ -14,6 +13,5 @@ export declare class ManualOperationLogEntity extends AbstractUuidPrimaryEntity
14
13
  userId: string;
15
14
  username: string;
16
15
  requestIp: string;
17
- rollbackActions: RollbackAction[];
18
16
  transaction: EntityTransactionEntity;
19
17
  }
@@ -64,14 +64,6 @@ __decorate([
64
64
  (0, typeorm_1.Column)({ nullable: true, comment: '操作IP' }),
65
65
  __metadata("design:type", String)
66
66
  ], ManualOperationLogEntity.prototype, "requestIp", void 0);
67
- __decorate([
68
- (0, typeorm_1.Column)({
69
- type: 'json',
70
- nullable: true,
71
- comment: '回滚操作列表',
72
- }),
73
- __metadata("design:type", Array)
74
- ], ManualOperationLogEntity.prototype, "rollbackActions", void 0);
75
67
  __decorate([
76
68
  (0, typeorm_1.ManyToOne)('EntityTransactionEntity', { onDelete: 'CASCADE' }),
77
69
  (0, typeorm_1.JoinColumn)({ name: 'transactionId' }),
@@ -40,14 +40,6 @@ export declare enum MaskingStrategy {
40
40
  MASK = "MASK",
41
41
  PARTIAL = "PARTIAL"
42
42
  }
43
- /**
44
- * 回滚操作类型(设计文档标准命名)
45
- */
46
- export declare enum RollbackActionType {
47
- ENTITY = "entity",// 实体回滚(删除/恢复)
48
- FILE = "file",// 文件回滚(删除上传的文件)
49
- CUSTOM = "custom"
50
- }
51
43
  /**
52
44
  * 变更类型(设计文档标准命名)
53
45
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChangeType = exports.RollbackActionType = exports.MaskingStrategy = exports.RecordStrategy = exports.RecoveryStrategy = exports.AuditTransactionStatus = exports.AuditOperation = void 0;
3
+ exports.ChangeType = exports.MaskingStrategy = exports.RecordStrategy = exports.RecoveryStrategy = exports.AuditTransactionStatus = exports.AuditOperation = void 0;
4
4
  /**
5
5
  * 审计操作类型(兼容性别名,映射到 OperationType)
6
6
  */
@@ -48,15 +48,6 @@ var MaskingStrategy;
48
48
  MaskingStrategy["MASK"] = "MASK";
49
49
  MaskingStrategy["PARTIAL"] = "PARTIAL";
50
50
  })(MaskingStrategy || (exports.MaskingStrategy = MaskingStrategy = {}));
51
- /**
52
- * 回滚操作类型(设计文档标准命名)
53
- */
54
- var RollbackActionType;
55
- (function (RollbackActionType) {
56
- RollbackActionType["ENTITY"] = "entity";
57
- RollbackActionType["FILE"] = "file";
58
- RollbackActionType["CUSTOM"] = "custom";
59
- })(RollbackActionType || (exports.RollbackActionType = RollbackActionType = {}));
60
51
  /**
61
52
  * 变更类型(设计文档标准命名)
62
53
  */
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 装饰器值映射完整示例
3
+ *
4
+ * 本示例演示如何使用 @AuditField 装饰器的 valueLabels 功能
5
+ * 实现字段值的多语言显示和映射
6
+ */
7
+ export declare class ProductEntity {
8
+ id: string;
9
+ name: string;
10
+ price: number;
11
+ costPrice: number;
12
+ stock: number;
13
+ status: string;
14
+ isFeatured: boolean;
15
+ productType: string;
16
+ internalNotes: string;
17
+ supplierCode: string;
18
+ }
19
+ export declare class OrderEntity {
20
+ orderSn: string;
21
+ totalAmount: number;
22
+ orderStatus: string;
23
+ paymentStatus: string;
24
+ shippingMethod: string;
25
+ customerPhone: string;
26
+ customerEmail: string;
27
+ }
28
+ export declare class UserEntity {
29
+ username: string;
30
+ email: string;
31
+ phone: string;
32
+ status: string;
33
+ role: string;
34
+ emailNotificationEnabled: boolean;
35
+ smsNotificationEnabled: boolean;
36
+ gender: string;
37
+ password: string;
38
+ }
39
+ export declare class InventoryEntity {
40
+ productCode: string;
41
+ availableStock: number;
42
+ lockedStock: number;
43
+ totalStock: number;
44
+ stockStatus: string;
45
+ }
46
+ /**
47
+ * 当产品状态从 'active' 变为 'out_of_stock' 时,
48
+ * 审计日志的 changeDetails 会显示:
49
+ *
50
+ * 中文 (language=zh):
51
+ * {
52
+ * "fieldName": "状态",
53
+ * "changeType": "modified",
54
+ * "displayOldValue": "在售",
55
+ * "displayNewValue": "缺货",
56
+ * "oldValue": "active",
57
+ * "newValue": "out_of_stock"
58
+ * }
59
+ *
60
+ * 英文 (language=en):
61
+ * {
62
+ * "fieldName": "Status",
63
+ * "changeType": "modified",
64
+ * "displayOldValue": "Active",
65
+ * "displayNewValue": "Out of Stock",
66
+ * "oldValue": "active",
67
+ * "newValue": "out_of_stock"
68
+ * }
69
+ */
70
+ export {};