@plyaz/types 1.6.0 → 1.7.1
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/types.d.ts +20 -53
- package/dist/auth/types.d.ts +3 -20
- package/dist/common/types.d.ts +1567 -3
- package/dist/errors/types.d.ts +4 -39
- package/dist/events/payload.d.ts +2 -3
- package/dist/events/types.d.ts +17 -78
- package/dist/features/cache/types.d.ts +7 -23
- package/dist/features/community/blog/providers/wordpress/types.d.ts +2 -3
- package/dist/features/community/blog/types.d.ts +6 -8
- package/dist/features/feature-flag/types.d.ts +37 -156
- package/dist/index.js.map +1 -1
- package/dist/testing/common/assertions/types.d.ts +16 -35
- package/dist/testing/common/factories/types.d.ts +35 -144
- package/dist/testing/common/mocks/types.d.ts +23 -66
- package/dist/testing/common/patterns/types.d.ts +13 -26
- package/dist/testing/common/utils/types.d.ts +174 -285
- package/dist/testing/common/wrappers/types.d.ts +14 -29
- package/dist/testing/features/cache/types.d.ts +6 -6
- package/dist/testing/features/feature-flags/types.d.ts +20 -31
- package/dist/web3/types.d.ts +3 -12
- package/package.json +2 -1
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
* @module TestingPatternTypes
|
|
41
41
|
* @since 1.0.0
|
|
42
42
|
*/
|
|
43
|
+
import type { Promisable } from 'type-fest';
|
|
43
44
|
import type * as Vitest from 'vitest';
|
|
45
|
+
import type { Identifiable, WithDuration, WithMetadata, WithRetryTracking, Clearable, Resettable, Named } from '../../../common/types';
|
|
44
46
|
/**
|
|
45
47
|
* Base operation types for CRUD and custom operations
|
|
46
48
|
*
|
|
@@ -97,11 +99,9 @@ export type OperationType = 'create' | 'update' | 'delete' | 'read' | 'custom';
|
|
|
97
99
|
* };
|
|
98
100
|
* ```
|
|
99
101
|
*/
|
|
100
|
-
export interface Operation<T = unknown> {
|
|
101
|
-
id?: string;
|
|
102
|
+
export interface Operation<T = unknown> extends Partial<Identifiable>, Partial<WithMetadata> {
|
|
102
103
|
type: OperationType;
|
|
103
104
|
data?: T;
|
|
104
|
-
metadata?: Record<string, unknown>;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Result of a single operation execution
|
|
@@ -143,12 +143,10 @@ export interface Operation<T = unknown> {
|
|
|
143
143
|
* }
|
|
144
144
|
* ```
|
|
145
145
|
*/
|
|
146
|
-
export interface OperationResult<T = unknown> {
|
|
147
|
-
id?: string;
|
|
146
|
+
export interface OperationResult<T = unknown> extends Partial<Identifiable>, Partial<WithDuration> {
|
|
148
147
|
success: boolean;
|
|
149
148
|
data?: T;
|
|
150
149
|
error?: Error;
|
|
151
|
-
duration?: number;
|
|
152
150
|
}
|
|
153
151
|
/**
|
|
154
152
|
* Result of batch operation processing
|
|
@@ -242,11 +240,9 @@ export interface BatchOperationResult<T = unknown> {
|
|
|
242
240
|
* };
|
|
243
241
|
* ```
|
|
244
242
|
*/
|
|
245
|
-
export interface BatchProcessorOptions {
|
|
243
|
+
export interface BatchProcessorOptions extends Partial<WithRetryTracking> {
|
|
246
244
|
batchSize?: number;
|
|
247
245
|
concurrency?: number;
|
|
248
|
-
retryCount?: number;
|
|
249
|
-
retryDelay?: number;
|
|
250
246
|
continueOnError?: boolean;
|
|
251
247
|
timeout?: number;
|
|
252
248
|
onProgress?: (progress: {
|
|
@@ -389,27 +385,25 @@ export interface CreateBatchTestHelperReturn<T> {
|
|
|
389
385
|
* mockHandler.clear();
|
|
390
386
|
* ```
|
|
391
387
|
*/
|
|
392
|
-
export interface CreateMockBatchHandlerReturn<T> {
|
|
388
|
+
export interface CreateMockBatchHandlerReturn<T> extends Clearable {
|
|
393
389
|
handler: Vitest.Mock<(operation: Operation<T>) => Promise<T>>;
|
|
394
390
|
getProcessedOperations: () => Operation<T>[];
|
|
395
391
|
getResults: () => Map<string, T>;
|
|
396
|
-
clear: () => void;
|
|
397
392
|
}
|
|
398
393
|
/**
|
|
399
394
|
* Options for createTableDrivenTest
|
|
400
395
|
*/
|
|
401
|
-
export interface CreateTableDrivenTestOptions<TInput, TExpected> {
|
|
402
|
-
name: string;
|
|
396
|
+
export interface CreateTableDrivenTestOptions<TInput, TExpected> extends Named {
|
|
403
397
|
cases: Array<TInput & {
|
|
404
398
|
name: string;
|
|
405
399
|
expected?: TExpected;
|
|
406
400
|
}>;
|
|
407
401
|
test?: (testCase: TInput & {
|
|
408
402
|
expected?: TExpected;
|
|
409
|
-
}) =>
|
|
403
|
+
}) => Promisable<void>;
|
|
410
404
|
fn?: (testCase: TInput & {
|
|
411
405
|
expected?: TExpected;
|
|
412
|
-
}) =>
|
|
406
|
+
}) => Promisable<void>;
|
|
413
407
|
}
|
|
414
408
|
/**
|
|
415
409
|
* Statistics collected for operation performance tracking.
|
|
@@ -472,21 +466,18 @@ export interface OperationStats {
|
|
|
472
466
|
*
|
|
473
467
|
* @public
|
|
474
468
|
*/
|
|
475
|
-
export interface OperationTracker {
|
|
469
|
+
export interface OperationTracker extends Resettable {
|
|
476
470
|
/** Track execution of a named operation */
|
|
477
471
|
track: <T>(operationName: string, operation: () => Promise<T>) => Promise<T>;
|
|
478
472
|
/** Get statistics for all tracked operations */
|
|
479
473
|
getStats: () => Record<string, OperationStats>;
|
|
480
|
-
/** Reset all tracking data */
|
|
481
|
-
reset: () => void;
|
|
482
474
|
}
|
|
483
475
|
/**
|
|
484
476
|
* Test operation for stress testing
|
|
485
477
|
*
|
|
486
478
|
* @public
|
|
487
479
|
*/
|
|
488
|
-
export interface TestOperation {
|
|
489
|
-
name: string;
|
|
480
|
+
export interface TestOperation extends Named {
|
|
490
481
|
operation: () => unknown | Promise<unknown>;
|
|
491
482
|
weight?: number;
|
|
492
483
|
}
|
|
@@ -595,15 +586,11 @@ export interface StressTestConfig {
|
|
|
595
586
|
* };
|
|
596
587
|
* ```
|
|
597
588
|
*/
|
|
598
|
-
export interface ProcessWithRetryParams<T> {
|
|
589
|
+
export interface ProcessWithRetryParams<T = unknown> extends WithRetryTracking {
|
|
599
590
|
/** Operation to process */
|
|
600
591
|
operation: Operation<T>;
|
|
601
592
|
/** Function to process the operation */
|
|
602
|
-
processFn: (operation: Operation<T>) =>
|
|
603
|
-
/** Number of retry attempts */
|
|
604
|
-
retryCount: number;
|
|
605
|
-
/** Delay between retries in milliseconds */
|
|
606
|
-
retryDelay: number;
|
|
593
|
+
processFn: (operation: Operation<T>) => Promisable<T>;
|
|
607
594
|
/** Operation timeout in milliseconds */
|
|
608
595
|
timeout: number;
|
|
609
596
|
}
|