@plyaz/types 1.7.1 → 1.7.2

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.
@@ -253,7 +253,7 @@ export interface Describable extends Named {
253
253
  * }
254
254
  * ```
255
255
  */
256
- export interface WithMetadata<T = UnknownRecord> {
256
+ export interface WithMetadata<T = UnknownRecord | undefined> {
257
257
  /** Metadata for additional information */
258
258
  metadata: T;
259
259
  }
@@ -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 */
@@ -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 WithStatusCode, 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 WithStatusCode, WithStatus<string | number> {
37
37
  /** Array of field names that failed validation */
38
38
  validation: string[];
39
39
  }
@@ -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
  };
@@ -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.2",
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.",