@engjts/nexus 0.1.8 → 0.1.10
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/dist/advanced/playground/playground.js.map +1 -1
- package/dist/advanced/static/generateDirectoryListing.d.ts +1 -1
- package/dist/advanced/static/generateDirectoryListing.d.ts.map +1 -1
- package/dist/advanced/static/generateDirectoryListing.js +12 -6
- package/dist/advanced/static/generateDirectoryListing.js.map +1 -1
- package/dist/advanced/static/index.d.ts +2 -0
- package/dist/advanced/static/index.d.ts.map +1 -1
- package/dist/advanced/static/index.js +4 -1
- package/dist/advanced/static/index.js.map +1 -1
- package/dist/advanced/static/serveStatic.d.ts.map +1 -1
- package/dist/advanced/static/serveStatic.js +7 -1
- package/dist/advanced/static/serveStatic.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/BENCHMARK_REPORT.md +0 -343
- package/documentation/01-getting-started.md +0 -240
- package/documentation/02-context.md +0 -335
- package/documentation/03-routing.md +0 -397
- package/documentation/04-middleware.md +0 -483
- package/documentation/05-validation.md +0 -514
- package/documentation/06-error-handling.md +0 -465
- package/documentation/07-performance.md +0 -364
- package/documentation/08-adapters.md +0 -470
- package/documentation/09-api-reference.md +0 -548
- package/documentation/10-examples.md +0 -582
- package/documentation/11-deployment.md +0 -477
- package/documentation/12-sentry.md +0 -620
- package/documentation/13-sentry-data-storage.md +0 -996
- package/documentation/14-sentry-data-reference.md +0 -457
- package/documentation/15-sentry-summary.md +0 -409
- package/documentation/16-alerts-system.md +0 -745
- package/documentation/17-alert-adapters.md +0 -696
- package/documentation/18-alerts-implementation-summary.md +0 -385
- package/documentation/19-class-based-routing.md +0 -840
- package/documentation/20-websocket-realtime.md +0 -813
- package/documentation/21-cache-system.md +0 -510
- package/documentation/22-job-queue.md +0 -772
- package/documentation/23-sentry-plugin.md +0 -551
- package/documentation/24-testing-utilities.md +0 -1287
- package/documentation/25-api-versioning.md +0 -533
- package/documentation/26-context-store.md +0 -607
- package/documentation/27-dependency-injection.md +0 -329
- package/documentation/28-lifecycle-hooks.md +0 -521
- package/documentation/29-package-structure.md +0 -196
- package/documentation/30-plugin-system.md +0 -414
- package/documentation/31-jwt-authentication.md +0 -597
- package/documentation/32-cli.md +0 -268
- package/documentation/ALERTS-COMPLETE-SUMMARY.md +0 -429
- package/documentation/ALERTS-INDEX.md +0 -330
- package/documentation/ALERTS-QUICK-REFERENCE.md +0 -286
- package/documentation/README.md +0 -178
- package/documentation/index.html +0 -34
- package/modern_framework_paper.md +0 -1870
- package/public/css/style.css +0 -87
- package/public/index.html +0 -34
- package/public/js/app.js +0 -27
- package/src/advanced/cache/InMemoryCacheStore.ts +0 -68
- package/src/advanced/cache/MultiTierCache.ts +0 -194
- package/src/advanced/cache/RedisCacheStore.ts +0 -341
- package/src/advanced/cache/index.ts +0 -5
- package/src/advanced/cache/types.ts +0 -40
- package/src/advanced/graphql/SimpleDataLoader.ts +0 -42
- package/src/advanced/graphql/index.ts +0 -22
- package/src/advanced/graphql/server.ts +0 -252
- package/src/advanced/graphql/types.ts +0 -42
- package/src/advanced/jobs/InMemoryQueueStore.ts +0 -68
- package/src/advanced/jobs/JobQueue.ts +0 -556
- package/src/advanced/jobs/RedisQueueStore.ts +0 -367
- package/src/advanced/jobs/index.ts +0 -5
- package/src/advanced/jobs/types.ts +0 -70
- package/src/advanced/observability/APMManager.ts +0 -163
- package/src/advanced/observability/AlertManager.ts +0 -109
- package/src/advanced/observability/MetricRegistry.ts +0 -151
- package/src/advanced/observability/ObservabilityCenter.ts +0 -304
- package/src/advanced/observability/StructuredLogger.ts +0 -154
- package/src/advanced/observability/TracingManager.ts +0 -117
- package/src/advanced/observability/adapters.ts +0 -304
- package/src/advanced/observability/createObservabilityMiddleware.ts +0 -63
- package/src/advanced/observability/index.ts +0 -11
- package/src/advanced/observability/types.ts +0 -174
- package/src/advanced/playground/extractPathParams.ts +0 -6
- package/src/advanced/playground/generateFieldExample.ts +0 -31
- package/src/advanced/playground/generatePlaygroundHTML.ts +0 -1956
- package/src/advanced/playground/generateSummary.ts +0 -19
- package/src/advanced/playground/getTagFromPath.ts +0 -9
- package/src/advanced/playground/index.ts +0 -8
- package/src/advanced/playground/playground.ts +0 -250
- package/src/advanced/playground/types.ts +0 -49
- package/src/advanced/playground/zodToExample.ts +0 -16
- package/src/advanced/playground/zodToParams.ts +0 -15
- package/src/advanced/postman/buildAuth.ts +0 -31
- package/src/advanced/postman/buildBody.ts +0 -15
- package/src/advanced/postman/buildQueryParams.ts +0 -27
- package/src/advanced/postman/buildRequestItem.ts +0 -36
- package/src/advanced/postman/buildResponses.ts +0 -11
- package/src/advanced/postman/buildUrl.ts +0 -33
- package/src/advanced/postman/capitalize.ts +0 -4
- package/src/advanced/postman/generateCollection.ts +0 -59
- package/src/advanced/postman/generateEnvironment.ts +0 -34
- package/src/advanced/postman/generateExampleFromZod.ts +0 -21
- package/src/advanced/postman/generateFieldExample.ts +0 -45
- package/src/advanced/postman/generateName.ts +0 -20
- package/src/advanced/postman/generateUUID.ts +0 -11
- package/src/advanced/postman/getTagFromPath.ts +0 -10
- package/src/advanced/postman/index.ts +0 -28
- package/src/advanced/postman/postman.ts +0 -156
- package/src/advanced/postman/slugify.ts +0 -7
- package/src/advanced/postman/types.ts +0 -140
- package/src/advanced/realtime/index.ts +0 -18
- package/src/advanced/realtime/websocket.ts +0 -231
- package/src/advanced/sentry/index.ts +0 -1236
- package/src/advanced/sentry/types.ts +0 -355
- package/src/advanced/static/generateDirectoryListing.ts +0 -47
- package/src/advanced/static/generateETag.ts +0 -7
- package/src/advanced/static/getMimeType.ts +0 -9
- package/src/advanced/static/index.ts +0 -32
- package/src/advanced/static/isSafePath.ts +0 -13
- package/src/advanced/static/publicDir.ts +0 -21
- package/src/advanced/static/serveStatic.ts +0 -225
- package/src/advanced/static/spa.ts +0 -24
- package/src/advanced/static/types.ts +0 -159
- package/src/advanced/swagger/SwaggerGenerator.ts +0 -66
- package/src/advanced/swagger/buildOperation.ts +0 -61
- package/src/advanced/swagger/buildParameters.ts +0 -61
- package/src/advanced/swagger/buildRequestBody.ts +0 -21
- package/src/advanced/swagger/buildResponses.ts +0 -54
- package/src/advanced/swagger/capitalize.ts +0 -5
- package/src/advanced/swagger/convertPath.ts +0 -9
- package/src/advanced/swagger/createSwagger.ts +0 -12
- package/src/advanced/swagger/generateOperationId.ts +0 -21
- package/src/advanced/swagger/generateSpec.ts +0 -105
- package/src/advanced/swagger/generateSummary.ts +0 -24
- package/src/advanced/swagger/generateSwaggerUI.ts +0 -70
- package/src/advanced/swagger/generateThemeCss.ts +0 -53
- package/src/advanced/swagger/index.ts +0 -25
- package/src/advanced/swagger/swagger.ts +0 -237
- package/src/advanced/swagger/types.ts +0 -206
- package/src/advanced/swagger/zodFieldToOpenAPI.ts +0 -94
- package/src/advanced/swagger/zodSchemaToOpenAPI.ts +0 -50
- package/src/advanced/swagger/zodToOpenAPI.ts +0 -22
- package/src/advanced/testing/factory.ts +0 -509
- package/src/advanced/testing/harness.ts +0 -612
- package/src/advanced/testing/index.ts +0 -430
- package/src/advanced/testing/load-test.ts +0 -618
- package/src/advanced/testing/mock-server.ts +0 -498
- package/src/advanced/testing/mock.ts +0 -670
- package/src/cli/bin.ts +0 -9
- package/src/cli/cli.ts +0 -158
- package/src/cli/commands/add.ts +0 -178
- package/src/cli/commands/build.ts +0 -73
- package/src/cli/commands/create.ts +0 -166
- package/src/cli/commands/dev.ts +0 -85
- package/src/cli/commands/generate.ts +0 -99
- package/src/cli/commands/help.ts +0 -95
- package/src/cli/commands/init.ts +0 -91
- package/src/cli/commands/version.ts +0 -38
- package/src/cli/index.ts +0 -6
- package/src/cli/templates/generators.ts +0 -359
- package/src/cli/templates/index.ts +0 -680
- package/src/cli/utils/exec.ts +0 -52
- package/src/cli/utils/file-system.ts +0 -78
- package/src/cli/utils/logger.ts +0 -111
- package/src/core/adapter.ts +0 -88
- package/src/core/application.ts +0 -1453
- package/src/core/context-pool.ts +0 -79
- package/src/core/context.ts +0 -856
- package/src/core/index.ts +0 -94
- package/src/core/middleware.ts +0 -272
- package/src/core/performance/buffer-pool.ts +0 -108
- package/src/core/performance/middleware-optimizer.ts +0 -162
- package/src/core/plugin/PluginManager.ts +0 -435
- package/src/core/plugin/builder.ts +0 -358
- package/src/core/plugin/index.ts +0 -50
- package/src/core/plugin/types.ts +0 -214
- package/src/core/router/file-router.ts +0 -623
- package/src/core/router/index.ts +0 -260
- package/src/core/router/radix-tree.ts +0 -242
- package/src/core/serializer.ts +0 -397
- package/src/core/store/index.ts +0 -30
- package/src/core/store/registry.ts +0 -178
- package/src/core/store/request-store.ts +0 -240
- package/src/core/store/types.ts +0 -233
- package/src/core/types.ts +0 -616
- package/src/database/adapter.ts +0 -35
- package/src/database/adapters/index.ts +0 -1
- package/src/database/adapters/mysql.ts +0 -669
- package/src/database/database.ts +0 -70
- package/src/database/dialect.ts +0 -388
- package/src/database/index.ts +0 -12
- package/src/database/migrations.ts +0 -86
- package/src/database/optimizer.ts +0 -125
- package/src/database/query-builder.ts +0 -404
- package/src/database/realtime.ts +0 -53
- package/src/database/schema.ts +0 -71
- package/src/database/transactions.ts +0 -56
- package/src/database/types.ts +0 -87
- package/src/deployment/cluster.ts +0 -471
- package/src/deployment/config.ts +0 -454
- package/src/deployment/docker.ts +0 -599
- package/src/deployment/graceful-shutdown.ts +0 -373
- package/src/deployment/index.ts +0 -56
- package/src/index.ts +0 -281
- package/src/security/adapter.ts +0 -318
- package/src/security/auth/JWTPlugin.ts +0 -234
- package/src/security/auth/JWTProvider.ts +0 -316
- package/src/security/auth/adapter.ts +0 -12
- package/src/security/auth/jwt.ts +0 -234
- package/src/security/auth/middleware.ts +0 -188
- package/src/security/csrf.ts +0 -220
- package/src/security/headers.ts +0 -108
- package/src/security/index.ts +0 -60
- package/src/security/rate-limit/adapter.ts +0 -7
- package/src/security/rate-limit/memory.ts +0 -108
- package/src/security/rate-limit/middleware.ts +0 -181
- package/src/security/sanitization.ts +0 -75
- package/src/security/types.ts +0 -240
- package/src/security/utils.ts +0 -52
- package/tsconfig.json +0 -39
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
# 📢 Alert System Documentation Index
|
|
2
|
-
|
|
3
|
-
Sistem Alert di Nexus menggunakan **Adapter Pattern** untuk mendukung multiple notification channels secara modular dan extensible.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 📚 Documentation Files
|
|
8
|
-
|
|
9
|
-
### 1. **ALERTS-COMPLETE-SUMMARY.md** ⭐ START HERE
|
|
10
|
-
**Untuk:** Overview lengkap project
|
|
11
|
-
- Status implementation
|
|
12
|
-
- Files yang dibuat/dimodifikasi
|
|
13
|
-
- Features yang diimplementasikan
|
|
14
|
-
- Quick start
|
|
15
|
-
- Production checklist
|
|
16
|
-
|
|
17
|
-
👉 **Baca ini terlebih dahulu untuk memahami apa yang sudah selesai**
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
### 2. **16-alerts-system.md**
|
|
22
|
-
**Untuk:** Memahami Alert System secara menyeluruh
|
|
23
|
-
- Overview & fitur utama
|
|
24
|
-
- Quick start (3 langkah)
|
|
25
|
-
- Configuration detailed
|
|
26
|
-
- Alert channels explanation
|
|
27
|
-
- Alert conditions
|
|
28
|
-
- Using with Observability Middleware
|
|
29
|
-
- Accessing alert data
|
|
30
|
-
- Best practices
|
|
31
|
-
- Troubleshooting
|
|
32
|
-
|
|
33
|
-
👉 **Baca ini untuk memahami cara kerja Alert System**
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
### 3. **17-alert-adapters.md**
|
|
38
|
-
**Untuk:** Custom adapters & advanced usage
|
|
39
|
-
- Adapter Pattern overview (7 built-in adapters)
|
|
40
|
-
- Telegram ✨ NEW
|
|
41
|
-
- Discord ✨ NEW
|
|
42
|
-
- Slack
|
|
43
|
-
- Webhook
|
|
44
|
-
- Email
|
|
45
|
-
- PagerDuty
|
|
46
|
-
- Console
|
|
47
|
-
- Creating custom adapters
|
|
48
|
-
- Registering adapters
|
|
49
|
-
- Multiple channels
|
|
50
|
-
- Real-world patterns
|
|
51
|
-
- Adapter registry API
|
|
52
|
-
- Error handling
|
|
53
|
-
|
|
54
|
-
👉 **Baca ini untuk membuat custom adapter atau advanced patterns**
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
### 4. **18-alerts-implementation-summary.md**
|
|
59
|
-
**Untuk:** Technical details & architecture
|
|
60
|
-
- Status: What's implemented
|
|
61
|
-
- Built-in adapters table
|
|
62
|
-
- Refactored AlertManager
|
|
63
|
-
- Enhanced AlertingOptions
|
|
64
|
-
- Comprehensive documentation files
|
|
65
|
-
- How to use (quick start & multi-channel)
|
|
66
|
-
- Architecture diagram
|
|
67
|
-
- Files changed
|
|
68
|
-
- Design decisions (Why adapter pattern?)
|
|
69
|
-
- Production checklist
|
|
70
|
-
|
|
71
|
-
👉 **Baca ini untuk memahami architecture & design decisions**
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
### 5. **ALERTS-QUICK-REFERENCE.md**
|
|
76
|
-
**Untuk:** Quick lookup & copy-paste ready code
|
|
77
|
-
- Setup channels (all 7)
|
|
78
|
-
- Define alerts syntax
|
|
79
|
-
- Usage patterns (dev, prod, multi-channel)
|
|
80
|
-
- API methods
|
|
81
|
-
- Custom adapter template
|
|
82
|
-
- Environment variables
|
|
83
|
-
- Debugging tips
|
|
84
|
-
- Common issues table
|
|
85
|
-
- Cooldown behavior
|
|
86
|
-
|
|
87
|
-
👉 **Baca ini saat development untuk quick reference**
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## 🎯 Quick Navigation
|
|
92
|
-
|
|
93
|
-
| I want to... | Read... |
|
|
94
|
-
|---|---|
|
|
95
|
-
| Understand the complete project | ALERTS-COMPLETE-SUMMARY.md |
|
|
96
|
-
| Learn Alert System basics | 16-alerts-system.md |
|
|
97
|
-
| Create custom adapter | 17-alert-adapters.md |
|
|
98
|
-
| Understand architecture | 18-alerts-implementation-summary.md |
|
|
99
|
-
| Quick setup code | ALERTS-QUICK-REFERENCE.md |
|
|
100
|
-
| See working examples | example-alerts.ts |
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## 🚀 Getting Started Path
|
|
105
|
-
|
|
106
|
-
### Path 1: I just want to use it (5 mins)
|
|
107
|
-
1. Read: **ALERTS-QUICK-REFERENCE.md** (quick setup)
|
|
108
|
-
2. Copy: **example-alerts.ts** pattern #1 or #2
|
|
109
|
-
3. Done! ✅
|
|
110
|
-
|
|
111
|
-
### Path 2: I want to understand it (20 mins)
|
|
112
|
-
1. Read: **ALERTS-COMPLETE-SUMMARY.md** (overview)
|
|
113
|
-
2. Read: **16-alerts-system.md** (complete guide)
|
|
114
|
-
3. Skim: **ALERTS-QUICK-REFERENCE.md** (reference)
|
|
115
|
-
4. Done! ✅
|
|
116
|
-
|
|
117
|
-
### Path 3: I need custom adapter (30 mins)
|
|
118
|
-
1. Read: **ALERTS-COMPLETE-SUMMARY.md** (overview)
|
|
119
|
-
2. Read: **17-alert-adapters.md** (adapter details)
|
|
120
|
-
3. Read: **example-alerts.ts** (example #3)
|
|
121
|
-
4. Create your adapter
|
|
122
|
-
5. Done! ✅
|
|
123
|
-
|
|
124
|
-
### Path 4: I need to deploy (30 mins)
|
|
125
|
-
1. Read: **ALERTS-COMPLETE-SUMMARY.md** (status)
|
|
126
|
-
2. Read: **18-alerts-implementation-summary.md** (architecture)
|
|
127
|
-
3. Check: **Production checklist** section
|
|
128
|
-
4. Setup: **.env.example.alerts** variables
|
|
129
|
-
5. Deploy! 🚀
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## 📝 Documentation Statistics
|
|
134
|
-
|
|
135
|
-
| File | Lines | Purpose |
|
|
136
|
-
|------|-------|---------|
|
|
137
|
-
| ALERTS-COMPLETE-SUMMARY.md | ~400 | Overview & summary |
|
|
138
|
-
| 16-alerts-system.md | 745 | Complete guide |
|
|
139
|
-
| 17-alert-adapters.md | 696 | Adapter details |
|
|
140
|
-
| 18-alerts-implementation-summary.md | 385 | Architecture |
|
|
141
|
-
| ALERTS-QUICK-REFERENCE.md | 286 | Quick reference |
|
|
142
|
-
| **Total** | **~2,512** | Comprehensive! |
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 🔧 Code Files
|
|
147
|
-
|
|
148
|
-
| File | Lines | Purpose |
|
|
149
|
-
|------|-------|---------|
|
|
150
|
-
| src/advanced/observability/adapters.ts | 304 | Adapter implementations |
|
|
151
|
-
| src/advanced/observability/index.ts | MODIFIED | AlertManager refactored |
|
|
152
|
-
| example-alerts.ts | 381 | 6 working examples |
|
|
153
|
-
| .env.example.alerts | ~20 | Environment template |
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## 🎁 What You Get
|
|
158
|
-
|
|
159
|
-
### ✅ Production-Ready Implementation
|
|
160
|
-
- 7 built-in adapters (Telegram, Discord, Slack, Webhook, Email, PagerDuty, Console)
|
|
161
|
-
- Adapter Pattern for extensibility
|
|
162
|
-
- Full error handling
|
|
163
|
-
- Type-safe implementation
|
|
164
|
-
|
|
165
|
-
### ✅ Comprehensive Documentation
|
|
166
|
-
- 5 documentation files (~2,500 lines)
|
|
167
|
-
- Quick reference card
|
|
168
|
-
- Real-world examples
|
|
169
|
-
- Architecture documentation
|
|
170
|
-
|
|
171
|
-
### ✅ Ready-to-Use Examples
|
|
172
|
-
- 6 complete example patterns
|
|
173
|
-
- Environment variable template
|
|
174
|
-
- Copy-paste ready code
|
|
175
|
-
|
|
176
|
-
### ✅ Best Practices
|
|
177
|
-
- Production checklist
|
|
178
|
-
- Common patterns
|
|
179
|
-
- Error handling guide
|
|
180
|
-
- Troubleshooting section
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## 🌟 Key Features
|
|
185
|
-
|
|
186
|
-
- ✨ **Telegram Support** - NEW
|
|
187
|
-
- ✨ **Discord Support** - NEW
|
|
188
|
-
- ✅ Slack, Webhook, Email, PagerDuty (template)
|
|
189
|
-
- ✅ Multiple channels per alert
|
|
190
|
-
- ✅ Adapter pattern for custom channels
|
|
191
|
-
- ✅ Alert condition evaluation
|
|
192
|
-
- ✅ Cooldown to prevent spam
|
|
193
|
-
- ✅ Alert history tracking
|
|
194
|
-
- ✅ Config validation per adapter
|
|
195
|
-
- ✅ Environment-aware setup
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## 📖 How Documentation is Organized
|
|
200
|
-
|
|
201
|
-
```
|
|
202
|
-
ALERTS-COMPLETE-SUMMARY.md ← START HERE (Overview)
|
|
203
|
-
↓
|
|
204
|
-
Choose your path...
|
|
205
|
-
↓
|
|
206
|
-
├─→ 16-alerts-system.md (Learn system)
|
|
207
|
-
├─→ 17-alert-adapters.md (Advanced)
|
|
208
|
-
├─→ 18-alerts-implementation-summary.md (Technical)
|
|
209
|
-
└─→ ALERTS-QUICK-REFERENCE.md (Lookup)
|
|
210
|
-
↓
|
|
211
|
-
example-alerts.ts (Copy patterns)
|
|
212
|
-
↓
|
|
213
|
-
.env.example.alerts (Setup env vars)
|
|
214
|
-
↓
|
|
215
|
-
Deploy! 🚀
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
---
|
|
219
|
-
|
|
220
|
-
## 🎓 Learning Resources
|
|
221
|
-
|
|
222
|
-
### Beginner
|
|
223
|
-
- Start: ALERTS-COMPLETE-SUMMARY.md
|
|
224
|
-
- Then: ALERTS-QUICK-REFERENCE.md
|
|
225
|
-
- Try: example-alerts.ts pattern #1
|
|
226
|
-
|
|
227
|
-
### Intermediate
|
|
228
|
-
- Read: 16-alerts-system.md (complete guide)
|
|
229
|
-
- Understand: 18-alerts-implementation-summary.md
|
|
230
|
-
- Try: example-alerts.ts patterns #2-#4
|
|
231
|
-
|
|
232
|
-
### Advanced
|
|
233
|
-
- Study: 17-alert-adapters.md (adapter pattern)
|
|
234
|
-
- Create: Custom adapter
|
|
235
|
-
- Try: example-alerts.ts pattern #3
|
|
236
|
-
|
|
237
|
-
### Production Deployment
|
|
238
|
-
- Check: Production checklist in ALERTS-COMPLETE-SUMMARY.md
|
|
239
|
-
- Read: 18-alerts-implementation-summary.md
|
|
240
|
-
- Setup: Environment variables from .env.example.alerts
|
|
241
|
-
- Deploy: Your production setup
|
|
242
|
-
|
|
243
|
-
---
|
|
244
|
-
|
|
245
|
-
## ✅ Verification Checklist
|
|
246
|
-
|
|
247
|
-
Before using in production, verify:
|
|
248
|
-
|
|
249
|
-
- [ ] Read ALERTS-COMPLETE-SUMMARY.md
|
|
250
|
-
- [ ] Understood adapter pattern
|
|
251
|
-
- [ ] Chose notification channels
|
|
252
|
-
- [ ] Copied example from example-alerts.ts
|
|
253
|
-
- [ ] Set environment variables from .env.example.alerts
|
|
254
|
-
- [ ] Tested with console adapter first
|
|
255
|
-
- [ ] Tested with actual channel (Telegram/Discord/etc)
|
|
256
|
-
- [ ] Checked production checklist
|
|
257
|
-
- [ ] Ready to deploy! 🚀
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## 🆘 Need Help?
|
|
262
|
-
|
|
263
|
-
### If you want to...
|
|
264
|
-
- **Understand the system** → Read 16-alerts-system.md
|
|
265
|
-
- **Setup quickly** → Copy from ALERTS-QUICK-REFERENCE.md
|
|
266
|
-
- **Create custom adapter** → Follow 17-alert-adapters.md
|
|
267
|
-
- **Troubleshoot issue** → Check troubleshooting section
|
|
268
|
-
- **See working code** → Check example-alerts.ts
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## 📞 Quick Reference
|
|
273
|
-
|
|
274
|
-
### Setup Telegram
|
|
275
|
-
```typescript
|
|
276
|
-
channels: {
|
|
277
|
-
telegram: {
|
|
278
|
-
botToken: process.env.TELEGRAM_BOT_TOKEN!,
|
|
279
|
-
chatId: process.env.TELEGRAM_CHAT_ID!
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Setup Discord
|
|
285
|
-
```typescript
|
|
286
|
-
channels: {
|
|
287
|
-
discord: {
|
|
288
|
-
webhookUrl: process.env.DISCORD_WEBHOOK_URL!
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Setup Multiple Channels
|
|
294
|
-
```typescript
|
|
295
|
-
channels: {
|
|
296
|
-
slack: { webhookUrl: process.env.SLACK_WEBHOOK_URL! },
|
|
297
|
-
telegram: { botToken: '...', chatId: '...' },
|
|
298
|
-
discord: { webhookUrl: '...' }
|
|
299
|
-
}
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
👉 **For more details, see ALERTS-QUICK-REFERENCE.md**
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## 📊 Documentation Coverage
|
|
307
|
-
|
|
308
|
-
- ✅ Overview & summary
|
|
309
|
-
- ✅ Quick start guide
|
|
310
|
-
- ✅ Complete usage guide
|
|
311
|
-
- ✅ Adapter pattern details
|
|
312
|
-
- ✅ Custom adapter creation
|
|
313
|
-
- ✅ Architecture & design
|
|
314
|
-
- ✅ Production deployment
|
|
315
|
-
- ✅ Troubleshooting guide
|
|
316
|
-
- ✅ Code examples (6 patterns)
|
|
317
|
-
- ✅ Environment setup
|
|
318
|
-
- ✅ API reference
|
|
319
|
-
- ✅ Best practices
|
|
320
|
-
|
|
321
|
-
**Status: Comprehensively Documented** ✨
|
|
322
|
-
|
|
323
|
-
---
|
|
324
|
-
|
|
325
|
-
**Last Updated:** December 3, 2025
|
|
326
|
-
**Status:** Production Ready 🚀
|
|
327
|
-
**Version:** 1.0
|
|
328
|
-
|
|
329
|
-
Start with **ALERTS-COMPLETE-SUMMARY.md** 👈
|
|
330
|
-
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
# Alert System - Quick Reference
|
|
2
|
-
|
|
3
|
-
## Setup Channels
|
|
4
|
-
|
|
5
|
-
### Telegram
|
|
6
|
-
```typescript
|
|
7
|
-
channels: {
|
|
8
|
-
telegram: {
|
|
9
|
-
botToken: process.env.TELEGRAM_BOT_TOKEN!,
|
|
10
|
-
chatId: process.env.TELEGRAM_CHAT_ID!
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Discord
|
|
16
|
-
```typescript
|
|
17
|
-
channels: {
|
|
18
|
-
discord: {
|
|
19
|
-
webhookUrl: process.env.DISCORD_WEBHOOK_URL!
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Slack
|
|
25
|
-
```typescript
|
|
26
|
-
channels: {
|
|
27
|
-
slack: {
|
|
28
|
-
webhookUrl: process.env.SLACK_WEBHOOK_URL!
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### Webhook (Custom)
|
|
34
|
-
```typescript
|
|
35
|
-
channels: {
|
|
36
|
-
webhook: {
|
|
37
|
-
url: 'https://your-service.com/alerts'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Multiple Channels
|
|
43
|
-
```typescript
|
|
44
|
-
channels: {
|
|
45
|
-
slack: { webhookUrl: '...' },
|
|
46
|
-
telegram: { botToken: '...', chatId: '...' },
|
|
47
|
-
discord: { webhookUrl: '...' }
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Define Alerts
|
|
54
|
-
|
|
55
|
-
### Basic Alert
|
|
56
|
-
```typescript
|
|
57
|
-
{
|
|
58
|
-
name: 'Alert Name',
|
|
59
|
-
condition: 'metric > threshold',
|
|
60
|
-
window: '5m',
|
|
61
|
-
threshold: 0.05,
|
|
62
|
-
channels: ['slack', 'telegram']
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Condition Operators
|
|
67
|
-
- `>` - Greater than
|
|
68
|
-
- `<` - Less than
|
|
69
|
-
- `>=` - Greater than or equal
|
|
70
|
-
- `<=` - Less than or equal
|
|
71
|
-
|
|
72
|
-
### Example Conditions
|
|
73
|
-
```typescript
|
|
74
|
-
'error_rate > 0.05' // 5% errors
|
|
75
|
-
'response_time > 1000' // 1000ms
|
|
76
|
-
'memory > 0.8' // 80%
|
|
77
|
-
'uptime < 1' // 100% uptime
|
|
78
|
-
'db_errors >= 10' // 10+ errors
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Usage Patterns
|
|
84
|
-
|
|
85
|
-
### Development
|
|
86
|
-
```typescript
|
|
87
|
-
alerting: {
|
|
88
|
-
enabled: true,
|
|
89
|
-
channels: { console: {} },
|
|
90
|
-
alerts: [{
|
|
91
|
-
name: 'Test',
|
|
92
|
-
condition: 'value > 1',
|
|
93
|
-
window: '5m',
|
|
94
|
-
threshold: 1,
|
|
95
|
-
channels: ['console']
|
|
96
|
-
}]
|
|
97
|
-
}
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Production (Multi-Channel)
|
|
101
|
-
```typescript
|
|
102
|
-
alerting: {
|
|
103
|
-
enabled: true,
|
|
104
|
-
channels: {
|
|
105
|
-
slack: { webhookUrl: process.env.SLACK_WEBHOOK_URL! },
|
|
106
|
-
telegram: {
|
|
107
|
-
botToken: process.env.TELEGRAM_BOT_TOKEN!,
|
|
108
|
-
chatId: process.env.TELEGRAM_CHAT_ID!
|
|
109
|
-
},
|
|
110
|
-
discord: { webhookUrl: process.env.DISCORD_WEBHOOK_URL! }
|
|
111
|
-
},
|
|
112
|
-
alerts: [
|
|
113
|
-
// WARNING level
|
|
114
|
-
{ name: 'High Memory', condition: 'memory > 0.7', window: '5m', threshold: 0.7, channels: ['slack'] },
|
|
115
|
-
// CRITICAL level
|
|
116
|
-
{ name: 'Server Down', condition: 'uptime < 1', window: '1m', threshold: 1, channels: ['slack', 'telegram'] },
|
|
117
|
-
// EMERGENCY level
|
|
118
|
-
{ name: 'Critical Error', condition: 'error_rate > 0.5', window: '1m', threshold: 0.5, channels: ['slack', 'telegram', 'discord'] }
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## API Methods
|
|
126
|
-
|
|
127
|
-
### Check & Trigger Alert
|
|
128
|
-
```typescript
|
|
129
|
-
await observability.alertManager?.checkAndTrigger('Alert Name', value);
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Get Alert History
|
|
133
|
-
```typescript
|
|
134
|
-
const history = observability.getAlertHistory();
|
|
135
|
-
// Returns: [{ alert, timestamp, value }, ...]
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Get Adapter Registry
|
|
139
|
-
```typescript
|
|
140
|
-
const registry = observability.alertManager?.getAdapterRegistry();
|
|
141
|
-
|
|
142
|
-
// Get all adapters
|
|
143
|
-
registry?.getNames();
|
|
144
|
-
// ['slack', 'telegram', 'discord', 'webhook', 'email', 'pagerduty', 'console']
|
|
145
|
-
|
|
146
|
-
// Check if adapter exists
|
|
147
|
-
registry?.has('telegram'); // true
|
|
148
|
-
|
|
149
|
-
// Register custom adapter
|
|
150
|
-
registry?.register('custom', customAdapter);
|
|
151
|
-
|
|
152
|
-
// Unregister adapter
|
|
153
|
-
registry?.unregister('console');
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## Custom Adapter Template
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
import { AlertChannelAdapter, AlertDefinition } from './nexus/advanced/observability';
|
|
162
|
-
|
|
163
|
-
class MyCustomAdapter implements AlertChannelAdapter {
|
|
164
|
-
async send(alert: AlertDefinition, value: any, config: any): Promise<void> {
|
|
165
|
-
// Your implementation
|
|
166
|
-
console.log(`Alert: ${alert.name}, Value: ${value}`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
validate(config: any): boolean {
|
|
170
|
-
// Validate config
|
|
171
|
-
return !!config.someRequiredField;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Register & use
|
|
176
|
-
registry?.register('my-custom', new MyCustomAdapter());
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Environment Variables Template
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
# Telegram
|
|
185
|
-
TELEGRAM_BOT_TOKEN=YOUR_BOT_TOKEN
|
|
186
|
-
TELEGRAM_CHAT_ID=YOUR_CHAT_ID
|
|
187
|
-
|
|
188
|
-
# Slack
|
|
189
|
-
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
|
|
190
|
-
|
|
191
|
-
# Discord
|
|
192
|
-
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
|
|
193
|
-
|
|
194
|
-
# Webhook
|
|
195
|
-
WEBHOOK_URL=https://your-service.com/alerts
|
|
196
|
-
|
|
197
|
-
# PagerDuty
|
|
198
|
-
PAGERDUTY_ROUTING_KEY=your-routing-key
|
|
199
|
-
|
|
200
|
-
# Email
|
|
201
|
-
EMAIL_RECIPIENTS=admin@example.com,ops@example.com
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## Debugging
|
|
207
|
-
|
|
208
|
-
### Test Alert Trigger
|
|
209
|
-
```typescript
|
|
210
|
-
// Manual trigger
|
|
211
|
-
await observability.alertManager?.checkAndTrigger('Test Alert', 100);
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### View Alert History
|
|
215
|
-
```typescript
|
|
216
|
-
const history = observability.getAlertHistory();
|
|
217
|
-
console.log(history);
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Check Adapter Status
|
|
221
|
-
```typescript
|
|
222
|
-
const registry = observability.alertManager?.getAdapterRegistry();
|
|
223
|
-
console.log('Available adapters:', registry?.getNames());
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Validate Channel Config
|
|
227
|
-
```typescript
|
|
228
|
-
const adapter = registry?.get('telegram');
|
|
229
|
-
const isValid = adapter?.validate({
|
|
230
|
-
botToken: 'YOUR_TOKEN',
|
|
231
|
-
chatId: 'YOUR_CHAT_ID'
|
|
232
|
-
});
|
|
233
|
-
console.log('Config valid:', isValid);
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
---
|
|
237
|
-
|
|
238
|
-
## Common Issues
|
|
239
|
-
|
|
240
|
-
| Issue | Solution |
|
|
241
|
-
|-------|----------|
|
|
242
|
-
| Alert not triggered | Check `enabled: true`, check condition, check threshold |
|
|
243
|
-
| Config invalid | Validate using `adapter.validate(config)` |
|
|
244
|
-
| Adapter not found | Register adapter: `registry?.register(name, adapter)` |
|
|
245
|
-
| Network error | Check webhook URL, check internet connection |
|
|
246
|
-
| Rate limited | Alerts have 60s cooldown to prevent spam |
|
|
247
|
-
| Wrong channel | Check `channels` array in alert definition |
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
## Cooldown Behavior
|
|
252
|
-
|
|
253
|
-
- Alert triggered → cooldown starts (60 seconds)
|
|
254
|
-
- Same alert within 60s → ignored (prevented)
|
|
255
|
-
- Different alert → triggered immediately
|
|
256
|
-
- After 60s → can trigger again
|
|
257
|
-
|
|
258
|
-
```typescript
|
|
259
|
-
// Time: 0s
|
|
260
|
-
await observability.alertManager?.checkAndTrigger('Alert A', 100); // ✅ Triggered
|
|
261
|
-
|
|
262
|
-
// Time: 5s
|
|
263
|
-
await observability.alertManager?.checkAndTrigger('Alert A', 100); // ❌ Ignored (cooldown)
|
|
264
|
-
|
|
265
|
-
// Time: 61s
|
|
266
|
-
await observability.alertManager?.checkAndTrigger('Alert A', 100); // ✅ Triggered
|
|
267
|
-
|
|
268
|
-
// Time: 66s
|
|
269
|
-
await observability.alertManager?.checkAndTrigger('Alert B', 100); // ✅ Different alert
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Resources
|
|
275
|
-
|
|
276
|
-
- **Full Documentation**: `documentation/16-alerts-system.md`
|
|
277
|
-
- **Adapter Guide**: `documentation/17-alert-adapters.md`
|
|
278
|
-
- **Implementation Summary**: `documentation/18-alerts-implementation-summary.md`
|
|
279
|
-
- **Examples**: `example-alerts.ts`
|
|
280
|
-
- **Source Code**: `src/advanced/observability/adapters.ts`
|
|
281
|
-
|
|
282
|
-
---
|
|
283
|
-
|
|
284
|
-
**Last Updated:** 2025-12-03
|
|
285
|
-
**Status:** Production Ready ✅
|
|
286
|
-
|