@breadstone/archipel-mcp 0.0.23 → 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/data/guides/caching.md +33 -0
- package/data/guides/email-delivery.md +27 -1
- 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/index.md +1 -0
- 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 +10 -10
- 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 +18 -7
- 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-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-telemetry/api/Class.OtelSdkHolder.md +20 -2
- 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 +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Class: ContextLogger'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Class: ContextLogger
|
|
7
|
+
|
|
8
|
+
Defined in: [ContextLogger.ts:20](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L20)
|
|
9
|
+
|
|
10
|
+
Structured logger that automatically enriches log entries with the
|
|
11
|
+
current request context (requestId, userId) from [RequestContextStore](Class.RequestContextStore).
|
|
12
|
+
|
|
13
|
+
## Remarks
|
|
14
|
+
|
|
15
|
+
This logger wraps the NestJS Logger and prepends structured
|
|
16
|
+
context fields. It is intended as a drop-in replacement for direct
|
|
17
|
+
`Logger` usage in services that need request-scoped correlation.
|
|
18
|
+
|
|
19
|
+
## Constructors
|
|
20
|
+
|
|
21
|
+
### Constructor
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
new ContextLogger(context?): ContextLogger;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Defined in: [ContextLogger.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L29)
|
|
28
|
+
|
|
29
|
+
#### Parameters
|
|
30
|
+
|
|
31
|
+
| Parameter | Type |
|
|
32
|
+
| ------ | ------ |
|
|
33
|
+
| `context?` | `string` |
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`ContextLogger`
|
|
38
|
+
|
|
39
|
+
## Methods
|
|
40
|
+
|
|
41
|
+
### debug()
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
debug(message, data?): void;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Defined in: [ContextLogger.ts:69](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L69)
|
|
48
|
+
|
|
49
|
+
Logs at `debug` level with request context.
|
|
50
|
+
|
|
51
|
+
#### Parameters
|
|
52
|
+
|
|
53
|
+
| Parameter | Type |
|
|
54
|
+
| ------ | ------ |
|
|
55
|
+
| `message` | `string` |
|
|
56
|
+
| `data?` | `Record`\<`string`, `unknown`\> |
|
|
57
|
+
|
|
58
|
+
#### Returns
|
|
59
|
+
|
|
60
|
+
`void`
|
|
61
|
+
|
|
62
|
+
***
|
|
63
|
+
|
|
64
|
+
### error()
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
error(message, data?): void;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Defined in: [ContextLogger.ts:60](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L60)
|
|
71
|
+
|
|
72
|
+
Logs at `error` level with request context.
|
|
73
|
+
|
|
74
|
+
#### Parameters
|
|
75
|
+
|
|
76
|
+
| Parameter | Type |
|
|
77
|
+
| ------ | ------ |
|
|
78
|
+
| `message` | `string` |
|
|
79
|
+
| `data?` | `Record`\<`string`, `unknown`\> |
|
|
80
|
+
|
|
81
|
+
#### Returns
|
|
82
|
+
|
|
83
|
+
`void`
|
|
84
|
+
|
|
85
|
+
***
|
|
86
|
+
|
|
87
|
+
### log()
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
log(message, data?): void;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Defined in: [ContextLogger.ts:42](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L42)
|
|
94
|
+
|
|
95
|
+
Logs at `log` level with request context.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
| Parameter | Type |
|
|
100
|
+
| ------ | ------ |
|
|
101
|
+
| `message` | `string` |
|
|
102
|
+
| `data?` | `Record`\<`string`, `unknown`\> |
|
|
103
|
+
|
|
104
|
+
#### Returns
|
|
105
|
+
|
|
106
|
+
`void`
|
|
107
|
+
|
|
108
|
+
***
|
|
109
|
+
|
|
110
|
+
### verbose()
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
verbose(message, data?): void;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Defined in: [ContextLogger.ts:78](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L78)
|
|
117
|
+
|
|
118
|
+
Logs at `verbose` level with request context.
|
|
119
|
+
|
|
120
|
+
#### Parameters
|
|
121
|
+
|
|
122
|
+
| Parameter | Type |
|
|
123
|
+
| ------ | ------ |
|
|
124
|
+
| `message` | `string` |
|
|
125
|
+
| `data?` | `Record`\<`string`, `unknown`\> |
|
|
126
|
+
|
|
127
|
+
#### Returns
|
|
128
|
+
|
|
129
|
+
`void`
|
|
130
|
+
|
|
131
|
+
***
|
|
132
|
+
|
|
133
|
+
### warn()
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
warn(message, data?): void;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Defined in: [ContextLogger.ts:51](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/ContextLogger.ts#L51)
|
|
140
|
+
|
|
141
|
+
Logs at `warn` level with request context.
|
|
142
|
+
|
|
143
|
+
#### Parameters
|
|
144
|
+
|
|
145
|
+
| Parameter | Type |
|
|
146
|
+
| ------ | ------ |
|
|
147
|
+
| `message` | `string` |
|
|
148
|
+
| `data?` | `Record`\<`string`, `unknown`\> |
|
|
149
|
+
|
|
150
|
+
#### Returns
|
|
151
|
+
|
|
152
|
+
`void`
|
|
@@ -5,9 +5,15 @@ editUrl: false
|
|
|
5
5
|
---
|
|
6
6
|
# Class: LoggerModule
|
|
7
7
|
|
|
8
|
-
Defined in: [LoggerModule.ts:
|
|
8
|
+
Defined in: [LoggerModule.ts:44](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/LoggerModule.ts#L44)
|
|
9
9
|
|
|
10
|
-
Global logging module that configures the NestJS Logger with an application-wide log level
|
|
10
|
+
Global logging module that configures the NestJS Logger with an application-wide log level
|
|
11
|
+
and provides request-scoped context propagation via [RequestIdMiddleware](Class.RequestIdMiddleware).
|
|
12
|
+
|
|
13
|
+
## Remarks
|
|
14
|
+
|
|
15
|
+
Apply [RequestIdMiddleware](Class.RequestIdMiddleware) in your `AppModule.configure()` to enable
|
|
16
|
+
automatic `requestId` propagation to all log entries via [ContextLogger](Class.ContextLogger).
|
|
11
17
|
|
|
12
18
|
## Constructors
|
|
13
19
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Class: RequestContextStore'
|
|
3
|
+
generated: true
|
|
4
|
+
editUrl: false
|
|
5
|
+
---
|
|
6
|
+
# Class: RequestContextStore
|
|
7
|
+
|
|
8
|
+
Defined in: [RequestContextStore.ts:29](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L29)
|
|
9
|
+
|
|
10
|
+
AsyncLocalStorage-based request context store.
|
|
11
|
+
|
|
12
|
+
Provides a per-request context accessible anywhere in the call stack
|
|
13
|
+
without passing parameters explicitly. This is the foundation for
|
|
14
|
+
structured logging with automatic `requestId` propagation.
|
|
15
|
+
|
|
16
|
+
## Constructors
|
|
17
|
+
|
|
18
|
+
### Constructor
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
new RequestContextStore(): RequestContextStore;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### Returns
|
|
25
|
+
|
|
26
|
+
`RequestContextStore`
|
|
27
|
+
|
|
28
|
+
## Methods
|
|
29
|
+
|
|
30
|
+
### get()
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
static get(): IRequestContext | undefined;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Defined in: [RequestContextStore.ts:57](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L57)
|
|
37
|
+
|
|
38
|
+
Returns the current request context, or `undefined` if called
|
|
39
|
+
outside a request scope.
|
|
40
|
+
|
|
41
|
+
#### Returns
|
|
42
|
+
|
|
43
|
+
[`IRequestContext`](Interface.IRequestContext) \| `undefined`
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### getRequestId()
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
static getRequestId(): string;
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Defined in: [RequestContextStore.ts:66](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L66)
|
|
54
|
+
|
|
55
|
+
Returns the current `requestId`, or `'unknown'` if no context is active.
|
|
56
|
+
|
|
57
|
+
#### Returns
|
|
58
|
+
|
|
59
|
+
`string`
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### run()
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
static run<T>(context, callback): T;
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Defined in: [RequestContextStore.ts:47](https://github.com/RueDeRennes/archipel/blob/main/libs/platform-logging/src/RequestContextStore.ts#L47)
|
|
70
|
+
|
|
71
|
+
Runs a callback within a new request context.
|
|
72
|
+
|
|
73
|
+
#### Type Parameters
|
|
74
|
+
|
|
75
|
+
| Type Parameter |
|
|
76
|
+
| ------ |
|
|
77
|
+
| `T` |
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
| Parameter | Type | Description |
|
|
82
|
+
| ------ | ------ | ------ |
|
|
83
|
+
| `context` | [`IRequestContext`](Interface.IRequestContext) | The request context to associate with the callback execution. |
|
|
84
|
+
| `callback` | () => `T` | The function to execute within the context. |
|
|
85
|
+
|
|
86
|
+
#### Returns
|
|
87
|
+
|
|
88
|
+
`T`
|
|
89
|
+
|
|
90
|
+
The return value of the callback.
|
|
@@ -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`.
|