@venizia/ignis-docs 0.2.0 → 0.2.1-0
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 +14 -14
- package/content/best-practices/api-usage-examples.md +39 -19
- package/content/best-practices/architectural-patterns.md +22 -11
- package/content/best-practices/architecture-decisions.md +29 -16
- package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
- package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
- package/content/best-practices/code-style-standards/control-flow.md +33 -1
- package/content/best-practices/code-style-standards/documentation.md +28 -8
- package/content/best-practices/code-style-standards/function-patterns.md +15 -4
- package/content/best-practices/code-style-standards/index.md +7 -2
- package/content/best-practices/code-style-standards/naming-conventions.md +26 -2
- package/content/best-practices/code-style-standards/route-definitions.md +9 -5
- package/content/best-practices/code-style-standards/tooling.md +14 -1
- package/content/best-practices/code-style-standards/type-safety.md +39 -6
- package/content/best-practices/common-pitfalls.md +59 -35
- package/content/best-practices/contribution-workflow.md +6 -2
- package/content/best-practices/data-modeling.md +78 -62
- package/content/best-practices/deployment-strategies.md +56 -19
- package/content/best-practices/error-handling.md +182 -93
- package/content/best-practices/index.md +6 -0
- package/content/best-practices/performance-optimization.md +26 -13
- package/content/best-practices/security-guidelines.md +35 -9
- package/content/best-practices/testing-strategies.md +7 -2
- package/content/best-practices/troubleshooting-tips.md +27 -17
- package/content/extensions/components/api-reference.md +107 -322
- package/content/extensions/components/authentication/api.md +454 -603
- package/content/extensions/components/authentication/errors.md +121 -498
- package/content/extensions/components/authentication/index.md +88 -801
- package/content/extensions/components/authentication/usage.md +207 -956
- package/content/extensions/components/authorization/api.md +736 -656
- package/content/extensions/components/authorization/errors.md +168 -206
- package/content/extensions/components/authorization/index.md +82 -797
- package/content/extensions/components/authorization/usage.md +194 -527
- package/content/extensions/components/health-check.md +71 -243
- package/content/extensions/components/mail/api.md +504 -287
- package/content/extensions/components/mail/errors.md +73 -61
- package/content/extensions/components/mail/index.md +96 -467
- package/content/extensions/components/mail/usage.md +130 -172
- package/content/extensions/components/request-tracker.md +66 -173
- package/content/extensions/components/socket-io/api.md +195 -13
- package/content/extensions/components/socket-io/errors.md +3 -3
- package/content/extensions/components/socket-io/index.md +50 -337
- package/content/extensions/components/socket-io/usage.md +143 -26
- package/content/extensions/components/static-asset/api.md +410 -142
- package/content/extensions/components/static-asset/errors.md +110 -53
- package/content/extensions/components/static-asset/index.md +79 -608
- package/content/extensions/components/static-asset/usage.md +180 -300
- package/content/extensions/components/websocket/api.md +275 -399
- package/content/extensions/components/websocket/errors.md +47 -56
- package/content/extensions/components/websocket/index.md +74 -407
- package/content/extensions/components/websocket/usage.md +110 -341
- package/content/extensions/helpers/cron/index.md +51 -160
- package/content/extensions/helpers/crypto/index.md +62 -483
- package/content/extensions/helpers/crypto/reference.md +456 -0
- package/content/extensions/helpers/env/index.md +60 -178
- package/content/extensions/helpers/error/index.md +221 -207
- package/content/extensions/helpers/inversion/index.md +65 -556
- package/content/extensions/helpers/inversion/reference.md +522 -0
- package/content/extensions/helpers/kafka/admin.md +20 -1
- package/content/extensions/helpers/kafka/compile-binary.md +41 -35
- package/content/extensions/helpers/kafka/consumer.md +54 -20
- package/content/extensions/helpers/kafka/examples.md +21 -16
- package/content/extensions/helpers/kafka/index.md +80 -610
- package/content/extensions/helpers/kafka/producer.md +134 -5
- package/content/extensions/helpers/kafka/schema-registry.md +45 -70
- package/content/extensions/helpers/logger/hf-logger.md +193 -0
- package/content/extensions/helpers/logger/index.md +64 -563
- package/content/extensions/helpers/logger/pino.md +85 -0
- package/content/extensions/helpers/logger/reference.md +746 -0
- package/content/extensions/helpers/network/api.md +241 -195
- package/content/extensions/helpers/network/index.md +72 -530
- package/content/extensions/helpers/queue/index.md +72 -900
- package/content/extensions/helpers/queue/reference.md +467 -0
- package/content/extensions/helpers/redis/index.md +73 -645
- package/content/extensions/helpers/redis/reference.md +727 -0
- package/content/extensions/helpers/secrets/index.md +66 -0
- package/content/extensions/helpers/socket-io/api.md +305 -203
- package/content/extensions/helpers/socket-io/index.md +66 -432
- package/content/extensions/helpers/storage/api.md +564 -462
- package/content/extensions/helpers/storage/index.md +77 -573
- package/content/extensions/helpers/types/index.md +66 -499
- package/content/extensions/helpers/types/reference.md +650 -0
- package/content/extensions/helpers/uid/index.md +58 -227
- package/content/extensions/helpers/websocket/api.md +329 -216
- package/content/extensions/helpers/websocket/index.md +65 -503
- package/content/extensions/helpers/worker-thread/index.md +58 -396
- package/content/extensions/helpers/worker-thread/reference.md +428 -0
- package/content/guides/core-concepts/persistent/models.md +1 -1
- package/content/guides/core-concepts/persistent/search-typesense.md +3 -3
- package/content/guides/core-concepts/persistent/transactions.md +1 -1
- package/content/guides/core-concepts/secrets-vault.md +177 -0
- package/content/guides/core-concepts/services.md +1 -1
- package/content/guides/migrations/redis-helpers-migration.md +1 -1
- package/content/guides/migrations/unified-connectors-migration.md +2 -2
- package/content/guides/tutorials/ecommerce-api.md +3 -8
- package/content/references/base/application.md +1 -1
- package/content/references/base/connectors.md +79 -136
- package/content/references/base/datasources-reference.md +599 -0
- package/content/references/base/datasources.md +84 -444
- package/content/references/base/dependency-injection.md +17 -39
- package/content/references/base/filter-system/application-usage.md +69 -121
- package/content/references/base/filter-system/array-operators.md +12 -0
- package/content/references/base/filter-system/comparison-operators.md +12 -0
- package/content/references/base/filter-system/default-filter.md +136 -348
- package/content/references/base/filter-system/fields-order-pagination.md +38 -16
- package/content/references/base/filter-system/index.md +106 -257
- package/content/references/base/filter-system/json-filtering.md +12 -2
- package/content/references/base/filter-system/list-operators.md +16 -2
- package/content/references/base/filter-system/logical-operators.md +13 -0
- package/content/references/base/filter-system/null-operators.md +13 -0
- package/content/references/base/filter-system/pattern-matching.md +12 -0
- package/content/references/base/filter-system/quick-reference.md +11 -2
- package/content/references/base/filter-system/range-operators.md +12 -0
- package/content/references/base/filter-system/tips.md +70 -133
- package/content/references/base/filter-system/use-cases.md +156 -233
- package/content/references/base/middlewares.md +35 -21
- package/content/references/base/models-reference.md +886 -0
- package/content/references/base/models.md +80 -1452
- package/content/references/base/repositories/advanced.md +156 -192
- package/content/references/base/repositories/index.md +77 -650
- package/content/references/base/repositories/mixins.md +22 -18
- package/content/references/base/repositories/relations.md +123 -171
- package/content/references/base/repositories/soft-deletable.md +58 -56
- package/content/references/base/secrets.md +263 -0
- package/content/references/base/services.md +2 -2
- package/content/references/configuration/environment-variables.md +48 -4
- package/content/references/configuration/index.md +49 -31
- package/content/references/quick-reference.md +3 -16
- package/content/references/utilities/crypto.md +35 -76
- package/content/references/utilities/date.md +33 -73
- package/content/references/utilities/index.md +1 -1
- package/content/references/utilities/jsx-reference.md +298 -0
- package/content/references/utilities/jsx.md +82 -525
- package/content/references/utilities/module.md +29 -62
- package/content/references/utilities/parse.md +34 -64
- package/content/references/utilities/performance.md +33 -58
- package/content/references/utilities/promise.md +28 -62
- package/content/references/utilities/request.md +57 -218
- package/content/references/utilities/schema.md +43 -137
- package/content/references/utilities/statuses-reference.md +361 -0
- package/content/references/utilities/statuses.md +63 -667
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Health Check
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A minimal status endpoint for uptime monitoring - the default target for load balancer health checks and Kubernetes liveness probes.
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
@@ -17,200 +17,106 @@ import { HealthCheckComponent, HealthCheckBindingKeys } from '@venizia/ignis';
|
|
|
17
17
|
import type { IHealthCheckOptions } from '@venizia/ignis';
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## In one example
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Skip this step to use the default `/health` path. To customize the path:
|
|
22
|
+
Register the component with no configuration - `GET /health` and `POST /health/ping` are live immediately.
|
|
25
23
|
|
|
26
24
|
```typescript
|
|
27
|
-
import {
|
|
25
|
+
import { HealthCheckComponent, BaseApplication, ValueOrPromise } from '@venizia/ignis';
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
});
|
|
27
|
+
export class Application extends BaseApplication {
|
|
28
|
+
preConfigure(): ValueOrPromise<void> {
|
|
29
|
+
this.component(HealthCheckComponent);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
35
32
|
```
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
import { HealthCheckComponent } from '@venizia/ignis';
|
|
41
|
-
|
|
42
|
-
preConfigure(): ValueOrPromise<void> {
|
|
43
|
-
// ... optional bindings from Step 1
|
|
44
|
-
this.component(HealthCheckComponent);
|
|
45
|
-
}
|
|
34
|
+
```bash
|
|
35
|
+
curl localhost:3000/health
|
|
36
|
+
# { "status": "ok" }
|
|
46
37
|
```
|
|
47
38
|
|
|
48
|
-
|
|
39
|
+
## How it works
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
- **Auto-registered controller.** `HealthCheckComponent.binding()` applies `@controller({ path })` to `HealthCheckController` via `Reflect.decorate` at runtime, then calls `this.application.controller(HealthCheckController)` - the path comes from DI, not a hardcoded class decorator.
|
|
42
|
+
- **Options are optional, field by field.** `IHealthCheckOptions.restOptions.path` is optional; a partially-filled binding (e.g., `{ restOptions: {} }`) still resolves - the component reads `healthOptions?.restOptions?.path ?? '/health'`, falling back per field rather than discarding the whole binding.
|
|
43
|
+
- **The default binding wins the race if you're late.** The constructor registers `HEALTH_CHECK_OPTIONS` via `initDefault: { enable: true }`, which runs before `binding()`. `initDefaultBindings()` only sets a key when `container.isBound()` is false - so a custom binding must exist BEFORE `this.component(HealthCheckComponent)` runs, or the default has already claimed the slot.
|
|
44
|
+
- **Three route styles, one controller.** `HealthCheckController` demonstrates all three IGNIS route patterns: fluent (`bindRoute().to()`) for `GET /`, decorator (`@api()`) for `POST /ping`, and imperative (`defineRoute()`, commented out in source) - a handy reference when picking a style for your own controllers.
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
> If you customized the path in Step 1, the endpoints will be at your custom path instead (e.g., `GET /health-check` and `POST /health-check/ping`).
|
|
46
|
+
## Common tasks
|
|
54
47
|
|
|
55
|
-
|
|
48
|
+
### Customize the health check path
|
|
49
|
+
Bind `IHealthCheckOptions` BEFORE registering the component - order matters (see above).
|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| `restOptions.path` | `string` | `'/health'` | Base path for health endpoints |
|
|
51
|
+
```typescript
|
|
52
|
+
import { HealthCheckBindingKeys, IHealthCheckOptions } from '@venizia/ignis';
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
this.bind<IHealthCheckOptions>({
|
|
55
|
+
key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
|
|
56
|
+
}).toValue({ restOptions: { path: '/health-check' } });
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
const DEFAULT_OPTIONS: IHealthCheckOptions = {
|
|
65
|
-
restOptions: { path: '/health' },
|
|
66
|
-
};
|
|
58
|
+
this.component(HealthCheckComponent); // AFTER the bind
|
|
67
59
|
```
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
interface IHealthCheckOptions {
|
|
72
|
-
restOptions: { path: string };
|
|
73
|
-
}
|
|
74
|
-
```
|
|
61
|
+
### Call the ping endpoint
|
|
62
|
+
`POST /health/ping` echoes `message` back with a server timestamp - useful for round-trip latency checks and body-parsing smoke tests.
|
|
75
63
|
|
|
76
|
-
|
|
64
|
+
```bash
|
|
65
|
+
curl -X POST localhost:3000/health/ping \
|
|
66
|
+
-H 'content-type: application/json' \
|
|
67
|
+
-d '{"message":"hello"}'
|
|
68
|
+
# { "type": "PONG", "date": "2026-02-11T12:00:00.000Z", "message": "hello" }
|
|
69
|
+
```
|
|
77
70
|
|
|
78
|
-
|
|
71
|
+
| Field | Type | Required | Constraints |
|
|
72
|
+
|-------|------|----------|-------------|
|
|
73
|
+
| `type` | `string` | No | Defaults to `"PING"` |
|
|
74
|
+
| `message` | `string` | Yes | Min 1, max 255 characters |
|
|
79
75
|
|
|
80
|
-
|
|
76
|
+
### Fix "health check endpoint returns 404"
|
|
77
|
+
Register the component in `preConfigure()`, before any controller registration completes.
|
|
81
78
|
|
|
82
79
|
```typescript
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
super({
|
|
87
|
-
scope: HealthCheckComponent.name,
|
|
88
|
-
initDefault: { enable: true, container: application },
|
|
89
|
-
bindings: {
|
|
90
|
-
[HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS]: Binding.bind<IHealthCheckOptions>({
|
|
91
|
-
key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
|
|
92
|
-
}).toValue(DEFAULT_OPTIONS),
|
|
93
|
-
},
|
|
94
|
-
});
|
|
80
|
+
preConfigure(): ValueOrPromise<void> {
|
|
81
|
+
this.component(HealthCheckComponent);
|
|
82
|
+
// ... other registrations
|
|
95
83
|
}
|
|
96
84
|
```
|
|
97
85
|
|
|
98
|
-
|
|
86
|
+
## Reference
|
|
99
87
|
|
|
100
|
-
|
|
88
|
+
### Configuration
|
|
89
|
+
| Option | Type | Default | Description |
|
|
90
|
+
|--------|------|---------|-------------|
|
|
91
|
+
| `restOptions.path` | `string` (optional) | `'/health'` | Base path for health endpoints |
|
|
101
92
|
|
|
102
93
|
```typescript
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
|
|
107
|
-
isOptional: true,
|
|
108
|
-
}) ?? DEFAULT_OPTIONS;
|
|
109
|
-
|
|
110
|
-
Reflect.decorate(
|
|
111
|
-
[controller({ path: healthOptions.restOptions.path })],
|
|
112
|
-
HealthCheckController,
|
|
113
|
-
);
|
|
114
|
-
this.application.controller(HealthCheckController);
|
|
94
|
+
interface IHealthCheckOptions {
|
|
95
|
+
/** Partially-filled bindings are accepted; every missing field falls back to its default. */
|
|
96
|
+
restOptions?: { path?: string };
|
|
115
97
|
}
|
|
116
98
|
```
|
|
117
99
|
|
|
118
|
-
|
|
119
|
-
> The `@controller` decorator is applied dynamically during `binding()`, not statically on the class definition. This allows the path to be configured at runtime via DI bindings.
|
|
120
|
-
|
|
121
|
-
## Binding Keys
|
|
122
|
-
|
|
100
|
+
### Binding keys
|
|
123
101
|
| Key | Constant | Type | Required | Default |
|
|
124
102
|
|-----|----------|------|----------|---------|
|
|
125
103
|
| `@app/health-check/options` | `HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS` | `IHealthCheckOptions` | No | `{ restOptions: { path: '/health' } }` |
|
|
126
104
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### Rest Paths
|
|
131
|
-
|
|
132
|
-
| Constant | Value | Full Path (default) |
|
|
105
|
+
### REST paths
|
|
106
|
+
| Constant | Value | Full path (default) |
|
|
133
107
|
|----------|-------|---------------------|
|
|
134
108
|
| `HealthCheckRestPaths.ROOT` | `/` | `GET /health` |
|
|
135
109
|
| `HealthCheckRestPaths.PING` | `/ping` | `POST /health/ping` |
|
|
136
110
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
class HealthCheckRestPaths {
|
|
141
|
-
static readonly ROOT = '/'; // GET /health (or custom base path)
|
|
142
|
-
static readonly PING = '/ping'; // POST /health/ping (or custom base path + /ping)
|
|
143
|
-
}
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
The controller defines two internal route paths via `HealthCheckRestPaths`. These paths are relative to the base path configured in `IHealthCheckOptions.restOptions.path`.
|
|
147
|
-
|
|
148
|
-
## API Endpoints
|
|
111
|
+
Paths are relative to the base path configured in `IHealthCheckOptions.restOptions.path`.
|
|
149
112
|
|
|
113
|
+
### API endpoints
|
|
150
114
|
| Method | Path | Description | Response |
|
|
151
115
|
|--------|------|-------------|----------|
|
|
152
116
|
| `GET` | `/health` | Basic health check | `{ "status": "ok" }` |
|
|
153
117
|
| `POST` | `/health/ping` | Echo test | `{ "type": "PONG", "date": "...", "message": "..." }` |
|
|
154
118
|
|
|
155
|
-
###
|
|
156
|
-
|
|
157
|
-
Returns a simple health status object. Used by load balancers, Kubernetes liveness probes, and monitoring tools to verify the application is running.
|
|
158
|
-
|
|
159
|
-
### POST /health/ping
|
|
160
|
-
|
|
161
|
-
Echoes a message back with a server timestamp. Useful for:
|
|
162
|
-
- Verifying end-to-end connectivity
|
|
163
|
-
- Measuring round-trip latency
|
|
164
|
-
- Testing request body parsing
|
|
165
|
-
|
|
166
|
-
#### Request & Response Specifications
|
|
167
|
-
|
|
168
|
-
**GET /health**
|
|
169
|
-
|
|
170
|
-
Response `200`:
|
|
171
|
-
```json
|
|
172
|
-
{
|
|
173
|
-
"status": "ok"
|
|
174
|
-
}
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**POST /health/ping**
|
|
178
|
-
|
|
179
|
-
Request body:
|
|
180
|
-
```json
|
|
181
|
-
{
|
|
182
|
-
"type": "PING",
|
|
183
|
-
"message": "Any string here"
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
| Field | Type | Required | Constraints |
|
|
188
|
-
|-------|------|----------|-------------|
|
|
189
|
-
| `type` | `string` | No | Defaults to `"PING"` |
|
|
190
|
-
| `message` | `string` | Yes | Min 1, max 255 characters |
|
|
191
|
-
|
|
192
|
-
Response `200`:
|
|
193
|
-
```json
|
|
194
|
-
{
|
|
195
|
-
"type": "PONG",
|
|
196
|
-
"date": "2026-02-11T12:00:00.000Z",
|
|
197
|
-
"message": "Any string here"
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Route Definition Patterns
|
|
202
|
-
|
|
203
|
-
The `HealthCheckController` demonstrates all three route definition patterns supported by IGNIS:
|
|
204
|
-
|
|
205
|
-
| Pattern | Method | Used For |
|
|
206
|
-
|---------|--------|----------|
|
|
207
|
-
| **Fluent API** (`bindRoute().to()`) | Root health check (`GET /`) | Inline handlers, method chaining |
|
|
208
|
-
| **Imperative API** (`defineRoute()`) | (commented out in source) | Direct handler assignment in `binding()` |
|
|
209
|
-
| **Decorator API** (`@api()`) | Ping endpoint (`POST /ping`) | Class method handlers with OpenAPI metadata |
|
|
210
|
-
|
|
211
|
-
The controller uses `this.definitions = RouteConfigs` to store route configurations for introspection. This is optional but enables tools to discover available routes without invoking `binding()`.
|
|
212
|
-
|
|
213
|
-
#### Controller Source
|
|
119
|
+
### Controller source
|
|
214
120
|
```typescript
|
|
215
121
|
import {
|
|
216
122
|
BaseRestController, IControllerOptions, TRouteContext,
|
|
@@ -286,101 +192,15 @@ export class HealthCheckController extends BaseRestController {
|
|
|
286
192
|
}
|
|
287
193
|
```
|
|
288
194
|
|
|
289
|
-
#### Route Configuration Schemas
|
|
290
|
-
|
|
291
|
-
**Root endpoint (`GET /`):**
|
|
292
|
-
```typescript
|
|
293
|
-
const RouteConfigs = {
|
|
294
|
-
ROOT: {
|
|
295
|
-
method: HTTP.Methods.GET,
|
|
296
|
-
path: HealthCheckRestPaths.ROOT,
|
|
297
|
-
responses: jsonResponse({
|
|
298
|
-
schema: z.object({ status: z.string() }).openapi({
|
|
299
|
-
description: 'HealthCheck Schema',
|
|
300
|
-
examples: [{ status: 'ok' }],
|
|
301
|
-
}),
|
|
302
|
-
description: 'Health check status',
|
|
303
|
-
}),
|
|
304
|
-
},
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
**Ping endpoint (`POST /ping`):**
|
|
308
|
-
```typescript
|
|
309
|
-
PING: {
|
|
310
|
-
method: HTTP.Methods.POST,
|
|
311
|
-
path: HealthCheckRestPaths.PING,
|
|
312
|
-
request: {
|
|
313
|
-
body: jsonContent({
|
|
314
|
-
description: 'PING | Request body',
|
|
315
|
-
schema: z.object({
|
|
316
|
-
type: z.string().optional().default('PING'),
|
|
317
|
-
message: z.string().min(1).max(255),
|
|
318
|
-
}),
|
|
319
|
-
}),
|
|
320
|
-
},
|
|
321
|
-
responses: jsonResponse({
|
|
322
|
-
schema: z.object({
|
|
323
|
-
type: z.string().optional().default('PONG'),
|
|
324
|
-
date: z.iso.datetime(),
|
|
325
|
-
message: z.string(),
|
|
326
|
-
}).openapi({
|
|
327
|
-
description: 'HealthCheck PingPong Schema',
|
|
328
|
-
examples: [{ date: new Date().toISOString(), message: 'ok' }],
|
|
329
|
-
}),
|
|
330
|
-
description: 'HealthCheck PingPong Message',
|
|
331
|
-
}),
|
|
332
|
-
},
|
|
333
|
-
} as const;
|
|
334
|
-
```
|
|
335
|
-
|
|
336
195
|
## Troubleshooting
|
|
337
196
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
```typescript
|
|
345
|
-
preConfigure(): ValueOrPromise<void> {
|
|
346
|
-
this.component(HealthCheckComponent);
|
|
347
|
-
// ... other registrations
|
|
348
|
-
}
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
### "Custom path is not applied"
|
|
197
|
+
| Symptom | Cause | Fix |
|
|
198
|
+
|---------|-------|-----|
|
|
199
|
+
| `GET /health` returns 404 | `HealthCheckComponent` not registered, or registered after controllers were already mounted | Call `this.component(HealthCheckComponent)` in `preConfigure()` |
|
|
200
|
+
| Custom path not applied | Custom `IHealthCheckOptions` bound AFTER `this.component()` ran - the default binding already claimed the DI key | Bind options BEFORE calling `this.component(HealthCheckComponent)` |
|
|
201
|
+
| `POST /health/ping` returns a validation error | `message` is missing, or exceeds 255 characters | Send a `message` string between 1 and 255 characters |
|
|
352
202
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
**Fix:** Bind your custom options before calling `this.component(HealthCheckComponent)`:
|
|
356
|
-
|
|
357
|
-
```typescript
|
|
358
|
-
preConfigure(): ValueOrPromise<void> {
|
|
359
|
-
// Bind options FIRST
|
|
360
|
-
this.bind<IHealthCheckOptions>({
|
|
361
|
-
key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
|
|
362
|
-
}).toValue({
|
|
363
|
-
restOptions: { path: '/custom-health' },
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// THEN register component
|
|
367
|
-
this.component(HealthCheckComponent);
|
|
368
|
-
}
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### "POST /health/ping returns validation error"
|
|
372
|
-
|
|
373
|
-
**Cause:** The request body is missing the required `message` field, or the `message` value exceeds the 255-character limit.
|
|
374
|
-
|
|
375
|
-
**Fix:** Ensure the request body includes a `message` string between 1 and 255 characters:
|
|
376
|
-
|
|
377
|
-
```json
|
|
378
|
-
{
|
|
379
|
-
"message": "hello"
|
|
380
|
-
}
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
## See Also
|
|
203
|
+
## See also
|
|
384
204
|
|
|
385
205
|
- **Guides:**
|
|
386
206
|
- [Components Overview](/guides/core-concepts/components) - Component system basics
|
|
@@ -391,3 +211,11 @@ preConfigure(): ValueOrPromise<void> {
|
|
|
391
211
|
|
|
392
212
|
- **Best Practices:**
|
|
393
213
|
- [Deployment Strategies](/best-practices/deployment-strategies) - Production monitoring
|
|
214
|
+
|
|
215
|
+
**Files:**
|
|
216
|
+
|
|
217
|
+
- [`packages/core/src/components/health-check/component.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core/src/components/health-check/component.ts) - `HealthCheckComponent`
|
|
218
|
+
- [`packages/core/src/components/health-check/controller.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core/src/components/health-check/controller.ts) - `HealthCheckController`
|
|
219
|
+
- [`packages/core/src/components/health-check/common/types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core/src/components/health-check/common/types.ts) - `IHealthCheckOptions`
|
|
220
|
+
- [`packages/core/src/components/health-check/common/keys.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core/src/components/health-check/common/keys.ts) - `HealthCheckBindingKeys`
|
|
221
|
+
- [`packages/core/src/components/health-check/common/rest-paths.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core/src/components/health-check/common/rest-paths.ts) - `HealthCheckRestPaths`
|