@featurevisor/types 0.18.0 → 0.20.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.20.0](https://github.com/fahad19/featurevisor/compare/v0.19.0...v0.20.0) (2023-05-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * SDK Instance from a single class ([#68](https://github.com/fahad19/featurevisor/issues/68)) ([1ab1d49](https://github.com/fahad19/featurevisor/commit/1ab1d49916fd4ccd14d5ec47d11e6bd863fd0af1))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.19.0](https://github.com/fahad19/featurevisor/compare/v0.18.0...v0.19.0) (2023-05-13)
18
+
19
+
20
+ ### Features
21
+
22
+ * Date comparison operators ([#67](https://github.com/fahad19/featurevisor/issues/67)) ([b555f39](https://github.com/fahad19/featurevisor/commit/b555f39a0cb99e95e1d66a3c76df4483a26e2caf))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.18.0](https://github.com/fahad19/featurevisor/compare/v0.17.0...v0.18.0) (2023-05-12)
7
29
 
8
30
 
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type AttributeKey = string;
2
- export type AttributeValue = string | number | boolean | null | undefined;
2
+ export type AttributeValue = string | number | boolean | Date | null | undefined;
3
3
  export interface Attributes {
4
4
  [key: AttributeKey]: AttributeValue;
5
5
  }
@@ -9,8 +9,8 @@ export interface Attribute {
9
9
  type: AttributeValue;
10
10
  capture?: boolean;
11
11
  }
12
- export type Operator = "equals" | "notEquals" | "greaterThan" | "greaterThanOrEquals" | "lessThan" | "lessThanOrEquals" | "contains" | "notContains" | "startsWith" | "endsWith" | "semverEquals" | "semverNotEquals" | "semverGreaterThan" | "semverGreaterThanOrEquals" | "semverLessThan" | "semverLessThanOrEquals" | "in" | "notIn";
13
- export type ConditionValue = string | number | boolean | null | undefined | string[];
12
+ export type Operator = "equals" | "notEquals" | "greaterThan" | "greaterThanOrEquals" | "lessThan" | "lessThanOrEquals" | "contains" | "notContains" | "startsWith" | "endsWith" | "semverEquals" | "semverNotEquals" | "semverGreaterThan" | "semverGreaterThanOrEquals" | "semverLessThan" | "semverLessThanOrEquals" | "before" | "after" | "in" | "notIn";
13
+ export type ConditionValue = string | number | boolean | Date | null | undefined | string[];
14
14
  export interface PlainCondition {
15
15
  attribute: AttributeKey;
16
16
  operator: Operator;
@@ -209,6 +209,31 @@ export interface ExistingFeatures {
209
209
  export interface ExistingState {
210
210
  features: ExistingFeatures;
211
211
  }
212
+ /**
213
+ * Tests
214
+ */
215
+ export interface Assertion {
216
+ description?: string;
217
+ at: Weight;
218
+ attributes: Attributes;
219
+ expectedVariation?: VariationValue;
220
+ expectedVariables?: {
221
+ [key: VariableKey]: VariableValue;
222
+ };
223
+ }
224
+ export interface TestFeature {
225
+ key: string;
226
+ assertions: Assertion[];
227
+ }
228
+ export interface Test {
229
+ description?: string;
230
+ tag: string;
231
+ environment: string;
232
+ features: TestFeature[];
233
+ }
234
+ export interface Spec {
235
+ tests: Test[];
236
+ }
212
237
  /**
213
238
  * Site index and history
214
239
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/types",
3
- "version": "0.18.0",
3
+ "version": "0.20.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": "9de4cc7d1e0bf04f43d03db047ee7be331109359"
44
+ "gitHead": "5ff80372509757b26872509d74e33bedb93d543c"
45
45
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type AttributeKey = string;
2
2
 
3
- export type AttributeValue = string | number | boolean | null | undefined;
3
+ export type AttributeValue = string | number | boolean | Date | null | undefined;
4
4
 
5
5
  export interface Attributes {
6
6
  [key: AttributeKey]: AttributeValue;
@@ -37,11 +37,15 @@ export type Operator =
37
37
  | "semverLessThan"
38
38
  | "semverLessThanOrEquals"
39
39
 
40
+ // date comparisons
41
+ | "before"
42
+ | "after"
43
+
40
44
  // array of strings
41
45
  | "in"
42
46
  | "notIn";
43
47
 
44
- export type ConditionValue = string | number | boolean | null | undefined | string[];
48
+ export type ConditionValue = string | number | boolean | Date | null | undefined | string[];
45
49
 
46
50
  export interface PlainCondition {
47
51
  attribute: AttributeKey;
@@ -320,6 +324,35 @@ export interface ExistingState {
320
324
  features: ExistingFeatures;
321
325
  }
322
326
 
327
+ /**
328
+ * Tests
329
+ */
330
+ export interface Assertion {
331
+ description?: string;
332
+ at: Weight; // bucket weight: 0 to 100
333
+ attributes: Attributes;
334
+ expectedVariation?: VariationValue;
335
+ expectedVariables?: {
336
+ [key: VariableKey]: VariableValue;
337
+ };
338
+ }
339
+
340
+ export interface TestFeature {
341
+ key: string;
342
+ assertions: Assertion[];
343
+ }
344
+
345
+ export interface Test {
346
+ description?: string;
347
+ tag: string;
348
+ environment: string;
349
+ features: TestFeature[];
350
+ }
351
+
352
+ export interface Spec {
353
+ tests: Test[];
354
+ }
355
+
323
356
  /**
324
357
  * Site index and history
325
358
  */