@plyaz/types 1.7.18 → 1.7.20

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.
Files changed (73) hide show
  1. package/dist/api/client/enum.d.ts +12 -0
  2. package/dist/api/client/index.d.ts +1 -0
  3. package/dist/api/client/types.d.ts +114 -0
  4. package/dist/api/config/types.d.ts +56 -9
  5. package/dist/api/debugger/enums.d.ts +153 -0
  6. package/dist/api/debugger/factories/index.d.ts +1 -0
  7. package/dist/api/debugger/factories/types.d.ts +191 -0
  8. package/dist/api/debugger/index.d.ts +2 -0
  9. package/dist/api/debugger/types.d.ts +628 -0
  10. package/dist/api/endpoints/campaigns/index.d.ts +1 -0
  11. package/dist/api/endpoints/campaigns/types.d.ts +68 -0
  12. package/dist/api/endpoints/health/index.d.ts +1 -0
  13. package/dist/api/endpoints/health/types.d.ts +127 -0
  14. package/dist/api/endpoints/index.d.ts +3 -0
  15. package/dist/api/endpoints/types.d.ts +5 -0
  16. package/dist/api/errors/enum.d.ts +182 -0
  17. package/dist/api/errors/index.d.ts +1 -0
  18. package/dist/api/errors/types.d.ts +126 -27
  19. package/dist/api/events/enum.d.ts +262 -0
  20. package/dist/api/events/factories/cache/index.d.ts +1 -0
  21. package/dist/api/events/factories/cache/types.d.ts +60 -0
  22. package/dist/api/events/factories/client/index.d.ts +1 -0
  23. package/dist/api/events/factories/client/types.d.ts +120 -0
  24. package/dist/api/events/factories/config/index.d.ts +1 -0
  25. package/dist/api/events/factories/config/types.d.ts +77 -0
  26. package/dist/api/events/factories/debug/index.d.ts +1 -0
  27. package/dist/api/events/factories/debug/types.d.ts +131 -0
  28. package/dist/api/events/factories/errors/index.d.ts +1 -0
  29. package/dist/api/events/factories/errors/types.d.ts +293 -0
  30. package/dist/api/events/factories/headers/index.d.ts +1 -0
  31. package/dist/api/events/factories/headers/types.d.ts +256 -0
  32. package/dist/api/events/factories/index.d.ts +9 -0
  33. package/dist/api/events/factories/network/index.d.ts +1 -0
  34. package/dist/api/events/factories/network/types.d.ts +196 -0
  35. package/dist/api/events/factories/performance/index.d.ts +1 -0
  36. package/dist/api/events/factories/performance/types.d.ts +150 -0
  37. package/dist/api/events/factories/types.d.ts +84 -0
  38. package/dist/api/events/index.d.ts +2 -0
  39. package/dist/api/events/types.d.ts +1 -730
  40. package/dist/api/headers/enum.d.ts +34 -0
  41. package/dist/api/headers/index.d.ts +1 -0
  42. package/dist/api/headers/types.d.ts +456 -0
  43. package/dist/api/hooks/index.d.ts +1 -0
  44. package/dist/api/hooks/types.d.ts +131 -0
  45. package/dist/api/index.d.ts +7 -1
  46. package/dist/api/network/enums.d.ts +75 -5
  47. package/dist/api/network/frameworks/index.d.ts +2 -0
  48. package/dist/api/network/frameworks/nestjs/index.d.ts +1 -0
  49. package/dist/api/network/frameworks/nestjs/types.d.ts +47 -0
  50. package/dist/api/network/frameworks/types.d.ts +76 -0
  51. package/dist/api/network/index.d.ts +1 -0
  52. package/dist/api/network/types.d.ts +346 -39
  53. package/dist/api/performance/types.d.ts +17 -10
  54. package/dist/api/polling/types.d.ts +6 -4
  55. package/dist/api/pubsub/enum.d.ts +12 -0
  56. package/dist/api/pubsub/index.d.ts +2 -0
  57. package/dist/api/pubsub/types.d.ts +61 -0
  58. package/dist/api/queue/types.d.ts +69 -0
  59. package/dist/api/regional/enum.d.ts +75 -0
  60. package/dist/api/regional/index.d.ts +1 -0
  61. package/dist/api/regional/types.d.ts +2 -1
  62. package/dist/api/request/index.d.ts +1 -0
  63. package/dist/api/request/types.d.ts +44 -0
  64. package/dist/api/retry/types.d.ts +31 -0
  65. package/dist/api/strategies/types.d.ts +12 -8
  66. package/dist/errors/index.cjs +69 -0
  67. package/dist/errors/index.cjs.map +1 -1
  68. package/dist/errors/index.d.ts +1 -1
  69. package/dist/errors/index.js +66 -0
  70. package/dist/errors/index.js.map +1 -1
  71. package/dist/features/cache/types.d.ts +5 -0
  72. package/dist/testing/features/api/types.d.ts +355 -4
  73. package/package.json +5 -3
@@ -0,0 +1,262 @@
1
+ /**
2
+ * Event Namespace Constants
3
+ * Centralized constants for all event namespaces in the API package
4
+ */
5
+ /**
6
+ * Main event namespaces for the API package
7
+ */
8
+ export declare const EVENT_NAMESPACES: {
9
+ readonly HEADERS: "headers";
10
+ readonly NETWORK: "network";
11
+ readonly ERRORS: "errors";
12
+ readonly DEBUG: "debug";
13
+ readonly CONFIG: "config";
14
+ readonly PERFORMANCE: "performance";
15
+ readonly CLIENT: "client";
16
+ readonly CACHE: "cache";
17
+ readonly POLLING: "polling";
18
+ readonly REQUEST: "request";
19
+ readonly REVALIDATION: "revalidation";
20
+ readonly EVENT_MANAGER: "eventManager";
21
+ };
22
+ /**
23
+ * Header-specific event keys
24
+ */
25
+ export declare const HEADER_EVENTS: {
26
+ readonly CHANGED: "headers:changed";
27
+ readonly ENRICHED: "headers:enriched";
28
+ readonly CONFLICT: "headers:conflict";
29
+ readonly OVERRIDE: "headers:override";
30
+ readonly TRACKED: "headers:tracked";
31
+ readonly MERGED: "headers:merged";
32
+ readonly FILTERED: "headers:filtered";
33
+ readonly VALIDATED: "headers:validated";
34
+ readonly CACHED: "headers:cached";
35
+ readonly CACHE_HIT: "headers:cache:hit";
36
+ readonly CACHE_MISS: "headers:cache:miss";
37
+ readonly ANY: "headers:*";
38
+ };
39
+ /**
40
+ * Network-specific event keys
41
+ */
42
+ export declare const NETWORK_EVENTS: {
43
+ readonly QUALITY_CHANGE: "network:quality:changed";
44
+ readonly INFO_UPDATE: "network:info-update";
45
+ readonly CONFIG_OVERRIDE: "network:config:override";
46
+ readonly CONFIG_RESTORED: "network:config:restored";
47
+ readonly OVERRIDE_CHANGE: "network:override-change";
48
+ readonly PRESET_APPLIED: "network:preset-applied";
49
+ readonly PRESET_CHANGED: "network:preset:changed";
50
+ readonly HINTS_UPDATED: "network:hints:updated";
51
+ readonly AUTO_DETECTION: "network:auto:detection";
52
+ readonly MANUAL_UPDATE: "network:manual:update";
53
+ readonly ANY: "network:*";
54
+ };
55
+ /**
56
+ * Error-specific event keys
57
+ */
58
+ export declare const ERROR_EVENTS: {
59
+ readonly NETWORK_ERROR: "errors:network";
60
+ readonly VALIDATION_ERROR: "errors:validation";
61
+ readonly AUTHENTICATION_ERROR: "errors:authentication";
62
+ readonly AUTHORIZATION_ERROR: "errors:authorization";
63
+ readonly RATE_LIMIT_ERROR: "errors:rate-limit";
64
+ readonly SERVER_ERROR: "errors:server";
65
+ readonly CLIENT_ERROR: "errors:client";
66
+ readonly TIMEOUT_ERROR: "errors:timeout";
67
+ readonly CONFLICT_ERROR: "errors:conflict";
68
+ readonly CACHE_ERROR: "errors:cache";
69
+ readonly HEADERS_ERROR: "errors:headers";
70
+ readonly RETRY_ERROR: "errors:retry";
71
+ readonly STRATEGY_ERROR: "errors:strategy";
72
+ readonly REGIONAL_ERROR: "errors:regional";
73
+ readonly NOT_FOUND_ERROR: "errors:not-found";
74
+ readonly EXTERNAL_SERVICE_ERROR: "errors:external-service";
75
+ readonly UNKNOWN_ERROR: "errors:unknown";
76
+ readonly GENERIC_ERROR: "errors:generic";
77
+ readonly ANY: "errors:*";
78
+ };
79
+ /**
80
+ * Handler scopes for different levels of event handlers
81
+ * These prefixes are used for registering handlers at different priority levels
82
+ * Can be used for any type of handler (error, request, response, debug, etc.)
83
+ *
84
+ * Priority order (lowest to highest):
85
+ * 1. GLOBAL - Set via setGlobalErrorHandlers(), persists across all instances
86
+ * 2. CONFIG - Set via setGlobalConfig({ errorHandlers }), global configuration
87
+ * 3. CLIENT - Set via createApiClient({ errorHandlers }), instance-specific
88
+ * 4. REQUEST/TEMPORARY - Set per-request or via updateConfig(), highest priority
89
+ *
90
+ * Usage:
91
+ * - GLOBAL: For app-wide handlers that should always run (e.g., logging)
92
+ * - CONFIG: For environment-specific handlers (e.g., dev vs prod)
93
+ * - CLIENT: For instance-specific handlers (e.g., per-service client)
94
+ * - REQUEST/TEMPORARY: For request-specific or runtime updates
95
+ *
96
+ * Note: REQUEST and TEMPORARY are aliases - both use 'request' scope
97
+ *
98
+ * Examples of namespaced handlers:
99
+ * - Error handlers: 'global:error', 'config:error', 'client:error'
100
+ * - Debug handlers: 'global:debug', 'config:debug', 'client:debug'
101
+ * - Request handlers: 'global:request', 'config:request', 'client:request'
102
+ */
103
+ export declare const HANDLER_SCOPES: {
104
+ readonly GLOBAL: "global";
105
+ readonly CONFIG: "config";
106
+ readonly CLIENT: "client";
107
+ readonly TEMPORARY: "request";
108
+ readonly REQUEST: "request";
109
+ };
110
+ /**
111
+ * Core event scopes (excluding aliases)
112
+ * These are the actual scope values used by the event system
113
+ */
114
+ export declare const EVENT_SCOPES: readonly ["global", "config", "client", "request"];
115
+ /**
116
+ * All event scopes including 'temporary' alias
117
+ * Used in APIs where 'temporary' provides semantic clarity
118
+ */
119
+ export declare const EVENT_SCOPES_WITH_TEMPORARY: readonly ["global", "config", "client", "request", "temporary"];
120
+ /**
121
+ * Debug-specific event keys
122
+ */
123
+ export declare const DEBUG_EVENTS: {
124
+ readonly CONFIG_CONFLICT: "debug:config-conflict";
125
+ readonly CONFIG_CHANGE: "debug:config-change";
126
+ readonly HEADERS_TRACKED: "debug:headers-tracked";
127
+ readonly NETWORK_OVERRIDE: "debug:network-override";
128
+ readonly NETWORK_STATE_CHANGED: "debug:network-state-changed";
129
+ readonly NETWORK_DATA_CLEARED: "debug:network-data-cleared";
130
+ readonly DEBUG_INFO: "debug:info";
131
+ readonly PERFORMANCE_IMPACT: "debug:performance-impact";
132
+ readonly MONITORING_ALERT: "debug:monitoring-alert";
133
+ readonly CONFIG_TRACKED: "debug:config-tracked";
134
+ readonly CONFLICTS_BATCH: "debug:conflicts-batch";
135
+ readonly EVENT_OPERATION: "debug:event-operation";
136
+ readonly ANY: "debug:*";
137
+ };
138
+ /**
139
+ * Configuration sources - where config updates originate from
140
+ */
141
+ export declare const EVENTS_CONFIG_SOURCES: {
142
+ readonly GLOBAL: "global";
143
+ readonly CREATE_API_CLIENT: "createApiClient";
144
+ readonly UPDATE_CONFIG: "updateConfig";
145
+ readonly MANUAL: "manual";
146
+ readonly ENVIRONMENT: "environment";
147
+ readonly PRESET: "preset";
148
+ readonly NETWORK_AWARE: "networkAware";
149
+ readonly ADAPTIVE: "adaptive";
150
+ };
151
+ /**
152
+ * Configuration-specific event keys
153
+ */
154
+ export declare const CONFIG_EVENTS: {
155
+ readonly GLOBAL_UPDATED: "config:global-updated";
156
+ readonly GLOBAL_RESET: "config:global-reset";
157
+ readonly ENVIRONMENT_CONFIGURED: "config:environment-configured";
158
+ readonly PRESET_APPLIED: "config:preset-applied";
159
+ readonly ANY: "config:*";
160
+ };
161
+ /**
162
+ * Performance-specific event keys
163
+ */
164
+ export declare const PERFORMANCE_EVENTS: {
165
+ readonly REQUEST_START: "performance:request-start";
166
+ readonly REQUEST_COMPLETE: "performance:request-complete";
167
+ readonly RETRY: "performance:retry";
168
+ readonly THRESHOLD_EXCEEDED: "performance:threshold-exceeded";
169
+ readonly OPTIMIZATION_APPLIED: "performance:optimization-applied";
170
+ readonly METRIC_RECORDED: "performance:metric-recorded";
171
+ readonly ANY: "performance:*";
172
+ };
173
+ /**
174
+ * Client-specific event keys
175
+ */
176
+ export declare const CLIENT_EVENTS: {
177
+ readonly CONFLICT: "client:conflict";
178
+ readonly DEBUG: "client:debug";
179
+ readonly CREATED: "client:created";
180
+ readonly ANY: "client:*";
181
+ };
182
+ /**
183
+ * Cache-specific event keys
184
+ */
185
+ export declare const CACHE_EVENTS: {
186
+ readonly HIT: "cache:hit";
187
+ readonly MISS: "cache:miss";
188
+ readonly INVALIDATE: "cache:invalidate";
189
+ readonly ANY: "cache:*";
190
+ };
191
+ /**
192
+ * All event keys combined for easy access
193
+ */
194
+ export declare const ALL_EVENTS: {
195
+ readonly HIT: "cache:hit";
196
+ readonly MISS: "cache:miss";
197
+ readonly INVALIDATE: "cache:invalidate";
198
+ readonly ANY: "cache:*";
199
+ readonly CONFLICT: "client:conflict";
200
+ readonly DEBUG: "client:debug";
201
+ readonly CREATED: "client:created";
202
+ readonly REQUEST_START: "performance:request-start";
203
+ readonly REQUEST_COMPLETE: "performance:request-complete";
204
+ readonly RETRY: "performance:retry";
205
+ readonly THRESHOLD_EXCEEDED: "performance:threshold-exceeded";
206
+ readonly OPTIMIZATION_APPLIED: "performance:optimization-applied";
207
+ readonly METRIC_RECORDED: "performance:metric-recorded";
208
+ readonly GLOBAL_UPDATED: "config:global-updated";
209
+ readonly GLOBAL_RESET: "config:global-reset";
210
+ readonly ENVIRONMENT_CONFIGURED: "config:environment-configured";
211
+ readonly PRESET_APPLIED: "config:preset-applied";
212
+ readonly CONFIG_CONFLICT: "debug:config-conflict";
213
+ readonly CONFIG_CHANGE: "debug:config-change";
214
+ readonly HEADERS_TRACKED: "debug:headers-tracked";
215
+ readonly NETWORK_OVERRIDE: "debug:network-override";
216
+ readonly NETWORK_STATE_CHANGED: "debug:network-state-changed";
217
+ readonly NETWORK_DATA_CLEARED: "debug:network-data-cleared";
218
+ readonly DEBUG_INFO: "debug:info";
219
+ readonly PERFORMANCE_IMPACT: "debug:performance-impact";
220
+ readonly MONITORING_ALERT: "debug:monitoring-alert";
221
+ readonly CONFIG_TRACKED: "debug:config-tracked";
222
+ readonly CONFLICTS_BATCH: "debug:conflicts-batch";
223
+ readonly EVENT_OPERATION: "debug:event-operation";
224
+ readonly NETWORK_ERROR: "errors:network";
225
+ readonly VALIDATION_ERROR: "errors:validation";
226
+ readonly AUTHENTICATION_ERROR: "errors:authentication";
227
+ readonly AUTHORIZATION_ERROR: "errors:authorization";
228
+ readonly RATE_LIMIT_ERROR: "errors:rate-limit";
229
+ readonly SERVER_ERROR: "errors:server";
230
+ readonly CLIENT_ERROR: "errors:client";
231
+ readonly TIMEOUT_ERROR: "errors:timeout";
232
+ readonly CONFLICT_ERROR: "errors:conflict";
233
+ readonly CACHE_ERROR: "errors:cache";
234
+ readonly HEADERS_ERROR: "errors:headers";
235
+ readonly RETRY_ERROR: "errors:retry";
236
+ readonly STRATEGY_ERROR: "errors:strategy";
237
+ readonly REGIONAL_ERROR: "errors:regional";
238
+ readonly NOT_FOUND_ERROR: "errors:not-found";
239
+ readonly EXTERNAL_SERVICE_ERROR: "errors:external-service";
240
+ readonly UNKNOWN_ERROR: "errors:unknown";
241
+ readonly GENERIC_ERROR: "errors:generic";
242
+ readonly QUALITY_CHANGE: "network:quality:changed";
243
+ readonly INFO_UPDATE: "network:info-update";
244
+ readonly CONFIG_OVERRIDE: "network:config:override";
245
+ readonly CONFIG_RESTORED: "network:config:restored";
246
+ readonly OVERRIDE_CHANGE: "network:override-change";
247
+ readonly PRESET_CHANGED: "network:preset:changed";
248
+ readonly HINTS_UPDATED: "network:hints:updated";
249
+ readonly AUTO_DETECTION: "network:auto:detection";
250
+ readonly MANUAL_UPDATE: "network:manual:update";
251
+ readonly CHANGED: "headers:changed";
252
+ readonly ENRICHED: "headers:enriched";
253
+ readonly OVERRIDE: "headers:override";
254
+ readonly TRACKED: "headers:tracked";
255
+ readonly MERGED: "headers:merged";
256
+ readonly FILTERED: "headers:filtered";
257
+ readonly VALIDATED: "headers:validated";
258
+ readonly CACHED: "headers:cached";
259
+ readonly CACHE_HIT: "headers:cache:hit";
260
+ readonly CACHE_MISS: "headers:cache:miss";
261
+ };
262
+ export type EventsConfigSource = (typeof EVENTS_CONFIG_SOURCES)[keyof typeof EVENTS_CONFIG_SOURCES];
@@ -0,0 +1 @@
1
+ export type * from './types';
@@ -0,0 +1,60 @@
1
+ import type { EventOptions } from '..';
2
+ import type { CACHE_EVENTS } from '../..';
3
+ /**
4
+ * Cache hit event
5
+ */
6
+ export interface CacheHitEvent {
7
+ type: typeof CACHE_EVENTS.HIT;
8
+ timestamp: number;
9
+ data: {
10
+ key: string;
11
+ value?: unknown;
12
+ age?: number;
13
+ ttl?: number;
14
+ };
15
+ }
16
+ /**
17
+ * Cache miss event
18
+ */
19
+ export interface CacheMissEvent {
20
+ type: typeof CACHE_EVENTS.MISS;
21
+ timestamp: number;
22
+ data: {
23
+ key: string;
24
+ reason?: 'not_found' | 'expired' | 'disabled';
25
+ };
26
+ }
27
+ /**
28
+ * Cache invalidate event
29
+ */
30
+ export interface CacheInvalidateEvent {
31
+ type: typeof CACHE_EVENTS.INVALIDATE;
32
+ timestamp: number;
33
+ data: {
34
+ key?: string;
35
+ pattern?: string;
36
+ reason?: string;
37
+ count?: number;
38
+ };
39
+ }
40
+ /**
41
+ * All cache event types
42
+ */
43
+ export type CacheEventData = CacheHitEvent | CacheMissEvent | CacheInvalidateEvent;
44
+ /**
45
+ * Options for emitHit method
46
+ */
47
+ export interface EmitHitOptions extends EventOptions {
48
+ value?: unknown;
49
+ age?: number;
50
+ ttl?: number;
51
+ }
52
+ /**
53
+ * Options for emitInvalidate method
54
+ */
55
+ export interface EmitInvalidateOptions extends EventOptions {
56
+ key?: string;
57
+ pattern?: string;
58
+ reason?: string;
59
+ count?: number;
60
+ }
@@ -0,0 +1 @@
1
+ export type * from './types';
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Client Event Factory
3
+ * Creates and emits client-related events with type safety
4
+ */
5
+ import { type BaseEvent, type EventOptions } from '..';
6
+ import type { CLIENT_EVENTS } from '../..';
7
+ import type { ConfigConflict, DebugInfo } from '../../../debugger';
8
+ /**
9
+ * Base structure for client events
10
+ */
11
+ export interface ClientEvent extends BaseEvent {
12
+ type: string;
13
+ data: unknown;
14
+ }
15
+ /**
16
+ * Client conflict event
17
+ */
18
+ export interface ClientConflictEvent extends BaseEvent {
19
+ type: typeof CLIENT_EVENTS.CONFLICT;
20
+ data: ConfigConflict;
21
+ }
22
+ /**
23
+ * Client debug event
24
+ */
25
+ export interface ClientDebugEvent extends BaseEvent {
26
+ type: typeof CLIENT_EVENTS.DEBUG;
27
+ data: DebugInfo;
28
+ }
29
+ /**
30
+ * Client created event
31
+ */
32
+ export interface ClientCreatedEvent extends BaseEvent {
33
+ type: typeof CLIENT_EVENTS.CREATED;
34
+ data: {
35
+ clientId: string;
36
+ config: Record<string, unknown>;
37
+ };
38
+ }
39
+ /**
40
+ * Request start event (client-level)
41
+ */
42
+ export interface RequestStartEvent extends BaseEvent {
43
+ type: 'request:start';
44
+ data: {
45
+ url?: string;
46
+ method?: string;
47
+ timestamp: number;
48
+ };
49
+ }
50
+ /**
51
+ * Response received event
52
+ */
53
+ export interface ResponseReceivedEvent extends BaseEvent {
54
+ type: 'response:received';
55
+ data: {
56
+ url?: string;
57
+ status?: number;
58
+ statusText?: string;
59
+ headers?: Record<string, string>;
60
+ timestamp: number;
61
+ };
62
+ }
63
+ /**
64
+ * Retry attempt event
65
+ */
66
+ export interface RetryAttemptEvent extends BaseEvent {
67
+ type: 'retry:attempt';
68
+ data: {
69
+ error: {
70
+ message: string;
71
+ code?: string;
72
+ status?: number;
73
+ };
74
+ attempt: number;
75
+ maxAttempts: number;
76
+ delay: number;
77
+ url?: string;
78
+ method?: string;
79
+ };
80
+ }
81
+ /**
82
+ * Options for emitResponseReceived method
83
+ */
84
+ export interface EmitResponseReceivedOptions extends EventOptions {
85
+ url?: string;
86
+ status?: number;
87
+ statusText?: string;
88
+ headers?: Record<string, string>;
89
+ }
90
+ /**
91
+ * Options for emitRetryAttempt method
92
+ */
93
+ export interface EmitRetryAttemptOptions extends EventOptions {
94
+ error: {
95
+ message: string;
96
+ code?: string;
97
+ status?: number;
98
+ };
99
+ attempt: number;
100
+ maxAttempts: number;
101
+ delay: number;
102
+ url?: string;
103
+ method?: string;
104
+ }
105
+ /**
106
+ * All client event types union
107
+ */
108
+ export type ClientEventType = ClientConflictEvent | ClientDebugEvent | ClientCreatedEvent | RequestStartEvent | ResponseReceivedEvent | RetryAttemptEvent;
109
+ /**
110
+ * Client event handlers interface
111
+ */
112
+ export interface ClientEventHandlers {
113
+ onClientConflict?: (event: ClientConflictEvent) => void;
114
+ onClientDebug?: (event: ClientDebugEvent) => void;
115
+ onClientCreated?: (event: ClientCreatedEvent) => void;
116
+ onRequestStart?: (event: RequestStartEvent) => void;
117
+ onResponseReceived?: (event: ResponseReceivedEvent) => void;
118
+ onRetryAttempt?: (event: RetryAttemptEvent) => void;
119
+ onAnyClientEvent?: (event: ClientEventType) => void;
120
+ }
@@ -0,0 +1 @@
1
+ export type * from './types';
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Config Event Factory
3
+ * Factory for creating and emitting configuration-related events
4
+ */
5
+ import type { DebuggerConfigSource, CONFIG_EVENTS, EventOptions, ApiConfig } from '../../..';
6
+ /**
7
+ * Configuration updated event
8
+ */
9
+ export interface ConfigGlobalUpdatedEvent {
10
+ type: typeof CONFIG_EVENTS.GLOBAL_UPDATED;
11
+ timestamp: number;
12
+ data: {
13
+ previous: ApiConfig;
14
+ current: ApiConfig;
15
+ source: DebuggerConfigSource;
16
+ changes: string[];
17
+ };
18
+ }
19
+ /**
20
+ * Configuration reset event
21
+ */
22
+ export interface ConfigGlobalResetEvent {
23
+ type: typeof CONFIG_EVENTS.GLOBAL_RESET;
24
+ timestamp: number;
25
+ data: {
26
+ previous: ApiConfig;
27
+ defaults: ApiConfig;
28
+ source: DebuggerConfigSource;
29
+ };
30
+ }
31
+ /**
32
+ * Environment configured event
33
+ */
34
+ export interface ConfigEnvironmentEvent {
35
+ type: typeof CONFIG_EVENTS.ENVIRONMENT_CONFIGURED;
36
+ timestamp: number;
37
+ data: {
38
+ environment: string;
39
+ config: ApiConfig;
40
+ source: DebuggerConfigSource;
41
+ };
42
+ }
43
+ /**
44
+ * Preset applied event
45
+ */
46
+ export interface ConfigPresetAppliedEvent {
47
+ type: typeof CONFIG_EVENTS.PRESET_APPLIED;
48
+ timestamp: number;
49
+ data: {
50
+ presetName: string;
51
+ config: ApiConfig;
52
+ source: DebuggerConfigSource;
53
+ };
54
+ }
55
+ /**
56
+ * All config event types
57
+ */
58
+ export type ConfigEventData = ConfigGlobalUpdatedEvent | ConfigGlobalResetEvent | ConfigEnvironmentEvent | ConfigPresetAppliedEvent;
59
+ /**
60
+ * Options for emitGlobalUpdated method
61
+ */
62
+ export interface EmitGlobalUpdatedOptions extends EventOptions {
63
+ previous: ApiConfig;
64
+ current: ApiConfig;
65
+ source: DebuggerConfigSource;
66
+ changes: string[];
67
+ }
68
+ /**
69
+ * Configuration event handlers interface
70
+ */
71
+ export interface ConfigEventHandlers {
72
+ onGlobalUpdated?: (event: ConfigGlobalUpdatedEvent) => void;
73
+ onGlobalReset?: (event: ConfigGlobalResetEvent) => void;
74
+ onEnvironmentConfigured?: (event: ConfigEnvironmentEvent) => void;
75
+ onPresetApplied?: (event: ConfigPresetAppliedEvent) => void;
76
+ onAnyConfigEvent?: (event: ConfigEventData) => void;
77
+ }
@@ -0,0 +1 @@
1
+ export type * from './types';
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Debug Event Factory
3
+ * Creates and emits debug-related events with type safety
4
+ */
5
+ import { type BaseEvent, type EventOptions } from '..';
6
+ import type { DEBUG_EVENTS } from '../..';
7
+ import type { ConfigConflict, DebugInfo, ActiveOverride, PerformanceImpact, MonitoringAlert } from '../../../debugger';
8
+ import type { DebuggerConfigSource } from '../../..';
9
+ /**
10
+ * Base structure for debug events
11
+ */
12
+ export interface DebugEvent extends BaseEvent {
13
+ type: string;
14
+ data: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * Config conflict event
18
+ */
19
+ export interface ConfigConflictEvent extends BaseEvent {
20
+ type: typeof DEBUG_EVENTS.CONFIG_CONFLICT;
21
+ data: ConfigConflict;
22
+ }
23
+ /**
24
+ * Config change event
25
+ */
26
+ export interface ConfigChangeEvent extends BaseEvent {
27
+ type: typeof DEBUG_EVENTS.CONFIG_CHANGE;
28
+ data: {
29
+ property: string;
30
+ oldValue: unknown;
31
+ newValue: unknown;
32
+ source: DebuggerConfigSource;
33
+ reason?: string;
34
+ };
35
+ }
36
+ /**
37
+ * Headers tracked event
38
+ */
39
+ export interface HeadersTrackedEvent extends BaseEvent {
40
+ type: typeof DEBUG_EVENTS.HEADERS_TRACKED;
41
+ data: {
42
+ headers: Record<string, string>;
43
+ source: DebuggerConfigSource;
44
+ metadata?: {
45
+ phase: 'config' | 'request' | 'response';
46
+ reason?: string;
47
+ };
48
+ };
49
+ }
50
+ /**
51
+ * Network override event
52
+ */
53
+ export interface NetworkOverrideEvent extends BaseEvent {
54
+ type: typeof DEBUG_EVENTS.NETWORK_OVERRIDE;
55
+ data: {
56
+ overrides: ActiveOverride[];
57
+ reason: string;
58
+ temporary?: boolean;
59
+ };
60
+ }
61
+ /**
62
+ * Debug info update event
63
+ */
64
+ export interface DebugInfoUpdateEvent extends BaseEvent {
65
+ type: typeof DEBUG_EVENTS.DEBUG_INFO;
66
+ data: DebugInfo;
67
+ }
68
+ /**
69
+ * Performance impact event
70
+ */
71
+ export interface PerformanceImpactEvent extends BaseEvent {
72
+ type: typeof DEBUG_EVENTS.PERFORMANCE_IMPACT;
73
+ data: PerformanceImpact & {
74
+ source: 'network' | 'config' | 'strategy' | 'adaptive';
75
+ recommendation?: string;
76
+ operation?: string;
77
+ duration?: number;
78
+ impact?: 'low' | 'medium' | 'high';
79
+ };
80
+ }
81
+ /**
82
+ * Monitoring alert event
83
+ */
84
+ export interface MonitoringAlertEvent extends BaseEvent {
85
+ type: typeof DEBUG_EVENTS.MONITORING_ALERT;
86
+ data: MonitoringAlert;
87
+ }
88
+ /**
89
+ * Config tracking event
90
+ */
91
+ export interface ConfigTrackingEvent extends BaseEvent {
92
+ type: typeof DEBUG_EVENTS.CONFIG_TRACKED;
93
+ data: {
94
+ config: Record<string, unknown>;
95
+ source: DebuggerConfigSource;
96
+ phase: 'initialization' | 'runtime' | 'update';
97
+ metadata?: Record<string, unknown>;
98
+ };
99
+ }
100
+ /**
101
+ * Options for emitConfigChange method
102
+ */
103
+ export interface EmitConfigChangeOptions extends EventOptions {
104
+ property: string;
105
+ oldValue: unknown;
106
+ newValue: unknown;
107
+ source: DebuggerConfigSource;
108
+ reason?: string;
109
+ }
110
+ /**
111
+ * Options for emitHeadersTracked method
112
+ */
113
+ export interface EmitHeadersTrackedOptions extends EventOptions {
114
+ headers: Record<string, string>;
115
+ source: DebuggerConfigSource;
116
+ phase?: 'config' | 'request' | 'response';
117
+ reason?: string;
118
+ }
119
+ /**
120
+ * Options for emitConfigTracked method
121
+ */
122
+ export interface EmitConfigTrackedOptions extends EventOptions {
123
+ config: Record<string, unknown>;
124
+ source: DebuggerConfigSource;
125
+ phase?: 'initialization' | 'runtime' | 'update';
126
+ metadata?: Record<string, unknown>;
127
+ }
128
+ /**
129
+ * Union type for all debug event types
130
+ */
131
+ export type DebugEventData = ConfigConflictEvent | ConfigChangeEvent | HeadersTrackedEvent | NetworkOverrideEvent | DebugInfoUpdateEvent | PerformanceImpactEvent | MonitoringAlertEvent | ConfigTrackingEvent;
@@ -0,0 +1 @@
1
+ export type * from './types';