@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
@@ -5,10 +5,80 @@
5
5
  * Network quality levels enum
6
6
  */
7
7
  export declare enum NETWORK_QUALITY {
8
- EXCELLENT = "excellent",
9
- GOOD = "good",
10
- FAIR = "fair",
11
- POOR = "poor",
12
- OFFLINE = "offline",
8
+ EXCELLENT = "excellent",// 4G, low latency
9
+ GOOD = "good",// 3G or good 4G
10
+ FAIR = "fair",// 2G or poor 3G
11
+ POOR = "poor",// Slow 2G or worse
12
+ OFFLINE = "offline",// No connection
13
13
  UNKNOWN = "unknown"
14
14
  }
15
+ /**
16
+ * Event priority mapping
17
+ */
18
+ export declare const EVENT_PRIORITY_MAP: {
19
+ readonly error: "critical";
20
+ readonly onNetworkError: "critical";
21
+ readonly critical: "critical";
22
+ readonly config: "high";
23
+ readonly auth: "high";
24
+ readonly conflict: "high";
25
+ readonly network: "normal";
26
+ readonly headers: "normal";
27
+ readonly performance: "normal";
28
+ readonly debug: "low";
29
+ readonly metrics: "low";
30
+ readonly tracking: "low";
31
+ };
32
+ /**
33
+ * Export preset names for easy access
34
+ */
35
+ export declare const NetworkPresetNames: {
36
+ readonly OFFLINE_FIRST: "offline-first";
37
+ readonly DATA_SAVER: "data-saver";
38
+ readonly SLOW_CONNECTION: "slow-connection";
39
+ readonly FAIR_CONNECTION: "fair-connection";
40
+ readonly GOOD_CONNECTION: "good-connection";
41
+ readonly EXCELLENT_CONNECTION: "excellent-connection";
42
+ readonly AGGRESSIVE_CACHE: "aggressive-cache";
43
+ readonly REALTIME: "realtime";
44
+ readonly BACKGROUND_SYNC: "background-sync";
45
+ };
46
+ /**
47
+ * Confidence levels for quality detection
48
+ */
49
+ export declare const NETWORK_CONFIDENCE_LEVELS: {
50
+ /** Excellent confidence (90%) */
51
+ readonly EXCELLENT: 0.9;
52
+ /** High confidence (80%) */
53
+ readonly HIGH: 0.8;
54
+ /** Medium confidence (70%) */
55
+ readonly MEDIUM: 0.7;
56
+ /** Low confidence (50%) */
57
+ readonly LOW: 0.5;
58
+ /** Threshold for high confidence classification */
59
+ readonly HIGH_THRESHOLD: 0.7;
60
+ /** Threshold for medium confidence classification */
61
+ readonly MEDIUM_THRESHOLD: 0.4;
62
+ };
63
+ /**
64
+ * Network quality thresholds
65
+ */
66
+ export interface QualityThresholds {
67
+ excellentRTT: number;
68
+ goodRTT: number;
69
+ fairRTT: number;
70
+ excellentSpeed: number;
71
+ goodSpeed: number;
72
+ fairSpeed: number;
73
+ }
74
+ export declare const SPEED_THRESHOLDS: {
75
+ readonly EXCELLENT: 10;
76
+ readonly GOOD: 2;
77
+ readonly FAIR: 0.5;
78
+ };
79
+ export declare const RTT_THRESHOLDS: {
80
+ readonly EXCELLENT: 50;
81
+ readonly GOOD: 150;
82
+ readonly FAIR: 400;
83
+ };
84
+ export declare const DEFAULT_THRESHOLDS: QualityThresholds;
@@ -0,0 +1,2 @@
1
+ export type * from './nestjs';
2
+ export type * from './types';
@@ -0,0 +1 @@
1
+ export type * from './types';
@@ -0,0 +1,47 @@
1
+ import type { Request } from 'express';
2
+ import type { NetworkInfo } from '../..';
3
+ import type { EnrichedHeadersOptions } from '../../../headers';
4
+ /**
5
+ * Options for the enriched headers guard
6
+ */
7
+ export interface EnrichedHeadersGuardOptions extends EnrichedHeadersOptions {
8
+ /**
9
+ * Debug mode - log header processing
10
+ * @default false
11
+ */
12
+ debug?: boolean;
13
+ /**
14
+ * Store headers in request object
15
+ * @default true
16
+ */
17
+ storeInRequest?: boolean;
18
+ /**
19
+ * Require specific headers to be present
20
+ */
21
+ requiredHeaders?: string[];
22
+ /**
23
+ * Require specific compliance for access
24
+ */
25
+ requiredCompliance?: string[];
26
+ }
27
+ /**
28
+ * Options for the enriched headers interceptor
29
+ */
30
+ export interface EnrichedHeadersInterceptorOptions extends EnrichedHeadersOptions {
31
+ /**
32
+ * Debug mode - log header processing
33
+ * @default false
34
+ */
35
+ debug?: boolean;
36
+ /**
37
+ * Store headers in request object
38
+ * @default true
39
+ */
40
+ storeInRequest?: boolean;
41
+ }
42
+ /**
43
+ * Extended request with network info for NestJS
44
+ */
45
+ export interface NestRequestWithNetwork extends Request {
46
+ networkInfo?: NetworkInfo;
47
+ }
@@ -0,0 +1,76 @@
1
+ import type { NextApiRequest } from 'next';
2
+ import type { NetworkInfo } from '..';
3
+ import type { ApiHeaders, EnrichedHeadersOptions } from '../../headers';
4
+ /**
5
+ * Extended Express request with network info
6
+ */
7
+ export interface ExpressRequestWithNetwork extends Request {
8
+ networkInfo?: NetworkInfo;
9
+ }
10
+ /**
11
+ * Express middleware factory with options
12
+ *
13
+ * @param options - Middleware options
14
+ * @returns Express middleware
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import express from 'express';
19
+ * import { createNetworkDetectionMiddleware } from '@plyaz/api/utils/network/frameworks/express';
20
+ *
21
+ * const app = express();
22
+ *
23
+ * app.use(createNetworkDetectionMiddleware({
24
+ * requestClientHints: true,
25
+ * onNetworkDetected: (networkInfo) => {
26
+ * console.log('Network detected:', networkInfo);
27
+ * }
28
+ * }));
29
+ * ```
30
+ */
31
+ export interface NetworkDetectionOptions {
32
+ /**
33
+ * Whether to request Client Hints from browser
34
+ * @default true
35
+ */
36
+ requestClientHints?: boolean;
37
+ /**
38
+ * Callback when network is detected
39
+ */
40
+ onNetworkDetected?: (networkInfo: NetworkInfo) => void;
41
+ /**
42
+ * Custom header name to store network info (for debugging)
43
+ */
44
+ debugHeaderName?: string;
45
+ }
46
+ /**
47
+ * Express request with enriched headers
48
+ */
49
+ export interface ExpressRequestWithEnrichedHeaders extends Request {
50
+ enrichedHeaders?: ApiHeaders;
51
+ }
52
+ /**
53
+ * Options for enriched headers middleware
54
+ */
55
+ export interface EnrichedHeadersMiddlewareOptions extends EnrichedHeadersOptions {
56
+ /**
57
+ * Store enriched headers in res.locals
58
+ * @default false
59
+ */
60
+ storeInLocals?: boolean;
61
+ /**
62
+ * Add specific headers to response
63
+ */
64
+ addToResponse?: string[];
65
+ /**
66
+ * Debug mode - log header processing
67
+ * @default false
68
+ */
69
+ debug?: boolean;
70
+ }
71
+ /**
72
+ * Extended Next.js request with network info
73
+ */
74
+ export interface NextApiRequestWithNetwork extends NextApiRequest {
75
+ networkInfo?: NetworkInfo;
76
+ }
@@ -4,3 +4,4 @@
4
4
  */
5
5
  export type * from './enums';
6
6
  export type * from './types';
7
+ export type * from './frameworks';
@@ -2,6 +2,7 @@
2
2
  * Network Information API types
3
3
  * Properly typed definitions for browser and Node.js navigator
4
4
  */
5
+ import type { DebuggerConfigSource, NetworkEvent, NETWORK_QUALITY } from '../../..';
5
6
  /**
6
7
  * Network Information interface (partial for what we use)
7
8
  */
@@ -17,20 +18,43 @@ export interface NetworkInformation {
17
18
  }
18
19
  /**
19
20
  * Navigator-like interface with necessary properties
20
- * Avoids directly extending Navigator which is experimental in Node
21
+ * Avoids directly extending Navigator which is experimental in Node.js environments
22
+ * Provides cross-platform compatibility for browser and server-side code
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const nav: NavigatorLike = {
27
+ * userAgent: 'Mozilla/5.0...',
28
+ * platform: 'MacIntel',
29
+ * onLine: true,
30
+ * language: 'en-US'
31
+ * };
32
+ * ```
21
33
  */
22
34
  interface NavigatorLike {
35
+ /** Browser user agent string */
23
36
  userAgent?: string;
37
+ /** Operating system platform identifier */
24
38
  platform?: string;
39
+ /** Browser engine identifier */
25
40
  product?: string;
41
+ /** Primary language code (e.g., 'en-US') */
26
42
  language?: string;
43
+ /** Array of preferred language codes */
27
44
  languages?: readonly string[];
45
+ /** Whether the browser is online */
28
46
  onLine?: boolean;
47
+ /** Number of logical processor cores */
29
48
  hardwareConcurrency?: number;
49
+ /** Device RAM in gigabytes (from Client Hints) */
30
50
  deviceMemory?: number;
51
+ /** Maximum number of simultaneous touch points */
31
52
  maxTouchPoints?: number;
53
+ /** Do Not Track header value */
32
54
  doNotTrack?: string | null;
55
+ /** Browser vendor identifier */
33
56
  vendor?: string;
57
+ /** Browser application version */
34
58
  appVersion?: string;
35
59
  }
36
60
  /**
@@ -57,65 +81,348 @@ export type ConnectionType = 'slow-2g' | '2g' | '3g' | '4g' | '5g' | 'wifi' | 'e
57
81
  /**
58
82
  * Effective connection type
59
83
  */
60
- export type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g';
84
+ export type EffectiveConnectionType = 'slow-2g' | '2g' | '3g' | '4g' | 'unknown';
61
85
  /**
62
- * Network information details
86
+ * Network connection information
63
87
  */
64
88
  export interface NetworkInfo {
65
- type?: ConnectionType;
66
- effectiveType?: EffectiveConnectionType;
67
- downlink?: number;
68
- rtt?: number;
89
+ type: ConnectionType;
90
+ effectiveType: EffectiveConnectionType;
91
+ downlink: number | null;
92
+ downlinkMax: number | null;
93
+ rtt: number | null;
94
+ saveData: boolean;
95
+ online: boolean;
96
+ deviceMemory?: number | null;
97
+ }
98
+ /**
99
+ * Network status callback
100
+ */
101
+ export type NetworkStatusCallback = (online: boolean) => void;
102
+ /**
103
+ * Network client hints
104
+ */
105
+ export interface NetworkClientHints {
106
+ 'Save-Data'?: 'on' | null;
107
+ ECT?: EffectiveConnectionType;
108
+ RTT?: string;
109
+ Downlink?: string;
110
+ 'Device-Memory'?: string;
111
+ }
112
+ /**
113
+ * Network preset names
114
+ */
115
+ export type NetworkPresetName = 'fast' | 'good' | 'moderate' | 'slow' | 'offline';
116
+ /**
117
+ * Network event listener
118
+ */
119
+ export type NetworkEventListener<TEvent extends NetworkEvent = NetworkEvent> = (event: TEvent) => void;
120
+ /**
121
+ * Adaptive configuration based on network
122
+ */
123
+ export interface AdaptiveConfig {
124
+ enableHeavyOperations: boolean;
125
+ enableAutoRefresh: boolean;
126
+ enablePreloading: boolean;
127
+ imageQuality: 'high' | 'medium' | 'low';
128
+ videoQuality: 'auto' | '1080p' | '720p' | '480p' | '360p';
129
+ dataFetchStrategy: 'aggressive' | 'balanced' | 'conservative';
130
+ }
131
+ /**
132
+ * Monitoring configuration for network-based optimization
133
+ */
134
+ export interface MonitoringConfig {
135
+ networkBasedOptimization: boolean;
136
+ adaptiveQuality: boolean;
137
+ enableMetrics: boolean;
138
+ deviceId: string;
139
+ platform: string;
140
+ }
141
+ /**
142
+ * Network metrics subset
143
+ */
144
+ export interface NetworkMetrics {
145
+ downlink: number | null;
146
+ downlinkMax: number | null;
147
+ rtt: number | null;
148
+ saveData: boolean;
149
+ }
150
+ /**
151
+ * Network event statistics
152
+ */
153
+ export interface NetworkEventStats {
154
+ totalEvents: number;
155
+ listenerCount: number;
156
+ recentEvents: NetworkEvent[];
157
+ overrideCount: number;
158
+ }
159
+ /**
160
+ * Partial network info from headers (with null for missing values)
161
+ */
162
+ export interface PartialNetworkInfoFromHeaders {
163
+ effectiveType: EffectiveConnectionType | null;
164
+ rtt: number | null;
165
+ downlink: number | null;
166
+ saveData: boolean;
167
+ deviceMemory?: number | null;
168
+ }
169
+ /**
170
+ * HTTP request object with network information
171
+ * Used for server-side network-aware request handling
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const request: NetworkRequest = {
176
+ * headers: new Headers({ 'User-Agent': '...' }),
177
+ * networkInfo: {
178
+ * effectiveType: '4g',
179
+ * rtt: 50,
180
+ * downlink: 10,
181
+ * saveData: false
182
+ * },
183
+ * networkQuality: NETWORK_QUALITY.GOOD,
184
+ * saveData: false
185
+ * };
186
+ * ```
187
+ */
188
+ export interface NetworkRequest {
189
+ /** Request headers (Headers object or plain object) */
190
+ headers?: Headers | Record<string, string | string[] | undefined>;
191
+ /** Network information extracted from headers */
192
+ networkInfo?: PartialNetworkInfoFromHeaders;
193
+ /** Detected network quality level */
194
+ networkQuality?: NETWORK_QUALITY;
195
+ /** Whether data saver mode is enabled */
69
196
  saveData?: boolean;
70
- onLine: boolean;
71
197
  }
72
198
  /**
73
- * Quality thresholds for network assessment
199
+ * HTTP response object for setting network-related headers
200
+ * Provides methods to add Client Hints and network metadata to responses
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const response: NetworkResponse = {
205
+ * setHeader: (key, value) => console.log(`${key}: ${value}`),
206
+ * headers: {
207
+ * set: (key, value) => console.log(`Setting ${key}: ${value}`)
208
+ * }
209
+ * };
210
+ * ```
74
211
  */
75
- export interface QualityThresholds {
76
- good?: {
77
- rtt?: number;
78
- downlink?: number;
212
+ export interface NetworkResponse {
213
+ /** Function to set a single response header */
214
+ setHeader?: (key: string, value: string) => void;
215
+ /** Headers object with set method */
216
+ headers?: {
217
+ set: (key: string, value: string) => void;
79
218
  };
80
- fair?: {
81
- rtt?: number;
82
- downlink?: number;
219
+ }
220
+ /**
221
+ * Network quality preset configurations
222
+ * These work alongside existing network utilities without conflicts
223
+ */
224
+ export interface NetworkQualityPreset {
225
+ /** Preset identifier */
226
+ id: string;
227
+ /** Human-readable name */
228
+ name: string;
229
+ /** Network quality this preset optimizes for */
230
+ targetQuality: NETWORK_QUALITY;
231
+ /** Preset configuration values */
232
+ config: {
233
+ /** Request timeout in milliseconds */
234
+ timeout?: number;
235
+ /** Cache time in seconds */
236
+ cacheTime?: number;
237
+ /** Stale time in seconds */
238
+ staleTime?: number;
239
+ /** Enable request deduplication */
240
+ dedupe?: boolean;
241
+ /** Deduplication time window in milliseconds */
242
+ dedupeTime?: number;
243
+ /** Maximum concurrent requests */
244
+ maxConcurrent?: number;
245
+ /** Request retry configuration */
246
+ retry?: {
247
+ attempts: number;
248
+ delay: number;
249
+ backoff: number;
250
+ maxDelay: number;
251
+ };
252
+ /** Response compression threshold */
253
+ compressionThreshold?: number;
254
+ /** Enable progressive loading */
255
+ progressive?: boolean;
256
+ /** Skip cache for new requests */
257
+ skipCache?: boolean;
258
+ /** Cache error responses */
259
+ cacheErrors?: boolean;
83
260
  };
84
- poor?: {
85
- rtt?: number;
86
- downlink?: number;
261
+ /** Conditions when this preset should be automatically applied */
262
+ autoApply?: {
263
+ /** Network qualities that trigger this preset */
264
+ qualities?: NETWORK_QUALITY[];
265
+ /** Save-data mode requirement */
266
+ saveData?: boolean;
267
+ /** Connection types that trigger this preset */
268
+ connectionTypes?: string[];
269
+ /** RTT threshold in milliseconds */
270
+ maxRTT?: number;
271
+ /** Minimum downlink speed in Mbps */
272
+ minDownlink?: number;
87
273
  };
88
274
  }
89
275
  /**
90
- * Network status callback
276
+ * User configuration preferences that should be preserved
91
277
  */
92
- export type NetworkStatusCallback = (online: boolean) => void;
278
+ export interface UserNetworkPreferences {
279
+ /** User's preferred quality level (overrides auto-detection) */
280
+ preferredQuality?: NETWORK_QUALITY;
281
+ /** User's timeout preferences */
282
+ timeouts?: {
283
+ minimum?: number;
284
+ maximum?: number;
285
+ default?: number;
286
+ };
287
+ /** User's caching preferences */
288
+ caching?: {
289
+ enabled?: boolean;
290
+ maxAge?: number;
291
+ staleWhileRevalidate?: boolean;
292
+ };
293
+ /** User's retry preferences */
294
+ retry?: {
295
+ maxAttempts?: number;
296
+ aggressive?: boolean;
297
+ };
298
+ /** Features the user has disabled */
299
+ disabledFeatures?: string[];
300
+ /** Custom endpoint-specific overrides */
301
+ endpointOverrides?: Record<string, Partial<NetworkQualityPreset['config']>>;
302
+ }
93
303
  /**
94
- * Adaptive configuration based on network
304
+ * Temporary override information for debugging and restoration
95
305
  */
96
- export interface AdaptiveConfig {
97
- timeout?: number;
98
- retry?: number;
99
- prefetch?: boolean;
100
- autoRefresh?: boolean;
101
- batchSize?: number;
102
- pageSize?: number;
306
+ export interface TemporaryOverride {
307
+ /** Property that was overridden */
308
+ property: string;
309
+ /** Original value before override */
310
+ originalValue: unknown;
311
+ /** Override value */
312
+ overrideValue: unknown;
313
+ /** When the override was applied */
314
+ appliedAt: number;
315
+ /** How long the override should last (in milliseconds) */
316
+ duration?: number;
317
+ /** Source configuration that requested the override */
318
+ source: DebuggerConfigSource;
319
+ /** Reason for the override */
320
+ reason: string;
321
+ /** Function to restore original value */
322
+ restore: () => void;
323
+ /** Whether override is still active */
324
+ active: boolean;
325
+ /** Context information for debugging */
326
+ context: {
327
+ endpoint?: string;
328
+ clientName?: string;
329
+ configPath?: string;
330
+ };
103
331
  }
104
332
  /**
105
- * Network client hints
333
+ * Extended navigator interface with additional device and platform properties
334
+ * Combines standard navigator properties with device capabilities
335
+ *
336
+ * @example
337
+ * ```typescript
338
+ * const navigator: ExtendedNavigator = {
339
+ * userAgent: window.navigator.userAgent,
340
+ * platform: 'MacIntel',
341
+ * hardwareConcurrency: 8,
342
+ * deviceMemory: 16,
343
+ * onLine: true
344
+ * };
345
+ * ```
106
346
  */
107
- export interface NetworkClientHints {
108
- downlink?: string;
109
- rtt?: string;
110
- ect?: string;
111
- saveData?: string;
347
+ export interface ExtendedNavigator {
348
+ /** Browser user agent string */
349
+ userAgent?: string;
350
+ /** Operating system platform identifier */
351
+ platform?: string;
352
+ /** Browser engine identifier */
353
+ product?: string;
354
+ /** Primary language code */
355
+ language?: string;
356
+ /** Array of preferred language codes */
357
+ languages?: readonly string[];
358
+ /** Whether the browser is online */
359
+ onLine?: boolean;
360
+ /** Number of logical processor cores */
361
+ hardwareConcurrency?: number;
362
+ /** Device RAM in gigabytes */
363
+ deviceMemory?: number;
364
+ /** Maximum number of simultaneous touch points */
365
+ maxTouchPoints?: number;
366
+ /** Browser vendor identifier */
367
+ vendor?: string;
368
+ /** Browser application version */
369
+ appVersion?: string;
370
+ /** Do Not Track preference */
371
+ doNotTrack?: string | null;
112
372
  }
113
373
  /**
114
- * Network preset names
374
+ * Platform detection results
115
375
  */
116
- export type NetworkPresetName = 'fast' | 'good' | 'moderate' | 'slow' | 'offline';
376
+ export interface PlatformInfo {
377
+ /** Operating system */
378
+ os: 'windows' | 'macos' | 'linux' | 'ios' | 'android' | 'unknown';
379
+ /** Browser/runtime */
380
+ runtime: 'chrome' | 'firefox' | 'safari' | 'edge' | 'node' | 'electron' | 'unknown';
381
+ /** Device type */
382
+ deviceType: 'desktop' | 'mobile' | 'tablet' | 'unknown';
383
+ /** Is mobile device */
384
+ isMobile: boolean;
385
+ /** Is touch device */
386
+ isTouch: boolean;
387
+ /** Screen size category */
388
+ screenSize: 'small' | 'medium' | 'large' | 'xlarge' | 'unknown';
389
+ }
117
390
  /**
118
- * Network event listener
391
+ * Application version information
119
392
  */
120
- export type NetworkEventListener = (event: Event) => void;
393
+ export interface AppInfo {
394
+ /** Version number */
395
+ version: string;
396
+ /** Environment (development, production, etc.) */
397
+ environment: string;
398
+ /** Build number or commit hash */
399
+ build?: string;
400
+ /** Feature flags */
401
+ features: string[];
402
+ }
403
+ /**
404
+ * Device information
405
+ */
406
+ export interface DeviceInfo {
407
+ /** Unique device identifier */
408
+ id: string;
409
+ /** Platform information */
410
+ platform: PlatformInfo;
411
+ /** Screen information */
412
+ screen: {
413
+ width: number;
414
+ height: number;
415
+ colorDepth: number;
416
+ pixelRatio: number;
417
+ };
418
+ /** Memory in GB (if available) */
419
+ memory?: number;
420
+ /** CPU cores (if available) */
421
+ cores?: number;
422
+ /** Timezone information */
423
+ timezone: {
424
+ name: string;
425
+ offset: number;
426
+ };
427
+ }
121
428
  export {};