@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.
- 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 +56 -9
- package/dist/api/debugger/enums.d.ts +153 -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 +628 -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 +262 -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 +77 -0
- package/dist/api/events/factories/debug/index.d.ts +1 -0
- package/dist/api/events/factories/debug/types.d.ts +131 -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 -730
- 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 +7 -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 +346 -39
- package/dist/api/performance/types.d.ts +17 -10
- package/dist/api/polling/types.d.ts +6 -4
- 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,6 +2,8 @@
|
|
|
2
2
|
* API Client Types
|
|
3
3
|
* Defines the client interface and options
|
|
4
4
|
*/
|
|
5
|
+
import type { ApiConfig } from '../config';
|
|
6
|
+
import type { ConfigUpdateStrategy, HandlerStrategy } from '../events';
|
|
5
7
|
/**
|
|
6
8
|
* Options for creating an API client
|
|
7
9
|
* Endpoints are automatically included from src/api/endpoints
|
|
@@ -29,3 +31,115 @@ export type ApiClientOptions = Record<string, unknown>;
|
|
|
29
31
|
* Note: Full type definition requires EndpointTypes and endpoints from api package
|
|
30
32
|
*/
|
|
31
33
|
export type ApiClientInstance = Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Event handler registration options
|
|
36
|
+
*/
|
|
37
|
+
export interface HandlerOptions {
|
|
38
|
+
strategy?: HandlerStrategy;
|
|
39
|
+
priority?: number;
|
|
40
|
+
namespace?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Config update options
|
|
44
|
+
*/
|
|
45
|
+
export interface UpdateConfigOptions {
|
|
46
|
+
strategy?: ConfigUpdateStrategy;
|
|
47
|
+
priority?: number;
|
|
48
|
+
namespace?: string;
|
|
49
|
+
scope?: string;
|
|
50
|
+
preserveFields?: (keyof ApiConfig)[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Client event configuration - uses ApiConfig directly
|
|
54
|
+
* This ensures we never miss any event configuration if ApiConfig is updated
|
|
55
|
+
*/
|
|
56
|
+
export type ClientEventConfig = Partial<ApiConfig>;
|
|
57
|
+
/**
|
|
58
|
+
* Monitoring state for a client instance
|
|
59
|
+
*/
|
|
60
|
+
export interface ClientMonitoringState {
|
|
61
|
+
intervals: Array<ReturnType<typeof globalThis.setInterval>>;
|
|
62
|
+
subscriptions: Array<() => void>;
|
|
63
|
+
monitoring: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Type for fetchff client with internal config
|
|
67
|
+
* Using index signature to avoid naming convention issues
|
|
68
|
+
*/
|
|
69
|
+
export type FetchffClientWithConfig = Record<string, unknown> & {
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Validation result for configuration updates
|
|
74
|
+
* Indicates whether the config update is valid and provides error details if not
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const validation: TrackValidation = {
|
|
79
|
+
* valid: false,
|
|
80
|
+
* errors: ['Invalid timeout value', 'Cache strategy not found']
|
|
81
|
+
* };
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export interface TrackValidation {
|
|
85
|
+
/** Whether the configuration is valid */
|
|
86
|
+
valid: boolean;
|
|
87
|
+
/** Array of validation error messages */
|
|
88
|
+
errors: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Represents a single configuration property change
|
|
92
|
+
* Tracks what changed, from what value, to what value
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* const change: AnalyzeConfigChanges = {
|
|
97
|
+
* property: 'timeout',
|
|
98
|
+
* oldValue: 30000,
|
|
99
|
+
* newValue: 60000,
|
|
100
|
+
* changed: true
|
|
101
|
+
* };
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export interface AnalyzeConfigChanges {
|
|
105
|
+
/** Name of the configuration property that changed */
|
|
106
|
+
property: string;
|
|
107
|
+
/** Previous value before the change */
|
|
108
|
+
oldValue: unknown;
|
|
109
|
+
/** New value after the change */
|
|
110
|
+
newValue: unknown;
|
|
111
|
+
/** Whether the value actually changed */
|
|
112
|
+
changed: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parameters for tracking configuration updates
|
|
116
|
+
* Contains all information needed to debug and monitor config changes
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const params: TrackConfigUpdateParams = {
|
|
121
|
+
* updates: { timeout: 60000, retry: { attempts: 5 } },
|
|
122
|
+
* updateOptions: { strategy: 'merge' },
|
|
123
|
+
* configChanges: [
|
|
124
|
+
* { property: 'timeout', oldValue: 30000, newValue: 60000, changed: true }
|
|
125
|
+
* ],
|
|
126
|
+
* eventImpact: { handlersUpdated: 2, scopesAffected: ['client', 'request'] },
|
|
127
|
+
* validation: { valid: true, errors: [] },
|
|
128
|
+
* startTime: Date.now()
|
|
129
|
+
* };
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export interface TrackConfigUpdateParams {
|
|
133
|
+
/** Configuration updates being applied */
|
|
134
|
+
updates: Partial<ApiClientOptions>;
|
|
135
|
+
/** Options controlling how the update is applied */
|
|
136
|
+
updateOptions: UpdateConfigOptions | undefined;
|
|
137
|
+
/** Detailed list of configuration changes */
|
|
138
|
+
configChanges: Array<AnalyzeConfigChanges>;
|
|
139
|
+
/** Impact on event handlers and scopes */
|
|
140
|
+
eventImpact: Record<string, unknown>;
|
|
141
|
+
/** Validation result for the update */
|
|
142
|
+
validation: TrackValidation;
|
|
143
|
+
/** Timestamp when the update started */
|
|
144
|
+
startTime: number;
|
|
145
|
+
}
|
|
@@ -9,17 +9,13 @@ import type { CacheStrategyName } from '../cache';
|
|
|
9
9
|
import type { RetryConfig, RetryStrategyName } from '../retry';
|
|
10
10
|
import type { PerformancePresetName } from '../performance';
|
|
11
11
|
import type { RevalidationStrategyName } from '../revalidation';
|
|
12
|
-
import type { ApiHeaders } from '../headers';
|
|
12
|
+
import type { ApiHeaders, EnrichedHeadersOptions, HeaderBuilderLike, HeaderPresetName } from '../headers';
|
|
13
13
|
import type { ErrorEventHandlers } from '../errors';
|
|
14
14
|
import type { ConfigUpdateStrategy, HandlerStrategy, EventScopeWithTemporary } from '../events';
|
|
15
15
|
import type { NETWORK_QUALITY } from '../network';
|
|
16
16
|
import type { HeaderEventHandlers, NetworkEventHandlers, ConfigEventHandlers, ClientEventHandlers, CacheEventHandlers, PerformanceEventHandlers } from '../events';
|
|
17
17
|
import type { ApiClientOptions } from '../client';
|
|
18
|
-
type
|
|
19
|
-
type HeaderPresetName = string;
|
|
20
|
-
type DebugEventsConfig = Record<string, unknown>;
|
|
21
|
-
type EnrichedHeadersOptions = Record<string, unknown>;
|
|
22
|
-
export type { ConfigUpdateStrategy } from '../events';
|
|
18
|
+
import type { DebugEventsConfig } from '../debugger';
|
|
23
19
|
/**
|
|
24
20
|
* HTTP Methods - extend from fetchff but uppercase
|
|
25
21
|
*/
|
|
@@ -54,7 +50,7 @@ export type RetryInterceptor = NonNullable<FetchffRequestConfig['onRetry']>;
|
|
|
54
50
|
* Extends fetchff's RequestConfig with our abstraction layer
|
|
55
51
|
* Supports ALL fetchff configuration options
|
|
56
52
|
*/
|
|
57
|
-
export interface ApiConfig
|
|
53
|
+
export interface ApiConfig extends Partial<Omit<FetchffRequestConfig, 'retry' | 'cache' | 'cacheTime' | 'staleTime' | 'skipCache' | 'cacheErrors' | 'cacheKey' | 'cacheBuster' | 'pollingInterval' | 'pollingDelay' | 'maxPollingAttempts' | 'shouldStopPolling' | 'data' | 'headers' | 'onRequest' | 'onResponse' | 'onError' | 'onRetry'>> {
|
|
58
54
|
/** Base URL for all requests */
|
|
59
55
|
baseURL?: string;
|
|
60
56
|
/** Default HTTP method */
|
|
@@ -154,7 +150,7 @@ export interface ApiConfig<TApiPackageError = unknown> extends Partial<Omit<Fetc
|
|
|
154
150
|
/** Dynamic headers computed at request time */
|
|
155
151
|
dynamic?: () => ApiHeaders | Promise<ApiHeaders>;
|
|
156
152
|
/** Header builder for complex logic */
|
|
157
|
-
builder?: (builder:
|
|
153
|
+
builder?: (builder: HeaderBuilderLike) => HeaderBuilderLike;
|
|
158
154
|
/** Auto-detect network conditions and add Client Hints */
|
|
159
155
|
autoDetectNetwork?: boolean;
|
|
160
156
|
/** Request Client Hints from browser */
|
|
@@ -325,7 +321,7 @@ export interface ApiConfig<TApiPackageError = unknown> extends Partial<Omit<Fetc
|
|
|
325
321
|
* });
|
|
326
322
|
* ```
|
|
327
323
|
*/
|
|
328
|
-
errorHandlers?: ErrorEventHandlers
|
|
324
|
+
errorHandlers?: ErrorEventHandlers;
|
|
329
325
|
/**
|
|
330
326
|
* Configuration event handlers for monitoring config changes and updates
|
|
331
327
|
* Track when global config is updated, reset, or when presets are applied
|
|
@@ -632,3 +628,54 @@ export interface ApiResponse<TData = DefaultPayload, TBody = DefaultPayload, TPa
|
|
|
632
628
|
*/
|
|
633
629
|
export interface ApiError<TData = DefaultPayload, TBody = DefaultPayload, TParams = DefaultParams, TPathParams = UrlPathParams> extends ResponseError<TData, TBody, TParams, TPathParams> {
|
|
634
630
|
}
|
|
631
|
+
/**
|
|
632
|
+
* Configuration state that tracks base config and temporary overrides separately
|
|
633
|
+
*/
|
|
634
|
+
export interface ConfigState {
|
|
635
|
+
/** Base configuration (persisted across requests) */
|
|
636
|
+
baseConfig: ApiConfig;
|
|
637
|
+
/** Temporary overrides (can be cleared without affecting base) */
|
|
638
|
+
temporaryOverrides: Partial<ApiConfig>;
|
|
639
|
+
/** Metadata about the configuration */
|
|
640
|
+
metadata: {
|
|
641
|
+
createdAt: string;
|
|
642
|
+
lastUpdatedAt: string;
|
|
643
|
+
updateCount: number;
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Options for applying configuration updates
|
|
648
|
+
*/
|
|
649
|
+
export interface ConfigUpdateOptions {
|
|
650
|
+
/** Strategy for how to apply the update */
|
|
651
|
+
strategy?: ConfigUpdateStrategy;
|
|
652
|
+
/** Essential fields that should be preserved even during replace */
|
|
653
|
+
preserveFields?: (keyof ApiConfig)[];
|
|
654
|
+
/** Whether to track this update in metadata */
|
|
655
|
+
trackUpdate?: boolean;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Result of a configuration update operation
|
|
659
|
+
*/
|
|
660
|
+
export interface ConfigUpdateResult {
|
|
661
|
+
/** Updated configuration state */
|
|
662
|
+
state: ConfigState;
|
|
663
|
+
/** Effective configuration (base + temporary merged) */
|
|
664
|
+
effectiveConfig: ApiConfig;
|
|
665
|
+
/** Fields that were modified */
|
|
666
|
+
modifiedFields: string[];
|
|
667
|
+
/** Whether the update resulted in any changes */
|
|
668
|
+
hasChanges: boolean;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* Parameters for tracking global config update
|
|
672
|
+
*/
|
|
673
|
+
export interface TrackGlobalConfigParams {
|
|
674
|
+
currentConfig: ApiConfig;
|
|
675
|
+
mergedConfig: ApiConfig;
|
|
676
|
+
config: ApiConfig;
|
|
677
|
+
eventImpact: Record<string, unknown>;
|
|
678
|
+
scopesChanged: boolean;
|
|
679
|
+
startTime: number;
|
|
680
|
+
configEntries: Array<[string, unknown]>;
|
|
681
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debugger Event Namespaces and Constants
|
|
3
|
+
* Centralized definition of all debugger tracking operations and event types
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Factory operation types for tracking
|
|
7
|
+
* Used when tracking factory-related operations
|
|
8
|
+
*/
|
|
9
|
+
export declare const FACTORY_OPERATIONS: {
|
|
10
|
+
readonly FACTORY_CREATED: "factory_created";
|
|
11
|
+
readonly FACTORY_ACCESSED: "factory_accessed";
|
|
12
|
+
readonly FACTORY_INITIALIZED: "factory_initialized";
|
|
13
|
+
readonly FACTORIES_RESET: "factories_reset";
|
|
14
|
+
readonly FACTORY_REGISTER: "factory_register";
|
|
15
|
+
readonly HANDLER_REGISTERED: "handler_registered";
|
|
16
|
+
readonly HANDLER_UNREGISTERED: "handler_unregistered";
|
|
17
|
+
readonly SCOPE_LISTENERS_CLEARED: "scope_listeners_cleared";
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Event system operation types
|
|
21
|
+
* Used when tracking event system operations
|
|
22
|
+
*/
|
|
23
|
+
export declare const EVENT_OPERATIONS: {
|
|
24
|
+
readonly ON: "on";
|
|
25
|
+
readonly ONCE: "once";
|
|
26
|
+
readonly OFF: "off";
|
|
27
|
+
readonly EMIT: "emit";
|
|
28
|
+
readonly EMIT_ACROSS_SCOPES: "emit_across_scopes";
|
|
29
|
+
readonly REMOVE_ALL_LISTENERS: "removeAllListeners";
|
|
30
|
+
readonly ONCE_EXECUTED: "once_executed";
|
|
31
|
+
readonly CONFIG_UPDATE: "config_update";
|
|
32
|
+
readonly CONFIG_UPDATE_FAILED: "config_update_failed";
|
|
33
|
+
readonly GLOBAL_CONFIG_UPDATE: "global_config_update";
|
|
34
|
+
readonly GLOBAL_CONFIG_RESET: "global_config_reset";
|
|
35
|
+
readonly SCOPE_CHANGE: "scope_change";
|
|
36
|
+
readonly FACTORY_CREATE: "factory_create";
|
|
37
|
+
readonly FACTORY_COORDINATION: "factory_coordination";
|
|
38
|
+
readonly HANDLER_STRATEGY: "handler_strategy";
|
|
39
|
+
readonly HANDLER_STRATEGY_APPLIED: "handler_strategy_applied";
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Queue operation types
|
|
43
|
+
* Used when tracking queue operations
|
|
44
|
+
*/
|
|
45
|
+
export declare const QUEUE_OPERATIONS: {
|
|
46
|
+
readonly QUEUE_CREATED: "queue_created";
|
|
47
|
+
readonly QUEUE_PROCESSED: "queue_processed";
|
|
48
|
+
readonly QUEUE_CLEARED: "queue_cleared";
|
|
49
|
+
readonly QUEUE_ERROR: "queue_error";
|
|
50
|
+
readonly BATCH_PROCESSED: "batch_processed";
|
|
51
|
+
readonly ITEM_ENQUEUED: "item_enqueued";
|
|
52
|
+
readonly ITEM_DEQUEUED: "item_dequeued";
|
|
53
|
+
readonly PRIORITY_CHANGED: "priority_changed";
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Config tracking sources
|
|
57
|
+
* Used to identify the source of configuration changes
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEBUGGER_CONFIG_SOURCES: {
|
|
60
|
+
readonly DEFAULT: "default";
|
|
61
|
+
readonly DIRECT: "direct";
|
|
62
|
+
readonly CLIENT: "client";
|
|
63
|
+
readonly UNIFIED_STRATEGY: "unifiedStrategy";
|
|
64
|
+
readonly PERFORMANCE_PRESET: "performancePreset";
|
|
65
|
+
readonly DATA_PATTERN: "dataPattern";
|
|
66
|
+
readonly CACHE_STRATEGY: "cacheStrategy";
|
|
67
|
+
readonly RETRY_STRATEGY: "retryStrategy";
|
|
68
|
+
readonly REVALIDATION_STRATEGY: "revalidationStrategy";
|
|
69
|
+
readonly ADAPTIVE_CONFIG: "adaptiveConfig";
|
|
70
|
+
readonly MONITORING_CONFIG: "monitoringConfig";
|
|
71
|
+
readonly POLLING_CONFIG: "pollingConfig";
|
|
72
|
+
readonly NETWORK_PRESET: "networkPreset";
|
|
73
|
+
readonly NETWORK_AWARE: "networkAware";
|
|
74
|
+
readonly NETWORK_QUALITY: "networkQuality";
|
|
75
|
+
readonly USER_PREFERENCE: "userPreference";
|
|
76
|
+
readonly TEMPORARY_OVERRIDE: "temporaryOverride";
|
|
77
|
+
readonly AUTO_OPTIMIZATION: "autoOptimization";
|
|
78
|
+
readonly NETWORK_CLIENT_HINTS: "networkClientHints";
|
|
79
|
+
readonly HEADER_PRESET: "headerPreset";
|
|
80
|
+
readonly ENRICHED_HEADERS: "enrichedHeaders";
|
|
81
|
+
readonly USER_HEADERS: "userHeaders";
|
|
82
|
+
readonly INTERCEPTOR: "interceptor";
|
|
83
|
+
readonly CONTEXT_HEADERS: "contextHeaders";
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Debug history entry types
|
|
87
|
+
* Used to categorize history entries
|
|
88
|
+
*/
|
|
89
|
+
export declare const HISTORY_TYPES: {
|
|
90
|
+
readonly CONFIG: "config";
|
|
91
|
+
readonly HEADER: "header";
|
|
92
|
+
readonly NETWORK: "network";
|
|
93
|
+
readonly PERFORMANCE: "performance";
|
|
94
|
+
readonly EVENT: "event";
|
|
95
|
+
readonly EVENT_OPERATION: "event_operation";
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Header transformation stages
|
|
99
|
+
* Used to track header changes through the pipeline
|
|
100
|
+
*/
|
|
101
|
+
export declare const HEADER_STAGES: {
|
|
102
|
+
readonly BASE: "base";
|
|
103
|
+
readonly ENRICHED: "enriched";
|
|
104
|
+
readonly INTERCEPTOR: "interceptor";
|
|
105
|
+
readonly FINAL: "final";
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Config update strategies
|
|
109
|
+
* Used when updating configuration
|
|
110
|
+
*/
|
|
111
|
+
export declare const UPDATE_STRATEGIES: {
|
|
112
|
+
readonly MERGE: "merge";
|
|
113
|
+
readonly REPLACE: "replace";
|
|
114
|
+
readonly TEMPORARY: "temporary";
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Combined operation types for unified tracking
|
|
118
|
+
*/
|
|
119
|
+
export declare const UNIFIED_OPERATIONS: {
|
|
120
|
+
readonly QUEUE_CREATED: "queue_created";
|
|
121
|
+
readonly QUEUE_PROCESSED: "queue_processed";
|
|
122
|
+
readonly QUEUE_CLEARED: "queue_cleared";
|
|
123
|
+
readonly QUEUE_ERROR: "queue_error";
|
|
124
|
+
readonly BATCH_PROCESSED: "batch_processed";
|
|
125
|
+
readonly ITEM_ENQUEUED: "item_enqueued";
|
|
126
|
+
readonly ITEM_DEQUEUED: "item_dequeued";
|
|
127
|
+
readonly PRIORITY_CHANGED: "priority_changed";
|
|
128
|
+
readonly ON: "on";
|
|
129
|
+
readonly ONCE: "once";
|
|
130
|
+
readonly OFF: "off";
|
|
131
|
+
readonly EMIT: "emit";
|
|
132
|
+
readonly EMIT_ACROSS_SCOPES: "emit_across_scopes";
|
|
133
|
+
readonly REMOVE_ALL_LISTENERS: "removeAllListeners";
|
|
134
|
+
readonly ONCE_EXECUTED: "once_executed";
|
|
135
|
+
readonly CONFIG_UPDATE: "config_update";
|
|
136
|
+
readonly CONFIG_UPDATE_FAILED: "config_update_failed";
|
|
137
|
+
readonly GLOBAL_CONFIG_UPDATE: "global_config_update";
|
|
138
|
+
readonly GLOBAL_CONFIG_RESET: "global_config_reset";
|
|
139
|
+
readonly SCOPE_CHANGE: "scope_change";
|
|
140
|
+
readonly FACTORY_CREATE: "factory_create";
|
|
141
|
+
readonly FACTORY_COORDINATION: "factory_coordination";
|
|
142
|
+
readonly HANDLER_STRATEGY: "handler_strategy";
|
|
143
|
+
readonly HANDLER_STRATEGY_APPLIED: "handler_strategy_applied";
|
|
144
|
+
readonly FACTORY_CREATED: "factory_created";
|
|
145
|
+
readonly FACTORY_ACCESSED: "factory_accessed";
|
|
146
|
+
readonly FACTORY_INITIALIZED: "factory_initialized";
|
|
147
|
+
readonly FACTORIES_RESET: "factories_reset";
|
|
148
|
+
readonly FACTORY_REGISTER: "factory_register";
|
|
149
|
+
readonly HANDLER_REGISTERED: "handler_registered";
|
|
150
|
+
readonly HANDLER_UNREGISTERED: "handler_unregistered";
|
|
151
|
+
readonly SCOPE_LISTENERS_CLEARED: "scope_listeners_cleared";
|
|
152
|
+
};
|
|
153
|
+
export type DebuggerConfigSource = (typeof DEBUGGER_CONFIG_SOURCES)[keyof typeof DEBUGGER_CONFIG_SOURCES];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from './types';
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { DEBUGGER_CONFIG_SOURCES, UnifiedOperationType } from '..';
|
|
2
|
+
import type { HandlerStrategy } from '../..';
|
|
3
|
+
/**
|
|
4
|
+
* Use the proper operation types from debugger/types.ts
|
|
5
|
+
*/
|
|
6
|
+
export type EventOperation = UnifiedOperationType;
|
|
7
|
+
/**
|
|
8
|
+
* Event tracking metadata interface
|
|
9
|
+
*/
|
|
10
|
+
export interface EventTrackingMetadata {
|
|
11
|
+
operation: EventOperation;
|
|
12
|
+
event: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
source: 'pubsub' | 'eventManager' | 'clientEventManager' | 'factory' | 'config';
|
|
15
|
+
module: string;
|
|
16
|
+
listenerCount?: number;
|
|
17
|
+
totalEvents?: number;
|
|
18
|
+
totalListeners?: number;
|
|
19
|
+
eventPattern?: {
|
|
20
|
+
isWildcard: boolean;
|
|
21
|
+
namespace: string | null;
|
|
22
|
+
scope: string | null;
|
|
23
|
+
};
|
|
24
|
+
operationMetadata?: {
|
|
25
|
+
wasNewEvent?: boolean;
|
|
26
|
+
previousListenerCount?: number;
|
|
27
|
+
newListenerCount?: number;
|
|
28
|
+
callbackType?: string;
|
|
29
|
+
addedSuccessfully?: boolean;
|
|
30
|
+
isUnsubscribe?: boolean;
|
|
31
|
+
beforeRemoveCount?: number;
|
|
32
|
+
afterRemoveCount?: number;
|
|
33
|
+
eventDeleted?: boolean;
|
|
34
|
+
isOneTimeListener?: boolean;
|
|
35
|
+
executionTime?: number;
|
|
36
|
+
autoUnsubscribed?: boolean;
|
|
37
|
+
directListeners?: number;
|
|
38
|
+
wildcardListeners?: number;
|
|
39
|
+
globalWildcardListeners?: number;
|
|
40
|
+
totalTriggered?: number;
|
|
41
|
+
dataType?: string;
|
|
42
|
+
dataSize?: number;
|
|
43
|
+
hasWildcardMatches?: boolean;
|
|
44
|
+
strategy?: HandlerStrategy | 'prioritize';
|
|
45
|
+
configSource?: keyof typeof DEBUGGER_CONFIG_SOURCES;
|
|
46
|
+
previousConfig?: unknown;
|
|
47
|
+
newConfig?: unknown;
|
|
48
|
+
impactedEvents?: string[];
|
|
49
|
+
factoryType?: string;
|
|
50
|
+
registeredEvents?: string[];
|
|
51
|
+
mergedFactories?: string[];
|
|
52
|
+
replacedFactories?: string[];
|
|
53
|
+
conflicts?: Array<{
|
|
54
|
+
property: string;
|
|
55
|
+
}>;
|
|
56
|
+
source?: string;
|
|
57
|
+
quality?: string;
|
|
58
|
+
};
|
|
59
|
+
performance?: {
|
|
60
|
+
operationDuration?: number;
|
|
61
|
+
memoryUsage?: number;
|
|
62
|
+
cpuUsage?: number;
|
|
63
|
+
};
|
|
64
|
+
context?: {
|
|
65
|
+
stackTrace?: string;
|
|
66
|
+
userAgent?: string;
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
requestId?: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Event tracking summary for reporting
|
|
73
|
+
*/
|
|
74
|
+
export interface EventTrackingSummary {
|
|
75
|
+
totalOperations: number;
|
|
76
|
+
operationsByType: Record<EventOperation, number>;
|
|
77
|
+
operationsBySource: Record<string, number>;
|
|
78
|
+
operationsByModule: Record<string, number>;
|
|
79
|
+
mostActiveEvents: Array<{
|
|
80
|
+
event: string;
|
|
81
|
+
operations: number;
|
|
82
|
+
}>;
|
|
83
|
+
averageListenerCount: number;
|
|
84
|
+
peakListenerCount: number;
|
|
85
|
+
memoryImpact: number;
|
|
86
|
+
performanceMetrics: {
|
|
87
|
+
averageOperationTime: number;
|
|
88
|
+
slowestOperations: Array<{
|
|
89
|
+
operation: EventOperation;
|
|
90
|
+
duration: number;
|
|
91
|
+
event: string;
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
configImpacts: Array<{
|
|
95
|
+
strategy: string;
|
|
96
|
+
impactedEvents: string[];
|
|
97
|
+
timestamp: number;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Header event analysis result
|
|
102
|
+
*/
|
|
103
|
+
export interface HeaderEventAnalysis {
|
|
104
|
+
totalHeaderEvents: number;
|
|
105
|
+
headerOperations: Record<string, number>;
|
|
106
|
+
conflictsByHeader: Record<string, number>;
|
|
107
|
+
overridesBySource: Record<string, number>;
|
|
108
|
+
averageHeaderProcessingTime: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Network event analysis result
|
|
112
|
+
*/
|
|
113
|
+
export interface NetworkEventAnalysis {
|
|
114
|
+
totalNetworkEvents: number;
|
|
115
|
+
qualityChanges: number;
|
|
116
|
+
configOverrides: number;
|
|
117
|
+
presetApplications: number;
|
|
118
|
+
qualityDistribution: Record<string, number>;
|
|
119
|
+
averageQualityChangeTime: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Config event analysis result
|
|
123
|
+
*/
|
|
124
|
+
export interface ConfigEventAnalysis {
|
|
125
|
+
totalConfigEvents: number;
|
|
126
|
+
updatesBySource: Record<string, number>;
|
|
127
|
+
strategiesUsed: Record<string, number>;
|
|
128
|
+
conflictsByProperty: Record<string, number>;
|
|
129
|
+
averageConfigUpdateTime: number;
|
|
130
|
+
impactedEventsByUpdate: number;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Factory event analysis result
|
|
134
|
+
*/
|
|
135
|
+
export interface FactoryEventAnalysis {
|
|
136
|
+
totalFactoryEvents: number;
|
|
137
|
+
factoryOperations: Record<string, number>;
|
|
138
|
+
factoriesByType: Record<string, number>;
|
|
139
|
+
registrationPatterns: Record<string, number>;
|
|
140
|
+
averageFactoryOperationTime: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* PubSub event analysis result
|
|
144
|
+
*/
|
|
145
|
+
export interface PubSubEventAnalysis {
|
|
146
|
+
totalPubSubEvents: number;
|
|
147
|
+
operationsByType: Record<string, number>;
|
|
148
|
+
mostActiveEvents: Array<{
|
|
149
|
+
event: string;
|
|
150
|
+
operations: number;
|
|
151
|
+
}>;
|
|
152
|
+
listenerTrends: {
|
|
153
|
+
averageListenerCount: number;
|
|
154
|
+
peakListenerCount: number;
|
|
155
|
+
listenerCountByEvent: Record<string, number>;
|
|
156
|
+
};
|
|
157
|
+
wildCardUsage: {
|
|
158
|
+
totalWildcardEvents: number;
|
|
159
|
+
wildcardPatterns: Record<string, number>;
|
|
160
|
+
};
|
|
161
|
+
performanceMetrics: {
|
|
162
|
+
averageEmitTime: number;
|
|
163
|
+
slowestOperations: Array<{
|
|
164
|
+
operation: string;
|
|
165
|
+
duration: number;
|
|
166
|
+
event: string;
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Combined tracking analysis for all event types
|
|
172
|
+
*/
|
|
173
|
+
export interface EventTrackingAnalysis {
|
|
174
|
+
headers: HeaderEventAnalysis;
|
|
175
|
+
network: NetworkEventAnalysis;
|
|
176
|
+
config: ConfigEventAnalysis;
|
|
177
|
+
factory: FactoryEventAnalysis;
|
|
178
|
+
pubsub: PubSubEventAnalysis;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Impact tracking state for performance calculations
|
|
182
|
+
*/
|
|
183
|
+
export interface ImpactState {
|
|
184
|
+
ux: number;
|
|
185
|
+
bandwidth: number;
|
|
186
|
+
latency: number;
|
|
187
|
+
latencyImpact: number;
|
|
188
|
+
bandwidthImpact: number;
|
|
189
|
+
cacheEfficiencyImpact: number;
|
|
190
|
+
recommendations: string[];
|
|
191
|
+
}
|