@plyaz/types 1.7.1 → 1.7.3

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.
@@ -18,7 +18,7 @@ export type FeatureFlagValue = boolean | string | number | UnknownRecord;
18
18
  * Core feature flag definition interface.
19
19
  * Represents a complete feature flag with all its metadata and configuration.
20
20
  */
21
- export interface FeatureFlag<FeatureFlagKey extends string> extends Describable, Timestamped, WithMetadata, Authored, Named, WithTags, WithEnvironment, Enabled, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
21
+ export interface FeatureFlag<FeatureFlagKey extends string> extends Describable, Timestamped, SetOptional<WithMetadata, 'metadata'>, Authored, Named, SetOptional<WithTags, 'tags'>, WithEnvironment, Enabled, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
22
22
  /** The data type of the flag value */
23
23
  type: FlagType;
24
24
  /** Percentage of users who should receive this flag (0-100) */
@@ -27,7 +27,7 @@ export interface FeatureFlag<FeatureFlagKey extends string> extends Describable,
27
27
  /**
28
28
  * Feature flag rule for advanced targeting and conditional logic.
29
29
  */
30
- export interface FeatureFlagRule<FeatureFlagKey extends string> extends Identifiable, Named, WithPriority<number>, WithMetadata, Enabled {
30
+ export interface FeatureFlagRule<FeatureFlagKey extends string> extends Identifiable, Named, WithPriority<number>, SetOptional<WithMetadata, 'metadata'>, Enabled {
31
31
  /** The feature flag this rule applies to */
32
32
  flagKey: FeatureFlagKey;
33
33
  /** Array of conditions that must all be met for this rule to apply */
@@ -51,7 +51,7 @@ export interface FeatureFlagCondition {
51
51
  /**
52
52
  * Context information used for feature flag evaluation.
53
53
  */
54
- export interface FeatureFlagContext extends SetOptional<WithUserId, 'userId'>, WithCountry, Versioned, WithEnvironment, WithPlatform {
54
+ export interface FeatureFlagContext extends SetOptional<WithUserId, 'userId'>, SetOptional<WithCountry, 'country'>, SetOptional<Versioned, 'version'>, WithEnvironment, SetOptional<WithPlatform, 'platform'> {
55
55
  /** User's email address */
56
56
  userEmail?: string;
57
57
  /** User's role or permission level */
@@ -79,7 +79,7 @@ export interface FeatureFlagEvaluation<FeatureFlagKey extends string> extends En
79
79
  /**
80
80
  * Configuration options for the feature flag system.
81
81
  */
82
- export interface FeatureFlagConfig<FeatureFlagKey extends string> extends SetOptional<WithLogging, 'isLoggingEnabled'>, WithApiKey {
82
+ export interface FeatureFlagConfig<FeatureFlagKey extends string> extends SetOptional<WithLogging, 'isLoggingEnabled'>, SetOptional<WithApiKey, 'apiKey'> {
83
83
  /** The storage provider to use for flag data */
84
84
  provider: 'database' | 'redis' | 'memory' | 'api' | 'file';
85
85
  /** Whether to enable caching of flag evaluations */
@@ -172,7 +172,7 @@ export interface FeatureFlagProviderProps<FeatureFlagKey extends string, Feature
172
172
  /**
173
173
  * Backend Request DTO for flag creation.
174
174
  */
175
- export interface CreateFlagRequest<FeatureFlagKey extends string> extends WithEnvironment, SetOptional<Enabled, 'isEnabled'>, SetOptional<Describable, 'description'>, Named, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
175
+ export interface CreateFlagRequest<FeatureFlagKey extends string> extends Partial<WithEnvironment>, SetOptional<Enabled, 'isEnabled'>, SetOptional<Describable, 'description'>, Named, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
176
176
  rolloutPercentage?: number;
177
177
  }
178
178
  /**
@@ -227,6 +227,8 @@ export interface ProviderStats {
227
227
  avgEvaluationTime: number;
228
228
  /** Last refresh timestamp */
229
229
  lastRefresh?: Date;
230
+ /** Last updated timestamp */
231
+ lastUpdated?: Date;
230
232
  /** Provider uptime in ms */
231
233
  uptime: number;
232
234
  }
@@ -303,7 +305,7 @@ export interface FlagEvaluationTestInput<FeatureFlagKey extends string> extends
303
305
  /**
304
306
  * Input for flag creation test cases
305
307
  */
306
- export interface FlagCreationTestInput<FeatureFlagKey extends string> extends WithEnvironment, Enabled, Describable, Named, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
308
+ export interface FlagCreationTestInput<FeatureFlagKey extends string> extends Partial<WithEnvironment>, Enabled, Describable, Named, KeyValuePair<FeatureFlagKey, FeatureFlagValue> {
307
309
  /** Rollout percentage (0-100) */
308
310
  rolloutPercentage?: number;
309
311
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Type definitions for assertion utilities.
5
5
  */
6
- import type { UnknownRecord, UnknownArray, Promisable } from 'type-fest';
6
+ import type { UnknownRecord, UnknownArray, SetOptional } from 'type-fest';
7
7
  import type { WithStatusCode, WithMessage, WithTimestamp, WithCorrelationId, WithMetadata, Named, WithRequestId, WithStatus } from '../../../common/types';
8
8
  /**
9
9
  * Pattern for matching HTTP errors with status code and message.
@@ -17,7 +17,7 @@ import type { WithStatusCode, WithMessage, WithTimestamp, WithCorrelationId, Wit
17
17
  * };
18
18
  * ```
19
19
  */
20
- export interface ErrorPattern extends WithStatusCode, WithStatus {
20
+ export interface ErrorPattern extends SetOptional<WithStatusCode, 'statusCode'>, WithStatus<string | number> {
21
21
  /** Regular expression to match against error message */
22
22
  message: RegExp;
23
23
  }
@@ -33,7 +33,7 @@ export interface ErrorPattern extends WithStatusCode, WithStatus {
33
33
  * };
34
34
  * ```
35
35
  */
36
- export interface ValidationErrorPattern extends WithStatusCode {
36
+ export interface ValidationErrorPattern extends SetOptional<WithStatusCode, 'statusCode'>, WithStatus<string | number> {
37
37
  /** Array of field names that failed validation */
38
38
  validation: string[];
39
39
  }
@@ -203,7 +203,7 @@ export interface ErrorPropagationTestResult<T> {
203
203
  */
204
204
  export interface ErrorCircuitBreaker<T> {
205
205
  /** Execute function with circuit breaker protection */
206
- execute: (fn: () => Promisable<T>) => Promisable<T>;
206
+ execute: (fn: () => T | Promise<T>) => T | Promise<T>;
207
207
  /** Get current circuit state */
208
208
  getState: () => 'closed' | 'open' | 'half-open';
209
209
  /** Get error statistics */
@@ -623,7 +623,7 @@ export interface ScenarioResult<T> {
623
623
  * };
624
624
  * ```
625
625
  */
626
- export interface TrackedCallRecord<TArgs extends unknown[], TReturn, TTimestamp = Date> extends Omit<Tracked<TReturn>, 'timestamp'>, WithDuration, WithTimestamp<TTimestamp> {
626
+ export interface TrackedCallRecord<TArgs extends unknown[], TReturn, TTimestamp = Date> extends Omit<Tracked<TReturn | undefined>, 'timestamp'>, WithDuration, WithTimestamp<TTimestamp> {
627
627
  /** Function arguments */
628
628
  args: TArgs;
629
629
  }
@@ -465,7 +465,7 @@ export type HttpExceptionError = Error & WithStatus<number> & {
465
465
  * };
466
466
  * ```
467
467
  */
468
- export type SimpleExceptionError = Error & WithStatus & {
468
+ export type SimpleExceptionError = Error & WithStatus<number> & {
469
469
  /** Error response data */
470
470
  response: unknown;
471
471
  };
@@ -400,10 +400,10 @@ export interface CreateTableDrivenTestOptions<TInput, TExpected> extends Named {
400
400
  }>;
401
401
  test?: (testCase: TInput & {
402
402
  expected?: TExpected;
403
- }) => Promisable<void>;
403
+ }) => void | Promise<void>;
404
404
  fn?: (testCase: TInput & {
405
405
  expected?: TExpected;
406
- }) => Promisable<void>;
406
+ }) => void | Promise<void>;
407
407
  }
408
408
  /**
409
409
  * Statistics collected for operation performance tracking.
@@ -2135,7 +2135,7 @@ export interface ModuleLifecycleTest extends Named {
2135
2135
  */
2136
2136
  export interface ApplicationLifecycleTest extends Named {
2137
2137
  app: UnknownRecord;
2138
- modules: UnknownArray;
2138
+ modules: unknown[];
2139
2139
  expectedStartupSequence: string[];
2140
2140
  expectedShutdownSequence: string[];
2141
2141
  }
@@ -2855,6 +2855,8 @@ export interface ApiRouteHandlerMethods {
2855
2855
  PUT?: Function;
2856
2856
  DELETE?: Function;
2857
2857
  PATCH?: Function;
2858
+ HEAD?: Function;
2859
+ OPTIONS?: Function;
2858
2860
  }
2859
2861
  /**
2860
2862
  * Test scenario for route handlers.
@@ -3653,7 +3655,7 @@ export interface SecretsManagementTest extends Named {
3653
3655
  }
3654
3656
  export interface SecretsManager extends KeyValueStore<string, string> {
3655
3657
  }
3656
- export interface MockEnvironment extends Exclude<KeyValueStore<string, string>, 'delete' | 'has'> {
3658
+ export interface MockEnvironment extends Omit<KeyValueStore<string, string>, 'delete' | 'has'> {
3657
3659
  update: (updates: EnvironmentConfig) => void;
3658
3660
  unset: (key: string) => void;
3659
3661
  restore: () => void;
@@ -4418,9 +4420,9 @@ export interface DynamicModuleClass {
4418
4420
  * ```
4419
4421
  */
4420
4422
  export interface DynamicModuleExpectations {
4421
- providers?: UnknownArray;
4422
- imports?: UnknownArray;
4423
- exports?: UnknownArray;
4423
+ providers?: unknown[];
4424
+ imports?: unknown[];
4425
+ exports?: unknown[];
4424
4426
  }
4425
4427
  /**
4426
4428
  * Return value from NestJS test suite setup.
@@ -4584,7 +4586,7 @@ export interface UserFlowStep extends Named {
4584
4586
  export interface MockNextRequestCreatorParams {
4585
4587
  url: string;
4586
4588
  options?: {
4587
- method?: string;
4589
+ method?: HttpMethod;
4588
4590
  headers?: Record<string, string>;
4589
4591
  body?: unknown;
4590
4592
  searchParams?: Record<string, string>;
@@ -1255,6 +1255,8 @@ export interface TestFeatureFlagContextValue<FeatureFlagKey extends string> {
1255
1255
  lastUpdated: Date;
1256
1256
  /** Force refresh flags */
1257
1257
  refresh: () => Promise<void>;
1258
+ /** Callback when provider is ready */
1259
+ onReady: () => void;
1258
1260
  }
1259
1261
  /**
1260
1262
  * Options for waiting for flag value changes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plyaz/types",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
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.",