@featurevisor/types 2.7.0 → 2.12.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 +22 -0
- package/package.json +2 -2
- package/src/datafile.d.ts +2 -1
- package/src/feature.d.ts +59 -18
- package/src/index.d.ts +1 -0
- package/src/schema.d.ts +59 -0
- package/src/site.d.ts +1 -1
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
|
+
# [2.12.0](https://github.com/featurevisor/featurevisor/compare/v2.11.0...v2.12.0) (2026-02-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* reusable schemas ([#390](https://github.com/featurevisor/featurevisor/issues/390)) ([fa32095](https://github.com/featurevisor/featurevisor/commit/fa3209554c08bdc2c7cc3dd8af8f8fc51213e7be))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.10.0](https://github.com/featurevisor/featurevisor/compare/v2.9.0...v2.10.0) (2026-02-15)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* typed arrays and objects as variables ([#388](https://github.com/featurevisor/featurevisor/issues/388)) ([5909f42](https://github.com/featurevisor/featurevisor/commit/5909f42b93c55a71d3f43fd7a2a58287ac82af7f))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [2.7.0](https://github.com/featurevisor/featurevisor/compare/v2.6.7...v2.7.0) (2026-02-05)
|
|
7
29
|
|
|
8
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featurevisor/types",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Common Typescript types for Featurevisor",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/featurevisor/featurevisor/issues"
|
|
48
48
|
},
|
|
49
49
|
"license": "MIT",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d7542c7da3615c821b031912e4d12ca4c81e5db2"
|
|
51
51
|
}
|
package/src/datafile.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
Required,
|
|
10
10
|
VariableKey,
|
|
11
11
|
VariableSchema,
|
|
12
|
+
ResolvedVariableSchema,
|
|
12
13
|
Variation,
|
|
13
14
|
Force,
|
|
14
15
|
VariationV1,
|
|
@@ -46,7 +47,7 @@ export interface Feature {
|
|
|
46
47
|
hash?: string;
|
|
47
48
|
deprecated?: boolean;
|
|
48
49
|
required?: Required[];
|
|
49
|
-
variablesSchema?: Record<VariableKey,
|
|
50
|
+
variablesSchema?: Record<VariableKey, ResolvedVariableSchema>;
|
|
50
51
|
disabledVariationValue?: VariationValue;
|
|
51
52
|
variations?: Variation[];
|
|
52
53
|
bucketBy: BucketBy;
|
package/src/feature.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import type { BucketBy } from "./bucket";
|
|
2
2
|
import type { Condition } from "./condition";
|
|
3
3
|
import type { GroupSegment } from "./segment";
|
|
4
|
+
import type { SchemaType, Value, Schema, SchemaKey } from "./schema";
|
|
4
5
|
|
|
5
6
|
export type VariationValue = string;
|
|
6
7
|
|
|
7
8
|
export type VariableKey = string;
|
|
8
|
-
export type VariableType =
|
|
9
|
-
| "boolean"
|
|
10
|
-
| "string"
|
|
11
|
-
| "integer"
|
|
12
|
-
| "double"
|
|
13
|
-
| "array"
|
|
14
|
-
| "object"
|
|
15
|
-
| "json";
|
|
16
|
-
export interface VariableObjectValue {
|
|
17
|
-
[key: string]: VariableValue;
|
|
18
|
-
}
|
|
9
|
+
export type VariableType = SchemaType | "json";
|
|
19
10
|
export type VariableValue =
|
|
20
|
-
|
|
|
21
|
-
|
|
22
|
-
| number
|
|
23
|
-
| string[]
|
|
24
|
-
| VariableObjectValue
|
|
11
|
+
| Value
|
|
12
|
+
// @TODO: consider removing below items
|
|
25
13
|
| null
|
|
26
14
|
| undefined;
|
|
27
15
|
|
|
@@ -71,16 +59,69 @@ export interface Variation {
|
|
|
71
59
|
};
|
|
72
60
|
}
|
|
73
61
|
|
|
74
|
-
|
|
62
|
+
/** Variable schema that references a reusable schema by key. No type/properties/required/items. */
|
|
63
|
+
export interface VariableSchemaWithReference {
|
|
75
64
|
deprecated?: boolean;
|
|
76
65
|
key?: VariableKey; // @NOTE: remove
|
|
77
|
-
|
|
66
|
+
schema: SchemaKey;
|
|
67
|
+
|
|
78
68
|
defaultValue: VariableValue;
|
|
79
69
|
description?: string; // only available in YAML files
|
|
80
70
|
useDefaultWhenDisabled?: boolean;
|
|
81
71
|
disabledValue?: VariableValue;
|
|
82
72
|
}
|
|
83
73
|
|
|
74
|
+
/** Variable schema with inline type and optional structure. */
|
|
75
|
+
export interface VariableSchemaWithInline {
|
|
76
|
+
deprecated?: boolean;
|
|
77
|
+
key?: VariableKey; // @NOTE: remove
|
|
78
|
+
type?: VariableType; // required when not using oneOf
|
|
79
|
+
|
|
80
|
+
properties?: Schema; // if type is object
|
|
81
|
+
required?: Schema["required"]; // if type is object
|
|
82
|
+
items?: Schema["items"]; // if type is array
|
|
83
|
+
oneOf?: Schema[]; // value must match exactly one of these (mutually exclusive with type at top level when used)
|
|
84
|
+
enum?: Value[];
|
|
85
|
+
const?: VariableValue;
|
|
86
|
+
|
|
87
|
+
// Numeric validation (when type is "integer" or "double")
|
|
88
|
+
minimum?: number;
|
|
89
|
+
maximum?: number;
|
|
90
|
+
|
|
91
|
+
// String validation (when type is "string")
|
|
92
|
+
minLength?: number;
|
|
93
|
+
maxLength?: number;
|
|
94
|
+
pattern?: string;
|
|
95
|
+
|
|
96
|
+
// Array validation (when type is "array")
|
|
97
|
+
minItems?: number;
|
|
98
|
+
maxItems?: number;
|
|
99
|
+
uniqueItems?: boolean;
|
|
100
|
+
|
|
101
|
+
defaultValue: VariableValue;
|
|
102
|
+
description?: string; // only available in YAML files
|
|
103
|
+
useDefaultWhenDisabled?: boolean;
|
|
104
|
+
disabledValue?: VariableValue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Either a reference to a reusable schema or an inline variable schema. */
|
|
108
|
+
export type VariableSchema = VariableSchemaWithReference | VariableSchemaWithInline;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Variable schema as emitted in the datafile (schema refs resolved to type only).
|
|
112
|
+
* Used by SDK and datafile; only `type` is kept from the schema for datafile size.
|
|
113
|
+
*/
|
|
114
|
+
export interface ResolvedVariableSchema {
|
|
115
|
+
deprecated?: boolean;
|
|
116
|
+
key?: VariableKey;
|
|
117
|
+
type: VariableType;
|
|
118
|
+
|
|
119
|
+
defaultValue: VariableValue;
|
|
120
|
+
description?: string;
|
|
121
|
+
useDefaultWhenDisabled?: boolean;
|
|
122
|
+
disabledValue?: VariableValue;
|
|
123
|
+
}
|
|
124
|
+
|
|
84
125
|
export type FeatureKey = string;
|
|
85
126
|
|
|
86
127
|
export interface RequiredWithVariation {
|
package/src/index.d.ts
CHANGED
package/src/schema.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type SchemaKey = string;
|
|
2
|
+
|
|
3
|
+
export type ObjectValue = { [key: string]: Value };
|
|
4
|
+
export type Value =
|
|
5
|
+
| boolean
|
|
6
|
+
| string
|
|
7
|
+
| number // covers integer and double
|
|
8
|
+
// | Date // @TODO: support in future
|
|
9
|
+
| ObjectValue
|
|
10
|
+
| Value[];
|
|
11
|
+
|
|
12
|
+
export type SchemaType =
|
|
13
|
+
| "boolean"
|
|
14
|
+
| "string"
|
|
15
|
+
| "integer"
|
|
16
|
+
| "double"
|
|
17
|
+
| "object"
|
|
18
|
+
// | "date" // @TODO: support in future
|
|
19
|
+
| "array";
|
|
20
|
+
|
|
21
|
+
// adapted JSON Schema for Featurevisor
|
|
22
|
+
export interface Schema {
|
|
23
|
+
// Basic metadata
|
|
24
|
+
description?: string;
|
|
25
|
+
|
|
26
|
+
// General validation keywords
|
|
27
|
+
type?: SchemaType;
|
|
28
|
+
enum?: Value[];
|
|
29
|
+
const?: Value;
|
|
30
|
+
|
|
31
|
+
// Numeric validation keywords (when type is "integer" or "double")
|
|
32
|
+
maximum?: number;
|
|
33
|
+
minimum?: number;
|
|
34
|
+
|
|
35
|
+
// String validation keywords (when type is "string")
|
|
36
|
+
maxLength?: number;
|
|
37
|
+
minLength?: number;
|
|
38
|
+
pattern?: string;
|
|
39
|
+
|
|
40
|
+
// Array validation keywords (when type is "array")
|
|
41
|
+
items?: Schema;
|
|
42
|
+
maxItems?: number;
|
|
43
|
+
minItems?: number;
|
|
44
|
+
uniqueItems?: boolean;
|
|
45
|
+
|
|
46
|
+
// Object validation keywords
|
|
47
|
+
required?: string[];
|
|
48
|
+
properties?: { [key: string]: Schema };
|
|
49
|
+
|
|
50
|
+
// Annotations
|
|
51
|
+
// default?: Value;
|
|
52
|
+
// examples?: Value[];
|
|
53
|
+
|
|
54
|
+
// when referencing another Schema by name
|
|
55
|
+
schema?: SchemaKey;
|
|
56
|
+
|
|
57
|
+
// oneOf: value must match exactly one of the given schemas (reusable Schema level only)
|
|
58
|
+
oneOf?: Schema[];
|
|
59
|
+
}
|
package/src/site.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Attribute } from "./attribute";
|
|
|
2
2
|
import type { Segment, SegmentKey } from "./segment";
|
|
3
3
|
import type { Tag, EnvironmentKey, FeatureKey, ParsedFeature } from "./feature";
|
|
4
4
|
|
|
5
|
-
export type EntityType = "attribute" | "segment" | "feature" | "group" | "test";
|
|
5
|
+
export type EntityType = "attribute" | "segment" | "feature" | "group" | "schema" | "test";
|
|
6
6
|
|
|
7
7
|
export type CommitHash = string;
|
|
8
8
|
|