UNPKG

4.81 kBTypeScriptView Raw
1/**
2 * A feature that can be enabled or disabled
3 */
4export interface ContributedFeature {
5 /**
6 * Named links describing the feature
7 */
8 _links?: any;
9 /**
10 * If true, the feature is enabled unless overridden at some scope
11 */
12 defaultState?: boolean;
13 /**
14 * Rules for setting the default value if not specified by any setting/scope. Evaluated in order until a rule returns an Enabled or Disabled state (not Undefined)
15 */
16 defaultValueRules?: ContributedFeatureValueRule[];
17 /**
18 * The description of the feature
19 */
20 description?: string;
21 /**
22 * Extra properties for the feature
23 */
24 featureProperties?: {
25 [key: string]: any;
26 };
27 /**
28 * Handler for listening to setter calls on feature value. These listeners are only invoked after a successful set has occurred
29 */
30 featureStateChangedListeners?: ContributedFeatureListener[];
31 /**
32 * The full contribution id of the feature
33 */
34 id?: string;
35 /**
36 * If this is set to true, then the id for this feature will be added to the list of claims for the request.
37 */
38 includeAsClaim?: boolean;
39 /**
40 * The friendly name of the feature
41 */
42 name?: string;
43 /**
44 * Suggested order to display feature in.
45 */
46 order?: number;
47 /**
48 * Rules for overriding a feature value. These rules are run before explicit user/host state values are checked. They are evaluated in order until a rule returns an Enabled or Disabled state (not Undefined)
49 */
50 overrideRules?: ContributedFeatureValueRule[];
51 /**
52 * The scopes/levels at which settings can set the enabled/disabled state of this feature
53 */
54 scopes?: ContributedFeatureSettingScope[];
55 /**
56 * The service instance id of the service that owns this feature
57 */
58 serviceInstanceType?: string;
59 /**
60 * Tags associated with the feature.
61 */
62 tags?: string[];
63}
64/**
65 * The current state of a feature within a given scope
66 */
67export declare enum ContributedFeatureEnabledValue {
68 /**
69 * The state of the feature is not set for the specified scope
70 */
71 Undefined = -1,
72 /**
73 * The feature is disabled at the specified scope
74 */
75 Disabled = 0,
76 /**
77 * The feature is enabled at the specified scope
78 */
79 Enabled = 1
80}
81export interface ContributedFeatureHandlerSettings {
82 /**
83 * Name of the handler to run
84 */
85 name?: string;
86 /**
87 * Properties to feed to the handler
88 */
89 properties?: {
90 [key: string]: any;
91 };
92}
93/**
94 * An identifier and properties used to pass into a handler for a listener or plugin
95 */
96export interface ContributedFeatureListener extends ContributedFeatureHandlerSettings {
97}
98/**
99 * The scope to which a feature setting applies
100 */
101export interface ContributedFeatureSettingScope {
102 /**
103 * The name of the settings scope to use when reading/writing the setting
104 */
105 settingScope?: string;
106 /**
107 * Whether this is a user-scope or this is a host-wide (all users) setting
108 */
109 userScoped?: boolean;
110}
111/**
112 * A contributed feature/state pair
113 */
114export interface ContributedFeatureState {
115 /**
116 * The full contribution id of the feature
117 */
118 featureId?: string;
119 /**
120 * True if the effective state was set by an override rule (indicating that the state cannot be managed by the end user)
121 */
122 overridden?: boolean;
123 /**
124 * Reason that the state was set (by a plugin/rule).
125 */
126 reason?: string;
127 /**
128 * The scope at which this state applies
129 */
130 scope?: ContributedFeatureSettingScope;
131 /**
132 * The current state of this feature
133 */
134 state?: ContributedFeatureEnabledValue;
135}
136/**
137 * A query for the effective contributed feature states for a list of feature ids
138 */
139export interface ContributedFeatureStateQuery {
140 /**
141 * The list of feature ids to query
142 */
143 featureIds?: string[];
144 /**
145 * The query result containing the current feature states for each of the queried feature ids
146 */
147 featureStates?: {
148 [key: string]: ContributedFeatureState;
149 };
150 /**
151 * A dictionary of scope values (project name, etc.) to use in the query (if querying across scopes)
152 */
153 scopeValues?: {
154 [key: string]: string;
155 };
156}
157/**
158 * A rule for dynamically getting the enabled/disabled state of a feature
159 */
160export interface ContributedFeatureValueRule extends ContributedFeatureHandlerSettings {
161}
162export declare var TypeInfo: {
163 ContributedFeatureEnabledValue: {
164 enumValues: {
165 undefined: number;
166 disabled: number;
167 enabled: number;
168 };
169 };
170 ContributedFeatureState: any;
171 ContributedFeatureStateQuery: any;
172};