@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
|
@@ -15,6 +15,11 @@ export interface CacheEntry<T = unknown> extends Partial<WithMetadata<Record<str
|
|
|
15
15
|
/** The cached data */
|
|
16
16
|
data: T;
|
|
17
17
|
}
|
|
18
|
+
export interface GenericCacheEntry<T = unknown> {
|
|
19
|
+
value: T;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
ttl: number;
|
|
22
|
+
}
|
|
18
23
|
/**
|
|
19
24
|
* Cache statistics for monitoring and debugging.
|
|
20
25
|
*/
|
|
@@ -44,16 +44,39 @@ export interface SetupApiTestOptions {
|
|
|
44
44
|
afterEach?: () => void | Promise<void>;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Mock spies for fetchff module functions
|
|
48
|
+
* Provides tracked mock implementations for all fetchff API methods
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const spies: FetchffSpies = {
|
|
53
|
+
* createApiFetcher: vi.fn(),
|
|
54
|
+
* isSlowConnection: vi.fn().mockReturnValue(false),
|
|
55
|
+
* fetchf: vi.fn().mockResolvedValue({ data: {} }),
|
|
56
|
+
* mutate: vi.fn().mockResolvedValue({ data: {} }),
|
|
57
|
+
* revalidate: vi.fn().mockResolvedValue(undefined),
|
|
58
|
+
* getCache: vi.fn().mockReturnValue(null),
|
|
59
|
+
* setCache: vi.fn(),
|
|
60
|
+
* deleteCache: vi.fn()
|
|
61
|
+
* };
|
|
62
|
+
* ```
|
|
48
63
|
*/
|
|
49
64
|
export interface FetchffSpies {
|
|
65
|
+
/** Mock for createApiFetcher function */
|
|
50
66
|
createApiFetcher: Vitest.Mock;
|
|
67
|
+
/** Mock for isSlowConnection network detection function */
|
|
51
68
|
isSlowConnection: Vitest.Mock;
|
|
69
|
+
/** Mock for fetchf main fetching function */
|
|
52
70
|
fetchf: Vitest.Mock;
|
|
71
|
+
/** Mock for mutate data mutation function */
|
|
53
72
|
mutate: Vitest.Mock;
|
|
73
|
+
/** Mock for revalidate cache revalidation function */
|
|
54
74
|
revalidate: Vitest.Mock;
|
|
75
|
+
/** Mock for getCache cache retrieval function */
|
|
55
76
|
getCache: Vitest.Mock;
|
|
77
|
+
/** Mock for setCache cache storage function */
|
|
56
78
|
setCache: Vitest.Mock;
|
|
79
|
+
/** Mock for deleteCache cache deletion function */
|
|
57
80
|
deleteCache: Vitest.Mock;
|
|
58
81
|
}
|
|
59
82
|
/**
|
|
@@ -69,30 +92,79 @@ export interface SetupFetchffMocksReturn {
|
|
|
69
92
|
};
|
|
70
93
|
}
|
|
71
94
|
/**
|
|
72
|
-
* Combined API mock spies
|
|
95
|
+
* Combined collection of all API-related mock spies
|
|
96
|
+
* Aggregates fetchff, adapter, and builder spies in a single interface for easy access
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const apiSpies: ApiMockSpies = {
|
|
101
|
+
* fetchff: createFetchffSpies(),
|
|
102
|
+
* adapter: createAdapterSpies(),
|
|
103
|
+
* builder: createBuilderSpies()
|
|
104
|
+
* };
|
|
105
|
+
*
|
|
106
|
+
* // Use in tests
|
|
107
|
+
* apiSpies.fetchff.fetchf.mockResolvedValue({ data: 'test' });
|
|
108
|
+
* apiSpies.adapter.toFetchffConfig.mockReturnValue(config);
|
|
109
|
+
* ```
|
|
73
110
|
*/
|
|
74
111
|
export interface ApiMockSpies {
|
|
112
|
+
/** Fetchff module spies */
|
|
75
113
|
fetchff: FetchffSpies;
|
|
114
|
+
/** Config adapter spies */
|
|
76
115
|
adapter: ConfigAdapterSpies;
|
|
116
|
+
/** Config builder spies */
|
|
77
117
|
builder: ConfigBuilderSpies;
|
|
78
118
|
}
|
|
79
119
|
/**
|
|
80
|
-
*
|
|
120
|
+
* Mock spies for configuration builder module
|
|
121
|
+
* Tracks calls to config construction and validation functions
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const builderSpies: ConfigBuilderSpies = {
|
|
126
|
+
* mergeConfigs: vi.fn().mockReturnValue(mergedConfig),
|
|
127
|
+
* buildApiConfig: vi.fn().mockReturnValue(apiConfig),
|
|
128
|
+
* applyDefaults: vi.fn().mockReturnValue(configWithDefaults),
|
|
129
|
+
* validateConfig: vi.fn().mockReturnValue(true)
|
|
130
|
+
* };
|
|
131
|
+
* ```
|
|
81
132
|
*/
|
|
82
133
|
export interface ConfigBuilderSpies {
|
|
134
|
+
/** Mock for mergeConfigs function that combines multiple configs */
|
|
83
135
|
mergeConfigs: Vitest.Mock;
|
|
136
|
+
/** Mock for buildApiConfig function that constructs API configuration */
|
|
84
137
|
buildApiConfig: Vitest.Mock;
|
|
138
|
+
/** Mock for applyDefaults function that applies default values */
|
|
85
139
|
applyDefaults: Vitest.Mock;
|
|
140
|
+
/** Mock for validateConfig function that validates configuration */
|
|
86
141
|
validateConfig: Vitest.Mock;
|
|
87
142
|
}
|
|
88
143
|
/**
|
|
89
|
-
*
|
|
144
|
+
* Mock spies for configuration adapter module
|
|
145
|
+
* Tracks configuration transformation and parsing operations
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const adapterSpies: ConfigAdapterSpies = {
|
|
150
|
+
* toFetchffConfig: vi.fn().mockReturnValue(fetchffConfig),
|
|
151
|
+
* fromFetchffResponse: vi.fn().mockReturnValue(response),
|
|
152
|
+
* mergeHeaders: vi.fn().mockReturnValue(mergedHeaders),
|
|
153
|
+
* parseRetryConfig: vi.fn().mockReturnValue(retryConfig),
|
|
154
|
+
* parseCacheConfig: vi.fn().mockReturnValue(cacheConfig)
|
|
155
|
+
* };
|
|
156
|
+
* ```
|
|
90
157
|
*/
|
|
91
158
|
export interface ConfigAdapterSpies {
|
|
159
|
+
/** Mock for toFetchffConfig function that converts config to fetchff format */
|
|
92
160
|
toFetchffConfig: Vitest.Mock;
|
|
161
|
+
/** Mock for fromFetchffResponse function that transforms fetchff responses */
|
|
93
162
|
fromFetchffResponse: Vitest.Mock;
|
|
163
|
+
/** Mock for mergeHeaders function that combines header objects */
|
|
94
164
|
mergeHeaders: Vitest.Mock;
|
|
165
|
+
/** Mock for parseRetryConfig function that parses retry configuration */
|
|
95
166
|
parseRetryConfig: Vitest.Mock;
|
|
167
|
+
/** Mock for parseCacheConfig function that parses cache configuration */
|
|
96
168
|
parseCacheConfig: Vitest.Mock;
|
|
97
169
|
}
|
|
98
170
|
/**
|
|
@@ -118,110 +190,389 @@ export interface NetworkInfoNavigatorMock {
|
|
|
118
190
|
language: string;
|
|
119
191
|
languages: string[];
|
|
120
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Return type for generic event factory mocks
|
|
195
|
+
* Provides basic event emitter functionality for testing event-driven systems
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const eventFactory: CreateMockEventFactoryReturn = {
|
|
200
|
+
* on: vi.fn(),
|
|
201
|
+
* off: vi.fn(),
|
|
202
|
+
* emit: vi.fn(),
|
|
203
|
+
* emitGeneric: vi.fn(),
|
|
204
|
+
* onAny: vi.fn(),
|
|
205
|
+
* offAny: vi.fn()
|
|
206
|
+
* };
|
|
207
|
+
*
|
|
208
|
+
* // Use in tests
|
|
209
|
+
* eventFactory.on('event', handler);
|
|
210
|
+
* eventFactory.emit('event', data);
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
121
213
|
export interface CreateMockEventFactoryReturn {
|
|
214
|
+
/** Mock for subscribing to specific events */
|
|
122
215
|
on: ReturnType<Vitest.Mock>;
|
|
216
|
+
/** Mock for unsubscribing from specific events */
|
|
123
217
|
off: ReturnType<Vitest.Mock>;
|
|
218
|
+
/** Mock for emitting specific events */
|
|
124
219
|
emit: ReturnType<Vitest.Mock>;
|
|
220
|
+
/** Mock for emitting generic events with any payload */
|
|
125
221
|
emitGeneric: ReturnType<Vitest.Mock>;
|
|
222
|
+
/** Mock for subscribing to all events (wildcard listener) */
|
|
126
223
|
onAny: ReturnType<Vitest.Mock>;
|
|
224
|
+
/** Mock for unsubscribing from all events */
|
|
127
225
|
offAny: ReturnType<Vitest.Mock>;
|
|
128
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Mock factory for network-related events
|
|
229
|
+
* Provides spies for all network event emission methods
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* const networkFactory: CreateMockNetworkFactory = {
|
|
234
|
+
* emitQualityChanged: vi.fn(),
|
|
235
|
+
* emitQualityChange: vi.fn(),
|
|
236
|
+
* emitConfigOverride: vi.fn(),
|
|
237
|
+
* emitConfigRestored: vi.fn(),
|
|
238
|
+
* emitInfoUpdate: vi.fn(),
|
|
239
|
+
* emitPresetApplied: vi.fn(),
|
|
240
|
+
* emitPresetChanged: vi.fn(),
|
|
241
|
+
* emitHintsUpdated: vi.fn(),
|
|
242
|
+
* emitAutoDetection: vi.fn(),
|
|
243
|
+
* emitManualUpdate: vi.fn()
|
|
244
|
+
* };
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
129
247
|
export interface CreateMockNetworkFactory {
|
|
248
|
+
/** Mock for emitting network quality changed events */
|
|
130
249
|
emitQualityChanged: ReturnType<Vitest.Mock>;
|
|
250
|
+
/** Mock for emitting network quality change events */
|
|
131
251
|
emitQualityChange: ReturnType<Vitest.Mock>;
|
|
252
|
+
/** Mock for emitting network config override events */
|
|
132
253
|
emitConfigOverride: ReturnType<Vitest.Mock>;
|
|
254
|
+
/** Mock for emitting network config restored events */
|
|
133
255
|
emitConfigRestored: ReturnType<Vitest.Mock>;
|
|
256
|
+
/** Mock for emitting network info update events */
|
|
134
257
|
emitInfoUpdate: ReturnType<Vitest.Mock>;
|
|
258
|
+
/** Mock for emitting network preset applied events */
|
|
135
259
|
emitPresetApplied: ReturnType<Vitest.Mock>;
|
|
260
|
+
/** Mock for emitting network preset changed events */
|
|
136
261
|
emitPresetChanged: ReturnType<Vitest.Mock>;
|
|
262
|
+
/** Mock for emitting network hints updated events */
|
|
137
263
|
emitHintsUpdated: ReturnType<Vitest.Mock>;
|
|
264
|
+
/** Mock for emitting auto-detection events */
|
|
138
265
|
emitAutoDetection: ReturnType<Vitest.Mock>;
|
|
266
|
+
/** Mock for emitting manual network update events */
|
|
139
267
|
emitManualUpdate: ReturnType<Vitest.Mock>;
|
|
140
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Mock factory for error-related events
|
|
271
|
+
* Provides spies for all error event emission methods
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const errorFactory: CreateMockErrorFactory = {
|
|
276
|
+
* emitError: vi.fn(),
|
|
277
|
+
* emitNetworkError: vi.fn(),
|
|
278
|
+
* emitTimeoutError: vi.fn(),
|
|
279
|
+
* emitClientError: vi.fn(),
|
|
280
|
+
* emitServerError: vi.fn(),
|
|
281
|
+
* emitValidationError: vi.fn(),
|
|
282
|
+
* emitHeadersError: vi.fn(),
|
|
283
|
+
* emitCritical: vi.fn()
|
|
284
|
+
* };
|
|
285
|
+
*
|
|
286
|
+
* // Trigger error events in tests
|
|
287
|
+
* errorFactory.emitNetworkError({ message: 'Connection failed' });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
141
290
|
export interface CreateMockErrorFactory {
|
|
291
|
+
/** Mock for emitting generic error events */
|
|
142
292
|
emitError: ReturnType<Vitest.Mock>;
|
|
293
|
+
/** Mock for emitting network-related error events */
|
|
143
294
|
emitNetworkError: ReturnType<Vitest.Mock>;
|
|
295
|
+
/** Mock for emitting timeout error events */
|
|
144
296
|
emitTimeoutError: ReturnType<Vitest.Mock>;
|
|
297
|
+
/** Mock for emitting client-side error events (4xx) */
|
|
145
298
|
emitClientError: ReturnType<Vitest.Mock>;
|
|
299
|
+
/** Mock for emitting server-side error events (5xx) */
|
|
146
300
|
emitServerError: ReturnType<Vitest.Mock>;
|
|
301
|
+
/** Mock for emitting validation error events */
|
|
147
302
|
emitValidationError: ReturnType<Vitest.Mock>;
|
|
303
|
+
/** Mock for emitting headers-related error events */
|
|
148
304
|
emitHeadersError: ReturnType<Vitest.Mock>;
|
|
305
|
+
/** Mock for emitting critical error events */
|
|
149
306
|
emitCritical: ReturnType<Vitest.Mock>;
|
|
150
307
|
}
|
|
308
|
+
/**
|
|
309
|
+
* Mock factory for header-related events
|
|
310
|
+
* Provides spies for all HTTP header event emission methods
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const headerFactory: CreateMockHeaderFactory = {
|
|
315
|
+
* emitChanged: vi.fn(),
|
|
316
|
+
* emitEnriched: vi.fn(),
|
|
317
|
+
* emitConflict: vi.fn(),
|
|
318
|
+
* emitOverride: vi.fn(),
|
|
319
|
+
* emitMerged: vi.fn(),
|
|
320
|
+
* emitFiltered: vi.fn(),
|
|
321
|
+
* emitValidated: vi.fn(),
|
|
322
|
+
* emitCached: vi.fn(),
|
|
323
|
+
* emitCacheHit: vi.fn(),
|
|
324
|
+
* emitCacheMiss: vi.fn()
|
|
325
|
+
* };
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
151
328
|
export interface CreateMockHeaderFactory {
|
|
329
|
+
/** Mock for emitting header changed events */
|
|
152
330
|
emitChanged: ReturnType<Vitest.Mock>;
|
|
331
|
+
/** Mock for emitting header enriched events */
|
|
153
332
|
emitEnriched: ReturnType<Vitest.Mock>;
|
|
333
|
+
/** Mock for emitting header conflict events */
|
|
154
334
|
emitConflict: ReturnType<Vitest.Mock>;
|
|
335
|
+
/** Mock for emitting header override events */
|
|
155
336
|
emitOverride: ReturnType<Vitest.Mock>;
|
|
337
|
+
/** Mock for emitting header merged events */
|
|
156
338
|
emitMerged: ReturnType<Vitest.Mock>;
|
|
339
|
+
/** Mock for emitting header filtered events */
|
|
157
340
|
emitFiltered: ReturnType<Vitest.Mock>;
|
|
341
|
+
/** Mock for emitting header validated events */
|
|
158
342
|
emitValidated: ReturnType<Vitest.Mock>;
|
|
343
|
+
/** Mock for emitting header cached events */
|
|
159
344
|
emitCached: ReturnType<Vitest.Mock>;
|
|
345
|
+
/** Mock for emitting header cache hit events */
|
|
160
346
|
emitCacheHit: ReturnType<Vitest.Mock>;
|
|
347
|
+
/** Mock for emitting header cache miss events */
|
|
161
348
|
emitCacheMiss: ReturnType<Vitest.Mock>;
|
|
162
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* Mock factory for debug and monitoring events
|
|
352
|
+
* Provides spies for all debugging and tracking event emission methods
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const debugFactory: CreateMockDebugFactory = {
|
|
357
|
+
* emitConfigConflict: vi.fn(),
|
|
358
|
+
* emitConflict: vi.fn(),
|
|
359
|
+
* emitConfigChange: vi.fn(),
|
|
360
|
+
* emitHeadersTracked: vi.fn(),
|
|
361
|
+
* emitNetworkOverride: vi.fn(),
|
|
362
|
+
* emitNetworkStateChanged: vi.fn(),
|
|
363
|
+
* emitNetworkDataCleared: vi.fn(),
|
|
364
|
+
* emitDebugInfo: vi.fn(),
|
|
365
|
+
* emitTracking: vi.fn(),
|
|
366
|
+
* emitPerformance: vi.fn(),
|
|
367
|
+
* emitMonitoringAlert: vi.fn()
|
|
368
|
+
* };
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
163
371
|
export interface CreateMockDebugFactory {
|
|
372
|
+
/** Mock for emitting config conflict debug events */
|
|
164
373
|
emitConfigConflict: ReturnType<Vitest.Mock>;
|
|
374
|
+
/** Mock for emitting generic conflict events */
|
|
165
375
|
emitConflict: ReturnType<Vitest.Mock>;
|
|
376
|
+
/** Mock for emitting config change debug events */
|
|
166
377
|
emitConfigChange: ReturnType<Vitest.Mock>;
|
|
378
|
+
/** Mock for emitting headers tracked debug events */
|
|
167
379
|
emitHeadersTracked: ReturnType<Vitest.Mock>;
|
|
380
|
+
/** Mock for emitting network override debug events */
|
|
168
381
|
emitNetworkOverride: ReturnType<Vitest.Mock>;
|
|
382
|
+
/** Mock for emitting network state changed debug events */
|
|
169
383
|
emitNetworkStateChanged: ReturnType<Vitest.Mock>;
|
|
384
|
+
/** Mock for emitting network data cleared debug events */
|
|
170
385
|
emitNetworkDataCleared: ReturnType<Vitest.Mock>;
|
|
386
|
+
/** Mock for emitting general debug information events */
|
|
171
387
|
emitDebugInfo: ReturnType<Vitest.Mock>;
|
|
388
|
+
/** Mock for emitting tracking events */
|
|
172
389
|
emitTracking: ReturnType<Vitest.Mock>;
|
|
390
|
+
/** Mock for emitting performance debug events */
|
|
173
391
|
emitPerformance: ReturnType<Vitest.Mock>;
|
|
392
|
+
/** Mock for emitting monitoring alert events */
|
|
174
393
|
emitMonitoringAlert: ReturnType<Vitest.Mock>;
|
|
175
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* Mock factory for configuration-related events
|
|
397
|
+
* Provides spies for config lifecycle event emission methods
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* const configFactory: CreateMockConfigFactory = {
|
|
402
|
+
* emitGlobalUpdated: vi.fn(),
|
|
403
|
+
* emitConfigChanged: vi.fn(),
|
|
404
|
+
* emitConfigOverride: vi.fn(),
|
|
405
|
+
* emitConfigRestored: vi.fn(),
|
|
406
|
+
* emitConfigValidated: vi.fn(),
|
|
407
|
+
* emitPresetApplied: vi.fn()
|
|
408
|
+
* };
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
176
411
|
export interface CreateMockConfigFactory {
|
|
412
|
+
/** Mock for emitting global config updated events */
|
|
177
413
|
emitGlobalUpdated: ReturnType<Vitest.Mock>;
|
|
414
|
+
/** Mock for emitting config changed events */
|
|
178
415
|
emitConfigChanged: ReturnType<Vitest.Mock>;
|
|
416
|
+
/** Mock for emitting config override events */
|
|
179
417
|
emitConfigOverride: ReturnType<Vitest.Mock>;
|
|
418
|
+
/** Mock for emitting config restored events */
|
|
180
419
|
emitConfigRestored: ReturnType<Vitest.Mock>;
|
|
420
|
+
/** Mock for emitting config validated events */
|
|
181
421
|
emitConfigValidated: ReturnType<Vitest.Mock>;
|
|
422
|
+
/** Mock for emitting preset applied events */
|
|
182
423
|
emitPresetApplied: ReturnType<Vitest.Mock>;
|
|
183
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Mock factory for performance monitoring events
|
|
427
|
+
* Provides spies for all performance metric event emission methods
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* const perfFactory: CreateMockPerformanceFactory = {
|
|
432
|
+
* emitMetric: vi.fn(),
|
|
433
|
+
* emitTiming: vi.fn(),
|
|
434
|
+
* emitThreshold: vi.fn(),
|
|
435
|
+
* emitCacheHit: vi.fn(),
|
|
436
|
+
* emitCacheMiss: vi.fn(),
|
|
437
|
+
* emitRequestStart: vi.fn(),
|
|
438
|
+
* emitRequestComplete: vi.fn(),
|
|
439
|
+
* emitRetry: vi.fn(),
|
|
440
|
+
* emitThresholdExceeded: vi.fn(),
|
|
441
|
+
* emitOptimizationApplied: vi.fn(),
|
|
442
|
+
* emitMetricRecorded: vi.fn()
|
|
443
|
+
* };
|
|
444
|
+
* ```
|
|
445
|
+
*/
|
|
184
446
|
export interface CreateMockPerformanceFactory {
|
|
447
|
+
/** Mock for emitting performance metric events */
|
|
185
448
|
emitMetric: ReturnType<Vitest.Mock>;
|
|
449
|
+
/** Mock for emitting performance timing events */
|
|
186
450
|
emitTiming: ReturnType<Vitest.Mock>;
|
|
451
|
+
/** Mock for emitting performance threshold events */
|
|
187
452
|
emitThreshold: ReturnType<Vitest.Mock>;
|
|
453
|
+
/** Mock for emitting cache hit performance events */
|
|
188
454
|
emitCacheHit: ReturnType<Vitest.Mock>;
|
|
455
|
+
/** Mock for emitting cache miss performance events */
|
|
189
456
|
emitCacheMiss: ReturnType<Vitest.Mock>;
|
|
457
|
+
/** Mock for emitting request start events */
|
|
190
458
|
emitRequestStart: ReturnType<Vitest.Mock>;
|
|
459
|
+
/** Mock for emitting request complete events */
|
|
191
460
|
emitRequestComplete: ReturnType<Vitest.Mock>;
|
|
461
|
+
/** Mock for emitting retry attempt events */
|
|
192
462
|
emitRetry: ReturnType<Vitest.Mock>;
|
|
463
|
+
/** Mock for emitting threshold exceeded events */
|
|
193
464
|
emitThresholdExceeded: ReturnType<Vitest.Mock>;
|
|
465
|
+
/** Mock for emitting optimization applied events */
|
|
194
466
|
emitOptimizationApplied: ReturnType<Vitest.Mock>;
|
|
467
|
+
/** Mock for emitting metric recorded events */
|
|
195
468
|
emitMetricRecorded: ReturnType<Vitest.Mock>;
|
|
196
469
|
}
|
|
470
|
+
/**
|
|
471
|
+
* Mock factory for cache-related events
|
|
472
|
+
* Provides spies for all cache operation event emission methods
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const cacheFactory: CreateMockCacheFactory = {
|
|
477
|
+
* emitHit: vi.fn(),
|
|
478
|
+
* emitMiss: vi.fn(),
|
|
479
|
+
* emitSet: vi.fn(),
|
|
480
|
+
* emitDelete: vi.fn(),
|
|
481
|
+
* emitClear: vi.fn(),
|
|
482
|
+
* emitExpire: vi.fn(),
|
|
483
|
+
* emitCacheHit: vi.fn(),
|
|
484
|
+
* emitCacheMiss: vi.fn(),
|
|
485
|
+
* emitCacheSet: vi.fn(),
|
|
486
|
+
* emitCacheDelete: vi.fn(),
|
|
487
|
+
* emitCacheClear: vi.fn(),
|
|
488
|
+
* emitCacheExpire: vi.fn()
|
|
489
|
+
* };
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
197
492
|
export interface CreateMockCacheFactory {
|
|
493
|
+
/** Mock for emitting cache hit events (short form) */
|
|
198
494
|
emitHit: ReturnType<Vitest.Mock>;
|
|
495
|
+
/** Mock for emitting cache miss events (short form) */
|
|
199
496
|
emitMiss: ReturnType<Vitest.Mock>;
|
|
497
|
+
/** Mock for emitting cache set events (short form) */
|
|
200
498
|
emitSet: ReturnType<Vitest.Mock>;
|
|
499
|
+
/** Mock for emitting cache delete events (short form) */
|
|
201
500
|
emitDelete: ReturnType<Vitest.Mock>;
|
|
501
|
+
/** Mock for emitting cache clear events (short form) */
|
|
202
502
|
emitClear: ReturnType<Vitest.Mock>;
|
|
503
|
+
/** Mock for emitting cache expire events (short form) */
|
|
203
504
|
emitExpire: ReturnType<Vitest.Mock>;
|
|
505
|
+
/** Mock for emitting cache hit events (full form) */
|
|
204
506
|
emitCacheHit: ReturnType<Vitest.Mock>;
|
|
507
|
+
/** Mock for emitting cache miss events (full form) */
|
|
205
508
|
emitCacheMiss: ReturnType<Vitest.Mock>;
|
|
509
|
+
/** Mock for emitting cache set events (full form) */
|
|
206
510
|
emitCacheSet: ReturnType<Vitest.Mock>;
|
|
511
|
+
/** Mock for emitting cache delete events (full form) */
|
|
207
512
|
emitCacheDelete: ReturnType<Vitest.Mock>;
|
|
513
|
+
/** Mock for emitting cache clear events (full form) */
|
|
208
514
|
emitCacheClear: ReturnType<Vitest.Mock>;
|
|
515
|
+
/** Mock for emitting cache expire events (full form) */
|
|
209
516
|
emitCacheExpire: ReturnType<Vitest.Mock>;
|
|
210
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Mock factory for base lifecycle events
|
|
520
|
+
* Provides spies for fundamental lifecycle event emission methods
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```typescript
|
|
524
|
+
* const baseFactory: CreateMockBaseFactory = {
|
|
525
|
+
* emitInitialized: vi.fn(),
|
|
526
|
+
* emitDestroyed: vi.fn(),
|
|
527
|
+
* emitReady: vi.fn()
|
|
528
|
+
* };
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
211
531
|
export interface CreateMockBaseFactory {
|
|
532
|
+
/** Mock for emitting initialized lifecycle events */
|
|
212
533
|
emitInitialized: ReturnType<Vitest.Mock>;
|
|
534
|
+
/** Mock for emitting destroyed lifecycle events */
|
|
213
535
|
emitDestroyed: ReturnType<Vitest.Mock>;
|
|
536
|
+
/** Mock for emitting ready state events */
|
|
214
537
|
emitReady: ReturnType<Vitest.Mock>;
|
|
215
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Mock factory for client-related events
|
|
541
|
+
* Provides spies for all API client event emission methods
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```typescript
|
|
545
|
+
* const clientFactory: CreateMockClientFactory = {
|
|
546
|
+
* emitRequest: vi.fn(),
|
|
547
|
+
* emitResponse: vi.fn(),
|
|
548
|
+
* emitError: vi.fn(),
|
|
549
|
+
* emitRetry: vi.fn(),
|
|
550
|
+
* emitTimeout: vi.fn(),
|
|
551
|
+
* emitConflict: vi.fn(),
|
|
552
|
+
* emitDebug: vi.fn(),
|
|
553
|
+
* emitCreated: vi.fn(),
|
|
554
|
+
* emitDestroyed: vi.fn()
|
|
555
|
+
* };
|
|
556
|
+
* ```
|
|
557
|
+
*/
|
|
216
558
|
export interface CreateMockClientFactory {
|
|
559
|
+
/** Mock for emitting API request events */
|
|
217
560
|
emitRequest: ReturnType<Vitest.Mock>;
|
|
561
|
+
/** Mock for emitting API response events */
|
|
218
562
|
emitResponse: ReturnType<Vitest.Mock>;
|
|
563
|
+
/** Mock for emitting client error events */
|
|
219
564
|
emitError: ReturnType<Vitest.Mock>;
|
|
565
|
+
/** Mock for emitting retry attempt events */
|
|
220
566
|
emitRetry: ReturnType<Vitest.Mock>;
|
|
567
|
+
/** Mock for emitting timeout events */
|
|
221
568
|
emitTimeout: ReturnType<Vitest.Mock>;
|
|
569
|
+
/** Mock for emitting conflict events */
|
|
222
570
|
emitConflict: ReturnType<Vitest.Mock>;
|
|
571
|
+
/** Mock for emitting debug events */
|
|
223
572
|
emitDebug: ReturnType<Vitest.Mock>;
|
|
573
|
+
/** Mock for emitting client created events */
|
|
224
574
|
emitCreated: ReturnType<Vitest.Mock>;
|
|
575
|
+
/** Mock for emitting client destroyed events */
|
|
225
576
|
emitDestroyed: ReturnType<Vitest.Mock>;
|
|
226
577
|
}
|
|
227
578
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plyaz/types",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.20",
|
|
4
4
|
"author": "Redeemer Pace",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "Provides shared TypeScript types and schema utilities for validation and parsing in the @playz ecosystem.",
|
|
@@ -182,11 +182,11 @@
|
|
|
182
182
|
"@eslint/markdown": "^6.5.0",
|
|
183
183
|
"@nestjs/common": "^11.1.3",
|
|
184
184
|
"@next/eslint-plugin-next": "^15.0.3",
|
|
185
|
-
"@plyaz/config": "^1.5.
|
|
186
|
-
"fetchff": "^4.1.0",
|
|
185
|
+
"@plyaz/config": "^1.5.3",
|
|
187
186
|
"@plyaz/devtools": "^1.9.4",
|
|
188
187
|
"@testing-library/react": "^16.3.0",
|
|
189
188
|
"@testing-library/user-event": "^14.6.1",
|
|
189
|
+
"@types/express": "^5.0.3",
|
|
190
190
|
"@types/node": "^22.14.0",
|
|
191
191
|
"@types/react": "^19.1.8",
|
|
192
192
|
"@types/react-dom": "^19.1.6",
|
|
@@ -221,6 +221,8 @@
|
|
|
221
221
|
"eslint-plugin-testing-library": "^6.5.0",
|
|
222
222
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
223
223
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
224
|
+
"express": "^5.1.0",
|
|
225
|
+
"fetchff": "^4.1.0",
|
|
224
226
|
"jiti": "^2.4.2",
|
|
225
227
|
"jsdom": "^26.1.0",
|
|
226
228
|
"markdownlint": "^0.38.0",
|