notifkit 0.1.2 → 0.1.3
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 +46 -54
- package/dist/index.d.mts +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,50 +53,40 @@ await notifkit.notify({
|
|
|
53
53
|
|
|
54
54
|
notifkit is both an **orchestration engine** and a **typed SDK**.
|
|
55
55
|
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
│ └─────────────┘ │
|
|
91
|
-
└──────────────────────────────────┬───────────────────────┘
|
|
92
|
-
│ Dispatch
|
|
93
|
-
▼
|
|
94
|
-
┌──────────────────────────────────────────────────────────┐
|
|
95
|
-
│ Provider Transports │
|
|
96
|
-
│ │
|
|
97
|
-
│ Email: Resend, SES, Postmark Push: Firebase (FCM) │
|
|
98
|
-
│ SMS: Twilio, MessageBird Webhooks: Custom HTTP │
|
|
99
|
-
└──────────────────────────────────────────────────────────┘
|
|
56
|
+
```mermaid
|
|
57
|
+
flowchart TD
|
|
58
|
+
App["Your Application / AI Agent<br/>Typed SDK · REST API · MCP Server"]
|
|
59
|
+
|
|
60
|
+
App -->|"HTTP POST /v1/notify"| API
|
|
61
|
+
|
|
62
|
+
API["Notifkit API Server<br/>Schema Validation · Auth · Multi-Tenancy<br/>Idempotency Gate · Priority Queue Ingestion"]
|
|
63
|
+
|
|
64
|
+
API --> PG
|
|
65
|
+
API --> REDIS
|
|
66
|
+
|
|
67
|
+
PG[("PostgreSQL — Storage<br/>Users · Preferences<br/>Templates · Workflows<br/>Delivery Logs · DLQ")]
|
|
68
|
+
REDIS[("Redis — Streams / ZSET<br/>Priority Queues<br/>Scheduled Sends<br/>Sliding Rate Limits")]
|
|
69
|
+
|
|
70
|
+
subgraph WORKERS["Background Workers Pipeline"]
|
|
71
|
+
direction LR
|
|
72
|
+
ENRICH["Enricher<br/>(Resolve)"] --> ENGINE["Engine<br/>(Quiet Hours)"] --> DELIVER["Delivery<br/>(Rate Limits / CB)"]
|
|
73
|
+
ENGINE --> SCHED["Scheduler<br/>(sendAt / QH)"]
|
|
74
|
+
SCHED --> DELIVER
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
REDIS -->|"consume"| ENRICH
|
|
78
|
+
ENRICH -.->|"read / write state"| PG
|
|
79
|
+
DELIVER -.->|"delivery logs"| PG
|
|
80
|
+
DELIVER -->|"Dispatch"| PROVIDERS
|
|
81
|
+
|
|
82
|
+
PROVIDERS["Provider Transports<br/>Email: Resend, SES, Postmark · Push: Firebase (FCM)<br/>SMS: Twilio, MessageBird · Webhooks: Custom HTTP"]
|
|
83
|
+
|
|
84
|
+
classDef entry stroke:#6366f1,stroke-width:2px
|
|
85
|
+
classDef store stroke:#0ea5e9,stroke-width:2px
|
|
86
|
+
classDef work stroke:#22c55e,stroke-width:2px
|
|
87
|
+
class App,API,PROVIDERS entry
|
|
88
|
+
class PG,REDIS store
|
|
89
|
+
class ENRICH,ENGINE,DELIVER,SCHED work
|
|
100
90
|
```
|
|
101
91
|
|
|
102
92
|
- **`NotifkitServer`**: Runs the HTTP REST API router (`/v1/notify`, `/health`, `/metrics`) and the background worker pipelines (enricher, decision engine, scheduler, delivery).
|
|
@@ -121,16 +111,18 @@ notifkit is both an **orchestration engine** and a **typed SDK**.
|
|
|
121
111
|
|
|
122
112
|
Because notification delivery is mission-critical, every pipeline component is tested against extreme failure conditions:
|
|
123
113
|
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
114
|
+
```mermaid
|
|
115
|
+
flowchart LR
|
|
116
|
+
S1["Redis Streams"] -->|"Kill Worker (SIGKILL)"| M1["Auto-Claim and Replay"] --> O1["Zero Lost Messages"]
|
|
117
|
+
S2["Connection Loss"] -->|"Drop DB / Redis"| M2["Auto-Reconnect / Retry"] --> O2["In-Flight State Intact"]
|
|
118
|
+
S3["10k+ Messages"] -->|"Burst"| M3["Concurrency and Limits"] --> O3["Flat Memory, No Leaks"]
|
|
119
|
+
|
|
120
|
+
classDef fault stroke:#ef4444,stroke-width:2px
|
|
121
|
+
classDef guard stroke:#6366f1,stroke-width:2px
|
|
122
|
+
classDef result stroke:#22c55e,stroke-width:2px
|
|
123
|
+
class S1,S2,S3 fault
|
|
124
|
+
class M1,M2,M3 guard
|
|
125
|
+
class O1,O2,O3 result
|
|
134
126
|
```
|
|
135
127
|
|
|
136
128
|
- **Chaos Monkey Testing (`tests/chaos/crash.test.ts`)**: Background worker processes are randomly terminated with `SIGKILL` during active, high-throughput message streaming. Consumer group Pending Entries List (PEL) re-claims guarantee **zero lost messages** and seamless failover.
|
package/dist/index.d.mts
CHANGED
|
@@ -444,7 +444,6 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
|
|
|
444
444
|
priority: "low" | "normal" | "high" | "critical";
|
|
445
445
|
projectId: string;
|
|
446
446
|
recipientId: string;
|
|
447
|
-
rawEventId: string;
|
|
448
447
|
templateVariables: Record<string, unknown>;
|
|
449
448
|
recipient: {
|
|
450
449
|
id: string;
|
|
@@ -464,6 +463,7 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
|
|
|
464
463
|
pushToken?: string | undefined;
|
|
465
464
|
pushTokens?: string[] | undefined;
|
|
466
465
|
};
|
|
466
|
+
rawEventId: string;
|
|
467
467
|
aiPrompts?: Record<string, string> | undefined;
|
|
468
468
|
templateId?: string | undefined;
|
|
469
469
|
campaignId?: string | undefined;
|
|
@@ -474,7 +474,6 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
|
|
|
474
474
|
priority: "low" | "normal" | "high" | "critical";
|
|
475
475
|
projectId: string;
|
|
476
476
|
recipientId: string;
|
|
477
|
-
rawEventId: string;
|
|
478
477
|
templateVariables: Record<string, unknown>;
|
|
479
478
|
recipient: {
|
|
480
479
|
id: string;
|
|
@@ -494,6 +493,7 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
|
|
|
494
493
|
pushTokens?: string[] | undefined;
|
|
495
494
|
locale?: string | undefined;
|
|
496
495
|
};
|
|
496
|
+
rawEventId: string;
|
|
497
497
|
aiPrompts?: Record<string, string> | undefined;
|
|
498
498
|
templateId?: string | undefined;
|
|
499
499
|
campaignId?: string | undefined;
|
|
@@ -702,9 +702,9 @@ declare const NotificationDispatchedPayloadSchema: z.ZodObject<{
|
|
|
702
702
|
priority: "low" | "normal" | "high" | "critical";
|
|
703
703
|
projectId: string;
|
|
704
704
|
taskId: string;
|
|
705
|
+
enrichedEventId: string;
|
|
705
706
|
recipientId: string;
|
|
706
707
|
templateVariables: Record<string, unknown>;
|
|
707
|
-
enrichedEventId: string;
|
|
708
708
|
renderedContent: {
|
|
709
709
|
content: Record<string, unknown>;
|
|
710
710
|
attachments?: {
|
|
@@ -747,8 +747,8 @@ declare const NotificationDispatchedPayloadSchema: z.ZodObject<{
|
|
|
747
747
|
priority: "low" | "normal" | "high" | "critical";
|
|
748
748
|
projectId: string;
|
|
749
749
|
taskId: string;
|
|
750
|
-
recipientId: string;
|
|
751
750
|
enrichedEventId: string;
|
|
751
|
+
recipientId: string;
|
|
752
752
|
renderedContent: {
|
|
753
753
|
content: Record<string, unknown>;
|
|
754
754
|
attachments?: {
|
|
@@ -993,6 +993,7 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
|
|
|
993
993
|
priority: "low" | "normal" | "high" | "critical";
|
|
994
994
|
aiPrompts: Record<string, string>;
|
|
995
995
|
projectId: string;
|
|
996
|
+
enrichedEventId: string;
|
|
996
997
|
recipientId: string;
|
|
997
998
|
templateVariables: Record<string, unknown>;
|
|
998
999
|
recipient: {
|
|
@@ -1013,7 +1014,6 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
|
|
|
1013
1014
|
pushToken?: string | undefined;
|
|
1014
1015
|
pushTokens?: string[] | undefined;
|
|
1015
1016
|
};
|
|
1016
|
-
enrichedEventId: string;
|
|
1017
1017
|
templateId?: string | undefined;
|
|
1018
1018
|
scheduledAt?: string | undefined;
|
|
1019
1019
|
fallbackChain?: ("push" | "email" | "sms" | "webhook" | "in-app")[] | undefined;
|
|
@@ -1022,6 +1022,7 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
|
|
|
1022
1022
|
priority: "low" | "normal" | "high" | "critical";
|
|
1023
1023
|
aiPrompts: Record<string, string>;
|
|
1024
1024
|
projectId: string;
|
|
1025
|
+
enrichedEventId: string;
|
|
1025
1026
|
recipientId: string;
|
|
1026
1027
|
templateVariables: Record<string, unknown>;
|
|
1027
1028
|
recipient: {
|
|
@@ -1042,7 +1043,6 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
|
|
|
1042
1043
|
pushTokens?: string[] | undefined;
|
|
1043
1044
|
locale?: string | undefined;
|
|
1044
1045
|
};
|
|
1045
|
-
enrichedEventId: string;
|
|
1046
1046
|
templateId?: string | undefined;
|
|
1047
1047
|
scheduledAt?: string | undefined;
|
|
1048
1048
|
fallbackChain?: ("push" | "email" | "sms" | "webhook" | "in-app")[] | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notifkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Self-hosted notification infrastructure. One call delivers to email, SMS, push, and webhook — routed by preference, quiet hours, and consent.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "devkitshq",
|
|
@@ -107,4 +107,4 @@
|
|
|
107
107
|
"npm": ">=10.0.0"
|
|
108
108
|
},
|
|
109
109
|
"packageManager": "npm@10.8.1"
|
|
110
|
-
}
|
|
110
|
+
}
|