@nest-omni/core 4.1.3-3 → 4.1.3-31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/audit/audit.module.d.ts +1 -0
- package/audit/audit.module.js +51 -2
- package/audit/controllers/audit.controller.d.ts +57 -1
- package/audit/controllers/audit.controller.js +43 -0
- package/audit/decorators/audit-action.decorator.d.ts +74 -0
- package/audit/decorators/audit-action.decorator.js +42 -0
- package/audit/decorators/audit-controller.decorator.d.ts +1 -1
- package/audit/decorators/audit-controller.decorator.js +2 -2
- package/audit/decorators/audit-operation.decorator.d.ts +0 -7
- package/audit/decorators/audit-operation.decorator.js +0 -7
- package/audit/decorators/entity-audit.decorator.d.ts +78 -2
- package/audit/decorators/entity-audit.decorator.js +145 -4
- package/audit/decorators/index.d.ts +2 -0
- package/audit/decorators/index.js +2 -0
- package/audit/dto/audit-action-query.dto.d.ts +13 -0
- package/audit/dto/audit-action-query.dto.js +77 -0
- package/audit/dto/index.d.ts +1 -0
- package/audit/dto/index.js +1 -0
- package/audit/entities/audit-action-summary.entity.d.ts +23 -0
- package/audit/entities/audit-action-summary.entity.js +101 -0
- package/audit/entities/entity-audit-log.entity.d.ts +7 -2
- package/audit/entities/entity-audit-log.entity.js +45 -9
- package/audit/entities/entity-transaction.entity.d.ts +8 -2
- package/audit/entities/entity-transaction.entity.js +39 -3
- package/audit/entities/index.d.ts +3 -0
- package/audit/entities/index.js +3 -0
- package/audit/entities/manual-operation-log.entity.d.ts +0 -2
- package/audit/entities/manual-operation-log.entity.js +8 -9
- package/audit/enums/audit.enums.d.ts +14 -6
- package/audit/enums/audit.enums.js +18 -9
- package/audit/examples/decorator-value-mapping.example.d.ts +70 -0
- package/audit/examples/decorator-value-mapping.example.js +414 -0
- package/audit/index.d.ts +5 -1
- package/audit/index.js +29 -2
- package/audit/interceptors/audit-action.interceptor.d.ts +39 -0
- package/audit/interceptors/audit-action.interceptor.js +217 -0
- package/audit/interceptors/audit.interceptor.d.ts +1 -0
- package/audit/interceptors/audit.interceptor.js +19 -11
- package/audit/interceptors/index.d.ts +1 -0
- package/audit/interceptors/index.js +1 -0
- package/audit/interfaces/audit.interfaces.d.ts +132 -4
- package/audit/services/audit-action.service.d.ts +142 -0
- package/audit/services/audit-action.service.js +246 -0
- package/audit/services/audit-context.service.d.ts +91 -0
- package/audit/services/audit-context.service.js +170 -0
- package/audit/services/entity-audit.service.d.ts +220 -9
- package/audit/services/entity-audit.service.js +761 -72
- package/audit/services/index.d.ts +3 -0
- package/audit/services/index.js +3 -0
- package/audit/services/manual-audit-log.service.d.ts +23 -23
- package/audit/services/manual-audit-log.service.js +34 -57
- package/audit/services/multi-database.service.d.ts +0 -5
- package/audit/services/multi-database.service.js +0 -24
- package/audit/services/operation-description.service.d.ts +14 -3
- package/audit/services/operation-description.service.js +165 -26
- package/audit/services/transaction-audit.service.d.ts +1 -0
- package/audit/services/transaction-audit.service.js +12 -9
- package/audit/subscribers/entity-audit.subscriber.d.ts +5 -0
- package/audit/subscribers/entity-audit.subscriber.js +69 -5
- package/cache/cache.module.d.ts +7 -8
- package/cache/cache.module.js +15 -13
- package/cache/cache.service.d.ts +6 -4
- package/cache/cache.service.js +24 -12
- package/cache/decorators/cache-put.decorator.js +5 -4
- package/cache/dependencies/callback.dependency.js +9 -0
- package/cache/dependencies/db.dependency.d.ts +43 -12
- package/cache/dependencies/db.dependency.js +46 -18
- package/cache/dependencies/tag.dependency.d.ts +31 -4
- package/cache/dependencies/tag.dependency.js +100 -11
- package/cache/entities/index.d.ts +1 -0
- package/cache/entities/index.js +17 -0
- package/cache/entities/typeorm-cache.entity.d.ts +71 -0
- package/cache/entities/typeorm-cache.entity.js +110 -0
- package/cache/index.d.ts +2 -1
- package/cache/index.js +19 -2
- package/cache/interfaces/cache-options.interface.d.ts +8 -0
- package/cache/providers/index.d.ts +2 -1
- package/cache/providers/index.js +2 -1
- package/cache/providers/lrucache.provider.d.ts +77 -0
- package/cache/providers/lrucache.provider.js +228 -0
- package/cache/providers/redis-cache.provider.d.ts +1 -0
- package/cache/providers/redis-cache.provider.js +8 -6
- package/cache/providers/typeorm-cache.provider.d.ts +211 -0
- package/cache/providers/typeorm-cache.provider.js +483 -0
- package/common/boilerplate.polyfill.d.ts +1 -0
- package/common/boilerplate.polyfill.js +18 -1
- package/common/helpers/validation-metadata-helper.d.ts +112 -0
- package/common/helpers/validation-metadata-helper.js +164 -0
- package/common/index.d.ts +1 -0
- package/common/index.js +4 -0
- package/decorators/examples/field-i18n.example.d.ts +294 -0
- package/decorators/examples/field-i18n.example.js +478 -0
- package/decorators/field.decorators.d.ts +95 -3
- package/decorators/field.decorators.js +152 -18
- package/decorators/transform.decorators.d.ts +0 -2
- package/decorators/transform.decorators.js +0 -23
- package/decorators/translate.decorator.d.ts +26 -0
- package/decorators/translate.decorator.js +26 -1
- package/email-log/email-log.constants.d.ts +8 -0
- package/email-log/email-log.constants.js +11 -0
- package/email-log/email-log.module.d.ts +47 -0
- package/email-log/email-log.module.js +140 -0
- package/email-log/index.d.ts +11 -0
- package/email-log/index.js +48 -0
- package/email-log/interfaces/email-log-options.interface.d.ts +61 -0
- package/email-log/interfaces/email-log-options.interface.js +134 -0
- package/email-log/interfaces/email-log-transport.interface.d.ts +20 -0
- package/email-log/interfaces/email-log-transport.interface.js +2 -0
- package/email-log/interfaces/index.d.ts +2 -0
- package/email-log/interfaces/index.js +18 -0
- package/email-log/providers/email-provider.d.ts +42 -0
- package/email-log/providers/email-provider.js +127 -0
- package/email-log/providers/index.d.ts +1 -0
- package/email-log/providers/index.js +17 -0
- package/email-log/services/email-log-alert.service.d.ts +46 -0
- package/email-log/services/email-log-alert.service.js +162 -0
- package/email-log/services/email-log-formatter.service.d.ts +78 -0
- package/email-log/services/email-log-formatter.service.js +442 -0
- package/email-log/services/email-log-logger.service.d.ts +85 -0
- package/email-log/services/email-log-logger.service.js +168 -0
- package/email-log/services/email-log-rate-limiter.service.d.ts +42 -0
- package/email-log/services/email-log-rate-limiter.service.js +110 -0
- package/email-log/services/email-log-transport.service.d.ts +80 -0
- package/email-log/services/email-log-transport.service.js +271 -0
- package/email-log/services/index.d.ts +5 -0
- package/email-log/services/index.js +21 -0
- package/email-log/transports/index.d.ts +1 -0
- package/email-log/transports/index.js +17 -0
- package/email-log/transports/pino-email.transport.d.ts +56 -0
- package/email-log/transports/pino-email.transport.js +188 -0
- package/email-log/utils/index.d.ts +2 -0
- package/email-log/utils/index.js +18 -0
- package/email-log/utils/log-level.helper.d.ts +46 -0
- package/email-log/utils/log-level.helper.js +74 -0
- package/email-log/utils/pino-transport.utils.d.ts +135 -0
- package/email-log/utils/pino-transport.utils.js +238 -0
- package/file-upload/controllers/file-access.controller.d.ts +23 -0
- package/file-upload/controllers/file-access.controller.js +128 -0
- package/file-upload/decorators/column.decorator.d.ts +151 -0
- package/file-upload/decorators/column.decorator.js +273 -0
- package/file-upload/decorators/csv-data.decorator.d.ts +30 -0
- package/file-upload/decorators/csv-data.decorator.js +85 -0
- package/file-upload/decorators/csv-import.decorator.d.ts +34 -0
- package/file-upload/decorators/csv-import.decorator.js +24 -0
- package/file-upload/decorators/examples/column-mapping.example.d.ts +76 -0
- package/file-upload/decorators/examples/column-mapping.example.js +122 -0
- package/file-upload/decorators/excel-data.decorator.d.ts +30 -0
- package/file-upload/decorators/excel-data.decorator.js +85 -0
- package/file-upload/decorators/file-upload.decorator.d.ts +83 -0
- package/file-upload/decorators/file-upload.decorator.js +172 -0
- package/file-upload/decorators/index.d.ts +5 -0
- package/file-upload/decorators/index.js +38 -0
- package/file-upload/decorators/process.decorator.d.ts +40 -0
- package/file-upload/decorators/process.decorator.js +52 -0
- package/file-upload/decorators/validate-data.decorator.d.ts +91 -0
- package/file-upload/decorators/validate-data.decorator.js +39 -0
- package/file-upload/dto/create-file.dto.d.ts +24 -0
- package/file-upload/dto/create-file.dto.js +112 -0
- package/file-upload/dto/find-files.dto.d.ts +15 -0
- package/file-upload/dto/find-files.dto.js +76 -0
- package/file-upload/dto/index.d.ts +4 -0
- package/file-upload/dto/index.js +20 -0
- package/file-upload/dto/pagination.dto.d.ts +7 -0
- package/file-upload/dto/pagination.dto.js +39 -0
- package/file-upload/dto/update-file.dto.d.ts +15 -0
- package/file-upload/dto/update-file.dto.js +67 -0
- package/file-upload/entities/file-metadata.entity.d.ts +25 -0
- package/file-upload/entities/file-metadata.entity.js +76 -0
- package/file-upload/entities/file.entity.d.ts +114 -0
- package/file-upload/entities/file.entity.js +350 -0
- package/file-upload/entities/index.d.ts +2 -0
- package/file-upload/entities/index.js +18 -0
- package/file-upload/enums/file-type.enum.d.ts +72 -0
- package/file-upload/enums/file-type.enum.js +212 -0
- package/file-upload/exceptions/file-upload.exception.d.ts +57 -0
- package/file-upload/exceptions/file-upload.exception.js +120 -0
- package/file-upload/exceptions/index.d.ts +1 -0
- package/file-upload/exceptions/index.js +17 -0
- package/file-upload/file-upload.module.d.ts +89 -0
- package/file-upload/file-upload.module.js +292 -0
- package/file-upload/index.d.ts +37 -0
- package/file-upload/index.js +77 -0
- package/file-upload/interceptors/file-upload.interceptor.d.ts +101 -0
- package/file-upload/interceptors/file-upload.interceptor.js +594 -0
- package/file-upload/interceptors/index.d.ts +1 -0
- package/file-upload/interceptors/index.js +17 -0
- package/file-upload/interfaces/custom-file-type.interface.d.ts +72 -0
- package/file-upload/interfaces/custom-file-type.interface.js +2 -0
- package/file-upload/interfaces/file-buffer.interface.d.ts +72 -0
- package/file-upload/interfaces/file-buffer.interface.js +2 -0
- package/file-upload/interfaces/file-entity.interface.d.ts +142 -0
- package/file-upload/interfaces/file-entity.interface.js +28 -0
- package/file-upload/interfaces/file-metadata.interface.d.ts +21 -0
- package/file-upload/interfaces/file-metadata.interface.js +2 -0
- package/file-upload/interfaces/file-processor.interface.d.ts +93 -0
- package/file-upload/interfaces/file-processor.interface.js +2 -0
- package/file-upload/interfaces/file-upload-options.interface.d.ts +74 -0
- package/file-upload/interfaces/file-upload-options.interface.js +5 -0
- package/file-upload/interfaces/index.d.ts +7 -0
- package/file-upload/interfaces/index.js +24 -0
- package/file-upload/interfaces/processor-options.interface.d.ts +102 -0
- package/file-upload/interfaces/processor-options.interface.js +2 -0
- package/file-upload/interfaces/storage-provider.interface.d.ts +239 -0
- package/file-upload/interfaces/storage-provider.interface.js +2 -0
- package/file-upload/interfaces/upload-options.interface.d.ts +19 -0
- package/file-upload/interfaces/upload-options.interface.js +2 -0
- package/file-upload/processors/csv.processor.d.ts +98 -0
- package/file-upload/processors/csv.processor.js +391 -0
- package/file-upload/processors/excel.processor.d.ts +130 -0
- package/file-upload/processors/excel.processor.js +547 -0
- package/file-upload/processors/image.processor.d.ts +199 -0
- package/file-upload/processors/image.processor.js +377 -0
- package/file-upload/providers/index.d.ts +2 -0
- package/file-upload/providers/index.js +18 -0
- package/file-upload/providers/local-storage.provider.d.ts +98 -0
- package/file-upload/providers/local-storage.provider.js +484 -0
- package/file-upload/providers/s3-storage.provider.d.ts +87 -0
- package/file-upload/providers/s3-storage.provider.js +455 -0
- package/file-upload/services/file-signature-validator.service.d.ts +118 -0
- package/file-upload/services/file-signature-validator.service.js +376 -0
- package/file-upload/services/file.service.d.ts +193 -0
- package/file-upload/services/file.service.js +638 -0
- package/file-upload/services/index.d.ts +4 -0
- package/file-upload/services/index.js +20 -0
- package/file-upload/services/malicious-file-detector.service.d.ts +300 -0
- package/file-upload/services/malicious-file-detector.service.js +1234 -0
- package/file-upload/services/mime-registry.service.d.ts +47 -0
- package/file-upload/services/mime-registry.service.js +167 -0
- package/file-upload/utils/checksum.util.d.ts +28 -0
- package/file-upload/utils/checksum.util.js +65 -0
- package/file-upload/utils/dynamic-import.util.d.ts +54 -0
- package/file-upload/utils/dynamic-import.util.js +156 -0
- package/file-upload/utils/filename.util.d.ts +59 -0
- package/file-upload/utils/filename.util.js +184 -0
- package/file-upload/utils/filepath.util.d.ts +70 -0
- package/file-upload/utils/filepath.util.js +152 -0
- package/file-upload/utils/index.d.ts +4 -0
- package/file-upload/utils/index.js +20 -0
- package/filters/bad-request.filter.d.ts +9 -0
- package/filters/bad-request.filter.js +57 -16
- package/http-client/config/http-client.config.d.ts +5 -0
- package/http-client/config/http-client.config.js +27 -14
- package/http-client/decorators/http-client.decorators.d.ts +7 -28
- package/http-client/decorators/http-client.decorators.js +124 -99
- package/http-client/entities/http-log.entity.d.ts +0 -20
- package/http-client/entities/http-log.entity.js +1 -21
- package/http-client/examples/advanced-usage.example.d.ts +4 -5
- package/http-client/examples/advanced-usage.example.js +7 -59
- package/http-client/examples/axios-config-extended.example.d.ts +17 -0
- package/http-client/examples/axios-config-extended.example.js +311 -0
- package/http-client/examples/flexible-response-example.d.ts +28 -0
- package/http-client/examples/flexible-response-example.js +120 -0
- package/http-client/examples/index.d.ts +2 -0
- package/http-client/examples/index.js +2 -0
- package/http-client/examples/proxy-from-environment.example.d.ts +133 -0
- package/http-client/examples/proxy-from-environment.example.js +409 -0
- package/http-client/examples/ssl-certificate.example.d.ts +47 -0
- package/http-client/examples/ssl-certificate.example.js +432 -0
- package/http-client/http-client.module.d.ts +43 -2
- package/http-client/http-client.module.js +150 -90
- package/http-client/index.d.ts +1 -1
- package/http-client/interfaces/api-client-config.interface.d.ts +24 -103
- package/http-client/interfaces/http-client-config.interface.d.ts +137 -62
- package/http-client/services/api-client-registry.service.d.ts +8 -21
- package/http-client/services/api-client-registry.service.js +31 -282
- package/http-client/services/circuit-breaker.service.d.ts +69 -2
- package/http-client/services/circuit-breaker.service.js +185 -7
- package/http-client/services/http-client.service.d.ts +85 -23
- package/http-client/services/http-client.service.js +512 -168
- package/http-client/services/http-log-query.service.js +0 -13
- package/http-client/services/index.d.ts +0 -1
- package/http-client/services/index.js +0 -1
- package/http-client/services/logging.service.d.ts +69 -16
- package/http-client/services/logging.service.js +290 -170
- package/http-client/utils/call-stack-extractor.util.d.ts +26 -0
- package/http-client/utils/call-stack-extractor.util.js +35 -0
- package/http-client/utils/context-extractor.util.d.ts +2 -0
- package/http-client/utils/context-extractor.util.js +17 -3
- package/http-client/utils/curl-generator.util.js +2 -5
- package/http-client/utils/index.d.ts +2 -0
- package/http-client/utils/index.js +2 -0
- package/http-client/utils/proxy-environment.util.d.ts +42 -0
- package/http-client/utils/proxy-environment.util.js +154 -0
- package/http-client/utils/retry-recorder.util.d.ts +0 -4
- package/http-client/utils/retry-recorder.util.js +2 -27
- package/http-client/utils/sanitize.util.d.ts +58 -0
- package/http-client/utils/sanitize.util.js +188 -0
- package/http-client/utils/security-validator.util.d.ts +118 -0
- package/http-client/utils/security-validator.util.js +354 -0
- package/index.d.ts +4 -1
- package/index.js +6 -1
- package/interceptors/translation-interceptor.service.d.ts +7 -0
- package/interceptors/translation-interceptor.service.js +40 -8
- package/ip-filter/constants.d.ts +21 -0
- package/ip-filter/constants.js +24 -0
- package/ip-filter/decorators/index.d.ts +1 -0
- package/ip-filter/decorators/index.js +17 -0
- package/ip-filter/decorators/ip-filter.decorator.d.ts +58 -0
- package/ip-filter/decorators/ip-filter.decorator.js +79 -0
- package/ip-filter/guards/index.d.ts +1 -0
- package/ip-filter/guards/index.js +17 -0
- package/ip-filter/guards/ip-filter.guard.d.ts +62 -0
- package/ip-filter/guards/ip-filter.guard.js +174 -0
- package/ip-filter/index.d.ts +7 -0
- package/ip-filter/index.js +23 -0
- package/ip-filter/interfaces/index.d.ts +4 -0
- package/ip-filter/interfaces/index.js +20 -0
- package/ip-filter/interfaces/ip-filter-async-options.interface.d.ts +15 -0
- package/ip-filter/interfaces/ip-filter-async-options.interface.js +2 -0
- package/ip-filter/interfaces/ip-filter-metadata.interface.d.ts +26 -0
- package/ip-filter/interfaces/ip-filter-metadata.interface.js +2 -0
- package/ip-filter/interfaces/ip-filter-options.interface.d.ts +34 -0
- package/ip-filter/interfaces/ip-filter-options.interface.js +2 -0
- package/ip-filter/interfaces/ip-rule.interface.d.ts +36 -0
- package/ip-filter/interfaces/ip-rule.interface.js +2 -0
- package/ip-filter/ip-filter.module.d.ts +55 -0
- package/ip-filter/ip-filter.module.js +105 -0
- package/ip-filter/services/index.d.ts +1 -0
- package/ip-filter/services/index.js +17 -0
- package/ip-filter/services/ip-filter.service.d.ts +92 -0
- package/ip-filter/services/ip-filter.service.js +238 -0
- package/ip-filter/utils/index.d.ts +1 -0
- package/ip-filter/utils/index.js +17 -0
- package/ip-filter/utils/ip-utils.d.ts +61 -0
- package/ip-filter/utils/ip-utils.js +162 -0
- package/package.json +34 -29
- package/providers/context.provider.d.ts +9 -0
- package/providers/context.provider.js +13 -0
- package/redis-lock/comprehensive-lock-cleanup.service.d.ts +94 -0
- package/redis-lock/comprehensive-lock-cleanup.service.js +253 -0
- package/redis-lock/index.d.ts +2 -0
- package/redis-lock/index.js +5 -1
- package/redis-lock/lock-heartbeat.service.d.ts +80 -0
- package/redis-lock/lock-heartbeat.service.js +232 -0
- package/redis-lock/redis-lock.module.d.ts +6 -0
- package/redis-lock/redis-lock.module.js +136 -77
- package/redis-lock/redis-lock.service.d.ts +31 -0
- package/redis-lock/redis-lock.service.js +124 -17
- package/setup/bootstrap.setup.d.ts +2 -1
- package/setup/bootstrap.setup.js +3 -2
- package/setup/index.d.ts +1 -0
- package/setup/index.js +1 -0
- package/setup/run-in-mode.decorator.d.ts +56 -0
- package/setup/run-in-mode.decorator.js +92 -0
- package/setup/schedule.decorator.d.ts +1 -0
- package/setup/schedule.decorator.js +28 -13
- package/setup/worker.decorator.js +10 -1
- package/shared/index.d.ts +1 -1
- package/shared/index.js +1 -1
- package/shared/{serviceRegistryModule.js → service-registry.module.js} +28 -17
- package/shared/services/api-config.service.d.ts +41 -0
- package/shared/services/api-config.service.js +175 -8
- package/shared/services/index.d.ts +0 -1
- package/shared/services/index.js +0 -1
- package/validators/custom-validate.validator.d.ts +1 -0
- package/validators/custom-validate.validator.js +1 -0
- package/validators/file-mimetype.validator.d.ts +0 -2
- package/validators/file-mimetype.validator.js +4 -6
- package/validators/is-exists.validator.d.ts +15 -6
- package/validators/is-exists.validator.js +8 -7
- package/validators/is-unique.validator.d.ts +22 -7
- package/validators/is-unique.validator.js +41 -17
- package/vault/vault-config.service.js +1 -1
- package/cache/providers/memory-cache.provider.d.ts +0 -49
- package/cache/providers/memory-cache.provider.js +0 -197
- package/http-client/services/cache.service.d.ts +0 -76
- package/http-client/services/cache.service.js +0 -333
- package/shared/services/validator.service.d.ts +0 -3
- package/shared/services/validator.service.js +0 -20
- /package/shared/{serviceRegistryModule.d.ts → service-registry.module.d.ts} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
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("./email-log-transport.service"), exports);
|
|
18
|
+
__exportStar(require("./email-log-formatter.service"), exports);
|
|
19
|
+
__exportStar(require("./email-log-rate-limiter.service"), exports);
|
|
20
|
+
__exportStar(require("./email-log-alert.service"), exports);
|
|
21
|
+
__exportStar(require("./email-log-logger.service"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pino-email.transport';
|
|
@@ -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("./pino-email.transport"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Transform } from 'stream';
|
|
2
|
+
import type { EmailLogOptions } from '../interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Pino email transport class
|
|
5
|
+
* This is a Transform stream that can be used directly with Pino's transport option
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import pino from 'pino';
|
|
10
|
+
* import { PinoEmailTransport } from '@nest-omni/core';
|
|
11
|
+
*
|
|
12
|
+
* const transport = new PinoEmailTransport({
|
|
13
|
+
* enabled: true,
|
|
14
|
+
* to: ['admin@example.com'],
|
|
15
|
+
* from: 'noreply@example.com',
|
|
16
|
+
* smtpHost: 'smtp.example.com',
|
|
17
|
+
* // ... other options
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const logger = pino(transport);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class PinoEmailTransport extends Transform {
|
|
24
|
+
private options;
|
|
25
|
+
private formatter;
|
|
26
|
+
private emailProvider;
|
|
27
|
+
constructor(options: EmailLogOptions);
|
|
28
|
+
private initDependencies;
|
|
29
|
+
_transform(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null, data?: any) => void): void;
|
|
30
|
+
private sendEmail;
|
|
31
|
+
private checkRateLimit;
|
|
32
|
+
/**
|
|
33
|
+
* Close the transport and cleanup resources
|
|
34
|
+
*/
|
|
35
|
+
close(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory function to create a Pino transport configuration
|
|
39
|
+
* This can be directly used in pino() constructor
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* import pino from 'pino';
|
|
44
|
+
* import { createPinoEmailTransport } from '@nest-omni/core';
|
|
45
|
+
*
|
|
46
|
+
* const transport = createPinoEmailTransport({
|
|
47
|
+
* enabled: true,
|
|
48
|
+
* to: ['admin@example.com'],
|
|
49
|
+
* from: 'noreply@example.com',
|
|
50
|
+
* smtpHost: 'smtp.example.com',
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* const logger = pino(transport);
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function createPinoEmailTransport(options: EmailLogOptions): PinoEmailTransport;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PinoEmailTransport = void 0;
|
|
13
|
+
exports.createPinoEmailTransport = createPinoEmailTransport;
|
|
14
|
+
const stream_1 = require("stream");
|
|
15
|
+
const pino_1 = require("pino");
|
|
16
|
+
const log_level_helper_1 = require("../utils/log-level.helper");
|
|
17
|
+
/**
|
|
18
|
+
* Pino email transport class
|
|
19
|
+
* This is a Transform stream that can be used directly with Pino's transport option
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import pino from 'pino';
|
|
24
|
+
* import { PinoEmailTransport } from '@nest-omni/core';
|
|
25
|
+
*
|
|
26
|
+
* const transport = new PinoEmailTransport({
|
|
27
|
+
* enabled: true,
|
|
28
|
+
* to: ['admin@example.com'],
|
|
29
|
+
* from: 'noreply@example.com',
|
|
30
|
+
* smtpHost: 'smtp.example.com',
|
|
31
|
+
* // ... other options
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* const logger = pino(transport);
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class PinoEmailTransport extends stream_1.Transform {
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super({ objectMode: true });
|
|
40
|
+
this.options = options;
|
|
41
|
+
// Import dependencies dynamically
|
|
42
|
+
this.initDependencies();
|
|
43
|
+
}
|
|
44
|
+
initDependencies() {
|
|
45
|
+
// Import formatter
|
|
46
|
+
const { EmailLogFormatterService } = require('../services/email-log-formatter.service');
|
|
47
|
+
this.formatter = new EmailLogFormatterService();
|
|
48
|
+
// Import email provider
|
|
49
|
+
const { EmailLogProvider } = require('../providers/email-provider');
|
|
50
|
+
this.emailProvider = new EmailLogProvider({
|
|
51
|
+
smtpHost: this.options.smtpHost,
|
|
52
|
+
smtpPort: this.options.smtpPort || 587,
|
|
53
|
+
smtpUsername: this.options.smtpUsername,
|
|
54
|
+
smtpPassword: this.options.smtpPassword,
|
|
55
|
+
smtpSecure: this.options.smtpSecure || false,
|
|
56
|
+
smtpIgnoreTLSError: this.options.smtpIgnoreTLSError || false,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
_transform(chunk, encoding, callback) {
|
|
60
|
+
try {
|
|
61
|
+
// Parse chunk if it's a string (Pino multistream can send strings)
|
|
62
|
+
let log = chunk;
|
|
63
|
+
if (typeof chunk === 'string') {
|
|
64
|
+
try {
|
|
65
|
+
log = JSON.parse(chunk);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
// If not valid JSON, try to extract JSON from the string
|
|
69
|
+
const match = chunk.match(/\{.*\}/);
|
|
70
|
+
if (match) {
|
|
71
|
+
log = JSON.parse(match[0]);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.error('[PinoEmailTransport] Failed to parse log chunk:', chunk.substring(0, 200));
|
|
75
|
+
callback();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (chunk instanceof Buffer) {
|
|
81
|
+
try {
|
|
82
|
+
log = JSON.parse(chunk.toString('utf-8'));
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
console.error('[PinoEmailTransport] Failed to parse buffer chunk');
|
|
86
|
+
callback();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Check if enabled
|
|
91
|
+
if (!this.options.enabled) {
|
|
92
|
+
callback();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
// Check log level
|
|
96
|
+
const levelValue = typeof log.level === 'number'
|
|
97
|
+
? log.level
|
|
98
|
+
: pino_1.default.levels.values[log.level] || 30;
|
|
99
|
+
const thresholdValue = (0, log_level_helper_1.getLevelValue)(this.options.level);
|
|
100
|
+
if (levelValue < thresholdValue) {
|
|
101
|
+
callback();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Check rate limiting (in-memory for transport)
|
|
105
|
+
if (!this.checkRateLimit(log.level)) {
|
|
106
|
+
callback();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Send email asynchronously (non-blocking)
|
|
110
|
+
this.sendEmail(log).catch((err) => {
|
|
111
|
+
console.error('Failed to send log email:', err);
|
|
112
|
+
});
|
|
113
|
+
callback();
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Error in PinoEmailTransport:', error);
|
|
117
|
+
callback(); // Don't fail the stream
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
sendEmail(log) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const appName = process.env.NAME || process.env.APP_NAME || 'omni-app';
|
|
123
|
+
const subjectPrefix = this.options.subjectPrefix || '[Log Alert]';
|
|
124
|
+
const emailContent = this.options.useHtmlFormat
|
|
125
|
+
? this.formatter.formatHtml(log, appName, subjectPrefix)
|
|
126
|
+
: this.formatter.formatText(log, appName, subjectPrefix);
|
|
127
|
+
yield this.emailProvider.sendLogEmail({
|
|
128
|
+
to: this.options.to,
|
|
129
|
+
cc: this.options.cc,
|
|
130
|
+
from: this.options.from,
|
|
131
|
+
subject: emailContent.subject,
|
|
132
|
+
html: 'html' in emailContent ? emailContent.html : undefined,
|
|
133
|
+
text: 'text' in emailContent ? emailContent.text : undefined,
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
checkRateLimit(level) {
|
|
138
|
+
// Simple in-memory rate limiting for transport
|
|
139
|
+
const now = Date.now();
|
|
140
|
+
const windowMs = this.options.rateLimitWindowMs || 60000;
|
|
141
|
+
const maxEmails = this.options.rateLimitMaxEmails || 10;
|
|
142
|
+
const key = `rate-limit:${level}`;
|
|
143
|
+
const state = this[key] || { count: 0, resetTime: now + windowMs };
|
|
144
|
+
if (now > state.resetTime) {
|
|
145
|
+
state.count = 0;
|
|
146
|
+
state.resetTime = now + windowMs;
|
|
147
|
+
}
|
|
148
|
+
if (state.count >= maxEmails) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
state.count++;
|
|
152
|
+
this[key] = state;
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Close the transport and cleanup resources
|
|
157
|
+
*/
|
|
158
|
+
close() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
if (this.emailProvider && typeof this.emailProvider.close === 'function') {
|
|
161
|
+
yield this.emailProvider.close();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.PinoEmailTransport = PinoEmailTransport;
|
|
167
|
+
/**
|
|
168
|
+
* Factory function to create a Pino transport configuration
|
|
169
|
+
* This can be directly used in pino() constructor
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* import pino from 'pino';
|
|
174
|
+
* import { createPinoEmailTransport } from '@nest-omni/core';
|
|
175
|
+
*
|
|
176
|
+
* const transport = createPinoEmailTransport({
|
|
177
|
+
* enabled: true,
|
|
178
|
+
* to: ['admin@example.com'],
|
|
179
|
+
* from: 'noreply@example.com',
|
|
180
|
+
* smtpHost: 'smtp.example.com',
|
|
181
|
+
* });
|
|
182
|
+
*
|
|
183
|
+
* const logger = pino(transport);
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
function createPinoEmailTransport(options) {
|
|
187
|
+
return new PinoEmailTransport(options);
|
|
188
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./pino-transport.utils"), exports);
|
|
18
|
+
__exportStar(require("./log-level.helper"), exports);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log Level Helper
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for log level operations across the email-log module.
|
|
5
|
+
* This eliminates code duplication and provides consistent behavior.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Log level values mapping
|
|
9
|
+
* Uses Pino's standard level values
|
|
10
|
+
*/
|
|
11
|
+
export declare const LOG_LEVEL_VALUES: Record<string, number>;
|
|
12
|
+
/**
|
|
13
|
+
* Get numeric level value from level name or number
|
|
14
|
+
*
|
|
15
|
+
* @param level - Level name (string) or number
|
|
16
|
+
* @returns Numeric level value
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* getLevelValue('error') // returns 50
|
|
20
|
+
* getLevelValue(50) // returns 50
|
|
21
|
+
* getLevelValue('unknown') // returns 30 (info)
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLevelValue(level: string | number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Get human-readable level label from numeric level
|
|
26
|
+
*
|
|
27
|
+
* @param level - Numeric level value
|
|
28
|
+
* @returns Level label string
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* getLevelLabel(50) // returns 'error'
|
|
32
|
+
* getLevelLabel(30) // returns 'info'
|
|
33
|
+
*/
|
|
34
|
+
export declare function getLevelLabel(level: number | string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a log level meets a threshold
|
|
37
|
+
*
|
|
38
|
+
* @param level - The log level to check
|
|
39
|
+
* @param threshold - The minimum threshold level
|
|
40
|
+
* @returns true if level meets or exceeds threshold
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* meetsThreshold('error', 'warn') // true (50 >= 40)
|
|
44
|
+
* meetsThreshold('info', 'error') // false (30 < 50)
|
|
45
|
+
*/
|
|
46
|
+
export declare function meetsThreshold(level: string | number, threshold: string | number): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Log Level Helper
|
|
4
|
+
*
|
|
5
|
+
* Shared utilities for log level operations across the email-log module.
|
|
6
|
+
* This eliminates code duplication and provides consistent behavior.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LOG_LEVEL_VALUES = void 0;
|
|
10
|
+
exports.getLevelValue = getLevelValue;
|
|
11
|
+
exports.getLevelLabel = getLevelLabel;
|
|
12
|
+
exports.meetsThreshold = meetsThreshold;
|
|
13
|
+
/**
|
|
14
|
+
* Log level values mapping
|
|
15
|
+
* Uses Pino's standard level values
|
|
16
|
+
*/
|
|
17
|
+
exports.LOG_LEVEL_VALUES = {
|
|
18
|
+
trace: 10,
|
|
19
|
+
debug: 20,
|
|
20
|
+
info: 30,
|
|
21
|
+
warn: 40,
|
|
22
|
+
error: 50,
|
|
23
|
+
fatal: 60,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Get numeric level value from level name or number
|
|
27
|
+
*
|
|
28
|
+
* @param level - Level name (string) or number
|
|
29
|
+
* @returns Numeric level value
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* getLevelValue('error') // returns 50
|
|
33
|
+
* getLevelValue(50) // returns 50
|
|
34
|
+
* getLevelValue('unknown') // returns 30 (info)
|
|
35
|
+
*/
|
|
36
|
+
function getLevelValue(level) {
|
|
37
|
+
if (typeof level === 'number') {
|
|
38
|
+
return level;
|
|
39
|
+
}
|
|
40
|
+
return exports.LOG_LEVEL_VALUES[level] || 30; // Default to info level
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get human-readable level label from numeric level
|
|
44
|
+
*
|
|
45
|
+
* @param level - Numeric level value
|
|
46
|
+
* @returns Level label string
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* getLevelLabel(50) // returns 'error'
|
|
50
|
+
* getLevelLabel(30) // returns 'info'
|
|
51
|
+
*/
|
|
52
|
+
function getLevelLabel(level) {
|
|
53
|
+
const levelNum = typeof level === 'string' ? getLevelValue(level) : level;
|
|
54
|
+
for (const [label, value] of Object.entries(exports.LOG_LEVEL_VALUES)) {
|
|
55
|
+
if (value === levelNum) {
|
|
56
|
+
return label;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return 'unknown';
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Check if a log level meets a threshold
|
|
63
|
+
*
|
|
64
|
+
* @param level - The log level to check
|
|
65
|
+
* @param threshold - The minimum threshold level
|
|
66
|
+
* @returns true if level meets or exceeds threshold
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* meetsThreshold('error', 'warn') // true (50 >= 40)
|
|
70
|
+
* meetsThreshold('info', 'error') // false (30 < 50)
|
|
71
|
+
*/
|
|
72
|
+
function meetsThreshold(level, threshold) {
|
|
73
|
+
return getLevelValue(level) >= getLevelValue(threshold);
|
|
74
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import pino from 'pino';
|
|
2
|
+
import type { EmailLogTransportService } from '../services/email-log-transport.service';
|
|
3
|
+
import type { EmailLogOptions } from '../interfaces';
|
|
4
|
+
import { PinoEmailTransport } from '../transports/pino-email.transport';
|
|
5
|
+
/**
|
|
6
|
+
* Pino multistream target interface
|
|
7
|
+
*/
|
|
8
|
+
export interface PinoMultiStreamTarget {
|
|
9
|
+
level: string | number;
|
|
10
|
+
stream: NodeJS.WritableStream;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a Pino transport stream for email logging
|
|
14
|
+
* This function creates a writable stream that can be used with Pino
|
|
15
|
+
*
|
|
16
|
+
* @param options Email log options
|
|
17
|
+
* @returns A Pino transport configuration
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createEmailTransport } from '@nest-omni/core';
|
|
22
|
+
* import pino from 'pino';
|
|
23
|
+
*
|
|
24
|
+
* const transport = createEmailTransport({
|
|
25
|
+
* enabled: true,
|
|
26
|
+
* to: ['admin@example.com'],
|
|
27
|
+
* from: 'noreply@example.com',
|
|
28
|
+
* smtpHost: 'smtp.example.com',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* const logger = pino(transport);
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function createEmailTransport(options: EmailLogOptions): PinoEmailTransport;
|
|
35
|
+
/**
|
|
36
|
+
* Create a Pino multistream configuration that includes email transport
|
|
37
|
+
*
|
|
38
|
+
* @param options Email log options
|
|
39
|
+
* @param emailTransport The email transport service instance or PinoEmailTransport
|
|
40
|
+
* @returns Pino multistream targets array
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* import { createPinoMultistream } from '@nest-omni/core';
|
|
45
|
+
* import pino from 'pino';
|
|
46
|
+
*
|
|
47
|
+
* const streams = createPinoMultistream(options, emailTransport);
|
|
48
|
+
* const logger = pino(pino.multistream(streams));
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function createPinoMultistream(options: EmailLogOptions, emailTransport: EmailLogTransportService | PinoEmailTransport): PinoMultiStreamTarget[];
|
|
52
|
+
/**
|
|
53
|
+
* Create a Pino logger with email transport already configured
|
|
54
|
+
* This is the simplest way to get started with email logging
|
|
55
|
+
*
|
|
56
|
+
* @param options Email log options
|
|
57
|
+
* @param baseLogger Optional base Pino logger to extend
|
|
58
|
+
* @returns Pino logger with email transport
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { createPinoEmailLogger } from '@nest-omni/core';
|
|
63
|
+
*
|
|
64
|
+
* const logger = createPinoEmailLogger({
|
|
65
|
+
* enabled: true,
|
|
66
|
+
* to: ['admin@example.com'],
|
|
67
|
+
* from: 'noreply@example.com',
|
|
68
|
+
* smtpHost: 'smtp.example.com',
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* logger.error('Something went wrong!', { userId: '123' });
|
|
72
|
+
* // This will log to console AND send an email
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function createPinoEmailLogger(options: EmailLogOptions, baseLogger?: pino.Logger): pino.Logger;
|
|
76
|
+
/**
|
|
77
|
+
* Manually attach email transport to an existing Pino logger
|
|
78
|
+
* Use this if you want to add email logging to a specific logger instance
|
|
79
|
+
*
|
|
80
|
+
* @param logger The Pino logger instance
|
|
81
|
+
* @param options Email log options
|
|
82
|
+
* @param emailTransport The email transport service instance
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { attachEmailTransportToLogger } from '@nest-omni/core';
|
|
87
|
+
*
|
|
88
|
+
* attachEmailTransportToLogger(myLogger, options, emailTransport);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare function attachEmailTransportToLogger(logger: pino.Logger, options: EmailLogOptions, emailTransport: EmailLogTransportService | PinoEmailTransport): void;
|
|
92
|
+
/**
|
|
93
|
+
* Create a child logger with email context
|
|
94
|
+
* Useful for adding consistent metadata to all logs from a module
|
|
95
|
+
*
|
|
96
|
+
* @param parentLogger The parent Pino logger
|
|
97
|
+
* @param context Context object to include in all logs
|
|
98
|
+
* @returns Child Pino logger
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* import { createPinoEmailLogger, createPinoEmailChildLogger } from '@nest-omni/core';
|
|
103
|
+
*
|
|
104
|
+
* const baseLogger = createPinoEmailLogger(options);
|
|
105
|
+
* const userServiceLogger = createPinoEmailChildLogger(baseLogger, {
|
|
106
|
+
* module: 'UserService',
|
|
107
|
+
* version: '1.0.0',
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* userServiceLogger.error('User creation failed', { userId: '123' });
|
|
111
|
+
* // Email will include: module, version, userId in context
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function createPinoEmailChildLogger(parentLogger: pino.Logger, context: Record<string, any>): pino.Logger;
|
|
115
|
+
/**
|
|
116
|
+
* Configure Pino email transport from environment variables
|
|
117
|
+
* This is a convenience function that reads from process.env
|
|
118
|
+
*
|
|
119
|
+
* @returns PinoEmailTransport instance or null if not configured
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* import { createEmailTransportFromEnv } from '@nest-omni/core';
|
|
124
|
+
* import pino from 'pino';
|
|
125
|
+
*
|
|
126
|
+
* const emailTransport = createEmailTransportFromEnv();
|
|
127
|
+
* const logger = emailTransport
|
|
128
|
+
* ? pino(pino.multistream([
|
|
129
|
+
* { level: 'trace', stream: process.stdout },
|
|
130
|
+
* { level: 'error', stream: emailTransport },
|
|
131
|
+
* ]))
|
|
132
|
+
* : pino();
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare function createEmailTransportFromEnv(): PinoEmailTransport | null;
|