@featurevisor/types 0.37.0 → 0.38.0
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.
- package/CHANGELOG.md +11 -0
- package/lib/index.d.ts +18 -14
- package/package.json +2 -2
- package/src/index.ts +23 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.38.0](https://github.com/fahad19/featurevisor/compare/v0.37.1...v0.38.0) (2023-07-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* SDK to support isEnabled() checks ([#104](https://github.com/fahad19/featurevisor/issues/104)) ([4f52136](https://github.com/fahad19/featurevisor/commit/4f521367a3f1ef76833ba614b6a1f4b66abef2e1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.37.0](https://github.com/fahad19/featurevisor/compare/v0.36.0...v0.37.0) (2023-07-14)
|
|
7
18
|
|
|
8
19
|
|
package/lib/index.d.ts
CHANGED
|
@@ -45,8 +45,7 @@ export interface NotGroupSegment {
|
|
|
45
45
|
}
|
|
46
46
|
export type AndOrNotGroupSegment = AndGroupSegment | OrGroupSegment | NotGroupSegment;
|
|
47
47
|
export type GroupSegment = PlainGroupSegment | AndOrNotGroupSegment;
|
|
48
|
-
export type
|
|
49
|
-
export type VariationValue = boolean | string | number | null | undefined;
|
|
48
|
+
export type VariationValue = string;
|
|
50
49
|
export type VariableKey = string;
|
|
51
50
|
export type VariableType = "boolean" | "string" | "integer" | "double" | "array" | "object" | "json";
|
|
52
51
|
export interface VariableObjectValue {
|
|
@@ -88,7 +87,8 @@ export type FeatureKey = string;
|
|
|
88
87
|
export interface Force {
|
|
89
88
|
conditions?: Condition | Condition[];
|
|
90
89
|
segments?: GroupSegment | GroupSegment[];
|
|
91
|
-
|
|
90
|
+
enabled?: boolean;
|
|
91
|
+
variation?: VariationValue;
|
|
92
92
|
variables?: {
|
|
93
93
|
[key: string]: VariableValue;
|
|
94
94
|
};
|
|
@@ -117,6 +117,7 @@ export interface Traffic {
|
|
|
117
117
|
key: RuleKey;
|
|
118
118
|
segments: GroupSegment | GroupSegment[] | "*";
|
|
119
119
|
percentage: Percentage;
|
|
120
|
+
enabled?: boolean;
|
|
120
121
|
variation?: VariationValue;
|
|
121
122
|
variables?: {
|
|
122
123
|
[key: string]: VariableValue;
|
|
@@ -131,12 +132,12 @@ export interface OrBucketBy {
|
|
|
131
132
|
export type BucketBy = PlainBucketBy | AndBucketBy | OrBucketBy;
|
|
132
133
|
export interface Feature {
|
|
133
134
|
key: FeatureKey;
|
|
134
|
-
defaultVariation: VariationValue;
|
|
135
135
|
variablesSchema?: VariableSchema[];
|
|
136
|
-
variations
|
|
136
|
+
variations?: Variation[];
|
|
137
137
|
bucketBy: BucketBy;
|
|
138
138
|
traffic: Traffic[];
|
|
139
139
|
force?: Force[];
|
|
140
|
+
ranges?: Range[];
|
|
140
141
|
}
|
|
141
142
|
export interface DatafileContent {
|
|
142
143
|
schemaVersion: string;
|
|
@@ -145,14 +146,16 @@ export interface DatafileContent {
|
|
|
145
146
|
segments: Segment[];
|
|
146
147
|
features: Feature[];
|
|
147
148
|
}
|
|
148
|
-
export interface
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
};
|
|
149
|
+
export interface OverrideFeature {
|
|
150
|
+
enabled: boolean;
|
|
151
|
+
variation?: VariationValue;
|
|
152
|
+
variables?: {
|
|
153
|
+
[key: VariableKey]: VariableValue;
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
+
export interface StickyFeatures {
|
|
157
|
+
[key: FeatureKey]: OverrideFeature;
|
|
158
|
+
}
|
|
156
159
|
export type InitialFeatures = StickyFeatures;
|
|
157
160
|
/**
|
|
158
161
|
* YAML-only type
|
|
@@ -164,6 +167,7 @@ export interface Rule {
|
|
|
164
167
|
key: RuleKey;
|
|
165
168
|
segments: GroupSegment | GroupSegment[];
|
|
166
169
|
percentage: Weight;
|
|
170
|
+
enabled?: boolean;
|
|
167
171
|
variation?: VariationValue;
|
|
168
172
|
variables?: {
|
|
169
173
|
[key: string]: VariableValue;
|
|
@@ -180,9 +184,8 @@ export interface ParsedFeature {
|
|
|
180
184
|
description: string;
|
|
181
185
|
tags: string[];
|
|
182
186
|
bucketBy: BucketBy;
|
|
183
|
-
defaultVariation: VariationValue;
|
|
184
187
|
variablesSchema?: VariableSchema[];
|
|
185
|
-
variations
|
|
188
|
+
variations?: Variation[];
|
|
186
189
|
environments: {
|
|
187
190
|
[key: EnvironmentKey]: Environment;
|
|
188
191
|
};
|
|
@@ -193,7 +196,7 @@ export interface ParsedFeature {
|
|
|
193
196
|
* with consistent bucketing
|
|
194
197
|
*/
|
|
195
198
|
export interface ExistingFeature {
|
|
196
|
-
variations
|
|
199
|
+
variations?: {
|
|
197
200
|
value: VariationValue;
|
|
198
201
|
weight: Weight;
|
|
199
202
|
}[];
|
|
@@ -217,6 +220,7 @@ export interface FeatureAssertion {
|
|
|
217
220
|
description?: string;
|
|
218
221
|
at: Weight;
|
|
219
222
|
context: Context;
|
|
223
|
+
expectedToBeEnabled: boolean;
|
|
220
224
|
expectedVariation?: VariationValue;
|
|
221
225
|
expectedVariables?: {
|
|
222
226
|
[key: VariableKey]: VariableValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "Common Typescript types for Featurevisor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"url": "https://github.com/fahad19/featurevisor/issues"
|
|
42
42
|
},
|
|
43
43
|
"license": "MIT",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "79edc620e398ae8250bd9870e6fbf8e3402e6010"
|
|
45
45
|
}
|
package/src/index.ts
CHANGED
|
@@ -96,8 +96,7 @@ export type AndOrNotGroupSegment = AndGroupSegment | OrGroupSegment | NotGroupSe
|
|
|
96
96
|
// group of segment keys with and/or conditions, or just string
|
|
97
97
|
export type GroupSegment = PlainGroupSegment | AndOrNotGroupSegment;
|
|
98
98
|
|
|
99
|
-
export type
|
|
100
|
-
export type VariationValue = boolean | string | number | null | undefined;
|
|
99
|
+
export type VariationValue = string;
|
|
101
100
|
|
|
102
101
|
export type VariableKey = string;
|
|
103
102
|
export type VariableType =
|
|
@@ -174,7 +173,8 @@ export interface Force {
|
|
|
174
173
|
conditions?: Condition | Condition[];
|
|
175
174
|
segments?: GroupSegment | GroupSegment[];
|
|
176
175
|
|
|
177
|
-
|
|
176
|
+
enabled?: boolean;
|
|
177
|
+
variation?: VariationValue;
|
|
178
178
|
variables?: {
|
|
179
179
|
[key: string]: VariableValue;
|
|
180
180
|
};
|
|
@@ -210,10 +210,13 @@ export interface Traffic {
|
|
|
210
210
|
key: RuleKey;
|
|
211
211
|
segments: GroupSegment | GroupSegment[] | "*";
|
|
212
212
|
percentage: Percentage;
|
|
213
|
+
|
|
214
|
+
enabled?: boolean;
|
|
213
215
|
variation?: VariationValue;
|
|
214
216
|
variables?: {
|
|
215
217
|
[key: string]: VariableValue;
|
|
216
218
|
};
|
|
219
|
+
|
|
217
220
|
allocation: Allocation[];
|
|
218
221
|
}
|
|
219
222
|
|
|
@@ -227,12 +230,12 @@ export type BucketBy = PlainBucketBy | AndBucketBy | OrBucketBy;
|
|
|
227
230
|
export interface Feature {
|
|
228
231
|
key: FeatureKey;
|
|
229
232
|
// @TODO: introduce new `parent` key?
|
|
230
|
-
defaultVariation: VariationValue;
|
|
231
233
|
variablesSchema?: VariableSchema[];
|
|
232
|
-
variations
|
|
234
|
+
variations?: Variation[];
|
|
233
235
|
bucketBy: BucketBy;
|
|
234
236
|
traffic: Traffic[];
|
|
235
237
|
force?: Force[];
|
|
238
|
+
ranges?: Range[]; // if in a Group (mutex), these are the available slot ranges
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
export interface DatafileContent {
|
|
@@ -243,15 +246,18 @@ export interface DatafileContent {
|
|
|
243
246
|
features: Feature[];
|
|
244
247
|
}
|
|
245
248
|
|
|
246
|
-
export interface
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
};
|
|
249
|
+
export interface OverrideFeature {
|
|
250
|
+
enabled: boolean;
|
|
251
|
+
variation?: VariationValue;
|
|
252
|
+
variables?: {
|
|
253
|
+
[key: VariableKey]: VariableValue;
|
|
252
254
|
};
|
|
253
255
|
}
|
|
254
256
|
|
|
257
|
+
export interface StickyFeatures {
|
|
258
|
+
[key: FeatureKey]: OverrideFeature;
|
|
259
|
+
}
|
|
260
|
+
|
|
255
261
|
export type InitialFeatures = StickyFeatures;
|
|
256
262
|
|
|
257
263
|
/**
|
|
@@ -267,6 +273,8 @@ export interface Rule {
|
|
|
267
273
|
key: RuleKey;
|
|
268
274
|
segments: GroupSegment | GroupSegment[];
|
|
269
275
|
percentage: Weight;
|
|
276
|
+
|
|
277
|
+
enabled?: boolean;
|
|
270
278
|
variation?: VariationValue;
|
|
271
279
|
variables?: {
|
|
272
280
|
[key: string]: VariableValue;
|
|
@@ -288,9 +296,8 @@ export interface ParsedFeature {
|
|
|
288
296
|
|
|
289
297
|
bucketBy: BucketBy;
|
|
290
298
|
|
|
291
|
-
defaultVariation: VariationValue;
|
|
292
299
|
variablesSchema?: VariableSchema[];
|
|
293
|
-
variations
|
|
300
|
+
variations?: Variation[];
|
|
294
301
|
|
|
295
302
|
environments: {
|
|
296
303
|
[key: EnvironmentKey]: Environment;
|
|
@@ -303,7 +310,7 @@ export interface ParsedFeature {
|
|
|
303
310
|
* with consistent bucketing
|
|
304
311
|
*/
|
|
305
312
|
export interface ExistingFeature {
|
|
306
|
-
variations
|
|
313
|
+
variations?: {
|
|
307
314
|
// @TODO: use Exclude with Variation?
|
|
308
315
|
value: VariationValue;
|
|
309
316
|
weight: Weight;
|
|
@@ -314,7 +321,7 @@ export interface ExistingFeature {
|
|
|
314
321
|
percentage: Percentage;
|
|
315
322
|
allocation: Allocation[];
|
|
316
323
|
}[];
|
|
317
|
-
ranges?: Range[]; // if in a Group, these are the available slot ranges
|
|
324
|
+
ranges?: Range[]; // if in a Group (mutex), these are the available slot ranges
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
export interface ExistingFeatures {
|
|
@@ -332,6 +339,7 @@ export interface FeatureAssertion {
|
|
|
332
339
|
description?: string;
|
|
333
340
|
at: Weight; // bucket weight: 0 to 100
|
|
334
341
|
context: Context;
|
|
342
|
+
expectedToBeEnabled: boolean;
|
|
335
343
|
expectedVariation?: VariationValue;
|
|
336
344
|
expectedVariables?: {
|
|
337
345
|
[key: VariableKey]: VariableValue;
|