@featurevisor/types 0.15.0 → 0.17.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.17.0](https://github.com/fahad19/featurevisor/compare/v0.16.0...v0.17.0) (2023-05-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * sticky features ([#65](https://github.com/fahad19/featurevisor/issues/65)) ([eb4ff69](https://github.com/fahad19/featurevisor/commit/eb4ff69dcb3d6f979eb1c9dec3fe4cf1583e1fc9))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.16.0](https://github.com/fahad19/featurevisor/compare/v0.15.0...v0.16.0) (2023-04-30)
18
+
19
+
20
+ ### Features
21
+
22
+ * Mutually exclusive experiments via Groups ([#63](https://github.com/fahad19/featurevisor/issues/63)) ([f3c8523](https://github.com/fahad19/featurevisor/commit/f3c85236d36fd0e499897f9ce1c2ed551c111523))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.15.0](https://github.com/fahad19/featurevisor/compare/v0.14.1...v0.15.0) (2023-04-23)
7
29
 
8
30
  **Note:** Version bump only for package @featurevisor/types
package/lib/index.d.ts CHANGED
@@ -93,15 +93,29 @@ export interface Force {
93
93
  [key: string]: VariableValue;
94
94
  };
95
95
  }
96
+ export interface Slot {
97
+ feature: FeatureKey | false;
98
+ percentage: Weight;
99
+ }
100
+ export interface Group {
101
+ key: string;
102
+ description: string;
103
+ slots: Slot[];
104
+ }
96
105
  export type BucketKey = string;
97
106
  export type BucketValue = number;
98
107
  /**
99
108
  * Datafile-only types
100
109
  */
101
110
  export type Percentage = number;
111
+ export interface Range {
112
+ start: Percentage;
113
+ end: Percentage;
114
+ }
102
115
  export interface Allocation {
103
116
  variation: VariationValue;
104
- percentage: Percentage;
117
+ percentage?: Percentage;
118
+ range: Range;
105
119
  }
106
120
  export interface Traffic {
107
121
  key: RuleKey;
@@ -130,6 +144,14 @@ export interface DatafileContent {
130
144
  segments: Segment[];
131
145
  features: Feature[];
132
146
  }
147
+ export interface StickyFeatures {
148
+ [key: FeatureKey]: {
149
+ variation: VariationValue;
150
+ variables?: {
151
+ [key: VariableKey]: VariableValue;
152
+ };
153
+ };
154
+ }
133
155
  /**
134
156
  * YAML-only type
135
157
  */
@@ -178,6 +200,7 @@ export interface ExistingFeature {
178
200
  percentage: Percentage;
179
201
  allocation: Allocation[];
180
202
  }[];
203
+ ranges?: Range[];
181
204
  }
182
205
  export interface ExistingFeatures {
183
206
  [key: FeatureKey]: ExistingFeature;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/types",
3
- "version": "0.15.0",
3
+ "version": "0.17.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": "254d79ee3bcbd5d9c2f771f66e653ffe5512176e"
44
+ "gitHead": "4e00e7a43d21c668f2a313750c22613dbd0b3ad3"
45
45
  }
package/src/index.ts CHANGED
@@ -176,6 +176,17 @@ export interface Force {
176
176
  };
177
177
  }
178
178
 
179
+ export interface Slot {
180
+ feature: FeatureKey | false;
181
+ percentage: Weight; // 0 to 100
182
+ }
183
+
184
+ export interface Group {
185
+ key: string;
186
+ description: string;
187
+ slots: Slot[];
188
+ }
189
+
179
190
  export type BucketKey = string;
180
191
  export type BucketValue = number; // 0 to 100,000 (100% * 1000 to include three decimal places in same integer)
181
192
 
@@ -184,9 +195,15 @@ export type BucketValue = number; // 0 to 100,000 (100% * 1000 to include three
184
195
  */
185
196
  export type Percentage = number; // 0 to 100,000 (100% * 1000 to include three decimal places in same integer)
186
197
 
198
+ export interface Range {
199
+ start: Percentage; // 0 to 100k
200
+ end: Percentage; // 0 to 100k
201
+ }
202
+
187
203
  export interface Allocation {
188
204
  variation: VariationValue;
189
- percentage: Percentage;
205
+ percentage?: Percentage; // @TODO: remove it in next breaking semver
206
+ range: Range; // @TODO: in future, turn it into `ranges`, so that Allocations with same variation do not repeat
190
207
  }
191
208
 
192
209
  export interface Traffic {
@@ -221,6 +238,15 @@ export interface DatafileContent {
221
238
  features: Feature[];
222
239
  }
223
240
 
241
+ export interface StickyFeatures {
242
+ [key: FeatureKey]: {
243
+ variation: VariationValue;
244
+ variables?: {
245
+ [key: VariableKey]: VariableValue;
246
+ };
247
+ };
248
+ }
249
+
224
250
  /**
225
251
  * YAML-only type
226
252
  */
@@ -281,6 +307,7 @@ export interface ExistingFeature {
281
307
  percentage: Percentage;
282
308
  allocation: Allocation[];
283
309
  }[];
310
+ ranges?: Range[]; // if in a Group, these are the available slot ranges
284
311
  }
285
312
 
286
313
  export interface ExistingFeatures {