@featurevisor/types 1.35.3 → 2.0.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.
- package/CHANGELOG.md +8 -0
- package/README.md +0 -6
- package/package.json +15 -8
- package/src/{index.ts → index.d.ts} +180 -69
- package/src/index.js +1 -0
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/lib/index.d.ts +0 -364
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/webpack.config.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [2.0.1](https://github.com/featurevisor/featurevisor/compare/v2.0.0...v2.0.1) (2025-07-19)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @featurevisor/types
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [1.35.3](https://github.com/featurevisor/featurevisor/compare/v1.35.2...v1.35.3) (2025-04-12)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @featurevisor/types
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Common Typescript types for Featurevisor",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "
|
|
7
|
-
"types": "
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"module": "src/index.js",
|
|
7
|
+
"types": "src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./src/index.d.ts",
|
|
11
|
+
"import": "./src/index.js",
|
|
12
|
+
"require": "./src/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"scripts": {
|
|
9
|
-
"transpile": "
|
|
10
|
-
"dist": "
|
|
11
|
-
"build": "
|
|
16
|
+
"transpile": "echo 'Nothing to transpile'",
|
|
17
|
+
"dist": "echo 'Nothing to dist'",
|
|
18
|
+
"build": "echo 'Nothing to build'",
|
|
12
19
|
"test": "echo 'Nothing to test in types package'"
|
|
13
20
|
},
|
|
14
21
|
"author": {
|
|
@@ -40,5 +47,5 @@
|
|
|
40
47
|
"url": "https://github.com/featurevisor/featurevisor/issues"
|
|
41
48
|
},
|
|
42
49
|
"license": "MIT",
|
|
43
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f5d883e1d6f8ba1b0c14fbbd79329b98f66b46e8"
|
|
44
51
|
}
|
|
@@ -1,24 +1,59 @@
|
|
|
1
1
|
export type AttributeKey = string;
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface AttributeObjectValue {
|
|
4
|
+
[key: AttributeKey]: AttributeValue;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type AttributeValue =
|
|
8
|
+
| string
|
|
9
|
+
| number
|
|
10
|
+
| boolean
|
|
11
|
+
| Date
|
|
12
|
+
| null
|
|
13
|
+
| undefined
|
|
14
|
+
| string[]
|
|
15
|
+
| AttributeObjectValue;
|
|
4
16
|
|
|
5
17
|
export interface Context {
|
|
6
18
|
[key: AttributeKey]: AttributeValue;
|
|
7
19
|
}
|
|
8
20
|
|
|
9
|
-
export type AttributeType =
|
|
21
|
+
export type AttributeType =
|
|
22
|
+
| "boolean"
|
|
23
|
+
| "string"
|
|
24
|
+
| "integer"
|
|
25
|
+
| "double"
|
|
26
|
+
| "date"
|
|
27
|
+
| "semver"
|
|
28
|
+
| "object"
|
|
29
|
+
| "array";
|
|
10
30
|
|
|
11
31
|
export interface Attribute {
|
|
12
32
|
archived?: boolean; // only available in YAML files
|
|
13
|
-
key
|
|
33
|
+
key?: AttributeKey; // needed for supporting v1 datafile generation
|
|
14
34
|
type: AttributeType;
|
|
15
|
-
capture?: boolean;
|
|
16
35
|
description?: string; // only available in YAML files
|
|
36
|
+
properties?: {
|
|
37
|
+
[key: AttributeKey]: {
|
|
38
|
+
type:
|
|
39
|
+
| "boolean"
|
|
40
|
+
| "string"
|
|
41
|
+
| "integer"
|
|
42
|
+
| "double"
|
|
43
|
+
| "date"
|
|
44
|
+
| "semver"
|
|
45
|
+
// | "object" // NOTE: avoid nesting for now
|
|
46
|
+
| "array";
|
|
47
|
+
description?: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
17
50
|
}
|
|
18
51
|
|
|
19
52
|
export type Operator =
|
|
20
53
|
| "equals"
|
|
21
54
|
| "notEquals"
|
|
55
|
+
| "exists"
|
|
56
|
+
| "notExists"
|
|
22
57
|
|
|
23
58
|
// numeric
|
|
24
59
|
| "greaterThan"
|
|
@@ -44,6 +79,14 @@ export type Operator =
|
|
|
44
79
|
| "before"
|
|
45
80
|
| "after"
|
|
46
81
|
|
|
82
|
+
// array of strings
|
|
83
|
+
| "includes"
|
|
84
|
+
| "notIncludes"
|
|
85
|
+
|
|
86
|
+
// regex
|
|
87
|
+
| "matches"
|
|
88
|
+
| "notMatches"
|
|
89
|
+
|
|
47
90
|
// array of strings
|
|
48
91
|
| "in"
|
|
49
92
|
| "notIn";
|
|
@@ -53,7 +96,8 @@ export type ConditionValue = string | number | boolean | Date | null | undefined
|
|
|
53
96
|
export interface PlainCondition {
|
|
54
97
|
attribute: AttributeKey;
|
|
55
98
|
operator: Operator;
|
|
56
|
-
value
|
|
99
|
+
value?: ConditionValue; // for all operators, except for "exists" and "notExists"
|
|
100
|
+
regexFlags?: string; // for regex operators only (matches, notMatches)
|
|
57
101
|
}
|
|
58
102
|
|
|
59
103
|
export interface AndCondition {
|
|
@@ -70,14 +114,14 @@ export interface NotCondition {
|
|
|
70
114
|
|
|
71
115
|
export type AndOrNotCondition = AndCondition | OrCondition | NotCondition;
|
|
72
116
|
|
|
73
|
-
export type Condition = PlainCondition | AndOrNotCondition;
|
|
117
|
+
export type Condition = PlainCondition | AndOrNotCondition | string;
|
|
74
118
|
|
|
75
119
|
export type SegmentKey = string;
|
|
76
120
|
|
|
77
121
|
export interface Segment {
|
|
78
122
|
archived?: boolean; // only available in YAML files
|
|
79
|
-
key
|
|
80
|
-
conditions: Condition | Condition[]
|
|
123
|
+
key?: SegmentKey; // needed for supporting v1 datafile generation
|
|
124
|
+
conditions: Condition | Condition[]; // string only when stringified for datafile
|
|
81
125
|
description?: string; // only available in YAML files
|
|
82
126
|
}
|
|
83
127
|
|
|
@@ -131,62 +175,56 @@ export interface VariableOverrideConditions {
|
|
|
131
175
|
conditions: Condition | Condition[];
|
|
132
176
|
}
|
|
133
177
|
|
|
134
|
-
export interface VariableOverrideBase {
|
|
135
|
-
value: VariableValue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
178
|
export type VariableOverrideSegmentsOrConditions =
|
|
139
179
|
| VariableOverrideSegments
|
|
140
180
|
| VariableOverrideConditions;
|
|
141
181
|
|
|
142
|
-
// export type VariableOverride = VariableOverrideBase & VariableOverrideSegmentsOrConditions;
|
|
143
|
-
|
|
144
182
|
export interface VariableOverride {
|
|
145
183
|
value: VariableValue;
|
|
146
184
|
|
|
147
185
|
// one of the below must be present in YAML files
|
|
148
|
-
// @TODO: try with above commented out TypeScript later
|
|
149
186
|
conditions?: Condition | Condition[];
|
|
150
187
|
segments?: GroupSegment | GroupSegment[];
|
|
151
188
|
}
|
|
152
189
|
|
|
153
|
-
export interface
|
|
190
|
+
export interface VariableV1 {
|
|
154
191
|
key: VariableKey;
|
|
155
192
|
value: VariableValue;
|
|
156
193
|
description?: string; // only available in YAML files
|
|
157
194
|
overrides?: VariableOverride[];
|
|
158
195
|
}
|
|
159
196
|
|
|
197
|
+
export interface VariationV1 {
|
|
198
|
+
description?: string; // only available in YAML files
|
|
199
|
+
value: VariationValue;
|
|
200
|
+
weight?: Weight; // 0 to 100 (available from parsed YAML, but not in datafile)
|
|
201
|
+
variables?: VariableV1[];
|
|
202
|
+
}
|
|
203
|
+
|
|
160
204
|
export interface Variation {
|
|
161
205
|
description?: string; // only available in YAML files
|
|
162
206
|
value: VariationValue;
|
|
163
207
|
weight?: Weight; // 0 to 100 (available from parsed YAML, but not in datafile)
|
|
164
|
-
variables?:
|
|
208
|
+
variables?: {
|
|
209
|
+
[key: VariableKey]: VariableValue;
|
|
210
|
+
};
|
|
211
|
+
variableOverrides?: {
|
|
212
|
+
[key: VariableKey]: VariableOverride[];
|
|
213
|
+
};
|
|
165
214
|
}
|
|
166
215
|
|
|
167
216
|
export interface VariableSchema {
|
|
168
217
|
deprecated?: boolean;
|
|
169
|
-
key
|
|
218
|
+
key?: VariableKey; // @NOTE: remove
|
|
170
219
|
type: VariableType;
|
|
171
220
|
defaultValue: VariableValue;
|
|
172
221
|
description?: string; // only available in YAML files
|
|
222
|
+
useDefaultWhenDisabled?: boolean;
|
|
223
|
+
disabledValue?: VariableValue;
|
|
173
224
|
}
|
|
174
225
|
|
|
175
226
|
export type FeatureKey = string;
|
|
176
227
|
|
|
177
|
-
export interface Force {
|
|
178
|
-
// one of the below must be present in YAML
|
|
179
|
-
// @TODO: make it better with TypeScript
|
|
180
|
-
conditions?: Condition | Condition[];
|
|
181
|
-
segments?: GroupSegment | GroupSegment[];
|
|
182
|
-
|
|
183
|
-
enabled?: boolean;
|
|
184
|
-
variation?: VariationValue;
|
|
185
|
-
variables?: {
|
|
186
|
-
[key: string]: VariableValue;
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
228
|
export interface Slot {
|
|
191
229
|
feature: FeatureKey | false;
|
|
192
230
|
percentage: Weight; // 0 to 100
|
|
@@ -210,7 +248,7 @@ export type Range = [Percentage, Percentage]; // 0 to 100k
|
|
|
210
248
|
|
|
211
249
|
export interface Allocation {
|
|
212
250
|
variation: VariationValue;
|
|
213
|
-
range: Range;
|
|
251
|
+
range: Range;
|
|
214
252
|
}
|
|
215
253
|
|
|
216
254
|
export interface Traffic {
|
|
@@ -223,8 +261,11 @@ export interface Traffic {
|
|
|
223
261
|
variables?: {
|
|
224
262
|
[key: string]: VariableValue;
|
|
225
263
|
};
|
|
264
|
+
variationWeights?: {
|
|
265
|
+
[key: string]: Weight;
|
|
266
|
+
};
|
|
226
267
|
|
|
227
|
-
allocation
|
|
268
|
+
allocation?: Allocation[];
|
|
228
269
|
}
|
|
229
270
|
|
|
230
271
|
export type PlainBucketBy = AttributeKey;
|
|
@@ -242,10 +283,12 @@ export interface RequiredWithVariation {
|
|
|
242
283
|
export type Required = FeatureKey | RequiredWithVariation;
|
|
243
284
|
|
|
244
285
|
export interface Feature {
|
|
245
|
-
key
|
|
286
|
+
key?: FeatureKey; // needed for supporting v1 datafile generation
|
|
287
|
+
hash?: string;
|
|
246
288
|
deprecated?: boolean;
|
|
247
289
|
required?: Required[];
|
|
248
|
-
variablesSchema?:
|
|
290
|
+
variablesSchema?: Record<VariableKey, VariableSchema>;
|
|
291
|
+
disabledVariationValue?: VariationValue;
|
|
249
292
|
variations?: Variation[];
|
|
250
293
|
bucketBy: BucketBy;
|
|
251
294
|
traffic: Traffic[];
|
|
@@ -253,20 +296,31 @@ export interface Feature {
|
|
|
253
296
|
ranges?: Range[]; // if in a Group (mutex), these are the available slot ranges
|
|
254
297
|
}
|
|
255
298
|
|
|
299
|
+
export interface FeatureV1 {
|
|
300
|
+
key?: FeatureKey;
|
|
301
|
+
hash?: string;
|
|
302
|
+
deprecated?: boolean;
|
|
303
|
+
required?: Required[];
|
|
304
|
+
bucketBy: BucketBy;
|
|
305
|
+
traffic: Traffic[];
|
|
306
|
+
force?: Force[];
|
|
307
|
+
ranges?: Range[]; // if in a Group (mutex), these are the available slot ranges
|
|
308
|
+
|
|
309
|
+
variablesSchema?: VariableSchema[];
|
|
310
|
+
variations?: VariationV1[];
|
|
311
|
+
}
|
|
312
|
+
|
|
256
313
|
export interface DatafileContentV1 {
|
|
257
314
|
schemaVersion: string;
|
|
258
315
|
revision: string;
|
|
259
316
|
attributes: Attribute[];
|
|
260
317
|
segments: Segment[];
|
|
261
|
-
features:
|
|
318
|
+
features: FeatureV1[];
|
|
262
319
|
}
|
|
263
320
|
|
|
264
|
-
export interface
|
|
321
|
+
export interface DatafileContent {
|
|
265
322
|
schemaVersion: string;
|
|
266
323
|
revision: string;
|
|
267
|
-
attributes: {
|
|
268
|
-
[key: AttributeKey]: Attribute;
|
|
269
|
-
};
|
|
270
324
|
segments: {
|
|
271
325
|
[key: SegmentKey]: Segment;
|
|
272
326
|
};
|
|
@@ -275,9 +329,7 @@ export interface DatafileContentV2 {
|
|
|
275
329
|
};
|
|
276
330
|
}
|
|
277
331
|
|
|
278
|
-
export
|
|
279
|
-
|
|
280
|
-
export interface OverrideFeature {
|
|
332
|
+
export interface EvaluatedFeature {
|
|
281
333
|
enabled: boolean;
|
|
282
334
|
variation?: VariationValue;
|
|
283
335
|
variables?: {
|
|
@@ -285,11 +337,11 @@ export interface OverrideFeature {
|
|
|
285
337
|
};
|
|
286
338
|
}
|
|
287
339
|
|
|
288
|
-
export interface
|
|
289
|
-
[key: FeatureKey]:
|
|
340
|
+
export interface EvaluatedFeatures {
|
|
341
|
+
[key: FeatureKey]: EvaluatedFeature;
|
|
290
342
|
}
|
|
291
343
|
|
|
292
|
-
export type
|
|
344
|
+
export type StickyFeatures = EvaluatedFeatures;
|
|
293
345
|
|
|
294
346
|
/**
|
|
295
347
|
* YAML-only type
|
|
@@ -298,6 +350,8 @@ export type Weight = number; // 0 to 100
|
|
|
298
350
|
|
|
299
351
|
export type EnvironmentKey = string; // ideally "production", "staging", "testing", or "development" only
|
|
300
352
|
|
|
353
|
+
export type Tag = string;
|
|
354
|
+
|
|
301
355
|
export type RuleKey = string;
|
|
302
356
|
|
|
303
357
|
export interface Rule {
|
|
@@ -311,16 +365,35 @@ export interface Rule {
|
|
|
311
365
|
variables?: {
|
|
312
366
|
[key: string]: VariableValue;
|
|
313
367
|
};
|
|
368
|
+
variationWeights?: {
|
|
369
|
+
[key: string]: Weight;
|
|
370
|
+
};
|
|
314
371
|
}
|
|
315
372
|
|
|
316
|
-
export
|
|
373
|
+
export interface RulesByEnvironment {
|
|
374
|
+
[key: EnvironmentKey]: Rule[];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export interface Force {
|
|
378
|
+
// one of the below must be present in YAML
|
|
379
|
+
conditions?: Condition | Condition[];
|
|
380
|
+
segments?: GroupSegment | GroupSegment[];
|
|
381
|
+
|
|
382
|
+
enabled?: boolean;
|
|
383
|
+
variation?: VariationValue;
|
|
384
|
+
variables?: {
|
|
385
|
+
[key: string]: VariableValue;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface ForceByEnvironment {
|
|
390
|
+
[key: EnvironmentKey]: Force[];
|
|
391
|
+
}
|
|
317
392
|
|
|
318
393
|
export type Expose = boolean | Tag[];
|
|
319
394
|
|
|
320
|
-
export interface
|
|
321
|
-
|
|
322
|
-
rules: Rule[];
|
|
323
|
-
force?: Force[];
|
|
395
|
+
export interface ExposeByEnvironment {
|
|
396
|
+
[key: EnvironmentKey]: Expose;
|
|
324
397
|
}
|
|
325
398
|
|
|
326
399
|
export interface ParsedFeature {
|
|
@@ -336,18 +409,14 @@ export interface ParsedFeature {
|
|
|
336
409
|
|
|
337
410
|
bucketBy: BucketBy;
|
|
338
411
|
|
|
339
|
-
|
|
340
|
-
variations?: Variation[];
|
|
412
|
+
disabledVariationValue?: VariationValue;
|
|
341
413
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
[key: EnvironmentKey]: Environment;
|
|
345
|
-
};
|
|
414
|
+
variablesSchema?: Record<VariableKey, VariableSchema>;
|
|
415
|
+
variations?: Variation[];
|
|
346
416
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
rules?: Rule[];
|
|
350
|
-
force?: Force[];
|
|
417
|
+
expose?: ExposeByEnvironment | Expose;
|
|
418
|
+
force?: ForceByEnvironment | Force[];
|
|
419
|
+
rules?: RulesByEnvironment | Rule[];
|
|
351
420
|
}
|
|
352
421
|
|
|
353
422
|
/**
|
|
@@ -356,16 +425,15 @@ export interface ParsedFeature {
|
|
|
356
425
|
* with consistent bucketing
|
|
357
426
|
*/
|
|
358
427
|
export interface ExistingFeature {
|
|
428
|
+
hash?: string;
|
|
359
429
|
variations?: {
|
|
360
|
-
// @TODO: use Exclude with Variation?
|
|
361
430
|
value: VariationValue;
|
|
362
431
|
weight: Weight;
|
|
363
432
|
}[];
|
|
364
433
|
traffic: {
|
|
365
|
-
// @TODO: use Exclude with Traffic?
|
|
366
434
|
key: RuleKey;
|
|
367
435
|
percentage: Percentage;
|
|
368
|
-
allocation
|
|
436
|
+
allocation?: Allocation[];
|
|
369
437
|
}[];
|
|
370
438
|
ranges?: Range[]; // if in a Group (mutex), these are the available slot ranges
|
|
371
439
|
}
|
|
@@ -385,20 +453,57 @@ export interface AssertionMatrix {
|
|
|
385
453
|
[key: string]: AttributeValue[];
|
|
386
454
|
}
|
|
387
455
|
|
|
456
|
+
export interface ExpectedEvaluations {
|
|
457
|
+
flag?: Record<string, any>;
|
|
458
|
+
variation?: Record<string, any>;
|
|
459
|
+
variables?: {
|
|
460
|
+
[key: VariableKey]: Record<string, any>;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export interface FeatureChildAssertion {
|
|
465
|
+
sticky?: StickyFeatures;
|
|
466
|
+
context?: Context;
|
|
467
|
+
|
|
468
|
+
defaultVariationValue?: VariationValue;
|
|
469
|
+
defaultVariableValues?: {
|
|
470
|
+
[key: string]: VariableValue;
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
expectedToBeEnabled?: boolean;
|
|
474
|
+
expectedVariation?: VariationValue;
|
|
475
|
+
expectedVariables?: {
|
|
476
|
+
[key: VariableKey]: VariableValue;
|
|
477
|
+
};
|
|
478
|
+
expectedEvaluations?: ExpectedEvaluations;
|
|
479
|
+
}
|
|
480
|
+
|
|
388
481
|
export interface FeatureAssertion {
|
|
389
482
|
matrix?: AssertionMatrix;
|
|
390
483
|
description?: string;
|
|
391
484
|
environment: EnvironmentKey;
|
|
392
|
-
at
|
|
393
|
-
|
|
394
|
-
|
|
485
|
+
at?: Weight; // bucket weight: 0 to 100
|
|
486
|
+
|
|
487
|
+
sticky?: StickyFeatures;
|
|
488
|
+
context?: Context;
|
|
489
|
+
|
|
490
|
+
defaultVariationValue?: VariationValue;
|
|
491
|
+
defaultVariableValues?: {
|
|
492
|
+
[key: string]: VariableValue;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
expectedToBeEnabled?: boolean;
|
|
395
496
|
expectedVariation?: VariationValue;
|
|
396
497
|
expectedVariables?: {
|
|
397
498
|
[key: VariableKey]: VariableValue;
|
|
398
499
|
};
|
|
500
|
+
expectedEvaluations?: ExpectedEvaluations;
|
|
501
|
+
|
|
502
|
+
children?: FeatureChildAssertion[];
|
|
399
503
|
}
|
|
400
504
|
|
|
401
505
|
export interface TestFeature {
|
|
506
|
+
key?: string; // file path
|
|
402
507
|
feature: FeatureKey;
|
|
403
508
|
assertions: FeatureAssertion[];
|
|
404
509
|
}
|
|
@@ -411,6 +516,7 @@ export interface SegmentAssertion {
|
|
|
411
516
|
}
|
|
412
517
|
|
|
413
518
|
export interface TestSegment {
|
|
519
|
+
key?: string; // file path
|
|
414
520
|
segment: SegmentKey;
|
|
415
521
|
assertions: SegmentAssertion[];
|
|
416
522
|
}
|
|
@@ -418,11 +524,16 @@ export interface TestSegment {
|
|
|
418
524
|
export type Test = TestSegment | TestFeature;
|
|
419
525
|
|
|
420
526
|
export interface TestResultAssertionError {
|
|
421
|
-
type: "flag" | "variation" | "variable" | "segment";
|
|
527
|
+
type: "flag" | "variation" | "variable" | "segment" | "evaluation";
|
|
422
528
|
expected: string | number | boolean | Date | null | undefined;
|
|
423
529
|
actual: string | number | boolean | Date | null | undefined;
|
|
424
530
|
message?: string;
|
|
425
|
-
details?:
|
|
531
|
+
details?: {
|
|
532
|
+
evaluationType?: string; // e.g., "flag", "variation", "variable"
|
|
533
|
+
evaluationKey?: string; // e.g., "myFeatureKey", "myVariableKey"
|
|
534
|
+
childIndex?: number; // for children assertions
|
|
535
|
+
[key: string]: any;
|
|
536
|
+
};
|
|
426
537
|
}
|
|
427
538
|
|
|
428
539
|
export interface TestResultAssertion {
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
package/dist/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FeaturevisorTypes=t():e.FeaturevisorTypes=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),e})()));
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAA2B,kBAAID,IAE/BD,EAAwB,kBAAIC,GAC7B,CATD,CASGK,MAAM,I","sources":["webpack://FeaturevisorTypes/webpack/universalModuleDefinition"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"FeaturevisorTypes\"] = factory();\n\telse\n\t\troot[\"FeaturevisorTypes\"] = factory();\n})(this, () => {\nreturn "],"names":["root","factory","exports","module","define","amd","this"],"sourceRoot":""}
|
package/lib/index.d.ts
DELETED
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
export type AttributeKey = string;
|
|
2
|
-
export type AttributeValue = string | number | boolean | Date | null | undefined;
|
|
3
|
-
export interface Context {
|
|
4
|
-
[key: AttributeKey]: AttributeValue;
|
|
5
|
-
}
|
|
6
|
-
export type AttributeType = "boolean" | "string" | "integer" | "double" | "date" | "semver";
|
|
7
|
-
export interface Attribute {
|
|
8
|
-
archived?: boolean;
|
|
9
|
-
key: AttributeKey;
|
|
10
|
-
type: AttributeType;
|
|
11
|
-
capture?: boolean;
|
|
12
|
-
description?: string;
|
|
13
|
-
}
|
|
14
|
-
export type Operator = "equals" | "notEquals" | "greaterThan" | "greaterThanOrEquals" | "lessThan" | "lessThanOrEquals" | "contains" | "notContains" | "startsWith" | "endsWith" | "semverEquals" | "semverNotEquals" | "semverGreaterThan" | "semverGreaterThanOrEquals" | "semverLessThan" | "semverLessThanOrEquals" | "before" | "after" | "in" | "notIn";
|
|
15
|
-
export type ConditionValue = string | number | boolean | Date | null | undefined | string[];
|
|
16
|
-
export interface PlainCondition {
|
|
17
|
-
attribute: AttributeKey;
|
|
18
|
-
operator: Operator;
|
|
19
|
-
value: ConditionValue;
|
|
20
|
-
}
|
|
21
|
-
export interface AndCondition {
|
|
22
|
-
and: Condition[];
|
|
23
|
-
}
|
|
24
|
-
export interface OrCondition {
|
|
25
|
-
or: Condition[];
|
|
26
|
-
}
|
|
27
|
-
export interface NotCondition {
|
|
28
|
-
not: Condition[];
|
|
29
|
-
}
|
|
30
|
-
export type AndOrNotCondition = AndCondition | OrCondition | NotCondition;
|
|
31
|
-
export type Condition = PlainCondition | AndOrNotCondition;
|
|
32
|
-
export type SegmentKey = string;
|
|
33
|
-
export interface Segment {
|
|
34
|
-
archived?: boolean;
|
|
35
|
-
key: SegmentKey;
|
|
36
|
-
conditions: Condition | Condition[] | string;
|
|
37
|
-
description?: string;
|
|
38
|
-
}
|
|
39
|
-
export type PlainGroupSegment = SegmentKey;
|
|
40
|
-
export interface AndGroupSegment {
|
|
41
|
-
and: GroupSegment[];
|
|
42
|
-
}
|
|
43
|
-
export interface OrGroupSegment {
|
|
44
|
-
or: GroupSegment[];
|
|
45
|
-
}
|
|
46
|
-
export interface NotGroupSegment {
|
|
47
|
-
not: GroupSegment[];
|
|
48
|
-
}
|
|
49
|
-
export type AndOrNotGroupSegment = AndGroupSegment | OrGroupSegment | NotGroupSegment;
|
|
50
|
-
export type GroupSegment = PlainGroupSegment | AndOrNotGroupSegment;
|
|
51
|
-
export type VariationValue = string;
|
|
52
|
-
export type VariableKey = string;
|
|
53
|
-
export type VariableType = "boolean" | "string" | "integer" | "double" | "array" | "object" | "json";
|
|
54
|
-
export interface VariableObjectValue {
|
|
55
|
-
[key: string]: VariableValue;
|
|
56
|
-
}
|
|
57
|
-
export type VariableValue = boolean | string | number | string[] | VariableObjectValue | null | undefined;
|
|
58
|
-
export interface VariableOverrideSegments {
|
|
59
|
-
segments: GroupSegment | GroupSegment[];
|
|
60
|
-
}
|
|
61
|
-
export interface VariableOverrideConditions {
|
|
62
|
-
conditions: Condition | Condition[];
|
|
63
|
-
}
|
|
64
|
-
export interface VariableOverrideBase {
|
|
65
|
-
value: VariableValue;
|
|
66
|
-
}
|
|
67
|
-
export type VariableOverrideSegmentsOrConditions = VariableOverrideSegments | VariableOverrideConditions;
|
|
68
|
-
export interface VariableOverride {
|
|
69
|
-
value: VariableValue;
|
|
70
|
-
conditions?: Condition | Condition[];
|
|
71
|
-
segments?: GroupSegment | GroupSegment[];
|
|
72
|
-
}
|
|
73
|
-
export interface Variable {
|
|
74
|
-
key: VariableKey;
|
|
75
|
-
value: VariableValue;
|
|
76
|
-
description?: string;
|
|
77
|
-
overrides?: VariableOverride[];
|
|
78
|
-
}
|
|
79
|
-
export interface Variation {
|
|
80
|
-
description?: string;
|
|
81
|
-
value: VariationValue;
|
|
82
|
-
weight?: Weight;
|
|
83
|
-
variables?: Variable[];
|
|
84
|
-
}
|
|
85
|
-
export interface VariableSchema {
|
|
86
|
-
deprecated?: boolean;
|
|
87
|
-
key: VariableKey;
|
|
88
|
-
type: VariableType;
|
|
89
|
-
defaultValue: VariableValue;
|
|
90
|
-
description?: string;
|
|
91
|
-
}
|
|
92
|
-
export type FeatureKey = string;
|
|
93
|
-
export interface Force {
|
|
94
|
-
conditions?: Condition | Condition[];
|
|
95
|
-
segments?: GroupSegment | GroupSegment[];
|
|
96
|
-
enabled?: boolean;
|
|
97
|
-
variation?: VariationValue;
|
|
98
|
-
variables?: {
|
|
99
|
-
[key: string]: VariableValue;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
export interface Slot {
|
|
103
|
-
feature: FeatureKey | false;
|
|
104
|
-
percentage: Weight;
|
|
105
|
-
}
|
|
106
|
-
export interface Group {
|
|
107
|
-
key: string;
|
|
108
|
-
description: string;
|
|
109
|
-
slots: Slot[];
|
|
110
|
-
}
|
|
111
|
-
export type BucketKey = string;
|
|
112
|
-
export type BucketValue = number;
|
|
113
|
-
/**
|
|
114
|
-
* Datafile-only types
|
|
115
|
-
*/
|
|
116
|
-
export type Percentage = number;
|
|
117
|
-
export type Range = [Percentage, Percentage];
|
|
118
|
-
export interface Allocation {
|
|
119
|
-
variation: VariationValue;
|
|
120
|
-
range: Range;
|
|
121
|
-
}
|
|
122
|
-
export interface Traffic {
|
|
123
|
-
key: RuleKey;
|
|
124
|
-
segments: GroupSegment | GroupSegment[] | "*";
|
|
125
|
-
percentage: Percentage;
|
|
126
|
-
enabled?: boolean;
|
|
127
|
-
variation?: VariationValue;
|
|
128
|
-
variables?: {
|
|
129
|
-
[key: string]: VariableValue;
|
|
130
|
-
};
|
|
131
|
-
allocation: Allocation[];
|
|
132
|
-
}
|
|
133
|
-
export type PlainBucketBy = AttributeKey;
|
|
134
|
-
export type AndBucketBy = AttributeKey[];
|
|
135
|
-
export interface OrBucketBy {
|
|
136
|
-
or: AttributeKey[];
|
|
137
|
-
}
|
|
138
|
-
export type BucketBy = PlainBucketBy | AndBucketBy | OrBucketBy;
|
|
139
|
-
export interface RequiredWithVariation {
|
|
140
|
-
key: FeatureKey;
|
|
141
|
-
variation: VariationValue;
|
|
142
|
-
}
|
|
143
|
-
export type Required = FeatureKey | RequiredWithVariation;
|
|
144
|
-
export interface Feature {
|
|
145
|
-
key: FeatureKey;
|
|
146
|
-
deprecated?: boolean;
|
|
147
|
-
required?: Required[];
|
|
148
|
-
variablesSchema?: VariableSchema[] | Record<VariableKey, VariableSchema>;
|
|
149
|
-
variations?: Variation[];
|
|
150
|
-
bucketBy: BucketBy;
|
|
151
|
-
traffic: Traffic[];
|
|
152
|
-
force?: Force[];
|
|
153
|
-
ranges?: Range[];
|
|
154
|
-
}
|
|
155
|
-
export interface DatafileContentV1 {
|
|
156
|
-
schemaVersion: string;
|
|
157
|
-
revision: string;
|
|
158
|
-
attributes: Attribute[];
|
|
159
|
-
segments: Segment[];
|
|
160
|
-
features: Feature[];
|
|
161
|
-
}
|
|
162
|
-
export interface DatafileContentV2 {
|
|
163
|
-
schemaVersion: string;
|
|
164
|
-
revision: string;
|
|
165
|
-
attributes: {
|
|
166
|
-
[key: AttributeKey]: Attribute;
|
|
167
|
-
};
|
|
168
|
-
segments: {
|
|
169
|
-
[key: SegmentKey]: Segment;
|
|
170
|
-
};
|
|
171
|
-
features: {
|
|
172
|
-
[key: FeatureKey]: Feature;
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
export type DatafileContent = DatafileContentV1 | DatafileContentV2;
|
|
176
|
-
export interface OverrideFeature {
|
|
177
|
-
enabled: boolean;
|
|
178
|
-
variation?: VariationValue;
|
|
179
|
-
variables?: {
|
|
180
|
-
[key: VariableKey]: VariableValue;
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
export interface StickyFeatures {
|
|
184
|
-
[key: FeatureKey]: OverrideFeature;
|
|
185
|
-
}
|
|
186
|
-
export type InitialFeatures = StickyFeatures;
|
|
187
|
-
/**
|
|
188
|
-
* YAML-only type
|
|
189
|
-
*/
|
|
190
|
-
export type Weight = number;
|
|
191
|
-
export type EnvironmentKey = string;
|
|
192
|
-
export type RuleKey = string;
|
|
193
|
-
export interface Rule {
|
|
194
|
-
key: RuleKey;
|
|
195
|
-
description?: string;
|
|
196
|
-
segments: GroupSegment | GroupSegment[];
|
|
197
|
-
percentage: Weight;
|
|
198
|
-
enabled?: boolean;
|
|
199
|
-
variation?: VariationValue;
|
|
200
|
-
variables?: {
|
|
201
|
-
[key: string]: VariableValue;
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
export type Tag = string;
|
|
205
|
-
export type Expose = boolean | Tag[];
|
|
206
|
-
export interface Environment {
|
|
207
|
-
expose?: Expose;
|
|
208
|
-
rules: Rule[];
|
|
209
|
-
force?: Force[];
|
|
210
|
-
}
|
|
211
|
-
export interface ParsedFeature {
|
|
212
|
-
key: FeatureKey;
|
|
213
|
-
archived?: boolean;
|
|
214
|
-
deprecated?: boolean;
|
|
215
|
-
description: string;
|
|
216
|
-
tags: Tag[];
|
|
217
|
-
required?: Required[];
|
|
218
|
-
bucketBy: BucketBy;
|
|
219
|
-
variablesSchema?: VariableSchema[];
|
|
220
|
-
variations?: Variation[];
|
|
221
|
-
environments?: {
|
|
222
|
-
[key: EnvironmentKey]: Environment;
|
|
223
|
-
};
|
|
224
|
-
expose?: Expose;
|
|
225
|
-
rules?: Rule[];
|
|
226
|
-
force?: Force[];
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* For maintaining old allocations info,
|
|
230
|
-
* allowing for gradual rollout of new allocations
|
|
231
|
-
* with consistent bucketing
|
|
232
|
-
*/
|
|
233
|
-
export interface ExistingFeature {
|
|
234
|
-
variations?: {
|
|
235
|
-
value: VariationValue;
|
|
236
|
-
weight: Weight;
|
|
237
|
-
}[];
|
|
238
|
-
traffic: {
|
|
239
|
-
key: RuleKey;
|
|
240
|
-
percentage: Percentage;
|
|
241
|
-
allocation: Allocation[];
|
|
242
|
-
}[];
|
|
243
|
-
ranges?: Range[];
|
|
244
|
-
}
|
|
245
|
-
export interface ExistingFeatures {
|
|
246
|
-
[key: FeatureKey]: ExistingFeature;
|
|
247
|
-
}
|
|
248
|
-
export interface ExistingState {
|
|
249
|
-
features: ExistingFeatures;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Tests
|
|
253
|
-
*/
|
|
254
|
-
export interface AssertionMatrix {
|
|
255
|
-
[key: string]: AttributeValue[];
|
|
256
|
-
}
|
|
257
|
-
export interface FeatureAssertion {
|
|
258
|
-
matrix?: AssertionMatrix;
|
|
259
|
-
description?: string;
|
|
260
|
-
environment: EnvironmentKey;
|
|
261
|
-
at: Weight;
|
|
262
|
-
context: Context;
|
|
263
|
-
expectedToBeEnabled: boolean;
|
|
264
|
-
expectedVariation?: VariationValue;
|
|
265
|
-
expectedVariables?: {
|
|
266
|
-
[key: VariableKey]: VariableValue;
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
export interface TestFeature {
|
|
270
|
-
feature: FeatureKey;
|
|
271
|
-
assertions: FeatureAssertion[];
|
|
272
|
-
}
|
|
273
|
-
export interface SegmentAssertion {
|
|
274
|
-
matrix?: AssertionMatrix;
|
|
275
|
-
description?: string;
|
|
276
|
-
context: Context;
|
|
277
|
-
expectedToMatch: boolean;
|
|
278
|
-
}
|
|
279
|
-
export interface TestSegment {
|
|
280
|
-
segment: SegmentKey;
|
|
281
|
-
assertions: SegmentAssertion[];
|
|
282
|
-
}
|
|
283
|
-
export type Test = TestSegment | TestFeature;
|
|
284
|
-
export interface TestResultAssertionError {
|
|
285
|
-
type: "flag" | "variation" | "variable" | "segment";
|
|
286
|
-
expected: string | number | boolean | Date | null | undefined;
|
|
287
|
-
actual: string | number | boolean | Date | null | undefined;
|
|
288
|
-
message?: string;
|
|
289
|
-
details?: object;
|
|
290
|
-
}
|
|
291
|
-
export interface TestResultAssertion {
|
|
292
|
-
description: string;
|
|
293
|
-
duration: number;
|
|
294
|
-
passed: boolean;
|
|
295
|
-
errors?: TestResultAssertionError[];
|
|
296
|
-
}
|
|
297
|
-
export interface TestResult {
|
|
298
|
-
type: "feature" | "segment";
|
|
299
|
-
key: string;
|
|
300
|
-
notFound?: boolean;
|
|
301
|
-
passed: boolean;
|
|
302
|
-
duration: number;
|
|
303
|
-
assertions: TestResultAssertion[];
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Site index and history
|
|
307
|
-
*/
|
|
308
|
-
export type EntityType = "attribute" | "segment" | "feature" | "group" | "test";
|
|
309
|
-
export type CommitHash = string;
|
|
310
|
-
export interface HistoryEntity {
|
|
311
|
-
type: EntityType;
|
|
312
|
-
key: string;
|
|
313
|
-
}
|
|
314
|
-
export interface HistoryEntry {
|
|
315
|
-
commit: CommitHash;
|
|
316
|
-
author: string;
|
|
317
|
-
timestamp: string;
|
|
318
|
-
entities: HistoryEntity[];
|
|
319
|
-
}
|
|
320
|
-
export interface LastModified {
|
|
321
|
-
commit: CommitHash;
|
|
322
|
-
timestamp: string;
|
|
323
|
-
author: string;
|
|
324
|
-
}
|
|
325
|
-
export interface SearchIndex {
|
|
326
|
-
links?: {
|
|
327
|
-
feature: string;
|
|
328
|
-
segment: string;
|
|
329
|
-
attribute: string;
|
|
330
|
-
commit: CommitHash;
|
|
331
|
-
};
|
|
332
|
-
projectConfig: {
|
|
333
|
-
tags: Tag[];
|
|
334
|
-
environments: EnvironmentKey[] | false;
|
|
335
|
-
};
|
|
336
|
-
entities: {
|
|
337
|
-
attributes: (Attribute & {
|
|
338
|
-
lastModified?: LastModified;
|
|
339
|
-
usedInSegments: SegmentKey[];
|
|
340
|
-
usedInFeatures: FeatureKey[];
|
|
341
|
-
})[];
|
|
342
|
-
segments: (Segment & {
|
|
343
|
-
lastModified?: LastModified;
|
|
344
|
-
usedInFeatures: FeatureKey[];
|
|
345
|
-
})[];
|
|
346
|
-
features: (ParsedFeature & {
|
|
347
|
-
lastModified?: LastModified;
|
|
348
|
-
})[];
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
export interface EntityDiff {
|
|
352
|
-
type: EntityType;
|
|
353
|
-
key: string;
|
|
354
|
-
created?: boolean;
|
|
355
|
-
deleted?: boolean;
|
|
356
|
-
updated?: boolean;
|
|
357
|
-
content?: string;
|
|
358
|
-
}
|
|
359
|
-
export interface Commit {
|
|
360
|
-
hash: CommitHash;
|
|
361
|
-
author: string;
|
|
362
|
-
timestamp: string;
|
|
363
|
-
entities: EntityDiff[];
|
|
364
|
-
}
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/webpack.config.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
|
|
3
|
-
const getWebpackConfig = require("../../tools/getWebpackConfig");
|
|
4
|
-
|
|
5
|
-
const wepbackConfig = getWebpackConfig({
|
|
6
|
-
entryFilePath: path.join(__dirname, "src", "index.ts"),
|
|
7
|
-
entryKey: "index",
|
|
8
|
-
outputDirectoryPath: path.join(__dirname, "dist"),
|
|
9
|
-
outputLibrary: "FeaturevisorTypes",
|
|
10
|
-
tsConfigFilePath: path.join(__dirname, "tsconfig.cjs.json"),
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
module.exports = wepbackConfig;
|