@plyaz/types 1.2.0 → 1.2.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.
|
@@ -17,7 +17,7 @@ export type FeatureFlagValue = boolean | string | number | Record<string, unknow
|
|
|
17
17
|
* Core feature flag definition interface.
|
|
18
18
|
* Represents a complete feature flag with all its metadata and configuration.
|
|
19
19
|
*/
|
|
20
|
-
export interface FeatureFlag<FeatureFlagKey> {
|
|
20
|
+
export interface FeatureFlag<FeatureFlagKey extends string> {
|
|
21
21
|
/** The unique identifier for this flag */
|
|
22
22
|
key: FeatureFlagKey;
|
|
23
23
|
/** Human-readable name for the flag */
|
|
@@ -46,7 +46,7 @@ export interface FeatureFlag<FeatureFlagKey> {
|
|
|
46
46
|
/**
|
|
47
47
|
* Feature flag rule for advanced targeting and conditional logic.
|
|
48
48
|
*/
|
|
49
|
-
export interface FeatureFlagRule<FeatureFlagKey> {
|
|
49
|
+
export interface FeatureFlagRule<FeatureFlagKey extends string> {
|
|
50
50
|
/** Unique identifier for this rule */
|
|
51
51
|
id: string;
|
|
52
52
|
/** The feature flag this rule applies to */
|
|
@@ -99,7 +99,7 @@ export interface FeatureFlagContext {
|
|
|
99
99
|
/**
|
|
100
100
|
* Result of a feature flag evaluation.
|
|
101
101
|
*/
|
|
102
|
-
export interface FeatureFlagEvaluation<FeatureFlagKey> {
|
|
102
|
+
export interface FeatureFlagEvaluation<FeatureFlagKey extends string> {
|
|
103
103
|
/** The feature flag key that was evaluated */
|
|
104
104
|
flagKey: FeatureFlagKey;
|
|
105
105
|
/** The resolved value for this flag */
|
|
@@ -118,7 +118,7 @@ export interface FeatureFlagEvaluation<FeatureFlagKey> {
|
|
|
118
118
|
/**
|
|
119
119
|
* Configuration options for the feature flag system.
|
|
120
120
|
*/
|
|
121
|
-
export interface FeatureFlagConfig<FeatureFlagKey> {
|
|
121
|
+
export interface FeatureFlagConfig<FeatureFlagKey extends string> {
|
|
122
122
|
/** The storage provider to use for flag data */
|
|
123
123
|
provider: 'database' | 'redis' | 'memory' | 'api' | 'file';
|
|
124
124
|
/** Whether to enable caching of flag evaluations */
|
|
@@ -170,7 +170,7 @@ export interface UseFeatureFlagOptions {
|
|
|
170
170
|
/**
|
|
171
171
|
* Internal state for feature flag evaluation in React hooks.
|
|
172
172
|
*/
|
|
173
|
-
export interface FeatureFlagState<FeatureFlagKey, T extends FeatureFlagValue = FeatureFlagValue> {
|
|
173
|
+
export interface FeatureFlagState<FeatureFlagKey extends string, T extends FeatureFlagValue = FeatureFlagValue> {
|
|
174
174
|
value: T;
|
|
175
175
|
isLoading: boolean;
|
|
176
176
|
error: Error | null;
|
|
@@ -179,7 +179,7 @@ export interface FeatureFlagState<FeatureFlagKey, T extends FeatureFlagValue = F
|
|
|
179
179
|
/**
|
|
180
180
|
* Context value interface for React feature flag provider.
|
|
181
181
|
*/
|
|
182
|
-
export interface FeatureFlagContextValue<FeatureFlagKey> {
|
|
182
|
+
export interface FeatureFlagContextValue<FeatureFlagKey extends string> {
|
|
183
183
|
/** The feature flag provider instance */
|
|
184
184
|
provider: FeatureFlagProvider<FeatureFlagKey>;
|
|
185
185
|
/** Whether the provider is initialized */
|
|
@@ -196,7 +196,7 @@ export interface FeatureFlagContextValue<FeatureFlagKey> {
|
|
|
196
196
|
/**
|
|
197
197
|
* Props for the React FeatureFlagProvider component.
|
|
198
198
|
*/
|
|
199
|
-
export interface FeatureFlagProviderProps<FeatureFlagKey> {
|
|
199
|
+
export interface FeatureFlagProviderProps<FeatureFlagKey extends string> {
|
|
200
200
|
/** Provider configuration */
|
|
201
201
|
config: FeatureFlagConfig<FeatureFlagKey>;
|
|
202
202
|
/** Default context for flag evaluation */
|
|
@@ -220,7 +220,7 @@ export interface FeatureFlagProviderProps<FeatureFlagKey> {
|
|
|
220
220
|
/**
|
|
221
221
|
* Backend Request DTO for flag creation.
|
|
222
222
|
*/
|
|
223
|
-
export interface CreateFlagRequest<FeatureFlagKey> {
|
|
223
|
+
export interface CreateFlagRequest<FeatureFlagKey extends string> {
|
|
224
224
|
key: FeatureFlagKey;
|
|
225
225
|
name: string;
|
|
226
226
|
description?: string;
|
|
@@ -240,7 +240,7 @@ export interface ProviderHealthStatus {
|
|
|
240
240
|
/**
|
|
241
241
|
* Main interface for feature flag providers.
|
|
242
242
|
*/
|
|
243
|
-
export interface FeatureFlagProvider<FeatureFlagKey> {
|
|
243
|
+
export interface FeatureFlagProvider<FeatureFlagKey extends string> {
|
|
244
244
|
/** Initializes the provider by loading initial data */
|
|
245
245
|
initialize(): Promise<void>;
|
|
246
246
|
/** Evaluates a feature flag and returns full evaluation details */
|
|
@@ -296,7 +296,7 @@ export interface FeatureFlagHelpers<FeatureFlagKey extends string = string> {
|
|
|
296
296
|
isAllEnabled: (keys: FeatureFlagKey[], context?: FeatureFlagContext) => Promise<boolean>;
|
|
297
297
|
whenEnabled: <T>(key: FeatureFlagKey, callback: () => T | Promise<T>, fallback?: () => T | Promise<T>, context?: FeatureFlagContext) => Promise<T | undefined>;
|
|
298
298
|
}
|
|
299
|
-
export interface FetchFeatureFlagDataResponse<FeatureFlagKey> {
|
|
299
|
+
export interface FetchFeatureFlagDataResponse<FeatureFlagKey extends string> {
|
|
300
300
|
flags: FeatureFlag<FeatureFlagKey>[];
|
|
301
301
|
rules: FeatureFlagRule<FeatureFlagKey>[];
|
|
302
302
|
}
|
|
@@ -314,7 +314,7 @@ export interface ErrorHandlingTestInput {
|
|
|
314
314
|
/**
|
|
315
315
|
* Input for flag evaluation test cases
|
|
316
316
|
*/
|
|
317
|
-
export interface FlagEvaluationTestInput<FeatureFlagKey> {
|
|
317
|
+
export interface FlagEvaluationTestInput<FeatureFlagKey extends string> {
|
|
318
318
|
/** The flag key to evaluate */
|
|
319
319
|
flagKey: FeatureFlagKey;
|
|
320
320
|
/** Optional evaluation context */
|
|
@@ -327,7 +327,7 @@ export interface FlagEvaluationTestInput<FeatureFlagKey> {
|
|
|
327
327
|
/**
|
|
328
328
|
* Input for flag creation test cases
|
|
329
329
|
*/
|
|
330
|
-
export interface FlagCreationTestInput<FeatureFlagKey> {
|
|
330
|
+
export interface FlagCreationTestInput<FeatureFlagKey extends string> {
|
|
331
331
|
/** Unique key for the flag */
|
|
332
332
|
key: FeatureFlagKey;
|
|
333
333
|
/** Human-readable name */
|
|
@@ -346,7 +346,7 @@ export interface FlagCreationTestInput<FeatureFlagKey> {
|
|
|
346
346
|
/**
|
|
347
347
|
* Input for flag update test cases
|
|
348
348
|
*/
|
|
349
|
-
export interface FlagUpdateTestInput<FeatureFlagKey> {
|
|
349
|
+
export interface FlagUpdateTestInput<FeatureFlagKey extends string> {
|
|
350
350
|
/** Key of the flag to update */
|
|
351
351
|
flagKey: FeatureFlagKey;
|
|
352
352
|
/** Update data object */
|
|
@@ -355,7 +355,7 @@ export interface FlagUpdateTestInput<FeatureFlagKey> {
|
|
|
355
355
|
/**
|
|
356
356
|
* Input for override test cases
|
|
357
357
|
*/
|
|
358
|
-
export interface OverrideTestInput<FeatureFlagKey> {
|
|
358
|
+
export interface OverrideTestInput<FeatureFlagKey extends string> {
|
|
359
359
|
/** Flag key to override */
|
|
360
360
|
flagKey: FeatureFlagKey;
|
|
361
361
|
/** Override value */
|
|
@@ -386,7 +386,7 @@ export interface ServiceInitializationTestInput {
|
|
|
386
386
|
/**
|
|
387
387
|
* Input for flag operation error test cases
|
|
388
388
|
*/
|
|
389
|
-
export interface FlagOperationErrorTestInput<FeatureFlagKey> {
|
|
389
|
+
export interface FlagOperationErrorTestInput<FeatureFlagKey extends string> {
|
|
390
390
|
/** Flag key involved in the operation */
|
|
391
391
|
flagKey: FeatureFlagKey;
|
|
392
392
|
/** Error that occurred */
|
|
@@ -428,7 +428,7 @@ export interface ModuleConfigurationTestInput {
|
|
|
428
428
|
export interface ProviderTypeTestInput {
|
|
429
429
|
provider: string;
|
|
430
430
|
}
|
|
431
|
-
export interface FlagOperationTestInput<FeatureFlagKey> {
|
|
431
|
+
export interface FlagOperationTestInput<FeatureFlagKey extends string> {
|
|
432
432
|
operation: 'create' | 'update' | 'delete' | 'evaluate';
|
|
433
433
|
flagKey: FeatureFlagKey;
|
|
434
434
|
data?: unknown;
|
|
@@ -441,12 +441,12 @@ export interface PermissionTestInput {
|
|
|
441
441
|
resource: string;
|
|
442
442
|
expected: boolean;
|
|
443
443
|
}
|
|
444
|
-
export interface CacheOperationTestInput<FeatureFlagKey> {
|
|
444
|
+
export interface CacheOperationTestInput<FeatureFlagKey extends string> {
|
|
445
445
|
operation: 'set' | 'get' | 'refresh' | 'clear';
|
|
446
446
|
flagKey?: FeatureFlagKey;
|
|
447
447
|
expectedBehavior: string;
|
|
448
448
|
}
|
|
449
|
-
export interface RuleEvaluationTestInput<FeatureFlagKey> {
|
|
449
|
+
export interface RuleEvaluationTestInput<FeatureFlagKey extends string> {
|
|
450
450
|
flagKey: FeatureFlagKey;
|
|
451
451
|
rules: Array<{
|
|
452
452
|
conditions: Record<string, unknown>;
|
|
@@ -455,7 +455,7 @@ export interface RuleEvaluationTestInput<FeatureFlagKey> {
|
|
|
455
455
|
context: FeatureFlagContext;
|
|
456
456
|
expectedValue: FeatureFlagValue;
|
|
457
457
|
}
|
|
458
|
-
export interface BatchOperationTestInput<FeatureFlagKey> {
|
|
458
|
+
export interface BatchOperationTestInput<FeatureFlagKey extends string> {
|
|
459
459
|
operations: Array<{
|
|
460
460
|
type: 'create' | 'update' | 'delete';
|
|
461
461
|
flagKey: FeatureFlagKey;
|
package/package.json
CHANGED