@featurevisor/types 0.27.0 → 0.29.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 CHANGED
@@ -3,6 +3,28 @@
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.29.0](https://github.com/fahad19/featurevisor/compare/v0.28.1...v0.29.0) (2023-06-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * drop Allocation.percentage in datafiles ([#80](https://github.com/fahad19/featurevisor/issues/80)) ([b43da69](https://github.com/fahad19/featurevisor/commit/b43da6922f81aef9fe8e8a54342067627adb990b))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.28.0](https://github.com/fahad19/featurevisor/compare/v0.27.1...v0.28.0) (2023-06-08)
18
+
19
+
20
+ ### Features
21
+
22
+ * make bucketing key configurable ([#79](https://github.com/fahad19/featurevisor/issues/79)) ([c05f0da](https://github.com/fahad19/featurevisor/commit/c05f0dae9e6e1d4ee68f2c457a49137bbd6727d9))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.27.0](https://github.com/fahad19/featurevisor/compare/v0.26.0...v0.27.0) (2023-05-24)
7
29
 
8
30
  **Note:** Version bump only for package @featurevisor/types
package/lib/index.d.ts CHANGED
@@ -108,15 +108,9 @@ export type BucketValue = number;
108
108
  * Datafile-only types
109
109
  */
110
110
  export type Percentage = number;
111
- export interface RangeObject {
112
- start: Percentage;
113
- end: Percentage;
114
- }
115
- export type RangeTuple = [Percentage, Percentage];
116
- export type Range = RangeObject | RangeTuple;
111
+ export type Range = [Percentage, Percentage];
117
112
  export interface Allocation {
118
113
  variation: VariationValue;
119
- percentage?: Percentage;
120
114
  range: Range;
121
115
  }
122
116
  export interface Traffic {
@@ -129,7 +123,12 @@ export interface Traffic {
129
123
  };
130
124
  allocation: Allocation[];
131
125
  }
132
- export type BucketBy = AttributeKey | AttributeKey[];
126
+ export type PlainBucketBy = AttributeKey;
127
+ export type AndBucketBy = AttributeKey[];
128
+ export interface OrBucketBy {
129
+ or: AttributeKey[];
130
+ }
131
+ export type BucketBy = PlainBucketBy | AndBucketBy | OrBucketBy;
133
132
  export interface Feature {
134
133
  key: FeatureKey;
135
134
  defaultVariation: VariationValue;
@@ -180,7 +179,7 @@ export interface ParsedFeature {
180
179
  archived: boolean;
181
180
  description: string;
182
181
  tags: string[];
183
- bucketBy?: AttributeKey | AttributeKey[];
182
+ bucketBy: BucketBy;
184
183
  defaultVariation: VariationValue;
185
184
  variablesSchema?: VariableSchema[];
186
185
  variations: Variation[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/types",
3
- "version": "0.27.0",
3
+ "version": "0.29.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": "ed546c01c10cc8fa9df9a9c8c6bc622af90c67f8"
44
+ "gitHead": "a58d59a7de4df79575589520415b261cae519b1c"
45
45
  }
package/src/index.ts CHANGED
@@ -199,19 +199,10 @@ export type BucketValue = number; // 0 to 100,000 (100% * 1000 to include three
199
199
  */
200
200
  export type Percentage = number; // 0 to 100,000 (100% * 1000 to include three decimal places in same integer)
201
201
 
202
- // @TODO: remove this in next breaking semver
203
- export interface RangeObject {
204
- start: Percentage; // 0 to 100k
205
- end: Percentage; // 0 to 100k
206
- }
207
-
208
- export type RangeTuple = [Percentage, Percentage]; // 0 to 100k
209
-
210
- export type Range = RangeObject | RangeTuple;
202
+ export type Range = [Percentage, Percentage]; // 0 to 100k
211
203
 
212
204
  export interface Allocation {
213
205
  variation: VariationValue;
214
- percentage?: Percentage; // @TODO: remove it in next breaking semver
215
206
  range: Range; // @TODO: in future, turn it into `ranges`, so that Allocations with same variation do not repeat
216
207
  }
217
208
 
@@ -226,11 +217,16 @@ export interface Traffic {
226
217
  allocation: Allocation[];
227
218
  }
228
219
 
229
- export type BucketBy = AttributeKey | AttributeKey[]; // @TODO: have first available attribute as well?
220
+ export type PlainBucketBy = AttributeKey;
221
+ export type AndBucketBy = AttributeKey[];
222
+ export interface OrBucketBy {
223
+ or: AttributeKey[];
224
+ }
225
+ export type BucketBy = PlainBucketBy | AndBucketBy | OrBucketBy;
226
+
230
227
  export interface Feature {
231
228
  key: FeatureKey;
232
229
  // @TODO: introduce new `parent` key?
233
- // @TODO: introduce `type` for distinguishing between feature flags and experiments?
234
230
  defaultVariation: VariationValue;
235
231
  variablesSchema?: VariableSchema[];
236
232
  variations: Variation[];
@@ -290,7 +286,7 @@ export interface ParsedFeature {
290
286
  description: string;
291
287
  tags: string[];
292
288
 
293
- bucketBy?: AttributeKey | AttributeKey[]; // @TODO: have first available attribute as well?
289
+ bucketBy: BucketBy;
294
290
 
295
291
  defaultVariation: VariationValue;
296
292
  variablesSchema?: VariableSchema[];