@plyaz/types 1.7.18 → 1.7.19
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/api/client/enum.d.ts +12 -0
- package/dist/api/client/index.d.ts +1 -0
- package/dist/api/client/types.d.ts +114 -0
- package/dist/api/config/types.d.ts +58 -10
- package/dist/api/debugger/enums.d.ts +152 -0
- package/dist/api/debugger/factories/index.d.ts +1 -0
- package/dist/api/debugger/factories/types.d.ts +191 -0
- package/dist/api/debugger/index.d.ts +2 -0
- package/dist/api/debugger/types.d.ts +664 -0
- package/dist/api/endpoints/campaigns/index.d.ts +1 -0
- package/dist/api/endpoints/campaigns/types.d.ts +68 -0
- package/dist/api/endpoints/health/index.d.ts +1 -0
- package/dist/api/endpoints/health/types.d.ts +127 -0
- package/dist/api/endpoints/index.d.ts +3 -0
- package/dist/api/endpoints/types.d.ts +5 -0
- package/dist/api/errors/enum.d.ts +182 -0
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/types.d.ts +126 -27
- package/dist/api/events/enum.d.ts +261 -0
- package/dist/api/events/factories/cache/index.d.ts +1 -0
- package/dist/api/events/factories/cache/types.d.ts +60 -0
- package/dist/api/events/factories/client/index.d.ts +1 -0
- package/dist/api/events/factories/client/types.d.ts +120 -0
- package/dist/api/events/factories/config/index.d.ts +1 -0
- package/dist/api/events/factories/config/types.d.ts +79 -0
- package/dist/api/events/factories/debug/index.d.ts +1 -0
- package/dist/api/events/factories/debug/types.d.ts +130 -0
- package/dist/api/events/factories/errors/index.d.ts +1 -0
- package/dist/api/events/factories/errors/types.d.ts +293 -0
- package/dist/api/events/factories/headers/index.d.ts +1 -0
- package/dist/api/events/factories/headers/types.d.ts +256 -0
- package/dist/api/events/factories/index.d.ts +9 -0
- package/dist/api/events/factories/network/index.d.ts +1 -0
- package/dist/api/events/factories/network/types.d.ts +196 -0
- package/dist/api/events/factories/performance/index.d.ts +1 -0
- package/dist/api/events/factories/performance/types.d.ts +150 -0
- package/dist/api/events/factories/types.d.ts +84 -0
- package/dist/api/events/index.d.ts +2 -0
- package/dist/api/events/types.d.ts +1 -726
- package/dist/api/headers/enum.d.ts +34 -0
- package/dist/api/headers/index.d.ts +1 -0
- package/dist/api/headers/types.d.ts +456 -0
- package/dist/api/hooks/index.d.ts +1 -0
- package/dist/api/hooks/types.d.ts +131 -0
- package/dist/api/index.d.ts +6 -1
- package/dist/api/network/enums.d.ts +75 -5
- package/dist/api/network/frameworks/index.d.ts +2 -0
- package/dist/api/network/frameworks/nestjs/index.d.ts +1 -0
- package/dist/api/network/frameworks/nestjs/types.d.ts +47 -0
- package/dist/api/network/frameworks/types.d.ts +76 -0
- package/dist/api/network/index.d.ts +1 -0
- package/dist/api/network/types.d.ts +347 -39
- package/dist/api/performance/types.d.ts +17 -10
- package/dist/api/polling/types.d.ts +1 -1
- package/dist/api/pubsub/enum.d.ts +12 -0
- package/dist/api/pubsub/index.d.ts +2 -0
- package/dist/api/pubsub/types.d.ts +61 -0
- package/dist/api/queue/types.d.ts +69 -0
- package/dist/api/regional/enum.d.ts +75 -0
- package/dist/api/regional/index.d.ts +1 -0
- package/dist/api/regional/types.d.ts +2 -1
- package/dist/api/request/index.d.ts +1 -0
- package/dist/api/request/types.d.ts +44 -0
- package/dist/api/retry/types.d.ts +31 -0
- package/dist/api/strategies/types.d.ts +12 -8
- package/dist/errors/index.cjs +69 -0
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +66 -0
- package/dist/errors/index.js.map +1 -1
- package/dist/features/cache/types.d.ts +5 -0
- package/dist/testing/features/api/types.d.ts +355 -4
- package/package.json +5 -3
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Event Type Definitions for API Package
|
|
3
3
|
* All event interfaces and type definitions from the events system
|
|
4
4
|
*/
|
|
5
|
-
import type { HEADER_EVENTS, NETWORK_EVENTS, ERROR_EVENTS, DEBUG_EVENTS, CONFIG_EVENTS, PERFORMANCE_EVENTS, CACHE_EVENTS } from '@plyaz/config';
|
|
6
5
|
import type { EventHandler } from '../../events';
|
|
6
|
+
import type { CacheEventData, CacheHitEvent, CacheInvalidateEvent, CacheMissEvent, ClientEventType, ConfigEventData, DebugEventData, ErrorEventData, HeaderEventData, NetworkEventData, PerformanceEventData } from './factories';
|
|
7
7
|
/**
|
|
8
8
|
* Type for core event scopes
|
|
9
9
|
*/
|
|
@@ -32,669 +32,6 @@ export type ConfigUpdateStrategy = 'merge' | 'replace' | 'temporary';
|
|
|
32
32
|
* - 'temporary': Apply as temporary handlers (highest priority, can be reverted)
|
|
33
33
|
*/
|
|
34
34
|
export type HandlerStrategy = 'merge' | 'replace' | 'append' | 'prepend' | 'temporary';
|
|
35
|
-
/**
|
|
36
|
-
* Options for adding event handlers
|
|
37
|
-
*/
|
|
38
|
-
export interface HandlerOptions {
|
|
39
|
-
/** Strategy for handling multiple handlers */
|
|
40
|
-
strategy?: HandlerStrategy;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Base structure for all events
|
|
44
|
-
*/
|
|
45
|
-
export interface BaseEvent {
|
|
46
|
-
/** Event type/name */
|
|
47
|
-
type: string;
|
|
48
|
-
/** Timestamp when event was created (milliseconds since epoch) */
|
|
49
|
-
timestamp: number;
|
|
50
|
-
/** Optional event source identifier */
|
|
51
|
-
source?: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Options for event creation
|
|
55
|
-
*/
|
|
56
|
-
export interface EventOptions {
|
|
57
|
-
/** Whether to emit immediately after creation */
|
|
58
|
-
emit?: boolean;
|
|
59
|
-
/** Additional metadata to attach */
|
|
60
|
-
metadata?: Record<string, unknown>;
|
|
61
|
-
/** Event source identifier */
|
|
62
|
-
source?: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Base structure for header events
|
|
66
|
-
*/
|
|
67
|
-
export interface HeaderEvent extends BaseEvent {
|
|
68
|
-
type: string;
|
|
69
|
-
data: Record<string, unknown>;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Headers changed event
|
|
73
|
-
*/
|
|
74
|
-
export interface HeadersChangedEvent extends HeaderEvent {
|
|
75
|
-
type: typeof HEADER_EVENTS.CHANGED;
|
|
76
|
-
data: {
|
|
77
|
-
previous: Record<string, string>;
|
|
78
|
-
current: Record<string, string>;
|
|
79
|
-
changes: {
|
|
80
|
-
added: Record<string, string>;
|
|
81
|
-
modified: Record<string, string>;
|
|
82
|
-
removed: string[];
|
|
83
|
-
};
|
|
84
|
-
source: ConfigSource;
|
|
85
|
-
reason?: string;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Headers enriched event
|
|
90
|
-
*/
|
|
91
|
-
export interface HeadersEnrichedEvent extends HeaderEvent {
|
|
92
|
-
type: typeof HEADER_EVENTS.ENRICHED;
|
|
93
|
-
data: {
|
|
94
|
-
original: Record<string, string>;
|
|
95
|
-
enriched: Record<string, string>;
|
|
96
|
-
addedHeaders: string[];
|
|
97
|
-
source: 'client-hints' | 'device-detection' | 'user-agent' | 'custom';
|
|
98
|
-
metadata?: {
|
|
99
|
-
deviceType?: string;
|
|
100
|
-
browserName?: string;
|
|
101
|
-
osName?: string;
|
|
102
|
-
[key: string]: unknown;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Headers conflict event
|
|
108
|
-
*/
|
|
109
|
-
export interface HeadersConflictEvent extends HeaderEvent {
|
|
110
|
-
type: typeof HEADER_EVENTS.CONFLICT;
|
|
111
|
-
data: {
|
|
112
|
-
header: string;
|
|
113
|
-
conflicts: Array<{
|
|
114
|
-
source: ConfigSource;
|
|
115
|
-
value: string;
|
|
116
|
-
priority: number;
|
|
117
|
-
}>;
|
|
118
|
-
resolution: {
|
|
119
|
-
source: ConfigSource;
|
|
120
|
-
value: string;
|
|
121
|
-
reason: string;
|
|
122
|
-
};
|
|
123
|
-
strategy: 'override' | 'merge' | 'preserve';
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Headers override event
|
|
128
|
-
*/
|
|
129
|
-
export interface HeadersOverrideEvent extends HeaderEvent {
|
|
130
|
-
type: typeof HEADER_EVENTS.OVERRIDE;
|
|
131
|
-
data: {
|
|
132
|
-
header: string;
|
|
133
|
-
previousValue: string | undefined;
|
|
134
|
-
newValue: string;
|
|
135
|
-
source: ConfigSource;
|
|
136
|
-
reason: string;
|
|
137
|
-
temporary?: boolean;
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Headers merged event
|
|
142
|
-
*/
|
|
143
|
-
export interface HeadersMergedEvent extends HeaderEvent {
|
|
144
|
-
type: typeof HEADER_EVENTS.MERGED;
|
|
145
|
-
data: {
|
|
146
|
-
sources: Array<Record<string, string>>;
|
|
147
|
-
result: Record<string, string>;
|
|
148
|
-
strategy: 'shallow' | 'deep' | 'concat';
|
|
149
|
-
conflictsResolved: number;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Headers filtered event
|
|
154
|
-
*/
|
|
155
|
-
export interface HeadersFilteredEvent extends HeaderEvent {
|
|
156
|
-
type: typeof HEADER_EVENTS.FILTERED;
|
|
157
|
-
data: {
|
|
158
|
-
original: Record<string, string>;
|
|
159
|
-
filtered: Record<string, string>;
|
|
160
|
-
removedHeaders: string[];
|
|
161
|
-
reason: string;
|
|
162
|
-
source?: ConfigSource;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Headers validated event
|
|
167
|
-
*/
|
|
168
|
-
export interface HeadersValidatedEvent extends HeaderEvent {
|
|
169
|
-
type: typeof HEADER_EVENTS.VALIDATED;
|
|
170
|
-
data: {
|
|
171
|
-
headers: Record<string, string>;
|
|
172
|
-
valid: boolean;
|
|
173
|
-
errors?: Array<{
|
|
174
|
-
header: string;
|
|
175
|
-
reason: string;
|
|
176
|
-
}>;
|
|
177
|
-
warnings?: Array<{
|
|
178
|
-
header: string;
|
|
179
|
-
message: string;
|
|
180
|
-
}>;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Headers cached event
|
|
185
|
-
*/
|
|
186
|
-
export interface HeadersCachedEvent extends HeaderEvent {
|
|
187
|
-
type: typeof HEADER_EVENTS.CACHED;
|
|
188
|
-
data: {
|
|
189
|
-
key: string;
|
|
190
|
-
headers: Record<string, string>;
|
|
191
|
-
ttl?: number;
|
|
192
|
-
strategy?: 'memory' | 'session' | 'persistent';
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Union type for all header event types
|
|
197
|
-
*/
|
|
198
|
-
export type HeaderEventData = HeadersChangedEvent | HeadersEnrichedEvent | HeadersConflictEvent | HeadersOverrideEvent | HeadersMergedEvent | HeadersValidatedEvent | HeadersCachedEvent;
|
|
199
|
-
/**
|
|
200
|
-
* Base structure for network events
|
|
201
|
-
*/
|
|
202
|
-
export interface NetworkEvent extends BaseEvent {
|
|
203
|
-
type: string;
|
|
204
|
-
data: Record<string, unknown>;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Network quality event
|
|
208
|
-
*/
|
|
209
|
-
export interface NetworkQualityEvent extends NetworkEvent {
|
|
210
|
-
type: typeof NETWORK_EVENTS.QUALITY_CHANGE;
|
|
211
|
-
data: {
|
|
212
|
-
previous: string;
|
|
213
|
-
current: string;
|
|
214
|
-
rtt?: number;
|
|
215
|
-
downlink?: number;
|
|
216
|
-
effectiveType?: string;
|
|
217
|
-
saveData?: boolean;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Network info event
|
|
222
|
-
*/
|
|
223
|
-
export interface NetworkInfoEvent extends NetworkEvent {
|
|
224
|
-
type: typeof NETWORK_EVENTS.INFO_UPDATE;
|
|
225
|
-
data: {
|
|
226
|
-
type?: string;
|
|
227
|
-
effectiveType?: string;
|
|
228
|
-
downlink?: number;
|
|
229
|
-
downlinkMax?: number;
|
|
230
|
-
rtt?: number;
|
|
231
|
-
saveData?: boolean;
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Network config override event
|
|
236
|
-
*/
|
|
237
|
-
export interface NetworkConfigOverrideEvent extends NetworkEvent {
|
|
238
|
-
type: typeof NETWORK_EVENTS.CONFIG_OVERRIDE;
|
|
239
|
-
data: {
|
|
240
|
-
reason: string;
|
|
241
|
-
override: Record<string, unknown>;
|
|
242
|
-
original: Record<string, unknown>;
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Network preset event
|
|
247
|
-
*/
|
|
248
|
-
export interface NetworkPresetEvent extends NetworkEvent {
|
|
249
|
-
type: typeof NETWORK_EVENTS.PRESET_APPLIED;
|
|
250
|
-
data: {
|
|
251
|
-
preset: string;
|
|
252
|
-
config: Record<string, unknown>;
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Network client hints event
|
|
257
|
-
*/
|
|
258
|
-
export interface NetworkClientHintsEvent extends NetworkEvent {
|
|
259
|
-
type: typeof NETWORK_EVENTS.HINTS_UPDATED;
|
|
260
|
-
data: {
|
|
261
|
-
hints: Record<string, unknown>;
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Network auto detection event
|
|
266
|
-
*/
|
|
267
|
-
export interface NetworkAutoDetectionEvent extends NetworkEvent {
|
|
268
|
-
type: typeof NETWORK_EVENTS.AUTO_DETECTION;
|
|
269
|
-
data: {
|
|
270
|
-
detected: Record<string, unknown>;
|
|
271
|
-
confidence: number;
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Network manual update event
|
|
276
|
-
*/
|
|
277
|
-
export interface NetworkManualUpdateEvent extends NetworkEvent {
|
|
278
|
-
type: typeof NETWORK_EVENTS.MANUAL_UPDATE;
|
|
279
|
-
data: {
|
|
280
|
-
updates: Record<string, unknown>;
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Union type for all network event types
|
|
285
|
-
*/
|
|
286
|
-
export type NetworkEventData = NetworkQualityEvent | NetworkInfoEvent | NetworkConfigOverrideEvent | NetworkPresetEvent | NetworkClientHintsEvent | NetworkAutoDetectionEvent | NetworkManualUpdateEvent;
|
|
287
|
-
/**
|
|
288
|
-
* Base structure for error events
|
|
289
|
-
*/
|
|
290
|
-
export interface ErrorEvent extends BaseEvent {
|
|
291
|
-
type: string;
|
|
292
|
-
data: Record<string, unknown>;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Generic error event
|
|
296
|
-
*/
|
|
297
|
-
export interface GenericErrorEvent extends ErrorEvent {
|
|
298
|
-
type: typeof ERROR_EVENTS.GENERIC_ERROR;
|
|
299
|
-
data: {
|
|
300
|
-
error: unknown;
|
|
301
|
-
message: string;
|
|
302
|
-
code?: string;
|
|
303
|
-
statusCode?: number;
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Network error event
|
|
308
|
-
*/
|
|
309
|
-
export interface NetworkErrorEvent extends ErrorEvent {
|
|
310
|
-
type: typeof ERROR_EVENTS.NETWORK_ERROR;
|
|
311
|
-
data: {
|
|
312
|
-
error: unknown;
|
|
313
|
-
message: string;
|
|
314
|
-
url?: string;
|
|
315
|
-
method?: string;
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Validation error event
|
|
320
|
-
*/
|
|
321
|
-
export interface ValidationErrorEvent extends ErrorEvent {
|
|
322
|
-
type: typeof ERROR_EVENTS.VALIDATION_ERROR;
|
|
323
|
-
data: {
|
|
324
|
-
error: unknown;
|
|
325
|
-
message: string;
|
|
326
|
-
field?: string;
|
|
327
|
-
value?: unknown;
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Authentication error event
|
|
332
|
-
*/
|
|
333
|
-
export interface AuthenticationErrorEvent extends ErrorEvent {
|
|
334
|
-
type: typeof ERROR_EVENTS.AUTHENTICATION_ERROR;
|
|
335
|
-
data: {
|
|
336
|
-
error: unknown;
|
|
337
|
-
message: string;
|
|
338
|
-
scheme?: string;
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Rate limit error event
|
|
343
|
-
*/
|
|
344
|
-
export interface RateLimitErrorEvent extends ErrorEvent {
|
|
345
|
-
type: typeof ERROR_EVENTS.RATE_LIMIT_ERROR;
|
|
346
|
-
data: {
|
|
347
|
-
error: unknown;
|
|
348
|
-
message: string;
|
|
349
|
-
limit?: number;
|
|
350
|
-
remaining?: number;
|
|
351
|
-
reset?: number;
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Server error event
|
|
356
|
-
*/
|
|
357
|
-
export interface ServerErrorEvent extends ErrorEvent {
|
|
358
|
-
type: typeof ERROR_EVENTS.SERVER_ERROR;
|
|
359
|
-
data: {
|
|
360
|
-
error: unknown;
|
|
361
|
-
message: string;
|
|
362
|
-
statusCode?: number;
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Timeout error event
|
|
367
|
-
*/
|
|
368
|
-
export interface TimeoutErrorEvent extends ErrorEvent {
|
|
369
|
-
type: typeof ERROR_EVENTS.TIMEOUT_ERROR;
|
|
370
|
-
data: {
|
|
371
|
-
error: unknown;
|
|
372
|
-
message: string;
|
|
373
|
-
timeout?: number;
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Union type for all error event types
|
|
378
|
-
*/
|
|
379
|
-
export type ErrorEventData = GenericErrorEvent | NetworkErrorEvent | ValidationErrorEvent | AuthenticationErrorEvent | RateLimitErrorEvent | ServerErrorEvent | TimeoutErrorEvent;
|
|
380
|
-
/**
|
|
381
|
-
* Base structure for debug events
|
|
382
|
-
*/
|
|
383
|
-
export interface DebugEvent extends BaseEvent {
|
|
384
|
-
type: string;
|
|
385
|
-
data: Record<string, unknown>;
|
|
386
|
-
}
|
|
387
|
-
/**
|
|
388
|
-
* Config conflict event
|
|
389
|
-
*/
|
|
390
|
-
export interface ConfigConflictEvent extends DebugEvent {
|
|
391
|
-
type: typeof DEBUG_EVENTS.CONFIG_CONFLICT;
|
|
392
|
-
data: {
|
|
393
|
-
property: string;
|
|
394
|
-
values: Array<{
|
|
395
|
-
source: string;
|
|
396
|
-
value: unknown;
|
|
397
|
-
}>;
|
|
398
|
-
resolution: {
|
|
399
|
-
source: string;
|
|
400
|
-
value: unknown;
|
|
401
|
-
};
|
|
402
|
-
};
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Config change event
|
|
406
|
-
*/
|
|
407
|
-
export interface ConfigChangeEvent extends DebugEvent {
|
|
408
|
-
type: typeof DEBUG_EVENTS.CONFIG_CHANGE;
|
|
409
|
-
data: {
|
|
410
|
-
property: string;
|
|
411
|
-
previous: unknown;
|
|
412
|
-
current: unknown;
|
|
413
|
-
source: ConfigSource;
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Headers tracked event
|
|
418
|
-
*/
|
|
419
|
-
export interface HeadersTrackedEvent extends DebugEvent {
|
|
420
|
-
type: typeof DEBUG_EVENTS.HEADERS_TRACKED;
|
|
421
|
-
data: {
|
|
422
|
-
headers: Record<string, string>;
|
|
423
|
-
timestamp: number;
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Network override event
|
|
428
|
-
*/
|
|
429
|
-
export interface NetworkOverrideEvent extends DebugEvent {
|
|
430
|
-
type: typeof DEBUG_EVENTS.NETWORK_OVERRIDE;
|
|
431
|
-
data: {
|
|
432
|
-
reason: string;
|
|
433
|
-
override: Record<string, unknown>;
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Debug info update event
|
|
438
|
-
*/
|
|
439
|
-
export interface DebugInfoUpdateEvent extends DebugEvent {
|
|
440
|
-
type: typeof DEBUG_EVENTS.DEBUG_INFO;
|
|
441
|
-
data: {
|
|
442
|
-
info: Record<string, unknown>;
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Performance impact event
|
|
447
|
-
*/
|
|
448
|
-
export interface PerformanceImpactEvent extends DebugEvent {
|
|
449
|
-
type: typeof DEBUG_EVENTS.PERFORMANCE_IMPACT;
|
|
450
|
-
data: {
|
|
451
|
-
operation: string;
|
|
452
|
-
duration: number;
|
|
453
|
-
impact: 'low' | 'medium' | 'high';
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Monitoring alert event
|
|
458
|
-
*/
|
|
459
|
-
export interface MonitoringAlertEvent extends DebugEvent {
|
|
460
|
-
type: typeof DEBUG_EVENTS.MONITORING_ALERT;
|
|
461
|
-
data: {
|
|
462
|
-
severity: 'info' | 'warning' | 'error';
|
|
463
|
-
message: string;
|
|
464
|
-
metadata?: Record<string, unknown>;
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Config tracking event
|
|
469
|
-
*/
|
|
470
|
-
export interface ConfigTrackingEvent extends DebugEvent {
|
|
471
|
-
type: typeof DEBUG_EVENTS.CONFIG_TRACKED;
|
|
472
|
-
data: {
|
|
473
|
-
config: Record<string, unknown>;
|
|
474
|
-
source: ConfigSource;
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Union type for all debug event types
|
|
479
|
-
*/
|
|
480
|
-
export type DebugEventData = ConfigConflictEvent | ConfigChangeEvent | HeadersTrackedEvent | NetworkOverrideEvent | DebugInfoUpdateEvent | PerformanceImpactEvent | MonitoringAlertEvent | ConfigTrackingEvent;
|
|
481
|
-
/**
|
|
482
|
-
* Config global updated event
|
|
483
|
-
*/
|
|
484
|
-
export interface ConfigGlobalUpdatedEvent extends BaseEvent {
|
|
485
|
-
type: typeof CONFIG_EVENTS.GLOBAL_UPDATED;
|
|
486
|
-
data: {
|
|
487
|
-
config: Record<string, unknown>;
|
|
488
|
-
previous?: Record<string, unknown>;
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Config global reset event
|
|
493
|
-
*/
|
|
494
|
-
export interface ConfigGlobalResetEvent extends BaseEvent {
|
|
495
|
-
type: typeof CONFIG_EVENTS.GLOBAL_RESET;
|
|
496
|
-
data: {
|
|
497
|
-
previous: Record<string, unknown>;
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Config environment event
|
|
502
|
-
*/
|
|
503
|
-
export interface ConfigEnvironmentEvent extends BaseEvent {
|
|
504
|
-
type: typeof CONFIG_EVENTS.ENVIRONMENT_CONFIGURED;
|
|
505
|
-
data: {
|
|
506
|
-
environment: string;
|
|
507
|
-
config: Record<string, unknown>;
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Config preset applied event
|
|
512
|
-
*/
|
|
513
|
-
export interface ConfigPresetAppliedEvent extends BaseEvent {
|
|
514
|
-
type: typeof CONFIG_EVENTS.PRESET_APPLIED;
|
|
515
|
-
data: {
|
|
516
|
-
preset: string;
|
|
517
|
-
config: Record<string, unknown>;
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Union type for all config event types
|
|
522
|
-
*/
|
|
523
|
-
export type ConfigEventData = ConfigGlobalUpdatedEvent | ConfigGlobalResetEvent | ConfigEnvironmentEvent | ConfigPresetAppliedEvent;
|
|
524
|
-
/**
|
|
525
|
-
* Performance request start event
|
|
526
|
-
*/
|
|
527
|
-
export interface PerformanceRequestStartEvent extends BaseEvent {
|
|
528
|
-
type: typeof PERFORMANCE_EVENTS.REQUEST_START;
|
|
529
|
-
data: {
|
|
530
|
-
requestId: string;
|
|
531
|
-
url: string;
|
|
532
|
-
method: string;
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Performance request complete event
|
|
537
|
-
*/
|
|
538
|
-
export interface PerformanceRequestCompleteEvent extends BaseEvent {
|
|
539
|
-
type: typeof PERFORMANCE_EVENTS.REQUEST_COMPLETE;
|
|
540
|
-
data: {
|
|
541
|
-
requestId: string;
|
|
542
|
-
url: string;
|
|
543
|
-
method: string;
|
|
544
|
-
duration: number;
|
|
545
|
-
status?: number;
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Performance retry event
|
|
550
|
-
*/
|
|
551
|
-
export interface PerformanceRetryEvent extends BaseEvent {
|
|
552
|
-
type: typeof PERFORMANCE_EVENTS.RETRY;
|
|
553
|
-
data: {
|
|
554
|
-
requestId: string;
|
|
555
|
-
attempt: number;
|
|
556
|
-
reason: string;
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Performance threshold exceeded event
|
|
561
|
-
*/
|
|
562
|
-
export interface PerformanceThresholdExceededEvent extends BaseEvent {
|
|
563
|
-
type: typeof PERFORMANCE_EVENTS.THRESHOLD_EXCEEDED;
|
|
564
|
-
data: {
|
|
565
|
-
type: string;
|
|
566
|
-
threshold: number;
|
|
567
|
-
actual: number;
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Performance optimization applied event
|
|
572
|
-
*/
|
|
573
|
-
export interface PerformanceOptimizationAppliedEvent extends BaseEvent {
|
|
574
|
-
type: typeof PERFORMANCE_EVENTS.OPTIMIZATION_APPLIED;
|
|
575
|
-
data: {
|
|
576
|
-
type: string;
|
|
577
|
-
description: string;
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Performance metric recorded event
|
|
582
|
-
*/
|
|
583
|
-
export interface PerformanceMetricRecordedEvent extends BaseEvent {
|
|
584
|
-
type: typeof PERFORMANCE_EVENTS.METRIC_RECORDED;
|
|
585
|
-
data: {
|
|
586
|
-
metric: string;
|
|
587
|
-
value: number;
|
|
588
|
-
unit: string;
|
|
589
|
-
};
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
|
-
* Union type for all performance event types
|
|
593
|
-
*/
|
|
594
|
-
export type PerformanceEventData = PerformanceRequestStartEvent | PerformanceRequestCompleteEvent | PerformanceRetryEvent | PerformanceThresholdExceededEvent | PerformanceOptimizationAppliedEvent | PerformanceMetricRecordedEvent;
|
|
595
|
-
/**
|
|
596
|
-
* Cache hit event
|
|
597
|
-
*/
|
|
598
|
-
export interface CacheHitEvent extends BaseEvent {
|
|
599
|
-
type: typeof CACHE_EVENTS.HIT;
|
|
600
|
-
data: {
|
|
601
|
-
key: string;
|
|
602
|
-
ttl?: number;
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Cache miss event
|
|
607
|
-
*/
|
|
608
|
-
export interface CacheMissEvent extends BaseEvent {
|
|
609
|
-
type: typeof CACHE_EVENTS.MISS;
|
|
610
|
-
data: {
|
|
611
|
-
key: string;
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Cache invalidate event
|
|
616
|
-
*/
|
|
617
|
-
export interface CacheInvalidateEvent extends BaseEvent {
|
|
618
|
-
type: typeof CACHE_EVENTS.INVALIDATE;
|
|
619
|
-
data: {
|
|
620
|
-
pattern?: string;
|
|
621
|
-
keys?: string[];
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* Union type for all cache event types
|
|
626
|
-
*/
|
|
627
|
-
export type CacheEventData = CacheHitEvent | CacheMissEvent | CacheInvalidateEvent;
|
|
628
|
-
/**
|
|
629
|
-
* Client conflict event
|
|
630
|
-
*/
|
|
631
|
-
export interface ClientConflictEvent extends BaseEvent {
|
|
632
|
-
type: string;
|
|
633
|
-
data: Record<string, unknown>;
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Client debug event
|
|
637
|
-
*/
|
|
638
|
-
export interface ClientDebugEvent extends BaseEvent {
|
|
639
|
-
type: string;
|
|
640
|
-
data: Record<string, unknown>;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Client created event
|
|
644
|
-
*/
|
|
645
|
-
export interface ClientCreatedEvent extends BaseEvent {
|
|
646
|
-
type: string;
|
|
647
|
-
data: {
|
|
648
|
-
clientId: string;
|
|
649
|
-
config: Record<string, unknown>;
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Request start event (client-level)
|
|
654
|
-
*/
|
|
655
|
-
export interface RequestStartEvent extends BaseEvent {
|
|
656
|
-
type: 'request:start';
|
|
657
|
-
data: {
|
|
658
|
-
url?: string;
|
|
659
|
-
method?: string;
|
|
660
|
-
timestamp: number;
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Response received event
|
|
665
|
-
*/
|
|
666
|
-
export interface ResponseReceivedEvent extends BaseEvent {
|
|
667
|
-
type: 'response:received';
|
|
668
|
-
data: {
|
|
669
|
-
url?: string;
|
|
670
|
-
status?: number;
|
|
671
|
-
statusText?: string;
|
|
672
|
-
headers?: Record<string, string>;
|
|
673
|
-
timestamp: number;
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Retry attempt event
|
|
678
|
-
*/
|
|
679
|
-
export interface RetryAttemptEvent extends BaseEvent {
|
|
680
|
-
type: 'retry:attempt';
|
|
681
|
-
data: {
|
|
682
|
-
error: {
|
|
683
|
-
message: string;
|
|
684
|
-
code?: string;
|
|
685
|
-
status?: number;
|
|
686
|
-
};
|
|
687
|
-
attempt: number;
|
|
688
|
-
maxAttempts: number;
|
|
689
|
-
delay: number;
|
|
690
|
-
url?: string;
|
|
691
|
-
method?: string;
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Union type for all client event types
|
|
696
|
-
*/
|
|
697
|
-
export type ClientEventType = ClientConflictEvent | ClientDebugEvent | ClientCreatedEvent | RequestStartEvent | ResponseReceivedEvent | RetryAttemptEvent;
|
|
698
35
|
export type AnyHeaderEvent = HeaderEventData;
|
|
699
36
|
export type AnyNetworkEvent = NetworkEventData;
|
|
700
37
|
export type AnyErrorEvent = ErrorEventData;
|
|
@@ -713,7 +50,6 @@ export type ErrorEventHandler = EventHandler<ErrorEventData>;
|
|
|
713
50
|
export type DebugEventHandler = EventHandler<DebugEventData>;
|
|
714
51
|
export type PerformanceEventHandler = EventHandler<PerformanceEventData>;
|
|
715
52
|
export type ConfigEventHandler = EventHandler<ConfigEventData>;
|
|
716
|
-
export type CacheEventHandler = EventHandler<CacheEventData>;
|
|
717
53
|
export type AnyHeaderEventHandler = EventHandler<AnyHeaderEvent>;
|
|
718
54
|
export type AnyNetworkEventHandler = EventHandler<AnyNetworkEvent>;
|
|
719
55
|
export type AnyErrorEventHandler = EventHandler<AnyErrorEvent>;
|
|
@@ -723,55 +59,6 @@ export type AnyConfigEventHandler = EventHandler<AnyConfigEvent>;
|
|
|
723
59
|
export type AnyCacheEventHandler = EventHandler<AnyCacheEvent>;
|
|
724
60
|
export type AnyClientEventHandler = EventHandler<AnyClientEvent>;
|
|
725
61
|
export type UniversalEventHandler = EventHandler<AnyEvent>;
|
|
726
|
-
/**
|
|
727
|
-
* Header event handlers interface
|
|
728
|
-
*/
|
|
729
|
-
export interface HeaderEventHandlers {
|
|
730
|
-
onHeadersChanged?: (event: HeadersChangedEvent) => void;
|
|
731
|
-
onHeadersEnriched?: (event: HeadersEnrichedEvent) => void;
|
|
732
|
-
onHeadersConflict?: (event: HeadersConflictEvent) => void;
|
|
733
|
-
onHeadersOverride?: (event: HeadersOverrideEvent) => void;
|
|
734
|
-
onHeadersMerged?: (event: HeadersMergedEvent) => void;
|
|
735
|
-
onHeadersFiltered?: (event: HeadersFilteredEvent) => void;
|
|
736
|
-
onHeadersValidated?: (event: HeadersValidatedEvent) => void;
|
|
737
|
-
onHeadersCached?: (event: HeadersCachedEvent) => void;
|
|
738
|
-
onAnyHeaderEvent?: (event: HeaderEventData) => void;
|
|
739
|
-
}
|
|
740
|
-
/**
|
|
741
|
-
* Network event handlers interface
|
|
742
|
-
*/
|
|
743
|
-
export interface NetworkEventHandlers {
|
|
744
|
-
onNetworkQualityChange?: (event: NetworkQualityEvent) => void;
|
|
745
|
-
onNetworkInfoUpdate?: (event: NetworkInfoEvent) => void;
|
|
746
|
-
onNetworkConfigOverride?: (event: NetworkConfigOverrideEvent) => void;
|
|
747
|
-
onNetworkPresetApplied?: (event: NetworkPresetEvent) => void;
|
|
748
|
-
onClientHintsUpdated?: (event: NetworkClientHintsEvent) => void;
|
|
749
|
-
onAutoDetection?: (event: NetworkAutoDetectionEvent) => void;
|
|
750
|
-
onManualUpdate?: (event: NetworkManualUpdateEvent) => void;
|
|
751
|
-
onAnyNetworkEvent?: (event: NetworkEventData) => void;
|
|
752
|
-
}
|
|
753
|
-
/**
|
|
754
|
-
* Configuration event handlers interface
|
|
755
|
-
*/
|
|
756
|
-
export interface ConfigEventHandlers {
|
|
757
|
-
onGlobalUpdated?: (event: ConfigGlobalUpdatedEvent) => void;
|
|
758
|
-
onGlobalReset?: (event: ConfigGlobalResetEvent) => void;
|
|
759
|
-
onEnvironmentConfigured?: (event: ConfigEnvironmentEvent) => void;
|
|
760
|
-
onPresetApplied?: (event: ConfigPresetAppliedEvent) => void;
|
|
761
|
-
onAnyConfigEvent?: (event: ConfigEventData) => void;
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Performance event handlers interface
|
|
765
|
-
*/
|
|
766
|
-
export interface PerformanceEventHandlers {
|
|
767
|
-
onRequestStart?: (event: PerformanceRequestStartEvent) => void;
|
|
768
|
-
onRequestComplete?: (event: PerformanceRequestCompleteEvent) => void;
|
|
769
|
-
onRetry?: (event: PerformanceRetryEvent) => void;
|
|
770
|
-
onMetricRecorded?: (event: PerformanceMetricRecordedEvent) => void;
|
|
771
|
-
onThresholdExceeded?: (event: PerformanceThresholdExceededEvent) => void;
|
|
772
|
-
onOptimizationApplied?: (event: PerformanceOptimizationAppliedEvent) => void;
|
|
773
|
-
onAnyPerformanceEvent?: (event: PerformanceEventData) => void;
|
|
774
|
-
}
|
|
775
62
|
/**
|
|
776
63
|
* Cache event handlers interface
|
|
777
64
|
*/
|
|
@@ -781,15 +68,3 @@ export interface CacheEventHandlers {
|
|
|
781
68
|
onCacheInvalidate?: (event: CacheInvalidateEvent) => void;
|
|
782
69
|
onAnyCacheEvent?: (event: CacheEventData) => void;
|
|
783
70
|
}
|
|
784
|
-
/**
|
|
785
|
-
* Client event handlers interface
|
|
786
|
-
*/
|
|
787
|
-
export interface ClientEventHandlers {
|
|
788
|
-
onClientConflict?: (event: ClientConflictEvent) => void;
|
|
789
|
-
onClientDebug?: (event: ClientDebugEvent) => void;
|
|
790
|
-
onClientCreated?: (event: ClientCreatedEvent) => void;
|
|
791
|
-
onRequestStart?: (event: RequestStartEvent) => void;
|
|
792
|
-
onResponseReceived?: (event: ResponseReceivedEvent) => void;
|
|
793
|
-
onRetryAttempt?: (event: RetryAttemptEvent) => void;
|
|
794
|
-
onAnyClientEvent?: (event: ClientEventType) => void;
|
|
795
|
-
}
|