|
3 | 3 |
|
4 | 4 | // Converted from https://github.com/Azure/AppConfiguration/blob/main/docs/FeatureManagement/FeatureFlag.v1.1.0.schema.json
|
5 | 5 |
|
6 |
| -/** |
7 |
| - * An ID used to uniquely identify and reference the feature. |
8 |
| - */ |
9 |
| -export type FeatureID = string |
10 |
| -/** |
11 |
| - * A description of the feature. |
12 |
| - */ |
13 |
| -export type FeatureDescription = string |
14 |
| -/** |
15 |
| - * A display name for the feature to use for display rather than the ID. |
16 |
| - */ |
17 |
| -export type FeatureDisplayName = string |
18 |
| -/** |
19 |
| - * A feature is OFF if enabled is false. If enabled is true, then the feature is ON if there are no conditions (null or empty) or if the conditions are satisfied. |
20 |
| - */ |
21 |
| -export type EnabledState = boolean |
22 |
| -/** |
23 |
| - * Determines whether any or all registered client filters must be enabled for the feature to be considered enabled. |
24 |
| - */ |
25 |
| -export enum RequirementType { |
26 |
| - Any = "Any", |
27 |
| - All = "All" |
28 |
| -} |
29 |
| -/** |
30 |
| - * The name used to refer to and require a client filter. |
31 |
| - */ |
32 |
| -export type ClientFilterName = string |
33 |
| -/** |
34 |
| - * Filters that must run on the client and be evaluated as true for the feature to be considered enabled. |
35 |
| - */ |
36 |
| -export type ClientFilterCollection = ClientFilter[] |
37 |
| - |
38 | 6 | export interface FeatureDefinition {
|
39 |
| - id: FeatureID |
40 |
| - description?: FeatureDescription |
41 |
| - display_name?: FeatureDisplayName |
42 |
| - enabled: EnabledState |
| 7 | + /** |
| 8 | + * An ID used to uniquely identify and reference the feature. |
| 9 | + */ |
| 10 | + id: string |
| 11 | + |
| 12 | + /** |
| 13 | + * A description of the feature. |
| 14 | + */ |
| 15 | + description?: string |
| 16 | + |
| 17 | + /** |
| 18 | + * A display name for the feature to use for display rather than the ID. |
| 19 | + */ |
| 20 | + display_name?: string |
| 21 | + |
| 22 | + /** |
| 23 | + * A feature is OFF if enabled is false. If enabled is true, then the feature is ON if there are no conditions (null or empty) or if the conditions are satisfied. |
| 24 | + */ |
| 25 | + enabled: boolean |
| 26 | + |
| 27 | + /** |
| 28 | + * The declaration of conditions used to dynamically enable features. |
| 29 | + */ |
43 | 30 | conditions?: FeatureEnablementConditions
|
44 |
| - [k: string]: unknown |
45 | 31 | }
|
46 |
| -/** |
47 |
| - * The declaration of conditions used to dynamically enable features. |
48 |
| - */ |
| 32 | + |
| 33 | +export enum RequirementType { |
| 34 | + Any = "Any", |
| 35 | + All = "All" |
| 36 | +} |
| 37 | + |
49 | 38 | export interface FeatureEnablementConditions {
|
| 39 | + /** |
| 40 | + * Determines whether any or all registered client filters must be enabled for the feature to be considered enabled. |
| 41 | + */ |
50 | 42 | requirement_type?: RequirementType
|
51 |
| - client_filters?: ClientFilterCollection |
52 |
| - [k: string]: unknown |
| 43 | + |
| 44 | + /** |
| 45 | + * Filters that must run on the client and be evaluated as true for the feature to be considered enabled. |
| 46 | + */ |
| 47 | + client_filters?: ClientFilter[] |
53 | 48 | }
|
| 49 | + |
54 | 50 | export interface ClientFilter {
|
55 |
| - name: ClientFilterName |
56 |
| - parameters?: ClientFilterParameters |
57 |
| - [k: string]: unknown |
58 |
| -} |
59 |
| -/** |
60 |
| - * Custom parameters for a given client filter. A client filter can require any set of parameters of any type. |
61 |
| - */ |
62 |
| -export interface ClientFilterParameters { |
63 | 51 | /**
|
64 |
| - * This interface was referenced by `ClientFilterParameters`'s JSON-Schema definition |
65 |
| - * via the `patternProperty` "^.*$". |
| 52 | + * The name used to refer to and require a client filter. |
| 53 | + */ |
| 54 | + name: string |
| 55 | + /** |
| 56 | + * Custom parameters for a given client filter. A client filter can require any set of parameters of any type. |
66 | 57 | */
|
67 |
| - [k: string]: |
68 |
| - | string |
69 |
| - | null |
70 |
| - | { |
71 |
| - [k: string]: unknown |
72 |
| - } |
73 |
| - | number |
74 |
| - | unknown[] |
75 |
| - | boolean |
| 58 | + parameters?: unknown |
76 | 59 | }
|
77 | 60 |
|
78 |
| -// Feature Management definition |
| 61 | +// Feature Management Section fed into feature manager. |
79 | 62 | export const FEATURE_MANAGEMENT_KEY = "FeatureManagement"
|
80 | 63 | export const FEATURE_FLAGS_KEY = "FeatureFlags"
|
81 | 64 | export interface FeatureManagement {
|
|
0 commit comments