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

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 (386) hide show
  1. package/audit/audit.module.d.ts +10 -0
  2. package/audit/audit.module.js +63 -1
  3. package/audit/controllers/audit.controller.d.ts +88 -0
  4. package/audit/controllers/audit.controller.js +74 -0
  5. package/audit/decorators/audit-action.decorator.d.ts +74 -0
  6. package/audit/decorators/audit-action.decorator.js +42 -0
  7. package/audit/decorators/audit-controller.decorator.d.ts +9 -1
  8. package/audit/decorators/audit-controller.decorator.js +11 -2
  9. package/audit/decorators/audit-operation.decorator.d.ts +45 -0
  10. package/audit/decorators/audit-operation.decorator.js +49 -0
  11. package/audit/decorators/entity-audit.decorator.d.ts +85 -1
  12. package/audit/decorators/entity-audit.decorator.js +153 -3
  13. package/audit/decorators/index.d.ts +2 -0
  14. package/audit/decorators/index.js +2 -0
  15. package/audit/dto/audit-log-query.dto.d.ts +3 -0
  16. package/audit/dto/audit-log-query.dto.js +3 -0
  17. package/audit/dto/begin-transaction.dto.d.ts +3 -0
  18. package/audit/dto/begin-transaction.dto.js +3 -0
  19. package/audit/dto/compare-entities.dto.d.ts +3 -0
  20. package/audit/dto/compare-entities.dto.js +3 -0
  21. package/audit/dto/pre-check-restore.dto.d.ts +3 -0
  22. package/audit/dto/pre-check-restore.dto.js +3 -0
  23. package/audit/dto/restore-entity.dto.d.ts +3 -0
  24. package/audit/dto/restore-entity.dto.js +3 -0
  25. package/audit/entities/audit-action-summary.entity.d.ts +23 -0
  26. package/audit/entities/audit-action-summary.entity.js +101 -0
  27. package/audit/entities/entity-audit-log.entity.d.ts +11 -0
  28. package/audit/entities/entity-audit-log.entity.js +57 -2
  29. package/audit/entities/entity-transaction.entity.d.ts +11 -2
  30. package/audit/entities/entity-transaction.entity.js +42 -3
  31. package/audit/entities/index.d.ts +3 -0
  32. package/audit/entities/index.js +3 -0
  33. package/audit/entities/manual-operation-log.entity.d.ts +4 -0
  34. package/audit/entities/manual-operation-log.entity.js +12 -1
  35. package/audit/entities/operation-template.entity.d.ts +4 -0
  36. package/audit/entities/operation-template.entity.js +4 -0
  37. package/audit/enums/audit.enums.d.ts +37 -6
  38. package/audit/enums/audit.enums.js +40 -7
  39. package/audit/index.d.ts +4 -1
  40. package/audit/index.js +34 -1
  41. package/audit/interceptors/audit-action.interceptor.d.ts +38 -0
  42. package/audit/interceptors/audit-action.interceptor.js +215 -0
  43. package/audit/interceptors/audit.interceptor.d.ts +15 -0
  44. package/audit/interceptors/audit.interceptor.js +23 -1
  45. package/audit/interceptors/index.d.ts +1 -0
  46. package/audit/interceptors/index.js +1 -0
  47. package/audit/interfaces/audit.interfaces.d.ts +187 -2
  48. package/audit/services/audit-action.service.d.ts +141 -0
  49. package/audit/services/audit-action.service.js +244 -0
  50. package/audit/services/audit-context.service.d.ts +97 -0
  51. package/audit/services/audit-context.service.js +185 -0
  52. package/audit/services/audit-strategy.service.d.ts +6 -0
  53. package/audit/services/audit-strategy.service.js +13 -0
  54. package/audit/services/entity-audit.service.d.ts +230 -3
  55. package/audit/services/entity-audit.service.js +607 -14
  56. package/audit/services/index.d.ts +3 -0
  57. package/audit/services/index.js +3 -0
  58. package/audit/services/manual-audit-log.service.d.ts +134 -9
  59. package/audit/services/manual-audit-log.service.js +157 -40
  60. package/audit/services/multi-database.service.d.ts +9 -2
  61. package/audit/services/multi-database.service.js +9 -21
  62. package/audit/services/operation-description.service.d.ts +71 -2
  63. package/audit/services/operation-description.service.js +231 -20
  64. package/audit/services/transaction-audit.service.d.ts +30 -0
  65. package/audit/services/transaction-audit.service.js +53 -5
  66. package/audit/subscribers/entity-audit.subscriber.d.ts +19 -0
  67. package/audit/subscribers/entity-audit.subscriber.js +76 -1
  68. package/cache/cache-metrics.service.d.ts +67 -0
  69. package/cache/cache-metrics.service.js +68 -4
  70. package/cache/cache-serialization.service.d.ts +31 -0
  71. package/cache/cache-serialization.service.js +25 -0
  72. package/cache/cache.constants.d.ts +9 -0
  73. package/cache/cache.constants.js +9 -0
  74. package/cache/cache.health.d.ts +26 -0
  75. package/cache/cache.health.js +30 -0
  76. package/cache/cache.module.d.ts +82 -2
  77. package/cache/cache.module.js +76 -5
  78. package/cache/cache.service.d.ts +140 -0
  79. package/cache/cache.service.js +169 -0
  80. package/cache/cache.warmup.service.d.ts +39 -0
  81. package/cache/cache.warmup.service.js +32 -0
  82. package/cache/decorators/cache-evict.decorator.d.ts +47 -0
  83. package/cache/decorators/cache-evict.decorator.js +56 -0
  84. package/cache/decorators/cache-put.decorator.d.ts +34 -0
  85. package/cache/decorators/cache-put.decorator.js +39 -0
  86. package/cache/decorators/cacheable.decorator.d.ts +40 -0
  87. package/cache/decorators/cacheable.decorator.js +55 -0
  88. package/cache/dependencies/callback.dependency.d.ts +33 -0
  89. package/cache/dependencies/callback.dependency.js +39 -1
  90. package/cache/dependencies/chain.dependency.d.ts +28 -0
  91. package/cache/dependencies/chain.dependency.js +34 -0
  92. package/cache/dependencies/db.dependency.d.ts +83 -7
  93. package/cache/dependencies/db.dependency.js +89 -14
  94. package/cache/dependencies/file.dependency.d.ts +32 -0
  95. package/cache/dependencies/file.dependency.js +34 -0
  96. package/cache/dependencies/tag.dependency.d.ts +75 -4
  97. package/cache/dependencies/tag.dependency.js +145 -11
  98. package/cache/dependencies/time.dependency.d.ts +43 -0
  99. package/cache/dependencies/time.dependency.js +43 -0
  100. package/cache/examples/basic-usage.d.ts +15 -0
  101. package/cache/examples/basic-usage.js +62 -8
  102. package/cache/index.js +9 -0
  103. package/cache/interfaces/cache-dependency.interface.d.ts +53 -0
  104. package/cache/interfaces/cache-options.interface.d.ts +89 -0
  105. package/cache/interfaces/cache-options.interface.js +6 -0
  106. package/cache/interfaces/cache-provider.interface.d.ts +78 -0
  107. package/cache/providers/base-cache.provider.d.ts +14 -0
  108. package/cache/providers/base-cache.provider.js +16 -0
  109. package/cache/providers/cls-cache.provider.d.ts +20 -0
  110. package/cache/providers/cls-cache.provider.js +28 -0
  111. package/cache/providers/memory-cache.provider.d.ts +43 -0
  112. package/cache/providers/memory-cache.provider.js +66 -0
  113. package/cache/providers/redis-cache.provider.d.ts +26 -0
  114. package/cache/providers/redis-cache.provider.js +29 -0
  115. package/cache/utils/dependency-manager.util.d.ts +52 -0
  116. package/cache/utils/dependency-manager.util.js +59 -0
  117. package/cache/utils/key-generator.util.d.ts +42 -0
  118. package/cache/utils/key-generator.util.js +53 -1
  119. package/common/abstract.entity.d.ts +14 -0
  120. package/common/abstract.entity.js +14 -0
  121. package/common/boilerplate.polyfill.d.ts +142 -0
  122. package/common/boilerplate.polyfill.js +18 -1
  123. package/common/dto/dto-container.d.ts +16 -0
  124. package/common/dto/dto-container.js +20 -0
  125. package/common/dto/dto-decorators.d.ts +18 -0
  126. package/common/dto/dto-decorators.js +14 -0
  127. package/common/dto/dto-extensions.d.ts +11 -0
  128. package/common/dto/dto-extensions.js +9 -0
  129. package/common/dto/dto-service-accessor.d.ts +17 -0
  130. package/common/dto/dto-service-accessor.js +18 -0
  131. package/common/dto/dto-transformer.d.ts +12 -0
  132. package/common/dto/dto-transformer.js +9 -0
  133. package/common/dto/index.js +2 -0
  134. package/common/examples/paginate-and-map.example.d.ts +6 -0
  135. package/common/examples/paginate-and-map.example.js +26 -0
  136. package/common/utils.d.ts +15 -0
  137. package/common/utils.js +15 -0
  138. package/constants/language-code.js +1 -0
  139. package/decorators/field.decorators.d.ts +1 -1
  140. package/decorators/field.decorators.js +8 -1
  141. package/decorators/property.decorators.js +1 -0
  142. package/decorators/public-route.decorator.js +1 -0
  143. package/decorators/transform.decorators.d.ts +27 -0
  144. package/decorators/transform.decorators.js +29 -0
  145. package/decorators/translate.decorator.js +1 -0
  146. package/decorators/user.decorator.js +1 -0
  147. package/decorators/validator.decorators.d.ts +8 -18
  148. package/decorators/validator.decorators.js +22 -190
  149. package/file-upload/controllers/file-access.controller.d.ts +23 -0
  150. package/file-upload/controllers/file-access.controller.js +128 -0
  151. package/file-upload/decorators/column.decorator.d.ts +151 -0
  152. package/file-upload/decorators/column.decorator.js +273 -0
  153. package/file-upload/decorators/csv-data.decorator.d.ts +30 -0
  154. package/file-upload/decorators/csv-data.decorator.js +85 -0
  155. package/file-upload/decorators/csv-import.decorator.d.ts +34 -0
  156. package/file-upload/decorators/csv-import.decorator.js +24 -0
  157. package/file-upload/decorators/examples/column-mapping.example.d.ts +76 -0
  158. package/file-upload/decorators/examples/column-mapping.example.js +122 -0
  159. package/file-upload/decorators/excel-data.decorator.d.ts +30 -0
  160. package/file-upload/decorators/excel-data.decorator.js +85 -0
  161. package/file-upload/decorators/file-upload.decorator.d.ts +83 -0
  162. package/file-upload/decorators/file-upload.decorator.js +172 -0
  163. package/file-upload/decorators/index.d.ts +5 -0
  164. package/file-upload/decorators/index.js +38 -0
  165. package/file-upload/decorators/process.decorator.d.ts +40 -0
  166. package/file-upload/decorators/process.decorator.js +52 -0
  167. package/file-upload/decorators/validate-data.decorator.d.ts +91 -0
  168. package/file-upload/decorators/validate-data.decorator.js +39 -0
  169. package/file-upload/dto/create-file.dto.d.ts +24 -0
  170. package/file-upload/dto/create-file.dto.js +112 -0
  171. package/file-upload/dto/find-files.dto.d.ts +15 -0
  172. package/file-upload/dto/find-files.dto.js +76 -0
  173. package/file-upload/dto/index.d.ts +4 -0
  174. package/file-upload/dto/index.js +20 -0
  175. package/file-upload/dto/pagination.dto.d.ts +7 -0
  176. package/file-upload/dto/pagination.dto.js +39 -0
  177. package/file-upload/dto/update-file.dto.d.ts +15 -0
  178. package/file-upload/dto/update-file.dto.js +67 -0
  179. package/file-upload/entities/file-metadata.entity.d.ts +25 -0
  180. package/file-upload/entities/file-metadata.entity.js +76 -0
  181. package/file-upload/entities/file.entity.d.ts +114 -0
  182. package/file-upload/entities/file.entity.js +350 -0
  183. package/file-upload/entities/index.d.ts +2 -0
  184. package/file-upload/entities/index.js +18 -0
  185. package/file-upload/enums/file-type.enum.d.ts +72 -0
  186. package/file-upload/enums/file-type.enum.js +212 -0
  187. package/file-upload/exceptions/file-upload.exception.d.ts +57 -0
  188. package/file-upload/exceptions/file-upload.exception.js +120 -0
  189. package/file-upload/exceptions/index.d.ts +1 -0
  190. package/file-upload/exceptions/index.js +17 -0
  191. package/file-upload/file-upload.module.d.ts +89 -0
  192. package/file-upload/file-upload.module.js +292 -0
  193. package/file-upload/index.d.ts +37 -0
  194. package/file-upload/index.js +77 -0
  195. package/file-upload/interceptors/file-upload.interceptor.d.ts +101 -0
  196. package/file-upload/interceptors/file-upload.interceptor.js +594 -0
  197. package/file-upload/interceptors/index.d.ts +1 -0
  198. package/file-upload/interceptors/index.js +17 -0
  199. package/file-upload/interfaces/custom-file-type.interface.d.ts +72 -0
  200. package/file-upload/interfaces/custom-file-type.interface.js +2 -0
  201. package/file-upload/interfaces/file-buffer.interface.d.ts +72 -0
  202. package/file-upload/interfaces/file-buffer.interface.js +2 -0
  203. package/file-upload/interfaces/file-entity.interface.d.ts +142 -0
  204. package/file-upload/interfaces/file-entity.interface.js +28 -0
  205. package/file-upload/interfaces/file-metadata.interface.d.ts +21 -0
  206. package/file-upload/interfaces/file-metadata.interface.js +2 -0
  207. package/file-upload/interfaces/file-processor.interface.d.ts +93 -0
  208. package/file-upload/interfaces/file-processor.interface.js +2 -0
  209. package/file-upload/interfaces/file-upload-options.interface.d.ts +74 -0
  210. package/file-upload/interfaces/file-upload-options.interface.js +5 -0
  211. package/file-upload/interfaces/index.d.ts +7 -0
  212. package/file-upload/interfaces/index.js +24 -0
  213. package/file-upload/interfaces/processor-options.interface.d.ts +102 -0
  214. package/file-upload/interfaces/processor-options.interface.js +2 -0
  215. package/file-upload/interfaces/storage-provider.interface.d.ts +239 -0
  216. package/file-upload/interfaces/storage-provider.interface.js +2 -0
  217. package/file-upload/interfaces/upload-options.interface.d.ts +19 -0
  218. package/file-upload/interfaces/upload-options.interface.js +2 -0
  219. package/file-upload/processors/csv.processor.d.ts +98 -0
  220. package/file-upload/processors/csv.processor.js +391 -0
  221. package/file-upload/processors/excel.processor.d.ts +130 -0
  222. package/file-upload/processors/excel.processor.js +547 -0
  223. package/file-upload/processors/image.processor.d.ts +199 -0
  224. package/file-upload/processors/image.processor.js +377 -0
  225. package/file-upload/providers/index.d.ts +2 -0
  226. package/file-upload/providers/index.js +18 -0
  227. package/file-upload/providers/local-storage.provider.d.ts +98 -0
  228. package/file-upload/providers/local-storage.provider.js +484 -0
  229. package/file-upload/providers/s3-storage.provider.d.ts +87 -0
  230. package/file-upload/providers/s3-storage.provider.js +455 -0
  231. package/file-upload/services/file-signature-validator.service.d.ts +118 -0
  232. package/file-upload/services/file-signature-validator.service.js +376 -0
  233. package/file-upload/services/file.service.d.ts +193 -0
  234. package/file-upload/services/file.service.js +638 -0
  235. package/file-upload/services/index.d.ts +4 -0
  236. package/file-upload/services/index.js +20 -0
  237. package/file-upload/services/malicious-file-detector.service.d.ts +300 -0
  238. package/file-upload/services/malicious-file-detector.service.js +1234 -0
  239. package/file-upload/services/mime-registry.service.d.ts +47 -0
  240. package/file-upload/services/mime-registry.service.js +167 -0
  241. package/file-upload/utils/checksum.util.d.ts +28 -0
  242. package/file-upload/utils/checksum.util.js +65 -0
  243. package/file-upload/utils/dynamic-import.util.d.ts +54 -0
  244. package/file-upload/utils/dynamic-import.util.js +156 -0
  245. package/file-upload/utils/filename.util.d.ts +59 -0
  246. package/file-upload/utils/filename.util.js +184 -0
  247. package/file-upload/utils/filepath.util.d.ts +70 -0
  248. package/file-upload/utils/filepath.util.js +152 -0
  249. package/file-upload/utils/index.d.ts +4 -0
  250. package/file-upload/utils/index.js +20 -0
  251. package/filters/constraint-errors.js +1 -0
  252. package/helpers/common.helper.d.ts +13 -0
  253. package/helpers/common.helper.js +13 -0
  254. package/http-client/config/http-client.config.d.ts +20 -0
  255. package/http-client/config/http-client.config.js +48 -21
  256. package/http-client/decorators/http-client.decorators.d.ts +55 -14
  257. package/http-client/decorators/http-client.decorators.js +154 -78
  258. package/http-client/entities/http-log.entity.d.ts +217 -8
  259. package/http-client/entities/http-log.entity.js +7 -22
  260. package/http-client/errors/http-client.errors.d.ts +57 -0
  261. package/http-client/errors/http-client.errors.js +58 -0
  262. package/http-client/examples/advanced-usage.example.d.ts +40 -0
  263. package/http-client/examples/advanced-usage.example.js +53 -61
  264. package/http-client/examples/auth-with-waiting-lock.example.d.ts +31 -0
  265. package/http-client/examples/auth-with-waiting-lock.example.js +52 -5
  266. package/http-client/examples/basic-usage.example.d.ts +60 -0
  267. package/http-client/examples/basic-usage.example.js +60 -0
  268. package/http-client/examples/multi-api-configuration.example.d.ts +60 -0
  269. package/http-client/examples/multi-api-configuration.example.js +76 -5
  270. package/http-client/examples/proxy-from-environment.example.d.ts +133 -0
  271. package/http-client/examples/proxy-from-environment.example.js +409 -0
  272. package/http-client/http-client.module.d.ts +48 -2
  273. package/http-client/http-client.module.js +147 -68
  274. package/http-client/index.d.ts +1 -1
  275. package/http-client/index.js +8 -0
  276. package/http-client/interfaces/api-client-config.interface.d.ts +80 -45
  277. package/http-client/interfaces/api-client-config.interface.js +3 -0
  278. package/http-client/interfaces/http-client-config.interface.d.ts +109 -52
  279. package/http-client/services/api-client-registry.service.d.ts +50 -11
  280. package/http-client/services/api-client-registry.service.js +90 -250
  281. package/http-client/services/circuit-breaker.service.d.ts +115 -2
  282. package/http-client/services/circuit-breaker.service.js +237 -7
  283. package/http-client/services/http-client.service.d.ts +124 -14
  284. package/http-client/services/http-client.service.js +437 -148
  285. package/http-client/services/http-log-query.service.d.ts +83 -0
  286. package/http-client/services/http-log-query.service.js +121 -13
  287. package/http-client/services/http-replay.service.d.ts +101 -0
  288. package/http-client/services/http-replay.service.js +86 -0
  289. package/http-client/services/index.d.ts +0 -1
  290. package/http-client/services/index.js +0 -1
  291. package/http-client/services/log-cleanup.service.d.ts +63 -0
  292. package/http-client/services/log-cleanup.service.js +54 -2
  293. package/http-client/services/logging.service.d.ts +116 -7
  294. package/http-client/services/logging.service.js +349 -86
  295. package/http-client/utils/call-stack-extractor.util.d.ts +63 -0
  296. package/http-client/utils/call-stack-extractor.util.js +83 -0
  297. package/http-client/utils/context-extractor.util.d.ts +49 -0
  298. package/http-client/utils/context-extractor.util.js +52 -0
  299. package/http-client/utils/curl-generator.util.d.ts +21 -0
  300. package/http-client/utils/curl-generator.util.js +44 -3
  301. package/http-client/utils/index.d.ts +1 -0
  302. package/http-client/utils/index.js +1 -0
  303. package/http-client/utils/proxy-environment.util.d.ts +42 -0
  304. package/http-client/utils/proxy-environment.util.js +148 -0
  305. package/http-client/utils/request-id.util.d.ts +18 -0
  306. package/http-client/utils/request-id.util.js +20 -0
  307. package/http-client/utils/retry-recorder.util.d.ts +42 -0
  308. package/http-client/utils/retry-recorder.util.js +44 -0
  309. package/http-client/utils/security-validator.util.d.ts +118 -0
  310. package/http-client/utils/security-validator.util.js +352 -0
  311. package/index.d.ts +3 -1
  312. package/index.js +12 -1
  313. package/interceptors/translation-interceptor.service.js +5 -0
  314. package/package.json +11 -7
  315. package/providers/context.provider.js +2 -0
  316. package/providers/generator.provider.d.ts +4 -0
  317. package/providers/generator.provider.js +4 -0
  318. package/redis-lock/comprehensive-lock-cleanup.service.d.ts +94 -0
  319. package/redis-lock/comprehensive-lock-cleanup.service.js +253 -0
  320. package/redis-lock/examples/lock-strategy.examples.d.ts +89 -0
  321. package/redis-lock/examples/lock-strategy.examples.js +130 -15
  322. package/redis-lock/index.d.ts +2 -0
  323. package/redis-lock/index.js +8 -1
  324. package/redis-lock/lock-heartbeat.service.d.ts +80 -0
  325. package/redis-lock/lock-heartbeat.service.js +232 -0
  326. package/redis-lock/redis-lock.decorator.d.ts +101 -0
  327. package/redis-lock/redis-lock.decorator.js +120 -0
  328. package/redis-lock/redis-lock.module.d.ts +66 -0
  329. package/redis-lock/redis-lock.module.js +175 -70
  330. package/redis-lock/redis-lock.service.d.ts +282 -0
  331. package/redis-lock/redis-lock.service.js +343 -20
  332. package/setup/bootstrap.setup.d.ts +1 -0
  333. package/setup/bootstrap.setup.js +21 -0
  334. package/setup/index.d.ts +1 -0
  335. package/setup/index.js +1 -0
  336. package/setup/mode.setup.d.ts +44 -0
  337. package/setup/mode.setup.js +44 -0
  338. package/setup/run-in-mode.decorator.d.ts +56 -0
  339. package/setup/run-in-mode.decorator.js +92 -0
  340. package/setup/schedule.decorator.d.ts +227 -0
  341. package/setup/schedule.decorator.js +240 -12
  342. package/setup/worker.decorator.d.ts +86 -0
  343. package/setup/worker.decorator.js +97 -0
  344. package/shared/index.d.ts +1 -1
  345. package/shared/index.js +1 -1
  346. package/shared/{serviceRegistryModule.js → service-registry.module.js} +19 -17
  347. package/shared/services/api-config.service.d.ts +3 -0
  348. package/shared/services/api-config.service.js +21 -9
  349. package/shared/services/index.d.ts +0 -1
  350. package/shared/services/index.js +0 -1
  351. package/validator-json/decorators.d.ts +17 -0
  352. package/validator-json/decorators.js +17 -2
  353. package/validator-json/default.d.ts +6 -0
  354. package/validator-json/default.js +30 -2
  355. package/validator-json/defaultConverters.js +1 -0
  356. package/validator-json/options.d.ts +23 -0
  357. package/validators/common-validators.d.ts +143 -0
  358. package/validators/common-validators.js +249 -0
  359. package/validators/custom-validate.examples.d.ts +23 -0
  360. package/validators/custom-validate.examples.js +78 -6
  361. package/validators/custom-validate.validator.d.ts +108 -0
  362. package/validators/custom-validate.validator.js +85 -0
  363. package/validators/file-mimetype.validator.d.ts +0 -2
  364. package/validators/file-mimetype.validator.js +4 -6
  365. package/validators/index.d.ts +1 -0
  366. package/validators/index.js +1 -0
  367. package/validators/is-exists.validator.d.ts +26 -6
  368. package/validators/is-exists.validator.js +30 -7
  369. package/validators/is-unique.validator.d.ts +33 -7
  370. package/validators/is-unique.validator.js +59 -17
  371. package/validators/skip-empty.validator.d.ts +5 -0
  372. package/validators/skip-empty.validator.js +5 -0
  373. package/vault/interfaces/vault-options.interface.d.ts +9 -0
  374. package/vault/vault-config.loader.d.ts +30 -0
  375. package/vault/vault-config.loader.js +48 -1
  376. package/vault/vault-config.service.d.ts +53 -0
  377. package/vault/vault-config.service.js +57 -0
  378. package/vault/vault.module.d.ts +4 -0
  379. package/vault/vault.module.js +4 -0
  380. package/decorators/examples/validation-decorators.example.d.ts +0 -69
  381. package/decorators/examples/validation-decorators.example.js +0 -331
  382. package/http-client/services/cache.service.d.ts +0 -24
  383. package/http-client/services/cache.service.js +0 -264
  384. package/shared/services/validator.service.d.ts +0 -3
  385. package/shared/services/validator.service.js +0 -20
  386. /package/shared/{serviceRegistryModule.d.ts → service-registry.module.d.ts} +0 -0
@@ -1,10 +1,16 @@
1
1
  import { DataSource } from 'typeorm';
2
2
  import { HttpLogEntity, HttpLogQueryOptions, HttpLogStats } from '../entities/http-log.entity';
3
+ /**
4
+ * HTTP日志查询服务
5
+ */
3
6
  export declare class HttpLogQueryService {
4
7
  private readonly dataSource?;
5
8
  private readonly logger;
6
9
  private logRepository;
7
10
  constructor(dataSource?: DataSource);
11
+ /**
12
+ * 查询HTTP日志
13
+ */
8
14
  findLogs(options?: HttpLogQueryOptions): Promise<{
9
15
  logs: HttpLogEntity[];
10
16
  total: number;
@@ -12,8 +18,17 @@ export declare class HttpLogQueryService {
12
18
  limit: number;
13
19
  totalPages: number;
14
20
  }>;
21
+ /**
22
+ * 根据ID查询单条日志
23
+ */
15
24
  findLogById(id: string, includeDetails?: boolean): Promise<HttpLogEntity | null>;
25
+ /**
26
+ * 根据请求ID查询日志
27
+ */
16
28
  findLogByRequestId(requestId: string): Promise<HttpLogEntity | null>;
29
+ /**
30
+ * 查询错误日志
31
+ */
17
32
  findErrorLogs(options?: {
18
33
  startDate?: Date;
19
34
  endDate?: Date;
@@ -25,6 +40,9 @@ export declare class HttpLogQueryService {
25
40
  logs: HttpLogEntity[];
26
41
  total: number;
27
42
  }>;
43
+ /**
44
+ * 查询慢请求日志
45
+ */
28
46
  findSlowRequests(minResponseTime?: number, options?: {
29
47
  page?: number;
30
48
  limit?: number;
@@ -32,6 +50,9 @@ export declare class HttpLogQueryService {
32
50
  logs: HttpLogEntity[];
33
51
  total: number;
34
52
  }>;
53
+ /**
54
+ * 查询重试日志
55
+ */
35
56
  findRetryLogs(options?: {
36
57
  minRetries?: number;
37
58
  page?: number;
@@ -40,6 +61,9 @@ export declare class HttpLogQueryService {
40
61
  logs: HttpLogEntity[];
41
62
  total: number;
42
63
  }>;
64
+ /**
65
+ * 获取统计信息
66
+ */
43
67
  getStats(options?: {
44
68
  startDate?: Date;
45
69
  endDate?: Date;
@@ -47,30 +71,89 @@ export declare class HttpLogQueryService {
47
71
  serviceName?: string;
48
72
  groupBy?: 'hour' | 'day' | 'week';
49
73
  }): Promise<HttpLogStats>;
74
+ /**
75
+ * 删除旧日志
76
+ */
50
77
  deleteOldLogs(daysToKeep?: number): Promise<number>;
78
+ /**
79
+ * 清空所有日志
80
+ */
51
81
  clearAllLogs(): Promise<number>;
82
+ /**
83
+ * 根据日志ID生成curl命令
84
+ * @param logId 日志ID
85
+ * @returns curl命令字符串
86
+ */
52
87
  generateCurlFromLog(logId: string): Promise<string | null>;
88
+ /**
89
+ * 根据请求ID生成curl命令
90
+ * @param requestId 请求ID
91
+ * @returns curl命令字符串
92
+ */
53
93
  generateCurlFromRequestId(requestId: string): Promise<string | null>;
94
+ /**
95
+ * 根据日志生成可重放的请求配置
96
+ * @param logId 日志ID
97
+ * @returns 请求配置对象
98
+ */
54
99
  generateReplayConfigFromLog(logId: string): Promise<any | null>;
100
+ /**
101
+ * 根据请求ID生成可重放的请求配置
102
+ * @param requestId 请求ID
103
+ * @returns 请求配置对象
104
+ */
55
105
  generateReplayConfigFromRequestId(requestId: string): Promise<any | null>;
106
+ /**
107
+ * 批量生成curl命令
108
+ * @param options 查询选项
109
+ * @returns curl命令数组
110
+ */
56
111
  generateBatchCurlCommands(options?: HttpLogQueryOptions): Promise<Array<{
57
112
  logId: string;
58
113
  requestId?: string;
59
114
  curlCommand: string;
60
115
  }>>;
116
+ /**
117
+ * 获取日志的完整重放信息
118
+ * @param logId 日志ID
119
+ * @returns 包含curl命令和重放配置的对象
120
+ */
61
121
  getLogReplayInfo(logId: string): Promise<{
62
122
  log: HttpLogEntity;
63
123
  curlCommand: string | null;
64
124
  replayConfig: any | null;
65
125
  } | null>;
126
+ /**
127
+ * 根据请求ID获取日志的完整重放信息
128
+ * @param requestId 请求ID
129
+ * @returns 包含curl命令和重放配置的对象
130
+ */
66
131
  getLogReplayInfoByRequestId(requestId: string): Promise<{
67
132
  log: HttpLogEntity;
68
133
  curlCommand: string | null;
69
134
  replayConfig: any | null;
70
135
  } | null>;
136
+ /**
137
+ * 初始化仓库
138
+ */
71
139
  private initializeRepository;
140
+ /**
141
+ * 计算响应时间百分位数
142
+ */
72
143
  private calculatePercentiles;
144
+ /**
145
+ * 格式化统计结果
146
+ */
73
147
  private formatStats;
148
+ /**
149
+ * 构建查询
150
+ */
74
151
  private buildQuery;
152
+ /**
153
+ * 清理敏感信息用于生成curl命令
154
+ * 移除或替换敏感的请求头和认证信息
155
+ * @param headers 原始请求头
156
+ * @returns 清理后的请求头
157
+ */
75
158
  private sanitizeHeadersForCurl;
76
159
  }
@@ -24,6 +24,9 @@ const common_1 = require("@nestjs/common");
24
24
  const typeorm_1 = require("typeorm");
25
25
  const http_log_entity_1 = require("../entities/http-log.entity");
26
26
  const curl_generator_util_1 = require("../utils/curl-generator.util");
27
+ /**
28
+ * HTTP日志查询服务
29
+ */
27
30
  let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
28
31
  constructor(dataSource) {
29
32
  this.dataSource = dataSource;
@@ -31,6 +34,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
31
34
  this.logRepository = null;
32
35
  this.initializeRepository();
33
36
  }
37
+ /**
38
+ * 查询HTTP日志
39
+ */
34
40
  findLogs() {
35
41
  return __awaiter(this, arguments, void 0, function* (options = {}) {
36
42
  if (!this.logRepository) {
@@ -38,9 +44,12 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
38
44
  }
39
45
  const { page = 1, limit = 50, sortBy = 'createdAt', sortOrder = 'DESC', includeDetails = false, } = options;
40
46
  const queryBuilder = this.buildQuery(options, includeDetails);
47
+ // 分页
41
48
  const offset = (page - 1) * limit;
42
49
  queryBuilder.skip(offset).take(limit);
50
+ // 排序
43
51
  queryBuilder.orderBy(`log.${sortBy}`, sortOrder);
52
+ // 执行查询
44
53
  const [logs, total] = yield queryBuilder.getManyAndCount();
45
54
  return {
46
55
  logs,
@@ -51,6 +60,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
51
60
  };
52
61
  });
53
62
  }
63
+ /**
64
+ * 根据ID查询单条日志
65
+ */
54
66
  findLogById(id_1) {
55
67
  return __awaiter(this, arguments, void 0, function* (id, includeDetails = false) {
56
68
  if (!this.logRepository) {
@@ -63,6 +75,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
63
75
  return queryBuilder.where('log.id = :id', { id }).getOne();
64
76
  });
65
77
  }
78
+ /**
79
+ * 根据请求ID查询日志
80
+ */
66
81
  findLogByRequestId(requestId) {
67
82
  return __awaiter(this, void 0, void 0, function* () {
68
83
  if (!this.logRepository) {
@@ -74,12 +89,18 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
74
89
  });
75
90
  });
76
91
  }
92
+ /**
93
+ * 查询错误日志
94
+ */
77
95
  findErrorLogs() {
78
96
  return __awaiter(this, arguments, void 0, function* (options = {}) {
79
97
  const queryOptions = Object.assign(Object.assign({}, options), { success: false });
80
98
  return this.findLogs(queryOptions);
81
99
  });
82
100
  }
101
+ /**
102
+ * 查询慢请求日志
103
+ */
83
104
  findSlowRequests() {
84
105
  return __awaiter(this, arguments, void 0, function* (minResponseTime = 5000, options = {}) {
85
106
  if (!this.logRepository) {
@@ -97,6 +118,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
97
118
  return { logs, total };
98
119
  });
99
120
  }
121
+ /**
122
+ * 查询重试日志
123
+ */
100
124
  findRetryLogs() {
101
125
  return __awaiter(this, arguments, void 0, function* (options = {}) {
102
126
  if (!this.logRepository) {
@@ -115,12 +139,16 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
115
139
  return { logs, total };
116
140
  });
117
141
  }
142
+ /**
143
+ * 获取统计信息
144
+ */
118
145
  getStats() {
119
146
  return __awaiter(this, arguments, void 0, function* (options = {}) {
120
147
  if (!this.logRepository) {
121
148
  throw new Error('HTTP log repository not available');
122
149
  }
123
150
  const { startDate, endDate, userId, serviceName } = options;
151
+ // 基础查询构建器
124
152
  const baseQuery = this.logRepository.createQueryBuilder('log');
125
153
  if (startDate) {
126
154
  baseQuery.andWhere('log.createdAt >= :startDate', { startDate });
@@ -134,6 +162,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
134
162
  if (serviceName) {
135
163
  baseQuery.andWhere('log.serviceName = :serviceName', { serviceName });
136
164
  }
165
+ // 总体统计
137
166
  const [total, successful, failed] = yield Promise.all([
138
167
  baseQuery.getCount(),
139
168
  baseQuery
@@ -145,36 +174,43 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
145
174
  .andWhere('log.success = :success', { success: false })
146
175
  .getCount(),
147
176
  ]);
177
+ // 响应时间统计
148
178
  const responseTimeStats = yield baseQuery
149
179
  .select('AVG(log.responseTime)', 'avg')
150
180
  .addSelect('MIN(log.responseTime)', 'min')
151
181
  .addSelect('MAX(log.responseTime)', 'max')
152
182
  .getRawOne();
183
+ // 按HTTP方法统计
153
184
  const httpMethodStats = yield baseQuery
154
185
  .select('log.method', 'method')
155
186
  .addSelect('COUNT(*)', 'count')
156
187
  .groupBy('log.method')
157
188
  .getRawMany();
189
+ // 按状态码统计
158
190
  const statusStats = yield baseQuery
159
191
  .select('log.statusCode', 'statusCode')
160
192
  .addSelect('COUNT(*)', 'count')
161
193
  .groupBy('log.statusCode')
162
194
  .getRawMany();
195
+ // 按服务统计
163
196
  const serviceStats = yield baseQuery
164
197
  .select('log.serviceName', 'serviceName')
165
198
  .addSelect('COUNT(*)', 'count')
166
199
  .groupBy('log.serviceName')
167
200
  .getRawMany();
201
+ // 按操作统计
168
202
  const operationStats = yield baseQuery
169
203
  .select('log.operationName', 'operationName')
170
204
  .addSelect('COUNT(*)', 'count')
171
205
  .groupBy('log.operationName')
172
206
  .getRawMany();
207
+ // 按来源统计
173
208
  const sourceStats = yield baseQuery
174
209
  .select('log.source', 'source')
175
210
  .addSelect('COUNT(*)', 'count')
176
211
  .groupBy('log.source')
177
212
  .getRawMany();
213
+ // 错误统计
178
214
  const errorStats = yield baseQuery
179
215
  .clone()
180
216
  .where('log.success = :success', { success: false })
@@ -182,17 +218,14 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
182
218
  .addSelect('COUNT(*)', 'count')
183
219
  .groupBy('log.errorCode')
184
220
  .getRawMany();
221
+ // 重试统计
185
222
  const retryStats = yield baseQuery
186
223
  .select('AVG(log.attemptCount)', 'avgAttempts')
187
224
  .addSelect('MAX(log.attemptCount)', 'maxAttempts')
188
225
  .addSelect('SUM(log.attemptCount - 1)', 'totalRetries')
189
226
  .addSelect('COUNT(*)', 'totalRequests')
190
227
  .getRawOne();
191
- const cacheStats = yield baseQuery
192
- .select('SUM(CASE WHEN log.cacheHit = true THEN 1 ELSE 0 END)', 'cacheHits')
193
- .addSelect('SUM(CASE WHEN log.cacheHit = false OR log.cacheHit IS NULL THEN 1 ELSE 0 END)', 'cacheMisses')
194
- .addSelect('COUNT(*)', 'total')
195
- .getRawOne();
228
+ // 百分位数计算(简化版)
196
229
  const percentiles = yield this.calculatePercentiles(baseQuery);
197
230
  return {
198
231
  totalRequests: total,
@@ -220,16 +253,12 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
220
253
  : 0,
221
254
  retryRate: total > 0 ? (((retryStats === null || retryStats === void 0 ? void 0 : retryStats.totalRetries) || 0) / total) * 100 : 0,
222
255
  },
223
- cacheStats: {
224
- cacheHits: (cacheStats === null || cacheStats === void 0 ? void 0 : cacheStats.cacheHits) || 0,
225
- cacheMisses: (cacheStats === null || cacheStats === void 0 ? void 0 : cacheStats.cacheMisses) || 0,
226
- cacheHitRate: (cacheStats === null || cacheStats === void 0 ? void 0 : cacheStats.total) > 0
227
- ? (((cacheStats === null || cacheStats === void 0 ? void 0 : cacheStats.cacheHits) || 0) / cacheStats.total) * 100
228
- : 0,
229
- },
230
256
  };
231
257
  });
232
258
  }
259
+ /**
260
+ * 删除旧日志
261
+ */
233
262
  deleteOldLogs() {
234
263
  return __awaiter(this, arguments, void 0, function* (daysToKeep = 30) {
235
264
  if (!this.logRepository) {
@@ -246,6 +275,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
246
275
  return result.affected || 0;
247
276
  });
248
277
  }
278
+ /**
279
+ * 清空所有日志
280
+ */
249
281
  clearAllLogs() {
250
282
  return __awaiter(this, void 0, void 0, function* () {
251
283
  if (!this.logRepository) {
@@ -253,9 +285,14 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
253
285
  }
254
286
  yield this.logRepository.clear();
255
287
  this.logger.warn('Cleared all HTTP logs');
256
- return 0;
288
+ return 0; // Cannot get affected count from clear()
257
289
  });
258
290
  }
291
+ /**
292
+ * 根据日志ID生成curl命令
293
+ * @param logId 日志ID
294
+ * @returns curl命令字符串
295
+ */
259
296
  generateCurlFromLog(logId) {
260
297
  return __awaiter(this, void 0, void 0, function* () {
261
298
  if (!this.logRepository) {
@@ -269,7 +306,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
269
306
  return null;
270
307
  }
271
308
  try {
309
+ // 清理敏感信息
272
310
  const sanitizedHeaders = this.sanitizeHeadersForCurl(log.headers || {});
311
+ // 构建请求配置
273
312
  const requestConfig = {
274
313
  method: log.method,
275
314
  url: log.url,
@@ -277,6 +316,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
277
316
  data: log.body,
278
317
  params: log.params,
279
318
  };
319
+ // 使用CurlGenerator生成curl命令
280
320
  const curlCommand = curl_generator_util_1.CurlGenerator.generateCurlCommand(requestConfig);
281
321
  this.logger.log(`Generated curl command for log ${logId}`);
282
322
  return curlCommand;
@@ -287,6 +327,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
287
327
  }
288
328
  });
289
329
  }
330
+ /**
331
+ * 根据请求ID生成curl命令
332
+ * @param requestId 请求ID
333
+ * @returns curl命令字符串
334
+ */
290
335
  generateCurlFromRequestId(requestId) {
291
336
  return __awaiter(this, void 0, void 0, function* () {
292
337
  if (!this.logRepository) {
@@ -303,6 +348,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
303
348
  return this.generateCurlFromLog(log.id);
304
349
  });
305
350
  }
351
+ /**
352
+ * 根据日志生成可重放的请求配置
353
+ * @param logId 日志ID
354
+ * @returns 请求配置对象
355
+ */
306
356
  generateReplayConfigFromLog(logId) {
307
357
  return __awaiter(this, void 0, void 0, function* () {
308
358
  if (!this.logRepository) {
@@ -316,6 +366,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
316
366
  return null;
317
367
  }
318
368
  try {
369
+ // 构建重放配置
319
370
  const replayConfig = {
320
371
  method: log.method,
321
372
  url: log.url,
@@ -326,6 +377,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
326
377
  : log.body
327
378
  : undefined,
328
379
  params: log.params || {},
380
+ // 添加重放标记
329
381
  metadata: {
330
382
  originalLogId: log.id,
331
383
  originalRequestId: log.requestId,
@@ -342,6 +394,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
342
394
  }
343
395
  });
344
396
  }
397
+ /**
398
+ * 根据请求ID生成可重放的请求配置
399
+ * @param requestId 请求ID
400
+ * @returns 请求配置对象
401
+ */
345
402
  generateReplayConfigFromRequestId(requestId) {
346
403
  return __awaiter(this, void 0, void 0, function* () {
347
404
  if (!this.logRepository) {
@@ -358,11 +415,17 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
358
415
  return this.generateReplayConfigFromLog(log.id);
359
416
  });
360
417
  }
418
+ /**
419
+ * 批量生成curl命令
420
+ * @param options 查询选项
421
+ * @returns curl命令数组
422
+ */
361
423
  generateBatchCurlCommands() {
362
424
  return __awaiter(this, arguments, void 0, function* (options = {}) {
363
425
  if (!this.logRepository) {
364
426
  throw new Error('HTTP log repository not available');
365
427
  }
428
+ // 限制返回数量以避免过大的响应
366
429
  const limitedOptions = Object.assign(Object.assign({}, options), { limit: Math.min(options.limit || 10, 50) });
367
430
  const result = yield this.findLogs(limitedOptions);
368
431
  const curlCommands = [];
@@ -385,6 +448,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
385
448
  return curlCommands;
386
449
  });
387
450
  }
451
+ /**
452
+ * 获取日志的完整重放信息
453
+ * @param logId 日志ID
454
+ * @returns 包含curl命令和重放配置的对象
455
+ */
388
456
  getLogReplayInfo(logId) {
389
457
  return __awaiter(this, void 0, void 0, function* () {
390
458
  if (!this.logRepository) {
@@ -405,6 +473,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
405
473
  };
406
474
  });
407
475
  }
476
+ /**
477
+ * 根据请求ID获取日志的完整重放信息
478
+ * @param requestId 请求ID
479
+ * @returns 包含curl命令和重放配置的对象
480
+ */
408
481
  getLogReplayInfoByRequestId(requestId) {
409
482
  return __awaiter(this, void 0, void 0, function* () {
410
483
  const log = yield this.findLogByRequestId(requestId);
@@ -414,6 +487,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
414
487
  return this.getLogReplayInfo(log.id);
415
488
  });
416
489
  }
490
+ /**
491
+ * 初始化仓库
492
+ */
417
493
  initializeRepository() {
418
494
  if (this.dataSource) {
419
495
  try {
@@ -425,9 +501,13 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
425
501
  }
426
502
  }
427
503
  }
504
+ /**
505
+ * 计算响应时间百分位数
506
+ */
428
507
  calculatePercentiles(queryBuilder) {
429
508
  return __awaiter(this, void 0, void 0, function* () {
430
509
  try {
510
+ // 获取所有响应时间
431
511
  const results = yield queryBuilder
432
512
  .select('log.responseTime', 'responseTime')
433
513
  .where('log.responseTime IS NOT NULL')
@@ -456,6 +536,9 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
456
536
  }
457
537
  });
458
538
  }
539
+ /**
540
+ * 格式化统计结果
541
+ */
459
542
  formatStats(stats, keyField, valueField) {
460
543
  return stats.reduce((acc, item) => {
461
544
  const key = item[keyField] || 'unknown';
@@ -464,14 +547,19 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
464
547
  return acc;
465
548
  }, {});
466
549
  }
550
+ /**
551
+ * 构建查询
552
+ */
467
553
  buildQuery(options, includeDetails = false) {
468
554
  if (!this.logRepository) {
469
555
  throw new Error('HTTP log repository not available');
470
556
  }
471
557
  const queryBuilder = this.logRepository.createQueryBuilder('log');
558
+ // 关联查询重试记录
472
559
  if (includeDetails) {
473
560
  queryBuilder.leftJoinAndSelect('log.retryRecords', 'retryRecords');
474
561
  }
562
+ // 基础条件
475
563
  if (options.requestId) {
476
564
  queryBuilder.andWhere('log.requestId = :requestId', {
477
565
  requestId: options.requestId,
@@ -480,6 +568,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
480
568
  if (options.userId) {
481
569
  queryBuilder.andWhere('log.userId = :userId', { userId: options.userId });
482
570
  }
571
+ // 方法过滤
483
572
  if (options.method) {
484
573
  if (Array.isArray(options.method)) {
485
574
  queryBuilder.andWhere('log.method IN (:...methods)', {
@@ -492,9 +581,11 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
492
581
  });
493
582
  }
494
583
  }
584
+ // URL过滤
495
585
  if (options.url) {
496
586
  queryBuilder.andWhere('log.url LIKE :url', { url: `%${options.url}%` });
497
587
  }
588
+ // 状态码过滤
498
589
  if (options.statusCode) {
499
590
  if (Array.isArray(options.statusCode)) {
500
591
  queryBuilder.andWhere('log.statusCode IN (:...statusCodes)', {
@@ -507,39 +598,47 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
507
598
  });
508
599
  }
509
600
  }
601
+ // 成功状态过滤
510
602
  if (options.success !== undefined) {
511
603
  queryBuilder.andWhere('log.success = :success', {
512
604
  success: options.success,
513
605
  });
514
606
  }
607
+ // 服务名称过滤
515
608
  if (options.serviceName) {
516
609
  queryBuilder.andWhere('log.serviceName = :serviceName', {
517
610
  serviceName: options.serviceName,
518
611
  });
519
612
  }
613
+ // 操作名称过滤
520
614
  if (options.operationName) {
521
615
  queryBuilder.andWhere('log.operationName = :operationName', {
522
616
  operationName: options.operationName,
523
617
  });
524
618
  }
619
+ // 客户端IP过滤
525
620
  if (options.clientIp) {
526
621
  queryBuilder.andWhere('log.clientIp = :clientIp', {
527
622
  clientIp: options.clientIp,
528
623
  });
529
624
  }
625
+ // 来源过滤
530
626
  if (options.source) {
531
627
  queryBuilder.andWhere('log.source = :source', { source: options.source });
532
628
  }
629
+ // 标签过滤
533
630
  if (options.tags && options.tags.length > 0) {
534
631
  queryBuilder.andWhere('JSON_CONTAINS(log.tags, :tags)', {
535
632
  tags: JSON.stringify(options.tags),
536
633
  });
537
634
  }
635
+ // 错误代码过滤
538
636
  if (options.errorCode) {
539
637
  queryBuilder.andWhere('log.errorCode = :errorCode', {
540
638
  errorCode: options.errorCode,
541
639
  });
542
640
  }
641
+ // 响应时间范围过滤
543
642
  if (options.minResponseTime) {
544
643
  queryBuilder.andWhere('log.responseTime >= :minResponseTime', {
545
644
  minResponseTime: options.minResponseTime,
@@ -550,6 +649,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
550
649
  maxResponseTime: options.maxResponseTime,
551
650
  });
552
651
  }
652
+ // 时间范围过滤
553
653
  if (options.startDate) {
554
654
  queryBuilder.andWhere('log.createdAt >= :startDate', {
555
655
  startDate: options.startDate,
@@ -560,11 +660,18 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
560
660
  endDate: options.endDate,
561
661
  });
562
662
  }
663
+ // 关键词搜索
563
664
  if (options.keyword) {
564
665
  queryBuilder.andWhere('(log.url LIKE :keyword OR log.errorMessage LIKE :keyword OR log.body LIKE :keyword)', { keyword: `%${options.keyword}%` });
565
666
  }
566
667
  return queryBuilder;
567
668
  }
669
+ /**
670
+ * 清理敏感信息用于生成curl命令
671
+ * 移除或替换敏感的请求头和认证信息
672
+ * @param headers 原始请求头
673
+ * @returns 清理后的请求头
674
+ */
568
675
  sanitizeHeadersForCurl(headers) {
569
676
  const sensitiveHeaders = [
570
677
  'authorization',
@@ -577,6 +684,7 @@ let HttpLogQueryService = HttpLogQueryService_1 = class HttpLogQueryService {
577
684
  const sanitized = Object.assign({}, headers);
578
685
  for (const header of sensitiveHeaders) {
579
686
  if (sanitized[header]) {
687
+ // 保留头部但替换值为占位符
580
688
  sanitized[header] = '***REDACTED***';
581
689
  }
582
690
  }