@plyaz/types 1.4.1 → 1.5.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.
@@ -732,3 +732,34 @@ export interface RepositoryOperationTestInput {
732
732
  /** Whether operation should throw an error */
733
733
  shouldThrow?: boolean;
734
734
  }
735
+ /**
736
+ * Flag defaults interface
737
+ * @interface FlagDefaults
738
+ */
739
+ export interface FlagDefaults {
740
+ /** Flag name */
741
+ name: string;
742
+ /** Flag description */
743
+ description: string;
744
+ /** Whether flag is enabled */
745
+ isEnabled: boolean;
746
+ /** Default value */
747
+ value: FeatureFlagValue;
748
+ /** Flag type */
749
+ type: FlagType;
750
+ /** Environment */
751
+ environment: 'development' | 'staging' | 'production' | 'all';
752
+ /** Created date */
753
+ createdAt: Date;
754
+ /** Updated date */
755
+ updatedAt: Date;
756
+ /** Created by */
757
+ createdBy: string;
758
+ /** Updated by */
759
+ updatedBy: string;
760
+ }
761
+ /**
762
+ * Feature flag value type
763
+ * @type FlagType
764
+ */
765
+ export type FlagType = 'boolean' | 'string' | 'number' | 'json';
@@ -344,49 +344,49 @@ export interface ScenarioTestSuite<TContext, TInput, TExpected> {
344
344
  */
345
345
  export interface AutoMockedRepository {
346
346
  /** Find entities matching criteria */
347
- find: Vitest.Mock;
347
+ find: Vitest.MockInstance;
348
348
  /** Find single entity */
349
- findOne: Vitest.Mock;
349
+ findOne: Vitest.MockInstance;
350
350
  /** Find single entity by criteria */
351
- findOneBy: Vitest.Mock;
351
+ findOneBy: Vitest.MockInstance;
352
352
  /** Find single entity or throw */
353
- findOneOrFail: Vitest.Mock;
353
+ findOneOrFail: Vitest.MockInstance;
354
354
  /** Find entities by criteria */
355
- findBy: Vitest.Mock;
355
+ findBy: Vitest.MockInstance;
356
356
  /** Find entities and get count */
357
- findAndCount: Vitest.Mock;
357
+ findAndCount: Vitest.MockInstance;
358
358
  /** Save entity */
359
- save: Vitest.Mock;
359
+ save: Vitest.MockInstance;
360
360
  /** Create entity instance */
361
- create: Vitest.Mock;
361
+ create: Vitest.MockInstance;
362
362
  /** Update entity */
363
- update: Vitest.Mock;
363
+ update: Vitest.MockInstance;
364
364
  /** Delete entity */
365
- delete: Vitest.Mock;
365
+ delete: Vitest.MockInstance;
366
366
  /** Remove entity */
367
- remove: Vitest.Mock;
367
+ remove: Vitest.MockInstance;
368
368
  /** Count entities */
369
- count: Vitest.Mock;
369
+ count: Vitest.MockInstance;
370
370
  /** Execute raw query */
371
- query: Vitest.Mock;
371
+ query: Vitest.MockInstance;
372
372
  /** Create query builder */
373
- createQueryBuilder: Vitest.Mock;
373
+ createQueryBuilder: Vitest.MockInstance;
374
374
  /** Preload entity with relations */
375
- preload: Vitest.Mock;
375
+ preload: Vitest.MockInstance;
376
376
  /** Merge entity changes */
377
- merge: Vitest.Mock;
377
+ merge: Vitest.MockInstance;
378
378
  /** Soft delete entity */
379
- softDelete: Vitest.Mock;
379
+ softDelete: Vitest.MockInstance;
380
380
  /** Restore soft deleted entity */
381
- restore: Vitest.Mock;
381
+ restore: Vitest.MockInstance;
382
382
  /** Check if entity exists */
383
- exist: Vitest.Mock;
383
+ exist: Vitest.MockInstance;
384
384
  /** Clear all entities */
385
- clear: Vitest.Mock;
385
+ clear: Vitest.MockInstance;
386
386
  /** Increment field value */
387
- increment: Vitest.Mock;
387
+ increment: Vitest.MockInstance;
388
388
  /** Decrement field value */
389
- decrement: Vitest.Mock;
389
+ decrement: Vitest.MockInstance;
390
390
  }
391
391
  /**
392
392
  * Auto-mocked HTTP service interface for HTTP client testing
@@ -407,21 +407,21 @@ export interface AutoMockedRepository {
407
407
  */
408
408
  export interface AutoMockedHttpService {
409
409
  /** HTTP GET request */
410
- get: Vitest.Mock;
410
+ get: Vitest.MockInstance;
411
411
  /** HTTP POST request */
412
- post: Vitest.Mock;
412
+ post: Vitest.MockInstance;
413
413
  /** HTTP PUT request */
414
- put: Vitest.Mock;
414
+ put: Vitest.MockInstance;
415
415
  /** HTTP PATCH request */
416
- patch: Vitest.Mock;
416
+ patch: Vitest.MockInstance;
417
417
  /** HTTP DELETE request */
418
- delete: Vitest.Mock;
418
+ delete: Vitest.MockInstance;
419
419
  /** HTTP HEAD request */
420
- head: Vitest.Mock;
420
+ head: Vitest.MockInstance;
421
421
  /** HTTP OPTIONS request */
422
- options: Vitest.Mock;
422
+ options: Vitest.MockInstance;
423
423
  /** Generic HTTP request */
424
- request: Vitest.Mock;
424
+ request: Vitest.MockInstance;
425
425
  }
426
426
  /**
427
427
  * Auto-mocked configuration service interface for config testing
@@ -442,13 +442,13 @@ export interface AutoMockedHttpService {
442
442
  */
443
443
  export interface AutoMockedConfigService {
444
444
  /** Get configuration value */
445
- get: Vitest.Mock;
445
+ get: Vitest.MockInstance;
446
446
  /** Get configuration value or throw */
447
- getOrThrow: Vitest.Mock;
447
+ getOrThrow: Vitest.MockInstance;
448
448
  /** Check if configuration key exists */
449
- has: Vitest.Mock;
449
+ has: Vitest.MockInstance;
450
450
  /** Set configuration value */
451
- set: Vitest.Mock;
451
+ set: Vitest.MockInstance;
452
452
  }
453
453
  /**
454
454
  * Database update operation result
@@ -699,3 +699,47 @@ export interface ScenarioResult<T> {
699
699
  /** Execution duration in milliseconds */
700
700
  duration: number;
701
701
  }
702
+ /**
703
+ * Tracked call record for mock functions
704
+ * @interface TrackedCallRecord
705
+ * @typeParam TArgs - Function argument types
706
+ * @typeParam TReturn - Function return type
707
+ */
708
+ export interface TrackedCallRecord<TArgs extends unknown[], TReturn> {
709
+ /** Function arguments */
710
+ args: TArgs;
711
+ /** Call timestamp */
712
+ timestamp: Date;
713
+ /** Return value */
714
+ result?: TReturn;
715
+ /** Error if thrown */
716
+ error?: Error;
717
+ /** Call duration */
718
+ duration?: number;
719
+ }
720
+ /**
721
+ * Tracked mock function with enhanced capabilities
722
+ * @interface TrackedMockFunction
723
+ * @typeParam TArgs - Function argument types
724
+ * @typeParam TReturn - Function return type
725
+ * @extends Vitest.MockInstance from vitest
726
+ */
727
+ export interface TrackedMockFunction<TArgs extends unknown[], TReturn> extends Vitest.MockInstance<(...args: TArgs) => TReturn> {
728
+ /** All call records */
729
+ calls: Array<TrackedCallRecord<TArgs, TReturn>>;
730
+ /** Get specific call */
731
+ getCall: (index: number) => TrackedCallRecord<TArgs, TReturn> | undefined;
732
+ /** Find calls matching predicate */
733
+ findCalls: (predicate: (call: {
734
+ args: TArgs;
735
+ timestamp: Date;
736
+ }) => boolean) => Array<TrackedCallRecord<TArgs, TReturn>>;
737
+ /** Get call count */
738
+ getCallCount: () => number;
739
+ /** Get total execution time */
740
+ getTotalExecutionTime: () => number;
741
+ /** Get average execution time */
742
+ getAverageExecutionTime: () => number;
743
+ /** Clear tracking history */
744
+ clearTracking: () => void;
745
+ }