autotel-subscribers 59.0.0 → 59.0.2
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/amplitude.d.cts +3 -4
- package/dist/amplitude.d.ts +3 -4
- package/dist/architecture-snapshot.d.cts +9 -10
- package/dist/architecture-snapshot.d.ts +9 -10
- package/dist/factories.d.cts +10 -10
- package/dist/factories.d.ts +10 -10
- package/dist/file.d.cts +3 -4
- package/dist/file.d.ts +3 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/loki.d.cts +12 -13
- package/dist/loki.d.ts +12 -13
- package/dist/middleware.d.cts +29 -30
- package/dist/middleware.d.ts +29 -30
- package/dist/mixpanel.d.cts +3 -4
- package/dist/mixpanel.d.ts +3 -4
- package/dist/posthog.d.cts +3 -4
- package/dist/posthog.d.ts +3 -4
- package/dist/security.d.cts +5 -6
- package/dist/security.d.ts +5 -6
- package/dist/segment.d.cts +3 -4
- package/dist/segment.d.ts +3 -4
- package/dist/slack.d.cts +3 -4
- package/dist/slack.d.ts +3 -4
- package/dist/testing.d.cts +3 -3
- package/dist/testing.d.ts +3 -3
- package/dist/webhook.d.cts +3 -4
- package/dist/webhook.d.ts +3 -4
- package/examples/subscriber-posthog.ts +5 -1
- package/package.json +17 -22
package/dist/middleware.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventAttributeValue, EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/middleware.d.ts
|
|
3
3
|
/** Normalized event for middleware processing */
|
|
4
|
-
type EventsEvent = {
|
|
4
|
+
export type EventsEvent = {
|
|
5
5
|
type: 'event';
|
|
6
6
|
name: string;
|
|
7
7
|
attributes?: EventAttributes;
|
|
@@ -25,7 +25,7 @@ type EventsEvent = {
|
|
|
25
25
|
attributes?: EventAttributes;
|
|
26
26
|
options?: EventTrackingOptions;
|
|
27
27
|
};
|
|
28
|
-
type SendEventRecord = {
|
|
28
|
+
export type SendEventRecord = {
|
|
29
29
|
subscriberName: string;
|
|
30
30
|
eventType: EventsEvent['type'];
|
|
31
31
|
eventName: string;
|
|
@@ -39,24 +39,24 @@ type SendEventRecord = {
|
|
|
39
39
|
code?: string;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
type SendEventSink = {
|
|
42
|
+
export type SendEventSink = {
|
|
43
43
|
write(event: SendEventRecord): Promise<void>;
|
|
44
44
|
};
|
|
45
|
-
type RateLimitAlgorithm = 'fixed' | 'sliding';
|
|
46
|
-
type RateLimitRecord = {
|
|
45
|
+
export type RateLimitAlgorithm = 'fixed' | 'sliding';
|
|
46
|
+
export type RateLimitRecord = {
|
|
47
47
|
count: number;
|
|
48
48
|
resetAtMs: number;
|
|
49
49
|
};
|
|
50
|
-
type RateLimitStore = {
|
|
50
|
+
export type RateLimitStore = {
|
|
51
51
|
record(key: string, windowMs: number, algorithm: RateLimitAlgorithm): Promise<RateLimitRecord>;
|
|
52
52
|
};
|
|
53
|
-
type IdempotencyStore<TResult = unknown> = {
|
|
53
|
+
export type IdempotencyStore<TResult = unknown> = {
|
|
54
54
|
get(key: string): Promise<TResult | null>;
|
|
55
55
|
set(key: string, result: TResult, ttlMs: number): Promise<void>;
|
|
56
56
|
};
|
|
57
57
|
/** The context a middleware chain threads through, when the caller names none. */
|
|
58
|
-
type MiddlewareContext = Record<string, EventAttributeValue>;
|
|
59
|
-
type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (params: {
|
|
58
|
+
export type MiddlewareContext = Record<string, EventAttributeValue>;
|
|
59
|
+
export type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (params: {
|
|
60
60
|
event: EventsEvent;
|
|
61
61
|
ctx: TCtxIn;
|
|
62
62
|
subscriber: Pick<EventSubscriber, 'name' | 'version'>;
|
|
@@ -66,7 +66,7 @@ type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (param
|
|
|
66
66
|
}) => Promise<void>;
|
|
67
67
|
}) => Promise<void>;
|
|
68
68
|
/** Type-safe middleware factory helper */
|
|
69
|
-
declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(fn: SubscriberMiddleware<TCtxIn, TCtxOut>) => SubscriberMiddleware<TCtxIn, TCtxOut>;
|
|
69
|
+
export declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(fn: SubscriberMiddleware<TCtxIn, TCtxOut>) => SubscriberMiddleware<TCtxIn, TCtxOut>;
|
|
70
70
|
/**
|
|
71
71
|
* Apply middleware to a subscriber
|
|
72
72
|
*
|
|
@@ -80,7 +80,7 @@ declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(f
|
|
|
80
80
|
* )
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
|
-
declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubscriber, middlewares: Array<SubscriberMiddleware<TCtx, TCtx>>, options?: {
|
|
83
|
+
export declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubscriber, middlewares: Array<SubscriberMiddleware<TCtx, TCtx>>, options?: {
|
|
84
84
|
initialContext?: () => TCtx;
|
|
85
85
|
}): EventSubscriber;
|
|
86
86
|
/**
|
|
@@ -88,7 +88,7 @@ declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubs
|
|
|
88
88
|
*
|
|
89
89
|
* Automatically retries failed events with exponential backoff delay
|
|
90
90
|
*/
|
|
91
|
-
declare function retryMiddleware(options: {
|
|
91
|
+
export declare function retryMiddleware(options: {
|
|
92
92
|
maxRetries?: number;
|
|
93
93
|
delayMs?: number;
|
|
94
94
|
onRetry?: (attempt: number, error: Error, event: EventsEvent) => void;
|
|
@@ -98,19 +98,19 @@ declare function retryMiddleware(options: {
|
|
|
98
98
|
*
|
|
99
99
|
* Only passes through a percentage of events based on the rate (0.0 to 1.0)
|
|
100
100
|
*/
|
|
101
|
-
declare function samplingMiddleware(rate: number): SubscriberMiddleware;
|
|
101
|
+
export declare function samplingMiddleware(rate: number): SubscriberMiddleware;
|
|
102
102
|
/**
|
|
103
103
|
* Enrichment middleware to add or modify event data
|
|
104
104
|
*
|
|
105
105
|
* Apply a transformation function to each event before sending
|
|
106
106
|
*/
|
|
107
|
-
declare function enrichmentMiddleware(enricher: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
107
|
+
export declare function enrichmentMiddleware(enricher: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
108
108
|
/**
|
|
109
109
|
* Logging middleware for debugging event flow
|
|
110
110
|
*
|
|
111
111
|
* Logs event type and name (optionally full event) to console
|
|
112
112
|
*/
|
|
113
|
-
declare function loggingMiddleware(options?: {
|
|
113
|
+
export declare function loggingMiddleware(options?: {
|
|
114
114
|
prefix?: string;
|
|
115
115
|
logAttributes?: boolean;
|
|
116
116
|
}): SubscriberMiddleware;
|
|
@@ -119,19 +119,19 @@ declare function loggingMiddleware(options?: {
|
|
|
119
119
|
*
|
|
120
120
|
* Only forwards events that match the predicate
|
|
121
121
|
*/
|
|
122
|
-
declare function filterMiddleware(predicate: (event: EventsEvent) => boolean): SubscriberMiddleware;
|
|
122
|
+
export declare function filterMiddleware(predicate: (event: EventsEvent) => boolean): SubscriberMiddleware;
|
|
123
123
|
/**
|
|
124
124
|
* Transform middleware to modify event structure
|
|
125
125
|
*
|
|
126
126
|
* Similar to enrichment but replaces entire event
|
|
127
127
|
*/
|
|
128
|
-
declare function transformMiddleware(transformer: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
128
|
+
export declare function transformMiddleware(transformer: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
129
129
|
/**
|
|
130
130
|
* Batching middleware to group events for bulk sending
|
|
131
131
|
*
|
|
132
132
|
* Collects events into batches before forwarding
|
|
133
133
|
*/
|
|
134
|
-
declare function batchingMiddleware(options: {
|
|
134
|
+
export declare function batchingMiddleware(options: {
|
|
135
135
|
batchSize?: number;
|
|
136
136
|
flushInterval?: number;
|
|
137
137
|
}): SubscriberMiddleware;
|
|
@@ -140,7 +140,7 @@ declare function batchingMiddleware(options: {
|
|
|
140
140
|
*
|
|
141
141
|
* Enforces a maximum rate of events sent per second
|
|
142
142
|
*/
|
|
143
|
-
declare function rateLimitMiddleware(options: {
|
|
143
|
+
export declare function rateLimitMiddleware(options: {
|
|
144
144
|
requestsPerSecond: number;
|
|
145
145
|
}): SubscriberMiddleware;
|
|
146
146
|
/**
|
|
@@ -148,7 +148,7 @@ declare function rateLimitMiddleware(options: {
|
|
|
148
148
|
*
|
|
149
149
|
* Prevents cascading failures by stopping requests when error rate exceeds threshold
|
|
150
150
|
*/
|
|
151
|
-
declare function circuitBreakerMiddleware(options: {
|
|
151
|
+
export declare function circuitBreakerMiddleware(options: {
|
|
152
152
|
failureThreshold?: number;
|
|
153
153
|
timeout?: number;
|
|
154
154
|
onOpen?: () => void;
|
|
@@ -159,7 +159,7 @@ declare function circuitBreakerMiddleware(options: {
|
|
|
159
159
|
*
|
|
160
160
|
* Rejects the event if processing exceeds the specified timeout
|
|
161
161
|
*/
|
|
162
|
-
declare function timeoutMiddleware(options: {
|
|
162
|
+
export declare function timeoutMiddleware(options: {
|
|
163
163
|
timeoutMs: number;
|
|
164
164
|
}): SubscriberMiddleware;
|
|
165
165
|
/**
|
|
@@ -167,7 +167,7 @@ declare function timeoutMiddleware(options: {
|
|
|
167
167
|
*
|
|
168
168
|
* Used with withIdempotency middleware to prevent duplicate event processing
|
|
169
169
|
*/
|
|
170
|
-
declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
170
|
+
export declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
171
171
|
get: (key: string) => Promise<TResult | null>;
|
|
172
172
|
set: (key: string, result: TResult, ttlMs: number) => Promise<void>;
|
|
173
173
|
}): IdempotencyStore<TResult>;
|
|
@@ -176,13 +176,13 @@ declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
|
176
176
|
*
|
|
177
177
|
* Useful for testing or single-process applications
|
|
178
178
|
*/
|
|
179
|
-
declare function inMemoryIdempotencyStore<TResult = unknown>(): IdempotencyStore<TResult>;
|
|
179
|
+
export declare function inMemoryIdempotencyStore<TResult = unknown>(): IdempotencyStore<TResult>;
|
|
180
180
|
/**
|
|
181
181
|
* Create a rate limit store with custom record operation
|
|
182
182
|
*
|
|
183
183
|
* Used with withRateLimit middleware for distributed rate limiting
|
|
184
184
|
*/
|
|
185
|
-
declare function createRateLimitStore(options: {
|
|
185
|
+
export declare function createRateLimitStore(options: {
|
|
186
186
|
record: (key: string, windowMs: number, algorithm: RateLimitAlgorithm) => Promise<RateLimitRecord>;
|
|
187
187
|
}): RateLimitStore;
|
|
188
188
|
/**
|
|
@@ -190,7 +190,7 @@ declare function createRateLimitStore(options: {
|
|
|
190
190
|
*
|
|
191
191
|
* Supports fixed and sliding window algorithms
|
|
192
192
|
*/
|
|
193
|
-
declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
193
|
+
export declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
194
194
|
/**
|
|
195
195
|
* Idempotency middleware to prevent duplicate processing
|
|
196
196
|
*
|
|
@@ -205,7 +205,7 @@ declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
|
205
205
|
* })
|
|
206
206
|
* ```
|
|
207
207
|
*/
|
|
208
|
-
declare function withIdempotency(options: {
|
|
208
|
+
export declare function withIdempotency(options: {
|
|
209
209
|
store: IdempotencyStore<boolean>;
|
|
210
210
|
key: string | ((event: EventsEvent) => string);
|
|
211
211
|
ttlMs: number;
|
|
@@ -225,7 +225,7 @@ declare function withIdempotency(options: {
|
|
|
225
225
|
* })
|
|
226
226
|
* ```
|
|
227
227
|
*/
|
|
228
|
-
declare function withRateLimit(options: {
|
|
228
|
+
export declare function withRateLimit(options: {
|
|
229
229
|
store: RateLimitStore;
|
|
230
230
|
key: string | ((event: EventsEvent) => string);
|
|
231
231
|
max: number;
|
|
@@ -248,8 +248,7 @@ declare function withRateLimit(options: {
|
|
|
248
248
|
* })
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
|
-
declare function withEventLogger(options: {
|
|
251
|
+
export declare function withEventLogger(options: {
|
|
252
252
|
sink: SendEventSink;
|
|
253
253
|
}): SubscriberMiddleware;
|
|
254
|
-
//#endregion
|
|
255
|
-
export { EventsEvent, IdempotencyStore, MiddlewareContext, RateLimitAlgorithm, RateLimitRecord, RateLimitStore, SendEventRecord, SendEventSink, SubscriberMiddleware, applyMiddleware, batchingMiddleware, circuitBreakerMiddleware, createIdempotencyStore, createMiddleware, createRateLimitStore, enrichmentMiddleware, filterMiddleware, inMemoryIdempotencyStore, inMemoryRateLimitStore, loggingMiddleware, rateLimitMiddleware, retryMiddleware, samplingMiddleware, timeoutMiddleware, transformMiddleware, withEventLogger, withIdempotency, withRateLimit };
|
|
254
|
+
//#endregion
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventAttributeValue, EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/middleware.d.ts
|
|
3
3
|
/** Normalized event for middleware processing */
|
|
4
|
-
type EventsEvent = {
|
|
4
|
+
export type EventsEvent = {
|
|
5
5
|
type: 'event';
|
|
6
6
|
name: string;
|
|
7
7
|
attributes?: EventAttributes;
|
|
@@ -25,7 +25,7 @@ type EventsEvent = {
|
|
|
25
25
|
attributes?: EventAttributes;
|
|
26
26
|
options?: EventTrackingOptions;
|
|
27
27
|
};
|
|
28
|
-
type SendEventRecord = {
|
|
28
|
+
export type SendEventRecord = {
|
|
29
29
|
subscriberName: string;
|
|
30
30
|
eventType: EventsEvent['type'];
|
|
31
31
|
eventName: string;
|
|
@@ -39,24 +39,24 @@ type SendEventRecord = {
|
|
|
39
39
|
code?: string;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
-
type SendEventSink = {
|
|
42
|
+
export type SendEventSink = {
|
|
43
43
|
write(event: SendEventRecord): Promise<void>;
|
|
44
44
|
};
|
|
45
|
-
type RateLimitAlgorithm = 'fixed' | 'sliding';
|
|
46
|
-
type RateLimitRecord = {
|
|
45
|
+
export type RateLimitAlgorithm = 'fixed' | 'sliding';
|
|
46
|
+
export type RateLimitRecord = {
|
|
47
47
|
count: number;
|
|
48
48
|
resetAtMs: number;
|
|
49
49
|
};
|
|
50
|
-
type RateLimitStore = {
|
|
50
|
+
export type RateLimitStore = {
|
|
51
51
|
record(key: string, windowMs: number, algorithm: RateLimitAlgorithm): Promise<RateLimitRecord>;
|
|
52
52
|
};
|
|
53
|
-
type IdempotencyStore<TResult = unknown> = {
|
|
53
|
+
export type IdempotencyStore<TResult = unknown> = {
|
|
54
54
|
get(key: string): Promise<TResult | null>;
|
|
55
55
|
set(key: string, result: TResult, ttlMs: number): Promise<void>;
|
|
56
56
|
};
|
|
57
57
|
/** The context a middleware chain threads through, when the caller names none. */
|
|
58
|
-
type MiddlewareContext = Record<string, EventAttributeValue>;
|
|
59
|
-
type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (params: {
|
|
58
|
+
export type MiddlewareContext = Record<string, EventAttributeValue>;
|
|
59
|
+
export type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (params: {
|
|
60
60
|
event: EventsEvent;
|
|
61
61
|
ctx: TCtxIn;
|
|
62
62
|
subscriber: Pick<EventSubscriber, 'name' | 'version'>;
|
|
@@ -66,7 +66,7 @@ type SubscriberMiddleware<TCtxIn = MiddlewareContext, TCtxOut = TCtxIn> = (param
|
|
|
66
66
|
}) => Promise<void>;
|
|
67
67
|
}) => Promise<void>;
|
|
68
68
|
/** Type-safe middleware factory helper */
|
|
69
|
-
declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(fn: SubscriberMiddleware<TCtxIn, TCtxOut>) => SubscriberMiddleware<TCtxIn, TCtxOut>;
|
|
69
|
+
export declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(fn: SubscriberMiddleware<TCtxIn, TCtxOut>) => SubscriberMiddleware<TCtxIn, TCtxOut>;
|
|
70
70
|
/**
|
|
71
71
|
* Apply middleware to a subscriber
|
|
72
72
|
*
|
|
@@ -80,7 +80,7 @@ declare const createMiddleware: <TCtxIn = MiddlewareContext, TCtxOut = TCtxIn>(f
|
|
|
80
80
|
* )
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
|
-
declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubscriber, middlewares: Array<SubscriberMiddleware<TCtx, TCtx>>, options?: {
|
|
83
|
+
export declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubscriber, middlewares: Array<SubscriberMiddleware<TCtx, TCtx>>, options?: {
|
|
84
84
|
initialContext?: () => TCtx;
|
|
85
85
|
}): EventSubscriber;
|
|
86
86
|
/**
|
|
@@ -88,7 +88,7 @@ declare function applyMiddleware<TCtx = MiddlewareContext>(subscriber: EventSubs
|
|
|
88
88
|
*
|
|
89
89
|
* Automatically retries failed events with exponential backoff delay
|
|
90
90
|
*/
|
|
91
|
-
declare function retryMiddleware(options: {
|
|
91
|
+
export declare function retryMiddleware(options: {
|
|
92
92
|
maxRetries?: number;
|
|
93
93
|
delayMs?: number;
|
|
94
94
|
onRetry?: (attempt: number, error: Error, event: EventsEvent) => void;
|
|
@@ -98,19 +98,19 @@ declare function retryMiddleware(options: {
|
|
|
98
98
|
*
|
|
99
99
|
* Only passes through a percentage of events based on the rate (0.0 to 1.0)
|
|
100
100
|
*/
|
|
101
|
-
declare function samplingMiddleware(rate: number): SubscriberMiddleware;
|
|
101
|
+
export declare function samplingMiddleware(rate: number): SubscriberMiddleware;
|
|
102
102
|
/**
|
|
103
103
|
* Enrichment middleware to add or modify event data
|
|
104
104
|
*
|
|
105
105
|
* Apply a transformation function to each event before sending
|
|
106
106
|
*/
|
|
107
|
-
declare function enrichmentMiddleware(enricher: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
107
|
+
export declare function enrichmentMiddleware(enricher: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
108
108
|
/**
|
|
109
109
|
* Logging middleware for debugging event flow
|
|
110
110
|
*
|
|
111
111
|
* Logs event type and name (optionally full event) to console
|
|
112
112
|
*/
|
|
113
|
-
declare function loggingMiddleware(options?: {
|
|
113
|
+
export declare function loggingMiddleware(options?: {
|
|
114
114
|
prefix?: string;
|
|
115
115
|
logAttributes?: boolean;
|
|
116
116
|
}): SubscriberMiddleware;
|
|
@@ -119,19 +119,19 @@ declare function loggingMiddleware(options?: {
|
|
|
119
119
|
*
|
|
120
120
|
* Only forwards events that match the predicate
|
|
121
121
|
*/
|
|
122
|
-
declare function filterMiddleware(predicate: (event: EventsEvent) => boolean): SubscriberMiddleware;
|
|
122
|
+
export declare function filterMiddleware(predicate: (event: EventsEvent) => boolean): SubscriberMiddleware;
|
|
123
123
|
/**
|
|
124
124
|
* Transform middleware to modify event structure
|
|
125
125
|
*
|
|
126
126
|
* Similar to enrichment but replaces entire event
|
|
127
127
|
*/
|
|
128
|
-
declare function transformMiddleware(transformer: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
128
|
+
export declare function transformMiddleware(transformer: (event: EventsEvent) => EventsEvent): SubscriberMiddleware;
|
|
129
129
|
/**
|
|
130
130
|
* Batching middleware to group events for bulk sending
|
|
131
131
|
*
|
|
132
132
|
* Collects events into batches before forwarding
|
|
133
133
|
*/
|
|
134
|
-
declare function batchingMiddleware(options: {
|
|
134
|
+
export declare function batchingMiddleware(options: {
|
|
135
135
|
batchSize?: number;
|
|
136
136
|
flushInterval?: number;
|
|
137
137
|
}): SubscriberMiddleware;
|
|
@@ -140,7 +140,7 @@ declare function batchingMiddleware(options: {
|
|
|
140
140
|
*
|
|
141
141
|
* Enforces a maximum rate of events sent per second
|
|
142
142
|
*/
|
|
143
|
-
declare function rateLimitMiddleware(options: {
|
|
143
|
+
export declare function rateLimitMiddleware(options: {
|
|
144
144
|
requestsPerSecond: number;
|
|
145
145
|
}): SubscriberMiddleware;
|
|
146
146
|
/**
|
|
@@ -148,7 +148,7 @@ declare function rateLimitMiddleware(options: {
|
|
|
148
148
|
*
|
|
149
149
|
* Prevents cascading failures by stopping requests when error rate exceeds threshold
|
|
150
150
|
*/
|
|
151
|
-
declare function circuitBreakerMiddleware(options: {
|
|
151
|
+
export declare function circuitBreakerMiddleware(options: {
|
|
152
152
|
failureThreshold?: number;
|
|
153
153
|
timeout?: number;
|
|
154
154
|
onOpen?: () => void;
|
|
@@ -159,7 +159,7 @@ declare function circuitBreakerMiddleware(options: {
|
|
|
159
159
|
*
|
|
160
160
|
* Rejects the event if processing exceeds the specified timeout
|
|
161
161
|
*/
|
|
162
|
-
declare function timeoutMiddleware(options: {
|
|
162
|
+
export declare function timeoutMiddleware(options: {
|
|
163
163
|
timeoutMs: number;
|
|
164
164
|
}): SubscriberMiddleware;
|
|
165
165
|
/**
|
|
@@ -167,7 +167,7 @@ declare function timeoutMiddleware(options: {
|
|
|
167
167
|
*
|
|
168
168
|
* Used with withIdempotency middleware to prevent duplicate event processing
|
|
169
169
|
*/
|
|
170
|
-
declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
170
|
+
export declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
171
171
|
get: (key: string) => Promise<TResult | null>;
|
|
172
172
|
set: (key: string, result: TResult, ttlMs: number) => Promise<void>;
|
|
173
173
|
}): IdempotencyStore<TResult>;
|
|
@@ -176,13 +176,13 @@ declare function createIdempotencyStore<TResult = unknown>(options: {
|
|
|
176
176
|
*
|
|
177
177
|
* Useful for testing or single-process applications
|
|
178
178
|
*/
|
|
179
|
-
declare function inMemoryIdempotencyStore<TResult = unknown>(): IdempotencyStore<TResult>;
|
|
179
|
+
export declare function inMemoryIdempotencyStore<TResult = unknown>(): IdempotencyStore<TResult>;
|
|
180
180
|
/**
|
|
181
181
|
* Create a rate limit store with custom record operation
|
|
182
182
|
*
|
|
183
183
|
* Used with withRateLimit middleware for distributed rate limiting
|
|
184
184
|
*/
|
|
185
|
-
declare function createRateLimitStore(options: {
|
|
185
|
+
export declare function createRateLimitStore(options: {
|
|
186
186
|
record: (key: string, windowMs: number, algorithm: RateLimitAlgorithm) => Promise<RateLimitRecord>;
|
|
187
187
|
}): RateLimitStore;
|
|
188
188
|
/**
|
|
@@ -190,7 +190,7 @@ declare function createRateLimitStore(options: {
|
|
|
190
190
|
*
|
|
191
191
|
* Supports fixed and sliding window algorithms
|
|
192
192
|
*/
|
|
193
|
-
declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
193
|
+
export declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
194
194
|
/**
|
|
195
195
|
* Idempotency middleware to prevent duplicate processing
|
|
196
196
|
*
|
|
@@ -205,7 +205,7 @@ declare function inMemoryRateLimitStore(): RateLimitStore;
|
|
|
205
205
|
* })
|
|
206
206
|
* ```
|
|
207
207
|
*/
|
|
208
|
-
declare function withIdempotency(options: {
|
|
208
|
+
export declare function withIdempotency(options: {
|
|
209
209
|
store: IdempotencyStore<boolean>;
|
|
210
210
|
key: string | ((event: EventsEvent) => string);
|
|
211
211
|
ttlMs: number;
|
|
@@ -225,7 +225,7 @@ declare function withIdempotency(options: {
|
|
|
225
225
|
* })
|
|
226
226
|
* ```
|
|
227
227
|
*/
|
|
228
|
-
declare function withRateLimit(options: {
|
|
228
|
+
export declare function withRateLimit(options: {
|
|
229
229
|
store: RateLimitStore;
|
|
230
230
|
key: string | ((event: EventsEvent) => string);
|
|
231
231
|
max: number;
|
|
@@ -248,8 +248,7 @@ declare function withRateLimit(options: {
|
|
|
248
248
|
* })
|
|
249
249
|
* ```
|
|
250
250
|
*/
|
|
251
|
-
declare function withEventLogger(options: {
|
|
251
|
+
export declare function withEventLogger(options: {
|
|
252
252
|
sink: SendEventSink;
|
|
253
253
|
}): SubscriberMiddleware;
|
|
254
|
-
//#endregion
|
|
255
|
-
export { EventsEvent, IdempotencyStore, MiddlewareContext, RateLimitAlgorithm, RateLimitRecord, RateLimitStore, SendEventRecord, SendEventSink, SubscriberMiddleware, applyMiddleware, batchingMiddleware, circuitBreakerMiddleware, createIdempotencyStore, createMiddleware, createRateLimitStore, enrichmentMiddleware, filterMiddleware, inMemoryIdempotencyStore, inMemoryRateLimitStore, loggingMiddleware, rateLimitMiddleware, retryMiddleware, samplingMiddleware, timeoutMiddleware, transformMiddleware, withEventLogger, withIdempotency, withRateLimit };
|
|
254
|
+
//#endregion
|
package/dist/mixpanel.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/mixpanel.d.ts
|
|
3
|
-
interface MixpanelConfig {
|
|
3
|
+
export interface MixpanelConfig {
|
|
4
4
|
/** Mixpanel project token */
|
|
5
5
|
token: string;
|
|
6
6
|
/** Enable/disable the subscriber */
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare class MixpanelSubscriber implements EventSubscriber {
|
|
9
|
+
export declare class MixpanelSubscriber implements EventSubscriber {
|
|
10
10
|
readonly name = "MixpanelSubscriber";
|
|
11
11
|
readonly version = "1.0.0";
|
|
12
12
|
private mixpanel;
|
|
@@ -30,5 +30,4 @@ declare class MixpanelSubscriber implements EventSubscriber {
|
|
|
30
30
|
trackOutcome(operationName: string, outcome: OutcomeStatus, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
|
|
31
31
|
trackValue(name: string, value: number, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { MixpanelConfig, MixpanelSubscriber };
|
|
33
|
+
//#endregion
|
package/dist/mixpanel.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EventAttributes, EventSubscriber, EventTrackingOptions, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/mixpanel.d.ts
|
|
3
|
-
interface MixpanelConfig {
|
|
3
|
+
export interface MixpanelConfig {
|
|
4
4
|
/** Mixpanel project token */
|
|
5
5
|
token: string;
|
|
6
6
|
/** Enable/disable the subscriber */
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare class MixpanelSubscriber implements EventSubscriber {
|
|
9
|
+
export declare class MixpanelSubscriber implements EventSubscriber {
|
|
10
10
|
readonly name = "MixpanelSubscriber";
|
|
11
11
|
readonly version = "1.0.0";
|
|
12
12
|
private mixpanel;
|
|
@@ -30,5 +30,4 @@ declare class MixpanelSubscriber implements EventSubscriber {
|
|
|
30
30
|
trackOutcome(operationName: string, outcome: OutcomeStatus, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
|
|
31
31
|
trackValue(name: string, value: number, attributes?: EventAttributes, options?: EventTrackingOptions): Promise<void>;
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { MixpanelConfig, MixpanelSubscriber };
|
|
33
|
+
//#endregion
|
package/dist/posthog.d.cts
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
* @deprecated Moved to `autotel-posthog/subscriber` - import it from there.
|
|
16
16
|
* Constructing this throws; it exists only to point at the new home.
|
|
17
17
|
*/
|
|
18
|
-
declare class PostHogSubscriber {
|
|
18
|
+
export declare class PostHogSubscriber {
|
|
19
19
|
constructor(..._config: unknown[]);
|
|
20
20
|
}
|
|
21
21
|
/** @deprecated Moved to `autotel-posthog/subscriber` along with the subscriber. */
|
|
22
|
-
type PostHogConfig = Record<never, never>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { PostHogConfig, PostHogSubscriber };
|
|
22
|
+
export type PostHogConfig = Record<never, never>;
|
|
23
|
+
//#endregion
|
package/dist/posthog.d.ts
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
* @deprecated Moved to `autotel-posthog/subscriber` - import it from there.
|
|
16
16
|
* Constructing this throws; it exists only to point at the new home.
|
|
17
17
|
*/
|
|
18
|
-
declare class PostHogSubscriber {
|
|
18
|
+
export declare class PostHogSubscriber {
|
|
19
19
|
constructor(..._config: unknown[]);
|
|
20
20
|
}
|
|
21
21
|
/** @deprecated Moved to `autotel-posthog/subscriber` along with the subscriber. */
|
|
22
|
-
type PostHogConfig = Record<never, never>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { PostHogConfig, PostHogSubscriber };
|
|
22
|
+
export type PostHogConfig = Record<never, never>;
|
|
23
|
+
//#endregion
|
package/dist/security.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import { n as EventPayload, r as EventSubscriber$1, t as AutotelEventContext$1 }
|
|
|
2
2
|
import { EventAttributes } from "autotel/event-subscriber";
|
|
3
3
|
import { SecuritySeverity } from "autotel/security-schema";
|
|
4
4
|
//#region src/security.d.ts
|
|
5
|
-
type SecurityAlertSeverity = SecuritySeverity;
|
|
5
|
+
export type SecurityAlertSeverity = SecuritySeverity;
|
|
6
6
|
/** Normalized alert passed to handlers and POSTed to webhooks. */
|
|
7
|
-
interface SecurityAlert {
|
|
7
|
+
export interface SecurityAlert {
|
|
8
8
|
/** Full event name, e.g. `security.auth.login.failed`. */
|
|
9
9
|
event: string;
|
|
10
10
|
severity: SecurityAlertSeverity;
|
|
@@ -18,7 +18,7 @@ interface SecurityAlert {
|
|
|
18
18
|
/** Trace correlation, when the Events pipeline includes it. */
|
|
19
19
|
trace?: AutotelEventContext$1;
|
|
20
20
|
}
|
|
21
|
-
interface SecuritySubscriberConfig {
|
|
21
|
+
export interface SecuritySubscriberConfig {
|
|
22
22
|
/** POST alerts as JSON to this URL. Required unless `handler` is set. */
|
|
23
23
|
webhookUrl?: string;
|
|
24
24
|
/** Extra headers for the webhook request (e.g. auth). */
|
|
@@ -43,7 +43,7 @@ interface SecuritySubscriberConfig {
|
|
|
43
43
|
/** Base webhook retry backoff; doubles per attempt. Default 1000. */
|
|
44
44
|
retryDelayMs?: number;
|
|
45
45
|
}
|
|
46
|
-
declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
46
|
+
export declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
47
47
|
readonly name = "SecuritySubscriber";
|
|
48
48
|
readonly version = "1.0.0";
|
|
49
49
|
private config;
|
|
@@ -52,5 +52,4 @@ declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
|
52
52
|
protected sendToDestination(payload: EventPayload): Promise<void>;
|
|
53
53
|
private toAlert;
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { SecurityAlert, SecurityAlertSeverity, SecuritySubscriber, SecuritySubscriberConfig };
|
|
55
|
+
//#endregion
|
package/dist/security.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { n as EventPayload, r as EventSubscriber$1, t as AutotelEventContext$1 }
|
|
|
2
2
|
import { SecuritySeverity } from "autotel/security-schema";
|
|
3
3
|
import { EventAttributes } from "autotel/event-subscriber";
|
|
4
4
|
//#region src/security.d.ts
|
|
5
|
-
type SecurityAlertSeverity = SecuritySeverity;
|
|
5
|
+
export type SecurityAlertSeverity = SecuritySeverity;
|
|
6
6
|
/** Normalized alert passed to handlers and POSTed to webhooks. */
|
|
7
|
-
interface SecurityAlert {
|
|
7
|
+
export interface SecurityAlert {
|
|
8
8
|
/** Full event name, e.g. `security.auth.login.failed`. */
|
|
9
9
|
event: string;
|
|
10
10
|
severity: SecurityAlertSeverity;
|
|
@@ -18,7 +18,7 @@ interface SecurityAlert {
|
|
|
18
18
|
/** Trace correlation, when the Events pipeline includes it. */
|
|
19
19
|
trace?: AutotelEventContext$1;
|
|
20
20
|
}
|
|
21
|
-
interface SecuritySubscriberConfig {
|
|
21
|
+
export interface SecuritySubscriberConfig {
|
|
22
22
|
/** POST alerts as JSON to this URL. Required unless `handler` is set. */
|
|
23
23
|
webhookUrl?: string;
|
|
24
24
|
/** Extra headers for the webhook request (e.g. auth). */
|
|
@@ -43,7 +43,7 @@ interface SecuritySubscriberConfig {
|
|
|
43
43
|
/** Base webhook retry backoff; doubles per attempt. Default 1000. */
|
|
44
44
|
retryDelayMs?: number;
|
|
45
45
|
}
|
|
46
|
-
declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
46
|
+
export declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
47
47
|
readonly name = "SecuritySubscriber";
|
|
48
48
|
readonly version = "1.0.0";
|
|
49
49
|
private config;
|
|
@@ -52,5 +52,4 @@ declare class SecuritySubscriber extends EventSubscriber$1 {
|
|
|
52
52
|
protected sendToDestination(payload: EventPayload): Promise<void>;
|
|
53
53
|
private toAlert;
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { SecurityAlert, SecurityAlertSeverity, SecuritySubscriber, SecuritySubscriberConfig };
|
|
55
|
+
//#endregion
|
package/dist/segment.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EventAttributes, EventSubscriber, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/segment.d.ts
|
|
3
|
-
interface SegmentConfig {
|
|
3
|
+
export interface SegmentConfig {
|
|
4
4
|
/** Segment write key */
|
|
5
5
|
writeKey: string;
|
|
6
6
|
/** Enable/disable the subscriber */
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare class SegmentSubscriber implements EventSubscriber {
|
|
9
|
+
export declare class SegmentSubscriber implements EventSubscriber {
|
|
10
10
|
readonly name = "SegmentSubscriber";
|
|
11
11
|
readonly version = "1.0.0";
|
|
12
12
|
private events;
|
|
@@ -23,5 +23,4 @@ declare class SegmentSubscriber implements EventSubscriber {
|
|
|
23
23
|
/** Flush pending events before shutdown */
|
|
24
24
|
shutdown(): Promise<void>;
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { SegmentConfig, SegmentSubscriber };
|
|
26
|
+
//#endregion
|
package/dist/segment.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EventAttributes, EventSubscriber, FunnelStatus, OutcomeStatus } from "autotel/event-subscriber";
|
|
2
2
|
//#region src/segment.d.ts
|
|
3
|
-
interface SegmentConfig {
|
|
3
|
+
export interface SegmentConfig {
|
|
4
4
|
/** Segment write key */
|
|
5
5
|
writeKey: string;
|
|
6
6
|
/** Enable/disable the subscriber */
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
}
|
|
9
|
-
declare class SegmentSubscriber implements EventSubscriber {
|
|
9
|
+
export declare class SegmentSubscriber implements EventSubscriber {
|
|
10
10
|
readonly name = "SegmentSubscriber";
|
|
11
11
|
readonly version = "1.0.0";
|
|
12
12
|
private events;
|
|
@@ -23,5 +23,4 @@ declare class SegmentSubscriber implements EventSubscriber {
|
|
|
23
23
|
/** Flush pending events before shutdown */
|
|
24
24
|
shutdown(): Promise<void>;
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { SegmentConfig, SegmentSubscriber };
|
|
26
|
+
//#endregion
|
package/dist/slack.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as EventPayload, r as EventSubscriber } from "./event-subscriber-base-DpZclJM4.cjs";
|
|
2
2
|
//#region src/slack.d.ts
|
|
3
|
-
interface SlackSubscriberConfig {
|
|
3
|
+
export interface SlackSubscriberConfig {
|
|
4
4
|
/** Slack webhook URL (https://hooks.slack.com/services/...) */
|
|
5
5
|
webhookUrl: string;
|
|
6
6
|
/** Default channel to post to (optional, overrides webhook default) */
|
|
@@ -20,7 +20,7 @@ interface SlackSubscriberConfig {
|
|
|
20
20
|
/** Enable/disable subscriber */
|
|
21
21
|
enabled?: boolean;
|
|
22
22
|
}
|
|
23
|
-
declare class SlackSubscriber extends EventSubscriber {
|
|
23
|
+
export declare class SlackSubscriber extends EventSubscriber {
|
|
24
24
|
readonly name = "SlackSubscriber";
|
|
25
25
|
readonly version = "1.0.0";
|
|
26
26
|
private config;
|
|
@@ -59,5 +59,4 @@ declare class SlackSubscriber extends EventSubscriber {
|
|
|
59
59
|
*/
|
|
60
60
|
protected handleError(error: Error, payload: EventPayload): void;
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
|
-
export { SlackSubscriber, SlackSubscriberConfig };
|
|
62
|
+
//#endregion
|
package/dist/slack.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as EventPayload, r as EventSubscriber } from "./event-subscriber-base-DpZclJM4.js";
|
|
2
2
|
//#region src/slack.d.ts
|
|
3
|
-
interface SlackSubscriberConfig {
|
|
3
|
+
export interface SlackSubscriberConfig {
|
|
4
4
|
/** Slack webhook URL (https://hooks.slack.com/services/...) */
|
|
5
5
|
webhookUrl: string;
|
|
6
6
|
/** Default channel to post to (optional, overrides webhook default) */
|
|
@@ -20,7 +20,7 @@ interface SlackSubscriberConfig {
|
|
|
20
20
|
/** Enable/disable subscriber */
|
|
21
21
|
enabled?: boolean;
|
|
22
22
|
}
|
|
23
|
-
declare class SlackSubscriber extends EventSubscriber {
|
|
23
|
+
export declare class SlackSubscriber extends EventSubscriber {
|
|
24
24
|
readonly name = "SlackSubscriber";
|
|
25
25
|
readonly version = "1.0.0";
|
|
26
26
|
private config;
|
|
@@ -59,5 +59,4 @@ declare class SlackSubscriber extends EventSubscriber {
|
|
|
59
59
|
*/
|
|
60
60
|
protected handleError(error: Error, payload: EventPayload): void;
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
|
-
export { SlackSubscriber, SlackSubscriberConfig };
|
|
62
|
+
//#endregion
|