@breadstone/archipel-mcp 0.0.22 → 0.0.25
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/README.md +32 -13
- package/data/guides/ai-text-generation.md +16 -24
- package/data/guides/caching.md +33 -0
- package/data/guides/email-delivery.md +27 -1
- package/data/guides/email-templates.md +49 -39
- package/data/guides/esigning-integration.md +11 -5
- package/data/guides/health-indicators.md +220 -0
- package/data/guides/index.md +2 -0
- package/data/guides/queue-infrastructure.md +329 -0
- package/data/guides/telemetry-and-observability.md +20 -0
- package/data/packages/platform-analytics/api/Class.AnalyticsClientPort.md +20 -0
- package/data/packages/platform-analytics/api/Class.AnalyticsHealthIndicator.md +78 -0
- package/data/packages/platform-analytics/api/Class.AppInsightsAnalyticsClient.md +24 -0
- package/data/packages/platform-analytics/api/Class.DatadogAnalyticsClient.md +24 -0
- package/data/packages/platform-analytics/api/Class.NoopAnalyticsClient.md +24 -0
- package/data/packages/platform-analytics/api/Class.SentryAnalyticsClient.md +24 -0
- package/data/packages/platform-analytics/api/index.md +1 -0
- package/data/packages/platform-analytics/index.md +25 -1
- package/data/packages/platform-authentication/api/Class.AuthenticationHealthIndicator.md +68 -0
- package/data/packages/platform-authentication/api/Interface.IMfaSubjectUpdate.md +1 -1
- package/data/packages/platform-authentication/api/index.md +2 -1
- package/data/packages/platform-authentication/index.md +25 -1
- package/data/packages/platform-blob-storage/api/Class.BlobHealthIndicator.md +7 -7
- package/data/packages/platform-blob-storage/api/Class.BlobModule.md +2 -2
- package/data/packages/platform-blob-storage/api/Interface.IAwsS3BlobProviderRegistration.md +3 -3
- package/data/packages/platform-blob-storage/api/Interface.IAzureBlobProviderRegistration.md +3 -3
- package/data/packages/platform-blob-storage/api/Interface.IBlobModuleOptions.md +5 -5
- package/data/packages/platform-blob-storage/api/Interface.ICustomBlobProviderRegistration.md +3 -3
- package/data/packages/platform-blob-storage/api/Interface.IVercelBlobProviderRegistration.md +3 -3
- package/data/packages/platform-blob-storage/api/TypeAlias.IBlobProviderRegistration.md +1 -1
- package/data/packages/platform-blob-storage/api/index.md +1 -1
- package/data/packages/platform-blob-storage/index.md +19 -14
- package/data/packages/platform-caching/api/Class.MemoryLayeredCache.md +10 -10
- package/data/packages/platform-caching/api/Class.NoopCacheMetricsRecorder.md +6 -6
- package/data/packages/platform-caching/api/Class.RedisLayeredCache.md +13 -13
- package/data/packages/platform-caching/api/Interface.ILayeredCache.md +9 -9
- package/data/packages/platform-caching/api/Interface.ILayeredCacheOptions.md +6 -6
- package/data/packages/platform-caching/api/Variable.CACHE_DEFAULT_TTL_MS.md +14 -0
- package/data/packages/platform-caching/api/Variable.CACHE_MAX_ENTRIES.md +14 -0
- package/data/packages/platform-caching/api/Variable.CACHE_STALE_WHILE_REVALIDATE.md +14 -0
- package/data/packages/platform-caching/api/Variable.PLATFORM_CACHING_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-caching/api/Variable.REDIS_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-caching/api/Variable.REDIS_KEY_PREFIX.md +14 -0
- package/data/packages/platform-caching/api/Variable.REDIS_TTL_SECONDS.md +14 -0
- package/data/packages/platform-caching/api/Variable.REDIS_URL.md +14 -0
- package/data/packages/platform-caching/api/index.md +13 -0
- package/data/packages/platform-caching/index.md +47 -1
- package/data/packages/platform-configuration/api/Function.createConfigKey.md +1 -1
- package/data/packages/platform-core/api/Class.HttpLoggerMiddleware.md +3 -3
- package/data/packages/platform-core/api/Function.maskSensitive.md +26 -0
- package/data/packages/platform-core/api/Function.maskSensitiveFields.md +26 -0
- package/data/packages/platform-core/api/index.md +2 -0
- package/data/packages/platform-core/index.md +11 -0
- package/data/packages/platform-database/api/Class.DatabaseHealthIndicator.md +8 -6
- package/data/packages/platform-database/api/Class.DatabaseModule.md +3 -3
- package/data/packages/platform-database/api/Class.RepositoryBase.md +20 -20
- package/data/packages/platform-database/api/Function.paginator.md +1 -1
- package/data/packages/platform-database/api/Interface.IDatabaseModuleConfig.md +3 -3
- package/data/packages/platform-database/api/TypeAlias.DelegateArgs.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.DelegateReturnTypes.md +1 -1
- package/data/packages/platform-database/api/TypeAlias.PaginateFunction.md +1 -1
- package/data/packages/platform-database/api/Variable.DATABASE_MODULE_CONFIG.md +1 -1
- package/data/packages/platform-database/index.md +17 -5
- package/data/packages/platform-documents/api/Class.DocumentEngine.md +9 -5
- package/data/packages/platform-documents/index.md +1 -1
- package/data/packages/platform-esigning/api/Class.AdobeSignEsigningProvider.md +24 -0
- package/data/packages/platform-esigning/api/Class.DocuSignEsigningProvider.md +24 -0
- package/data/packages/platform-esigning/api/Class.DropboxSignEsigningProvider.md +24 -0
- package/data/packages/platform-esigning/api/Class.EsigningClientPort.md +20 -0
- package/data/packages/platform-esigning/api/Class.EsigningHealthIndicator.md +78 -0
- package/data/packages/platform-esigning/api/Class.InternalEsigningProvider.md +24 -0
- package/data/packages/platform-esigning/api/index.md +1 -0
- package/data/packages/platform-esigning/index.md +26 -2
- package/data/packages/platform-health/api/Class.HealthModule.md +42 -0
- package/data/packages/platform-health/api/Class.HealthOrchestrator.md +64 -0
- package/data/packages/platform-health/api/Interface.IHealthCheckResult.md +46 -0
- package/data/packages/platform-health/api/Interface.IHealthIndicator.md +41 -0
- package/data/packages/platform-health/api/Variable.HEALTH_INDICATORS_TOKEN.md +14 -0
- package/data/packages/platform-health/api/index.md +26 -0
- package/data/packages/platform-health/index.md +19 -8
- package/data/packages/platform-intelligence/api/Class.IntelligenceHealthIndicator.md +78 -0
- package/data/packages/platform-intelligence/api/index.md +1 -0
- package/data/packages/platform-intelligence/index.md +24 -1
- package/data/packages/platform-logging/api/Class.ContextLogger.md +152 -0
- package/data/packages/platform-logging/api/Class.LoggerModule.md +8 -2
- package/data/packages/platform-logging/api/Class.RequestContextStore.md +90 -0
- package/data/packages/platform-logging/api/Class.RequestIdMiddleware.md +68 -0
- package/data/packages/platform-logging/api/Interface.IRequestContext.md +34 -0
- package/data/packages/platform-logging/api/Variable.REQUEST_ID_HEADER.md +14 -0
- package/data/packages/platform-logging/api/index.md +11 -1
- package/data/packages/platform-logging/index.md +89 -7
- package/data/packages/platform-mailing/api/Class.MailHealthIndicator.md +5 -5
- package/data/packages/platform-mailing/api/Class.MailModule.md +28 -1
- package/data/packages/platform-mailing/api/Class.MailVerificationService.md +49 -16
- package/data/packages/platform-mailing/api/Class.SmtpConnectionVerifier.md +84 -0
- package/data/packages/platform-mailing/api/Interface.IMailModuleOptions.md +36 -0
- package/data/packages/platform-mailing/api/index.md +3 -1
- package/data/packages/platform-mailing/index.md +64 -8
- package/data/packages/platform-mapping/api/Class.MappingBuilder.md +110 -0
- package/data/packages/platform-mapping/api/Class.MappingError.md +56 -0
- package/data/packages/platform-mapping/api/Class.MappingModule.md +46 -0
- package/data/packages/platform-mapping/api/Class.MappingNotRegisteredError.md +52 -0
- package/data/packages/platform-mapping/api/Class.MappingProfileBase.md +52 -0
- package/data/packages/platform-mapping/api/Class.MappingService.md +284 -0
- package/data/packages/platform-mapping/api/Class.TypeMappingNotRegisteredError.md +53 -0
- package/data/packages/platform-mapping/api/Function.createMappingKey.md +39 -0
- package/data/packages/platform-mapping/api/Interface.IMappingBuilder.md +76 -0
- package/data/packages/platform-mapping/api/Interface.IMappingKey.md +58 -0
- package/data/packages/platform-mapping/api/Interface.IMappingProfile.md +32 -0
- package/data/packages/platform-mapping/api/TypeAlias.Constructor.md +28 -0
- package/data/packages/platform-mapping/api/index.md +38 -0
- package/data/packages/platform-mapping/index.md +1 -1
- package/data/packages/platform-mcp/api/Class.McpHealthIndicator.md +78 -0
- package/data/packages/platform-mcp/api/index.md +1 -0
- package/data/packages/platform-mcp/index.md +24 -1
- package/data/packages/platform-openapi/api/Function.SwaggerFeature.md +2 -2
- package/data/packages/platform-openapi/api/Function.getSwaggerFeatureMetadata.md +2 -2
- package/data/packages/platform-payments/api/Class.LemonSqueezyClient.md +24 -0
- package/data/packages/platform-payments/api/Class.MollieClient.md +24 -0
- package/data/packages/platform-payments/api/Class.PaddleClient.md +24 -0
- package/data/packages/platform-payments/api/Class.PaymentClientPort.md +20 -0
- package/data/packages/platform-payments/api/Class.PaymentHealthIndicator.md +78 -0
- package/data/packages/platform-payments/api/Class.StripeClient.md +28 -4
- package/data/packages/platform-payments/api/index.md +1 -0
- package/data/packages/platform-payments/index.md +26 -2
- package/data/packages/platform-queue/api/Class.AzureQueue.md +221 -0
- package/data/packages/platform-queue/api/Class.BullMqQueue.md +220 -0
- package/data/packages/platform-queue/api/Class.MemoryQueue.md +194 -0
- package/data/packages/platform-queue/api/Class.QueueError.md +51 -0
- package/data/packages/platform-queue/api/Class.QueueHealthIndicator.md +68 -0
- package/data/packages/platform-queue/api/Class.QueueJobNotFoundError.md +43 -0
- package/data/packages/platform-queue/api/Class.QueueJobStateError.md +48 -0
- package/data/packages/platform-queue/api/Class.QueueValidationError.md +43 -0
- package/data/packages/platform-queue/api/Interface.IAzureQueueOptions.md +48 -0
- package/data/packages/platform-queue/api/Interface.IBullMqQueueOptions.md +45 -0
- package/data/packages/platform-queue/api/Interface.IMemoryQueueOptions.md +32 -0
- package/data/packages/platform-queue/api/Interface.IQueue.md +173 -0
- package/data/packages/platform-queue/api/Interface.IQueueJob.md +139 -0
- package/data/packages/platform-queue/api/TypeAlias.QueueJobStatus.md +14 -0
- package/data/packages/platform-queue/api/Variable.AZURE_CONFIG_ENTRIES.md +17 -0
- package/data/packages/platform-queue/api/Variable.AZURE_CONNECTION_STRING.md +14 -0
- package/data/packages/platform-queue/api/Variable.AZURE_RECEIVE_WAIT_MS.md +21 -0
- package/data/packages/platform-queue/api/Variable.BULLMQ_CONFIG_ENTRIES.md +17 -0
- package/data/packages/platform-queue/api/Variable.BULLMQ_PREFIX.md +18 -0
- package/data/packages/platform-queue/api/Variable.BULLMQ_REDIS_URL.md +21 -0
- package/data/packages/platform-queue/api/Variable.PLATFORM_QUEUE_CONFIG_ENTRIES.md +17 -0
- package/data/packages/platform-queue/api/Variable.QUEUE_JOB_STATUS.md +30 -0
- package/data/packages/platform-queue/api/Variable.QUEUE_MAX_JOBS.md +21 -0
- package/data/packages/platform-queue/api/index.md +49 -0
- package/data/packages/platform-queue/index.md +168 -0
- package/data/packages/platform-resources/api/Class.BlobResourceStrategy.md +195 -0
- package/data/packages/platform-resources/api/Class.EmbeddedResourceStrategy.md +215 -0
- package/data/packages/platform-resources/api/Class.FileResourceStrategy.md +190 -0
- package/data/packages/platform-resources/api/Class.ResourceManager.md +477 -0
- package/data/packages/platform-resources/api/Class.ResourceModule.md +46 -0
- package/data/packages/platform-resources/api/Class.ResourceNotFoundError.md +60 -0
- package/data/packages/platform-resources/api/Interface.IBlobResourceStrategyConfig.md +28 -0
- package/data/packages/platform-resources/api/Interface.IBlobServiceAdapter.md +40 -0
- package/data/packages/platform-resources/api/Interface.IFileResourceStrategyConfig.md +72 -0
- package/data/packages/platform-resources/api/Interface.IResourceManagerConfig.md +89 -0
- package/data/packages/platform-resources/api/Interface.IResourceMetadata.md +94 -0
- package/data/packages/platform-resources/api/Interface.IResourceResult.md +34 -0
- package/data/packages/platform-resources/api/Interface.IResourceStrategy.md +134 -0
- package/data/packages/platform-resources/api/index.md +29 -0
- package/data/packages/platform-resources/index.md +1 -1
- package/data/packages/platform-telemetry/api/Class.OtelSdkHolder.md +21 -3
- package/data/packages/platform-telemetry/api/Class.TelemetryHealthIndicator.md +78 -0
- package/data/packages/platform-telemetry/api/index.md +1 -0
- package/data/packages/platform-telemetry/index.md +25 -1
- package/data/patterns/config-pattern.md +5 -3
- package/package.json +2 -2
- package/src/tools/registerGetConfigPatternTool.js +1 -1
- package/src/tools/registerGetDtoPatternTool.js +1 -1
- package/src/tools/registerGetErrorHandlingPatternTool.js +1 -1
- package/src/tools/registerGetGuardPatternTool.js +1 -1
- package/src/tools/registerGetMappingPatternTool.js +1 -1
- package/src/tools/registerGetModulePatternTool.js +1 -1
- package/src/tools/registerGetQueryPatternTool.js +1 -1
- package/src/tools/registerGetRepositoryPatternTool.js +1 -1
- package/src/tools/registerGetTestingPatternTool.js +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Class: RequestIdMiddleware'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Class: RequestIdMiddleware
|
|
7
|
+
|
|
8
|
+
Defined in: [RequestIdMiddleware.ts:27](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestIdMiddleware.ts#L27)
|
|
9
|
+
|
|
10
|
+
NestJS middleware that extracts or generates a unique request ID
|
|
11
|
+
and stores it in the [RequestContextStore](Class.RequestContextStore) via `AsyncLocalStorage`.
|
|
12
|
+
|
|
13
|
+
## Remarks
|
|
14
|
+
|
|
15
|
+
If the incoming request already carries a `x-request-id` header (e.g. from
|
|
16
|
+
an API gateway or load balancer), the middleware reuses that value.
|
|
17
|
+
Otherwise it generates a new UUID v4.
|
|
18
|
+
|
|
19
|
+
The request ID is also set on the response headers for traceability.
|
|
20
|
+
|
|
21
|
+
## Implements
|
|
22
|
+
|
|
23
|
+
- `NestMiddleware`
|
|
24
|
+
|
|
25
|
+
## Constructors
|
|
26
|
+
|
|
27
|
+
### Constructor
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
new RequestIdMiddleware(): RequestIdMiddleware;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Returns
|
|
34
|
+
|
|
35
|
+
`RequestIdMiddleware`
|
|
36
|
+
|
|
37
|
+
## Methods
|
|
38
|
+
|
|
39
|
+
### use()
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
use(
|
|
43
|
+
req,
|
|
44
|
+
res,
|
|
45
|
+
next): void;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Defined in: [RequestIdMiddleware.ts:33](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestIdMiddleware.ts#L33)
|
|
49
|
+
|
|
50
|
+
#### Parameters
|
|
51
|
+
|
|
52
|
+
| Parameter | Type |
|
|
53
|
+
| ------ | ------ |
|
|
54
|
+
| `req` | `Request` |
|
|
55
|
+
| `res` | `Response` |
|
|
56
|
+
| `next` | (`error?`) => `void` |
|
|
57
|
+
|
|
58
|
+
#### Returns
|
|
59
|
+
|
|
60
|
+
`void`
|
|
61
|
+
|
|
62
|
+
#### Inherit Doc
|
|
63
|
+
|
|
64
|
+
#### Implementation of
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
NestMiddleware.use
|
|
68
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: IRequestContext'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: IRequestContext
|
|
7
|
+
|
|
8
|
+
Defined in: [RequestContextStore.ts:12](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L12)
|
|
9
|
+
|
|
10
|
+
Shape of the per-request context stored in [RequestContextStore](Class.RequestContextStore).
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
### requestId
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
readonly requestId: string;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Defined in: [RequestContextStore.ts:14](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L14)
|
|
21
|
+
|
|
22
|
+
Unique request correlation identifier.
|
|
23
|
+
|
|
24
|
+
***
|
|
25
|
+
|
|
26
|
+
### userId?
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
readonly optional userId?: string;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Defined in: [RequestContextStore.ts:17](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L17)
|
|
33
|
+
|
|
34
|
+
Optional authenticated user identifier.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Variable: REQUEST\_ID\_HEADER'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Variable: REQUEST\_ID\_HEADER
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
const REQUEST_ID_HEADER: "x-request-id" = 'x-request-id';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Defined in: [RequestIdMiddleware.ts:11](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestIdMiddleware.ts#L11)
|
|
13
|
+
|
|
14
|
+
Header name used to propagate the request correlation ID.
|
|
@@ -9,7 +9,16 @@ editUrl: false
|
|
|
9
9
|
|
|
10
10
|
| Class | Description |
|
|
11
11
|
| ------ | ------ |
|
|
12
|
-
| [
|
|
12
|
+
| [ContextLogger](Class.ContextLogger) | Structured logger that automatically enriches log entries with the current request context (requestId, userId) from [RequestContextStore](Class.RequestContextStore). |
|
|
13
|
+
| [LoggerModule](Class.LoggerModule) | Global logging module that configures the NestJS Logger with an application-wide log level and provides request-scoped context propagation via [RequestIdMiddleware](Class.RequestIdMiddleware). |
|
|
14
|
+
| [RequestContextStore](Class.RequestContextStore) | AsyncLocalStorage-based request context store. |
|
|
15
|
+
| [RequestIdMiddleware](Class.RequestIdMiddleware) | NestJS middleware that extracts or generates a unique request ID and stores it in the [RequestContextStore](Class.RequestContextStore) via `AsyncLocalStorage`. |
|
|
16
|
+
|
|
17
|
+
## Interfaces
|
|
18
|
+
|
|
19
|
+
| Interface | Description |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| [IRequestContext](Interface.IRequestContext) | Shape of the per-request context stored in [RequestContextStore](Class.RequestContextStore). |
|
|
13
22
|
|
|
14
23
|
## Variables
|
|
15
24
|
|
|
@@ -17,3 +26,4 @@ editUrl: false
|
|
|
17
26
|
| ------ | ------ |
|
|
18
27
|
| [APP\_LOG\_LEVEL](Variable.APP_LOG_LEVEL) | Application log level (e.g. `'debug'`, `'info'`, `'warn'`, `'error'`). |
|
|
19
28
|
| [PLATFORM\_LOGGING\_CONFIG\_ENTRIES](Variable.PLATFORM_LOGGING_CONFIG_ENTRIES) | All configuration entries required by `platform-logging`. |
|
|
29
|
+
| [REQUEST\_ID\_HEADER](Variable.REQUEST_ID_HEADER) | Header name used to propagate the request correlation ID. |
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: platform-logging
|
|
3
|
-
description: Configurable logging module for NestJS with log-level management.
|
|
3
|
+
description: Configurable logging module for NestJS with log-level management, request context propagation, and structured logging.
|
|
4
4
|
order: 6
|
|
5
|
-
tags: [logging, log-level, nestjs]
|
|
5
|
+
tags: [logging, log-level, nestjs, request-context, structured-logging, correlation-id]
|
|
6
6
|
package: '@breadstone/archipel-platform-logging'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# platform-logging
|
|
10
10
|
|
|
11
|
-
Configurable logging module for NestJS applications with application-wide log-level management. Wraps the built-in NestJS `Logger` and configures it via the central `ConfigModule`.
|
|
11
|
+
Configurable logging module for NestJS applications with application-wide log-level management, request-scoped context propagation, and structured logging. Wraps the built-in NestJS `Logger` and configures it via the central `ConfigModule`.
|
|
12
12
|
|
|
13
13
|
**Package:** `@breadstone/archipel-platform-logging`
|
|
14
14
|
|
|
@@ -48,6 +48,75 @@ export class PaymentService {
|
|
|
48
48
|
|
|
49
49
|
---
|
|
50
50
|
|
|
51
|
+
## Request Context Propagation
|
|
52
|
+
|
|
53
|
+
### RequestIdMiddleware
|
|
54
|
+
|
|
55
|
+
Extracts or generates a unique `x-request-id` per request and stores it in `AsyncLocalStorage` via `RequestContextStore`. Apply it globally:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { RequestIdMiddleware } from '@breadstone/archipel-platform-logging';
|
|
59
|
+
|
|
60
|
+
export class AppModule implements NestModule {
|
|
61
|
+
public configure(consumer: MiddlewareConsumer): void {
|
|
62
|
+
consumer.apply(RequestIdMiddleware).forRoutes('*');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The middleware:
|
|
68
|
+
|
|
69
|
+
1. Reads the `x-request-id` header from the incoming request (if present from an API gateway or load balancer)
|
|
70
|
+
2. Generates a UUID v4 if no header is found
|
|
71
|
+
3. Sets the `x-request-id` header on the response
|
|
72
|
+
4. Wraps the request execution in `RequestContextStore.run()` so the ID is available anywhere in the call stack
|
|
73
|
+
|
|
74
|
+
### RequestContextStore
|
|
75
|
+
|
|
76
|
+
`AsyncLocalStorage`-based per-request context store. Access the current request context from anywhere without passing parameters:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { RequestContextStore, type IRequestContext } from '@breadstone/archipel-platform-logging';
|
|
80
|
+
|
|
81
|
+
// Get current context
|
|
82
|
+
const context: IRequestContext | undefined = RequestContextStore.get();
|
|
83
|
+
const requestId: string | undefined = RequestContextStore.getRequestId();
|
|
84
|
+
|
|
85
|
+
// Run a callback within a context (used internally by middleware)
|
|
86
|
+
RequestContextStore.run({ requestId: 'abc-123', userId: 'user-1' }, () => {
|
|
87
|
+
// context is available in all nested calls
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### IRequestContext
|
|
92
|
+
|
|
93
|
+
| Field | Type | Description |
|
|
94
|
+
| ----------- | -------- | --------------------------------- |
|
|
95
|
+
| `requestId` | `string` | Unique request correlation ID |
|
|
96
|
+
| `userId` | `string?`| Optional authenticated user ID |
|
|
97
|
+
|
|
98
|
+
### ContextLogger
|
|
99
|
+
|
|
100
|
+
Structured logger that automatically enriches every log entry with the current request context:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { ContextLogger } from '@breadstone/archipel-platform-logging';
|
|
104
|
+
|
|
105
|
+
@Injectable()
|
|
106
|
+
export class OrderService {
|
|
107
|
+
private readonly _logger = new ContextLogger(OrderService.name);
|
|
108
|
+
|
|
109
|
+
public async placeOrder(dto: CreateOrderDto): Promise<void> {
|
|
110
|
+
this._logger.log('Placing order', { orderId: dto.orderId });
|
|
111
|
+
// Output: { requestId: "abc-123", userId: "user-1", orderId: "...", message: "Placing order" }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Methods: `log()`, `warn()`, `error()`, `debug()`, `verbose()` — all accept an optional `data` record that is merged with the request context.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
51
120
|
## Environment Variables
|
|
52
121
|
|
|
53
122
|
| Variable | Description | Required | Default |
|
|
@@ -58,9 +127,22 @@ export class PaymentService {
|
|
|
58
127
|
|
|
59
128
|
---
|
|
60
129
|
|
|
130
|
+
## Peer Dependencies
|
|
131
|
+
|
|
132
|
+
| Package | Required | Notes |
|
|
133
|
+
| --------- | -------- | ---------------------------------------------- |
|
|
134
|
+
| `express` | Yes | Required for `RequestIdMiddleware` types (`Request`, `Response`) |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
61
138
|
## Exports Summary
|
|
62
139
|
|
|
63
|
-
| Export
|
|
64
|
-
|
|
|
65
|
-
| `LoggerModule`
|
|
66
|
-
| `Logger`
|
|
140
|
+
| Export | Type | Description |
|
|
141
|
+
| ----------------------- | ------------- | ------------------------------------------------------------------ |
|
|
142
|
+
| `LoggerModule` | NestJS Module | Global logging module with log-level control |
|
|
143
|
+
| `Logger` | Provider | NestJS Logger configured with `APP_LOG_LEVEL` |
|
|
144
|
+
| `ContextLogger` | Class | Structured logger enriched with request context |
|
|
145
|
+
| `RequestContextStore` | Class | AsyncLocalStorage-based per-request context (requestId, userId) |
|
|
146
|
+
| `RequestIdMiddleware` | Middleware | Extracts/generates `x-request-id` and wraps in context store |
|
|
147
|
+
| `IRequestContext` | Interface | Shape of the per-request context |
|
|
148
|
+
| `REQUEST_ID_HEADER` | Constant | Header name (`'x-request-id'`) |
|
|
@@ -5,7 +5,7 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: MailHealthIndicator
|
|
7
7
|
|
|
8
|
-
Defined in:
|
|
8
|
+
Defined in: platform-mailing/src/health/MailHealthIndicator.ts:17
|
|
9
9
|
|
|
10
10
|
Health indicator for mail service.
|
|
11
11
|
|
|
@@ -21,7 +21,7 @@ Health indicator for mail service.
|
|
|
21
21
|
new MailHealthIndicator(configService): MailHealthIndicator;
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Defined in:
|
|
24
|
+
Defined in: platform-mailing/src/health/MailHealthIndicator.ts:31
|
|
25
25
|
|
|
26
26
|
Constructs a new instance of the `MailHealthIndicator` class.
|
|
27
27
|
|
|
@@ -40,10 +40,10 @@ Constructs a new instance of the `MailHealthIndicator` class.
|
|
|
40
40
|
### key
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
|
-
readonly key:
|
|
43
|
+
readonly key: string = 'mail';
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Defined in:
|
|
46
|
+
Defined in: platform-mailing/src/health/MailHealthIndicator.ts:39
|
|
47
47
|
|
|
48
48
|
Unique key identifying the indicator
|
|
49
49
|
|
|
@@ -61,7 +61,7 @@ IHealthIndicator.key
|
|
|
61
61
|
check(): HealthIndicatorResult<"mail">;
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Defined in:
|
|
64
|
+
Defined in: platform-mailing/src/health/MailHealthIndicator.ts:51
|
|
65
65
|
|
|
66
66
|
Checks if the mail configuration is valid.
|
|
67
67
|
|
|
@@ -5,10 +5,13 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: MailModule
|
|
7
7
|
|
|
8
|
-
Defined in: [platform-mailing/src/tokens/MailModule.ts:
|
|
8
|
+
Defined in: [platform-mailing/src/tokens/MailModule.ts:46](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/tokens/MailModule.ts#L46)
|
|
9
9
|
|
|
10
10
|
Represents the mail module.
|
|
11
11
|
|
|
12
|
+
Delivery and template strategies are resolved at runtime based on
|
|
13
|
+
configuration keys `MAIL_DELIVERY_STRATEGY` and `MAIL_TEMPLATE_STRATEGY`.
|
|
14
|
+
|
|
12
15
|
## Constructors
|
|
13
16
|
|
|
14
17
|
### Constructor
|
|
@@ -20,3 +23,27 @@ new MailModule(): MailModule;
|
|
|
20
23
|
#### Returns
|
|
21
24
|
|
|
22
25
|
`MailModule`
|
|
26
|
+
|
|
27
|
+
## Methods
|
|
28
|
+
|
|
29
|
+
### register()
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
static register(options?): DynamicModule;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Defined in: [platform-mailing/src/tokens/MailModule.ts:55](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/tokens/MailModule.ts#L55)
|
|
36
|
+
|
|
37
|
+
Registers the mail module with optional configuration.
|
|
38
|
+
|
|
39
|
+
#### Parameters
|
|
40
|
+
|
|
41
|
+
| Parameter | Type | Description |
|
|
42
|
+
| ------ | ------ | ------ |
|
|
43
|
+
| `options?` | [`IMailModuleOptions`](Interface.IMailModuleOptions) | Module registration options. |
|
|
44
|
+
|
|
45
|
+
#### Returns
|
|
46
|
+
|
|
47
|
+
`DynamicModule`
|
|
48
|
+
|
|
49
|
+
A configured `DynamicModule`.
|
|
@@ -5,16 +5,16 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# ~~Class: MailVerificationService~~
|
|
7
7
|
|
|
8
|
-
Defined in: [platform-mailing/src/services/MailVerificationService.ts:
|
|
9
|
-
|
|
10
|
-
Verifies SMTP server connectivity. Does **not** validate individual email
|
|
11
|
-
addresses — only checks whether the configured SMTP transport is reachable.
|
|
8
|
+
Defined in: [platform-mailing/src/services/MailVerificationService.ts:15](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/MailVerificationService.ts#L15)
|
|
12
9
|
|
|
13
10
|
## Deprecated
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
Use [SmtpConnectionVerifier](Class.SmtpConnectionVerifier) instead. This class will be
|
|
13
|
+
removed in a future major release.
|
|
14
|
+
|
|
15
|
+
## Extends
|
|
16
|
+
|
|
17
|
+
- [`SmtpConnectionVerifier`](Class.SmtpConnectionVerifier)
|
|
18
18
|
|
|
19
19
|
## Constructors
|
|
20
20
|
|
|
@@ -24,9 +24,9 @@ than calling it directly.
|
|
|
24
24
|
new MailVerificationService(configService): MailVerificationService;
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Defined in: [platform-mailing/src/services/
|
|
27
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:32](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L32)
|
|
28
28
|
|
|
29
|
-
Constructs a new instance of the
|
|
29
|
+
Constructs a new instance of the [SmtpConnectionVerifier](Class.SmtpConnectionVerifier) class.
|
|
30
30
|
|
|
31
31
|
#### Parameters
|
|
32
32
|
|
|
@@ -38,6 +38,10 @@ Constructs a new instance of the `MailVerificationService` class.
|
|
|
38
38
|
|
|
39
39
|
`MailVerificationService`
|
|
40
40
|
|
|
41
|
+
#### Inherited from
|
|
42
|
+
|
|
43
|
+
[`SmtpConnectionVerifier`](Class.SmtpConnectionVerifier).[`constructor`](Class.SmtpConnectionVerifier#constructor)
|
|
44
|
+
|
|
41
45
|
## Methods
|
|
42
46
|
|
|
43
47
|
### ~~sendTestEmail()~~
|
|
@@ -50,9 +54,9 @@ sendTestEmail(
|
|
|
50
54
|
text): Promise<void>;
|
|
51
55
|
```
|
|
52
56
|
|
|
53
|
-
Defined in: [platform-mailing/src/services/
|
|
57
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:74](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L74)
|
|
54
58
|
|
|
55
|
-
Send an email for testing purposes
|
|
59
|
+
Send an email for testing purposes.
|
|
56
60
|
|
|
57
61
|
#### Parameters
|
|
58
62
|
|
|
@@ -67,26 +71,55 @@ Send an email for testing purposes or verification
|
|
|
67
71
|
|
|
68
72
|
`Promise`\<`void`\>
|
|
69
73
|
|
|
74
|
+
#### Inherited from
|
|
75
|
+
|
|
76
|
+
[`SmtpConnectionVerifier`](Class.SmtpConnectionVerifier).[`sendTestEmail`](Class.SmtpConnectionVerifier#sendtestemail)
|
|
77
|
+
|
|
78
|
+
***
|
|
79
|
+
|
|
80
|
+
### ~~verifyConnection()~~
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
verifyConnection(): Promise<boolean>;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:54](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L54)
|
|
87
|
+
|
|
88
|
+
Verifies that the configured SMTP server is reachable.
|
|
89
|
+
|
|
90
|
+
#### Returns
|
|
91
|
+
|
|
92
|
+
`Promise`\<`boolean`\>
|
|
93
|
+
|
|
94
|
+
`true` if the SMTP server is reachable, `false` otherwise.
|
|
95
|
+
|
|
96
|
+
#### Inherited from
|
|
97
|
+
|
|
98
|
+
[`SmtpConnectionVerifier`](Class.SmtpConnectionVerifier).[`verifyConnection`](Class.SmtpConnectionVerifier#verifyconnection)
|
|
99
|
+
|
|
70
100
|
***
|
|
71
101
|
|
|
72
102
|
### ~~verifyEmail()~~
|
|
73
103
|
|
|
74
104
|
```ts
|
|
75
|
-
verifyEmail(
|
|
105
|
+
verifyEmail(_email): Promise<boolean>;
|
|
76
106
|
```
|
|
77
107
|
|
|
78
|
-
Defined in: [platform-mailing/src/services/MailVerificationService.ts:
|
|
108
|
+
Defined in: [platform-mailing/src/services/MailVerificationService.ts:27](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/MailVerificationService.ts#L27)
|
|
79
109
|
|
|
80
|
-
Verifies
|
|
110
|
+
Verifies SMTP server connectivity.
|
|
81
111
|
|
|
82
112
|
#### Parameters
|
|
83
113
|
|
|
84
114
|
| Parameter | Type | Description |
|
|
85
115
|
| ------ | ------ | ------ |
|
|
86
|
-
| `
|
|
116
|
+
| `_email` | `string` | Unused. Kept for backward compatibility. |
|
|
87
117
|
|
|
88
118
|
#### Returns
|
|
89
119
|
|
|
90
120
|
`Promise`\<`boolean`\>
|
|
91
121
|
|
|
92
|
-
|
|
122
|
+
#### Deprecated
|
|
123
|
+
|
|
124
|
+
Use [SmtpConnectionVerifier.verifyConnection](Class.SmtpConnectionVerifier#verifyconnection) instead.
|
|
125
|
+
The `email` parameter was never used.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Class: SmtpConnectionVerifier'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Class: SmtpConnectionVerifier
|
|
7
|
+
|
|
8
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:17](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L17)
|
|
9
|
+
|
|
10
|
+
Verifies SMTP server connectivity. Does **not** validate individual email
|
|
11
|
+
addresses — only checks whether the configured SMTP transport is reachable.
|
|
12
|
+
|
|
13
|
+
## Extended by
|
|
14
|
+
|
|
15
|
+
- [`MailVerificationService`](Class.MailVerificationService)
|
|
16
|
+
|
|
17
|
+
## Constructors
|
|
18
|
+
|
|
19
|
+
### Constructor
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
new SmtpConnectionVerifier(configService): SmtpConnectionVerifier;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:32](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L32)
|
|
26
|
+
|
|
27
|
+
Constructs a new instance of the SmtpConnectionVerifier class.
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
| Parameter | Type |
|
|
32
|
+
| ------ | ------ |
|
|
33
|
+
| `configService` | `ConfigService` |
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`SmtpConnectionVerifier`
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
### sendTestEmail()
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
sendTestEmail(
|
|
45
|
+
from,
|
|
46
|
+
to,
|
|
47
|
+
subject,
|
|
48
|
+
text): Promise<void>;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:74](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L74)
|
|
52
|
+
|
|
53
|
+
Send an email for testing purposes.
|
|
54
|
+
|
|
55
|
+
#### Parameters
|
|
56
|
+
|
|
57
|
+
| Parameter | Type |
|
|
58
|
+
| ------ | ------ |
|
|
59
|
+
| `from` | `string` |
|
|
60
|
+
| `to` | `string` |
|
|
61
|
+
| `subject` | `string` |
|
|
62
|
+
| `text` | `string` |
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`Promise`\<`void`\>
|
|
67
|
+
|
|
68
|
+
***
|
|
69
|
+
|
|
70
|
+
### verifyConnection()
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
verifyConnection(): Promise<boolean>;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Defined in: [platform-mailing/src/services/SmtpConnectionVerifier.ts:54](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/services/SmtpConnectionVerifier.ts#L54)
|
|
77
|
+
|
|
78
|
+
Verifies that the configured SMTP server is reachable.
|
|
79
|
+
|
|
80
|
+
#### Returns
|
|
81
|
+
|
|
82
|
+
`Promise`\<`boolean`\>
|
|
83
|
+
|
|
84
|
+
`true` if the SMTP server is reachable, `false` otherwise.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Interface: IMailModuleOptions'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Interface: IMailModuleOptions
|
|
7
|
+
|
|
8
|
+
Defined in: [platform-mailing/src/tokens/MailModule.ts:23](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/tokens/MailModule.ts#L23)
|
|
9
|
+
|
|
10
|
+
Options for configuring the [MailModule](Class.MailModule).
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
### configEntries?
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
readonly optional configEntries?: readonly Omit<IConfigRegistryEntry<unknown>, "module">[];
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Defined in: [platform-mailing/src/tokens/MailModule.ts:34](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/tokens/MailModule.ts#L34)
|
|
21
|
+
|
|
22
|
+
Additional or overriding configuration entries.
|
|
23
|
+
Merged with the platform default entries.
|
|
24
|
+
|
|
25
|
+
***
|
|
26
|
+
|
|
27
|
+
### isGlobal?
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
readonly optional isGlobal?: boolean;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Defined in: [platform-mailing/src/tokens/MailModule.ts:28](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-mailing/src/tokens/MailModule.ts#L28)
|
|
34
|
+
|
|
35
|
+
Whether to register the module globally.
|
|
36
|
+
Defaults to `true`.
|
|
@@ -16,10 +16,11 @@ editUrl: false
|
|
|
16
16
|
| [MailModule](Class.MailModule) | Represents the mail module. |
|
|
17
17
|
| [MailService](Class.MailService) | Represents the `MailService` class. |
|
|
18
18
|
| [MailTemplateEngine](Class.MailTemplateEngine) | The `MailTemplateEngine` class. |
|
|
19
|
-
| [~~MailVerificationService~~](Class.MailVerificationService) |
|
|
19
|
+
| [~~MailVerificationService~~](Class.MailVerificationService) | - |
|
|
20
20
|
| [PostmarkDeliveryStrategy](Class.PostmarkDeliveryStrategy) | The `PostmarkDeliveryStrategy` class. |
|
|
21
21
|
| [ResendDeliveryStrategy](Class.ResendDeliveryStrategy) | Delivers emails via the Resend API. |
|
|
22
22
|
| [SendGridDeliveryStrategy](Class.SendGridDeliveryStrategy) | Delivers emails via the SendGrid API. |
|
|
23
|
+
| [SmtpConnectionVerifier](Class.SmtpConnectionVerifier) | Verifies SMTP server connectivity. Does **not** validate individual email addresses — only checks whether the configured SMTP transport is reachable. |
|
|
23
24
|
| [SmtpDeliveryStrategy](Class.SmtpDeliveryStrategy) | The `SmtpDeliveryStrategy` class. |
|
|
24
25
|
| [TemplateFetchStrategyBase](Class.TemplateFetchStrategyBase) | Represents the base class for template fetch strategies. |
|
|
25
26
|
|
|
@@ -29,6 +30,7 @@ editUrl: false
|
|
|
29
30
|
| ------ | ------ |
|
|
30
31
|
| [IMailAttachment](Interface.IMailAttachment) | Represents an email attachment. |
|
|
31
32
|
| [IMailEvents](Interface.IMailEvents) | Represents the contract of events emitted by the mail domain. |
|
|
33
|
+
| [IMailModuleOptions](Interface.IMailModuleOptions) | Options for configuring the [MailModule](Class.MailModule). |
|
|
32
34
|
| [IMailTemplateVariants](Interface.IMailTemplateVariants) | Represents the in-memory structure for a single template (multiple formats). |
|
|
33
35
|
|
|
34
36
|
## Type Aliases
|