@nest-omni/core 3.1.2-8 → 4.1.2-9

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 (94) hide show
  1. package/audit/audit.module.d.ts +10 -0
  2. package/audit/audit.module.js +231 -0
  3. package/audit/controllers/audit.controller.d.ts +20 -0
  4. package/audit/controllers/audit.controller.js +142 -0
  5. package/audit/controllers/index.d.ts +1 -0
  6. package/audit/controllers/index.js +17 -0
  7. package/audit/decorators/audit-controller.decorator.d.ts +5 -0
  8. package/audit/decorators/audit-controller.decorator.js +17 -0
  9. package/audit/decorators/audit-operation.decorator.d.ts +5 -0
  10. package/audit/decorators/audit-operation.decorator.js +23 -0
  11. package/audit/decorators/entity-audit.decorator.d.ts +5 -0
  12. package/audit/decorators/entity-audit.decorator.js +19 -0
  13. package/audit/decorators/index.d.ts +2 -0
  14. package/audit/decorators/index.js +18 -0
  15. package/audit/dto/audit-log-query.dto.d.ts +14 -0
  16. package/audit/dto/audit-log-query.dto.js +95 -0
  17. package/audit/dto/begin-transaction.dto.d.ts +3 -0
  18. package/audit/dto/begin-transaction.dto.js +22 -0
  19. package/audit/dto/compare-entities.dto.d.ts +6 -0
  20. package/audit/dto/compare-entities.dto.js +44 -0
  21. package/audit/dto/index.d.ts +5 -0
  22. package/audit/dto/index.js +21 -0
  23. package/audit/dto/pre-check-restore.dto.d.ts +5 -0
  24. package/audit/dto/pre-check-restore.dto.js +32 -0
  25. package/audit/dto/restore-entity.dto.d.ts +9 -0
  26. package/audit/dto/restore-entity.dto.js +53 -0
  27. package/audit/entities/entity-audit-log.entity.d.ts +18 -0
  28. package/audit/entities/entity-audit-log.entity.js +81 -0
  29. package/audit/entities/entity-transaction.entity.d.ts +14 -0
  30. package/audit/entities/entity-transaction.entity.js +51 -0
  31. package/audit/entities/index.d.ts +2 -0
  32. package/audit/entities/index.js +18 -0
  33. package/audit/entities/manual-operation-log.entity.d.ts +15 -0
  34. package/audit/entities/manual-operation-log.entity.js +82 -0
  35. package/audit/entities/operation-template.entity.d.ts +11 -0
  36. package/audit/entities/operation-template.entity.js +65 -0
  37. package/audit/enums/audit.enums.d.ts +27 -0
  38. package/audit/enums/audit.enums.js +35 -0
  39. package/audit/enums/index.d.ts +1 -0
  40. package/audit/enums/index.js +17 -0
  41. package/audit/index.d.ts +10 -0
  42. package/audit/index.js +26 -0
  43. package/audit/interceptors/audit.interceptor.d.ts +12 -0
  44. package/audit/interceptors/audit.interceptor.js +95 -0
  45. package/audit/interceptors/index.d.ts +1 -0
  46. package/audit/interceptors/index.js +17 -0
  47. package/audit/interfaces/audit.interfaces.d.ts +119 -0
  48. package/audit/interfaces/audit.interfaces.js +2 -0
  49. package/audit/interfaces/index.d.ts +1 -0
  50. package/audit/interfaces/index.js +17 -0
  51. package/audit/services/audit-context.service.d.ts +10 -0
  52. package/audit/services/audit-context.service.js +55 -0
  53. package/audit/services/audit-strategy.service.d.ts +19 -0
  54. package/audit/services/audit-strategy.service.js +89 -0
  55. package/audit/services/entity-audit.service.d.ts +37 -0
  56. package/audit/services/entity-audit.service.js +484 -0
  57. package/audit/services/index.d.ts +5 -0
  58. package/audit/services/index.js +21 -0
  59. package/audit/services/manual-audit-log.service.d.ts +29 -0
  60. package/audit/services/manual-audit-log.service.js +184 -0
  61. package/audit/services/multi-database.service.d.ts +10 -0
  62. package/audit/services/multi-database.service.js +59 -0
  63. package/audit/services/operation-description.service.d.ts +21 -0
  64. package/audit/services/operation-description.service.js +213 -0
  65. package/audit/services/transaction-audit.service.d.ts +22 -0
  66. package/audit/services/transaction-audit.service.js +201 -0
  67. package/audit/subscribers/entity-audit.subscriber.d.ts +14 -0
  68. package/audit/subscribers/entity-audit.subscriber.js +136 -0
  69. package/audit/subscribers/index.d.ts +1 -0
  70. package/audit/subscribers/index.js +17 -0
  71. package/common/abstract.entity.js +1 -1
  72. package/http-client/examples/advanced-usage.example.js +14 -1
  73. package/http-client/examples/auth-with-waiting-lock.example.d.ts +17 -0
  74. package/http-client/examples/auth-with-waiting-lock.example.js +336 -0
  75. package/http-client/examples/basic-usage.example.d.ts +1 -9
  76. package/http-client/examples/basic-usage.example.js +4 -14
  77. package/http-client/examples/multi-api-configuration.example.js +4 -4
  78. package/http-client/http-client.module.js +7 -4
  79. package/http-client/services/api-client-registry.service.d.ts +2 -1
  80. package/http-client/services/api-client-registry.service.js +2 -1
  81. package/http-client/services/http-client.service.d.ts +18 -1
  82. package/http-client/services/http-client.service.js +123 -3
  83. package/http-client/services/http-log-query.service.d.ts +20 -0
  84. package/http-client/services/http-log-query.service.js +176 -0
  85. package/http-client/services/http-replay.service.d.ts +58 -0
  86. package/http-client/services/http-replay.service.js +266 -0
  87. package/http-client/services/log-cleanup.service.js +2 -2
  88. package/http-client/services/logging.service.js +1 -1
  89. package/http-client/utils/request-id.util.d.ts +4 -0
  90. package/http-client/utils/request-id.util.js +34 -0
  91. package/index.d.ts +1 -0
  92. package/index.js +1 -0
  93. package/package.json +1 -1
  94. package/setup/bootstrap.setup.js +5 -1
@@ -0,0 +1,201 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.TransactionAuditService = void 0;
25
+ const common_1 = require("@nestjs/common");
26
+ const typeorm_1 = require("@nestjs/typeorm");
27
+ const typeorm_2 = require("typeorm");
28
+ const entities_1 = require("../entities");
29
+ const enums_1 = require("../enums");
30
+ const audit_context_service_1 = require("./audit-context.service");
31
+ const entity_audit_service_1 = require("./entity-audit.service");
32
+ const multi_database_service_1 = require("./multi-database.service");
33
+ let TransactionAuditService = class TransactionAuditService {
34
+ constructor(transactionRepository, contextService, auditService, multiDbService) {
35
+ this.transactionRepository = transactionRepository;
36
+ this.contextService = contextService;
37
+ this.auditService = auditService;
38
+ this.multiDbService = multiDbService;
39
+ }
40
+ beginTransaction(description) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const context = yield this.contextService.getCurrentContext();
43
+ const transaction = this.transactionRepository.create({
44
+ description,
45
+ status: enums_1.TransactionStatus.PENDING,
46
+ entities: [],
47
+ userId: context.userId,
48
+ username: context.username,
49
+ });
50
+ const savedTransaction = yield this.transactionRepository.save(transaction);
51
+ this.contextService.setContext({
52
+ transactionId: savedTransaction.id,
53
+ });
54
+ return savedTransaction.id;
55
+ });
56
+ }
57
+ commitTransaction(transactionId) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const transaction = yield this.transactionRepository.findOne({
60
+ where: { id: transactionId },
61
+ });
62
+ if (!transaction) {
63
+ throw new Error(`Transaction not found: ${transactionId}`);
64
+ }
65
+ transaction.status = enums_1.TransactionStatus.COMMITTED;
66
+ yield this.transactionRepository.save(transaction);
67
+ });
68
+ }
69
+ rollbackTransaction(transactionId) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const transaction = yield this.transactionRepository.findOne({
72
+ where: { id: transactionId },
73
+ });
74
+ if (!transaction) {
75
+ throw new Error(`Transaction not found: ${transactionId}`);
76
+ }
77
+ yield this.performRollback(transaction);
78
+ transaction.status = enums_1.TransactionStatus.ROLLED_BACK;
79
+ yield this.transactionRepository.save(transaction);
80
+ });
81
+ }
82
+ addEntityToTransaction(transactionId, entityType, entityId, operation) {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ const transaction = yield this.transactionRepository.findOne({
85
+ where: { id: transactionId },
86
+ });
87
+ if (!transaction) {
88
+ throw new Error(`Transaction not found: ${transactionId}`);
89
+ }
90
+ transaction.entities.push({
91
+ entityType,
92
+ entityId,
93
+ operation,
94
+ });
95
+ yield this.transactionRepository.save(transaction);
96
+ });
97
+ }
98
+ performRollback(transaction) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const reversedEntities = [...transaction.entities].reverse();
101
+ const entitiesByConnection = yield this.groupEntitiesByConnection(reversedEntities);
102
+ for (const [connectionName, entities] of Object.entries(entitiesByConnection)) {
103
+ yield this.rollbackEntitiesInConnection(connectionName, entities);
104
+ }
105
+ });
106
+ }
107
+ groupEntitiesByConnection(entities) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const grouped = {};
110
+ const monitoredConnections = this.multiDbService.getMonitoredConnections();
111
+ for (const entity of entities) {
112
+ let connectionFound = false;
113
+ for (const connectionName of monitoredConnections) {
114
+ try {
115
+ const dataSource = yield this.multiDbService.getDataSource(connectionName);
116
+ const metadata = dataSource.getMetadata(entity.entityType);
117
+ if (metadata) {
118
+ if (!grouped[connectionName]) {
119
+ grouped[connectionName] = [];
120
+ }
121
+ grouped[connectionName].push(entity);
122
+ connectionFound = true;
123
+ break;
124
+ }
125
+ }
126
+ catch (error) {
127
+ continue;
128
+ }
129
+ }
130
+ if (!connectionFound) {
131
+ const defaultConnection = 'default';
132
+ if (!grouped[defaultConnection]) {
133
+ grouped[defaultConnection] = [];
134
+ }
135
+ grouped[defaultConnection].push(entity);
136
+ }
137
+ }
138
+ return grouped;
139
+ });
140
+ }
141
+ rollbackEntitiesInConnection(connectionName, entities) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const dataSource = yield this.multiDbService.getDataSource(connectionName);
144
+ yield dataSource.transaction((manager) => __awaiter(this, void 0, void 0, function* () {
145
+ for (const entity of entities) {
146
+ try {
147
+ yield this.rollbackSingleEntity(manager, entity, connectionName);
148
+ }
149
+ catch (error) {
150
+ console.error(`Failed to rollback entity ${entity.entityType}:${entity.entityId} in connection ${connectionName}:`, error);
151
+ throw error;
152
+ }
153
+ }
154
+ }));
155
+ });
156
+ }
157
+ rollbackSingleEntity(manager, entity, connectionName) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ const repository = manager.getRepository(entity.entityType);
160
+ switch (entity.operation) {
161
+ case enums_1.AuditOperation.CREATE:
162
+ yield repository.delete({ id: entity.entityId });
163
+ break;
164
+ case enums_1.AuditOperation.UPDATE:
165
+ const auditLog = yield this.getLatestAuditLog(entity.entityType, entity.entityId);
166
+ if (auditLog && auditLog.oldValue) {
167
+ yield repository.update({ id: entity.entityId }, auditLog.oldValue);
168
+ }
169
+ break;
170
+ case enums_1.AuditOperation.DELETE:
171
+ const deletedAuditLog = yield this.getLatestAuditLog(entity.entityType, entity.entityId);
172
+ if (deletedAuditLog && deletedAuditLog.oldValue) {
173
+ yield repository.save(deletedAuditLog.oldValue);
174
+ }
175
+ break;
176
+ case enums_1.AuditOperation.RESTORE:
177
+ const restoreAuditLog = yield this.getLatestAuditLog(entity.entityType, entity.entityId);
178
+ if (restoreAuditLog && restoreAuditLog.oldValue) {
179
+ yield repository.update({ id: entity.entityId }, restoreAuditLog.oldValue);
180
+ }
181
+ break;
182
+ default:
183
+ console.warn(`Unknown operation type: ${entity.operation}`);
184
+ }
185
+ });
186
+ }
187
+ getLatestAuditLog(entityType, entityId) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ return null;
190
+ });
191
+ }
192
+ };
193
+ exports.TransactionAuditService = TransactionAuditService;
194
+ exports.TransactionAuditService = TransactionAuditService = __decorate([
195
+ (0, common_1.Injectable)(),
196
+ __param(0, (0, typeorm_1.InjectRepository)(entities_1.EntityTransactionEntity)),
197
+ __metadata("design:paramtypes", [typeorm_2.Repository,
198
+ audit_context_service_1.AuditContextService,
199
+ entity_audit_service_1.EntityAuditService,
200
+ multi_database_service_1.MultiDatabaseService])
201
+ ], TransactionAuditService);
@@ -0,0 +1,14 @@
1
+ import { EntitySubscriberInterface, InsertEvent, UpdateEvent, RemoveEvent, DataSource } from 'typeorm';
2
+ import { EntityAuditService } from '../services/entity-audit.service';
3
+ import { AuditContextService } from '../services/audit-context.service';
4
+ import { DefaultAuditStrategy } from '../services/audit-strategy.service';
5
+ export declare class EntityAuditSubscriber implements EntitySubscriberInterface<any> {
6
+ private readonly entityAuditService;
7
+ private readonly contextService;
8
+ private readonly auditStrategy;
9
+ constructor(entityAuditService: EntityAuditService, contextService: AuditContextService, auditStrategy: DefaultAuditStrategy, dataSource: DataSource);
10
+ afterInsert(event: InsertEvent<any>): Promise<void>;
11
+ afterUpdate(event: UpdateEvent<any>): Promise<void>;
12
+ beforeRemove(event: RemoveEvent<any>): Promise<void>;
13
+ private isAuditEnabled;
14
+ }
@@ -0,0 +1,136 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
+ return new (P || (P = Promise))(function (resolve, reject) {
14
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.EntityAuditSubscriber = void 0;
22
+ const common_1 = require("@nestjs/common");
23
+ const typeorm_1 = require("typeorm");
24
+ const entity_audit_service_1 = require("../services/entity-audit.service");
25
+ const audit_context_service_1 = require("../services/audit-context.service");
26
+ const audit_strategy_service_1 = require("../services/audit-strategy.service");
27
+ const enums_1 = require("../enums");
28
+ const decorators_1 = require("../decorators");
29
+ let EntityAuditSubscriber = class EntityAuditSubscriber {
30
+ constructor(entityAuditService, contextService, auditStrategy, dataSource) {
31
+ this.entityAuditService = entityAuditService;
32
+ this.contextService = contextService;
33
+ this.auditStrategy = auditStrategy;
34
+ dataSource.subscribers.push(this);
35
+ }
36
+ afterInsert(event) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const entity = event.entity;
39
+ if (!entity)
40
+ return;
41
+ const entityType = entity.constructor.name;
42
+ const entityId = entity.id;
43
+ if (!this.isAuditEnabled(entity)) {
44
+ return;
45
+ }
46
+ if (!this.auditStrategy.shouldRecord(entityType, enums_1.AuditOperation.CREATE)) {
47
+ return;
48
+ }
49
+ try {
50
+ const context = yield this.contextService.getCurrentContext();
51
+ yield this.entityAuditService.logEntityChange(entityType, entityId, enums_1.AuditOperation.CREATE, {}, entity, {
52
+ requestId: context.requestId,
53
+ requestIp: context.requestIp,
54
+ userAgent: context.userAgent,
55
+ });
56
+ }
57
+ catch (error) {
58
+ console.error('Failed to log audit for insert:', error);
59
+ }
60
+ });
61
+ }
62
+ afterUpdate(event) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const entity = event.entity;
65
+ const databaseEntity = event.databaseEntity;
66
+ if (!entity)
67
+ return;
68
+ const entityType = entity.constructor.name;
69
+ const entityId = entity.id;
70
+ if (!this.isAuditEnabled(entity)) {
71
+ return;
72
+ }
73
+ if (!this.auditStrategy.shouldRecord(entityType, enums_1.AuditOperation.UPDATE)) {
74
+ return;
75
+ }
76
+ try {
77
+ const context = yield this.contextService.getCurrentContext();
78
+ yield this.entityAuditService.logEntityChange(entityType, entityId, enums_1.AuditOperation.UPDATE, databaseEntity || {}, entity, {
79
+ requestId: context.requestId,
80
+ requestIp: context.requestIp,
81
+ userAgent: context.userAgent,
82
+ });
83
+ }
84
+ catch (error) {
85
+ console.error('Failed to log audit for update:', error);
86
+ }
87
+ });
88
+ }
89
+ beforeRemove(event) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const entity = event.entity;
92
+ if (!entity)
93
+ return;
94
+ const entityType = entity.constructor.name;
95
+ const entityId = entity.id;
96
+ if (!this.isAuditEnabled(entity)) {
97
+ return;
98
+ }
99
+ if (!this.auditStrategy.shouldRecord(entityType, enums_1.AuditOperation.DELETE)) {
100
+ return;
101
+ }
102
+ try {
103
+ const context = yield this.contextService.getCurrentContext();
104
+ yield this.entityAuditService.logEntityChange(entityType, entityId, enums_1.AuditOperation.DELETE, entity, {}, {
105
+ requestId: context.requestId,
106
+ requestIp: context.requestIp,
107
+ userAgent: context.userAgent,
108
+ });
109
+ }
110
+ catch (error) {
111
+ console.error('Failed to log audit for delete:', error);
112
+ }
113
+ });
114
+ }
115
+ isAuditEnabled(entity) {
116
+ try {
117
+ const auditOptions = Reflect.getMetadata(decorators_1.ENTITY_AUDIT_OPTIONS, entity.constructor);
118
+ if (auditOptions && auditOptions.enabled === false) {
119
+ return false;
120
+ }
121
+ return true;
122
+ }
123
+ catch (error) {
124
+ return true;
125
+ }
126
+ }
127
+ };
128
+ exports.EntityAuditSubscriber = EntityAuditSubscriber;
129
+ exports.EntityAuditSubscriber = EntityAuditSubscriber = __decorate([
130
+ (0, common_1.Injectable)(),
131
+ (0, typeorm_1.EventSubscriber)(),
132
+ __metadata("design:paramtypes", [entity_audit_service_1.EntityAuditService,
133
+ audit_context_service_1.AuditContextService,
134
+ audit_strategy_service_1.DefaultAuditStrategy,
135
+ typeorm_1.DataSource])
136
+ ], EntityAuditSubscriber);
@@ -0,0 +1 @@
1
+ export * from './entity-audit.subscriber';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./entity-audit.subscriber"), exports);
@@ -43,7 +43,7 @@ class AbstractEntity extends AbstractBaseEntity {
43
43
  }
44
44
  exports.AbstractEntity = AbstractEntity;
45
45
  __decorate([
46
- (0, typeorm_1.PrimaryGeneratedColumn)('increment'),
46
+ (0, typeorm_1.PrimaryColumn)(),
47
47
  (0, decorators_1.NumberFieldOptional)({ swagger: false }),
48
48
  __metadata("design:type", Number)
49
49
  ], AbstractEntity.prototype, "id", void 0);
@@ -22,6 +22,7 @@ exports.PaymentHttpService = exports.GitHubHttpService = void 0;
22
22
  const common_1 = require("@nestjs/common");
23
23
  const decorators_1 = require("../decorators");
24
24
  const http_client_service_1 = require("../services/http-client.service");
25
+ const cache_options_interface_1 = require("../../cache/interfaces/cache-options.interface");
25
26
  let GitHubHttpService = class GitHubHttpService {
26
27
  constructor(httpClient) {
27
28
  this.httpClient = httpClient;
@@ -187,15 +188,22 @@ exports.GitHubHttpService = GitHubHttpService = __decorate([
187
188
  cache: {
188
189
  enabled: true,
189
190
  defaultTtl: 300000,
191
+ cacheableMethods: ['GET', 'HEAD'],
192
+ cacheableStatusCodes: [200, 304],
190
193
  options: {
191
- layers: ['memory', 'redis'],
194
+ layers: [cache_options_interface_1.CacheLayer.MEMORY, cache_options_interface_1.CacheLayer.REDIS],
192
195
  },
193
196
  },
194
197
  logging: {
195
198
  enabled: true,
199
+ logRequests: true,
200
+ logResponses: true,
201
+ logErrors: true,
196
202
  logHeaders: true,
197
203
  logBody: true,
204
+ maxBodyLength: 1000,
198
205
  sanitizeHeaders: ['authorization'],
206
+ logLevel: 'info',
199
207
  },
200
208
  }),
201
209
  (0, common_1.Injectable)(),
@@ -309,9 +317,14 @@ exports.PaymentHttpService = PaymentHttpService = __decorate([
309
317
  },
310
318
  logging: {
311
319
  enabled: true,
320
+ logRequests: true,
321
+ logResponses: true,
322
+ logErrors: true,
312
323
  logHeaders: false,
313
324
  logBody: false,
325
+ maxBodyLength: 1000,
314
326
  sanitizeHeaders: ['authorization', 'x-api-key', 'x-client-secret'],
327
+ logLevel: 'info',
315
328
  },
316
329
  }),
317
330
  (0, common_1.Injectable)(),
@@ -0,0 +1,17 @@
1
+ import { HttpClientService } from '../services/http-client.service';
2
+ import { HttpLogQueryService } from '../services/http-log-query.service';
3
+ import { HttpReplayService } from '../services/http-replay.service';
4
+ export declare class AuthWithWaitingLockExample {
5
+ private readonly httpClient;
6
+ private readonly logQueryService;
7
+ private readonly replayService;
8
+ private readonly logger;
9
+ constructor(httpClient: HttpClientService, logQueryService: HttpLogQueryService, replayService: HttpReplayService);
10
+ basicAuthWithLock(): Promise<any>;
11
+ batchAuthWithLock(): Promise<any[]>;
12
+ generateCurlFromLogs(): Promise<void>;
13
+ demonstrateRequestReplay(): Promise<void>;
14
+ batchReplayAndCompare(): Promise<void>;
15
+ comprehensiveDemo(): Promise<void>;
16
+ runAllExamples(): Promise<void>;
17
+ }