@featurevisor/core 0.14.1 → 0.15.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,17 @@
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.15.0](https://github.com/fahad19/featurevisor/compare/v0.14.1...v0.15.0) (2023-04-23)
7
+
8
+
9
+ ### Features
10
+
11
+ * JSON Schemas ([#58](https://github.com/fahad19/featurevisor/issues/58)) ([697536a](https://github.com/fahad19/featurevisor/commit/697536a0f08de81d78b853a00ece041fa1ff6405))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.14.1](https://github.com/fahad19/featurevisor/compare/v0.14.0...v0.14.1) (2023-04-22)
7
18
 
8
19
 
@@ -0,0 +1,5 @@
1
+ # JSON Schema
2
+
3
+ Featurevisor attribute, segment, and feature JSON schemas are defined in this directory.
4
+
5
+ They are not directly used anywhere in the codebase, and only kept here for reference.
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "archived": {
6
+ "type": "boolean",
7
+ "description": "Indicates whether the attribute is archived or not."
8
+ },
9
+ "description": {
10
+ "type": "string",
11
+ "description": "Human readable description of the attribute for documentation purposes."
12
+ },
13
+ "type": {
14
+ "type": "string",
15
+ "description": "Type of attribute. Allows values are: string, boolean, integer, and double."
16
+ },
17
+ "capture": {
18
+ "type": "boolean",
19
+ "description": "Mark this attribute as one for capturing during feature activation."
20
+ }
21
+ },
22
+ "description": "JSON Schema for creating Featurevisor attribute, expressed in YAML",
23
+ "required": ["description", "type"]
24
+ }
@@ -0,0 +1,289 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$defs": {
4
+ "variation_value": {
5
+ "anyOf": [
6
+ {
7
+ "type": "string"
8
+ },
9
+ {
10
+ "type": "number"
11
+ },
12
+ {
13
+ "type": "boolean"
14
+ }
15
+ ]
16
+ },
17
+ "flat_object": {
18
+ "type": "object",
19
+ "additionalProperties": {
20
+ "oneOf": [{ "type": "string" }, { "type": "boolean" }, { "type": "number" }]
21
+ }
22
+ },
23
+ "variable_value": {
24
+ "anyOf": [
25
+ {
26
+ "type": "string"
27
+ },
28
+ {
29
+ "type": "number"
30
+ },
31
+ {
32
+ "type": "boolean"
33
+ },
34
+ {
35
+ "type": "array",
36
+ "items": {
37
+ "type": "string"
38
+ }
39
+ },
40
+ {
41
+ "type": "object",
42
+ "properties": {
43
+ "key": {
44
+ "$ref": "#/$defs/flat_object"
45
+ }
46
+ }
47
+ }
48
+ ]
49
+ },
50
+ "variation": {
51
+ "type": "object",
52
+ "properties": {
53
+ "description": {
54
+ "type": "string",
55
+ "description": "Human readable description of the variation for documentation purposes."
56
+ },
57
+ "value": {
58
+ "$ref": "#/$defs/variation_value",
59
+ "description": "Value of the variation."
60
+ },
61
+ "weight": {
62
+ "type": "number",
63
+ "description": "Weight of the variation between 0 and 100 (inclusive).",
64
+ "minimum": 0,
65
+ "maximum": 100
66
+ },
67
+ "variables": {
68
+ "type": "object",
69
+ "properties": {
70
+ "key": {
71
+ "type": "string",
72
+ "description": "Key of the variable."
73
+ },
74
+ "value": {
75
+ "$ref": "#/$defs/variable_value",
76
+ "description": "Value of the variable."
77
+ },
78
+ "overrides": {
79
+ "type": "object",
80
+ "properties": {
81
+ "conditions": {
82
+ "$ref": "segment.json#/$defs/multiple_conditions",
83
+ "description": "Embedded conditions for overriding the variable"
84
+ },
85
+ "segments": {
86
+ "$ref": "#/$defs/segments",
87
+ "description": "Embedded conditions for overriding the variable"
88
+ },
89
+ "value": {
90
+ "$ref": "#/$defs/variable_value",
91
+ "description": "Value of the override."
92
+ }
93
+ },
94
+ "required": ["value"]
95
+ }
96
+ },
97
+ "description": "Variables for the variation.",
98
+ "required": ["key"]
99
+ }
100
+ },
101
+ "description": "Variation for the feature.",
102
+ "required": ["value"]
103
+ },
104
+ "segments": {
105
+ "oneOf": [
106
+ { "$ref": "#/$defs/segments_everyone" },
107
+ { "$ref": "#/$defs/segments_multiple" },
108
+ { "$ref": "#/$defs/segments_complex" }
109
+ ],
110
+ "description": "Array of segment keys"
111
+ },
112
+ "segments_everyone": {
113
+ "type": "string",
114
+ "description": "Target everyone",
115
+ "enum": ["*"]
116
+ },
117
+ "segments_single": {
118
+ "type": "string",
119
+ "description": "Target a specific segment"
120
+ },
121
+ "segments_complex": {
122
+ "oneOf": [
123
+ { "$ref": "#/$defs/segments_and" },
124
+ { "$ref": "#/$defs/segments_or" },
125
+ { "$ref": "#/$defs/segments_not" }
126
+ ]
127
+ },
128
+ "segments_and": {
129
+ "type": "object",
130
+ "properties": {
131
+ "and": {
132
+ "$ref": "#/$defs/segments_multiple"
133
+ }
134
+ },
135
+ "description": "Target segments with 'and' operator.",
136
+ "required": ["and"]
137
+ },
138
+ "segments_or": {
139
+ "type": "object",
140
+ "properties": {
141
+ "or": {
142
+ "$ref": "#/$defs/segments_multiple"
143
+ }
144
+ },
145
+ "description": "Target segments with 'or' operator.",
146
+ "required": ["or"]
147
+ },
148
+ "segments_not": {
149
+ "type": "object",
150
+ "properties": {
151
+ "or": {
152
+ "$ref": "#/$defs/segments_multiple"
153
+ }
154
+ },
155
+ "description": "Target segments with 'not' operator.",
156
+ "required": ["not"]
157
+ },
158
+ "segments_multiple": {
159
+ "type": "array",
160
+ "items": {
161
+ "oneOf": [{ "$ref": "#/$defs/segments_single" }, { "$ref": "#/$defs/segments_complex" }]
162
+ },
163
+ "description": "Target an array of segments"
164
+ }
165
+ },
166
+ "type": "object",
167
+ "properties": {
168
+ "archived": {
169
+ "type": "boolean",
170
+ "description": "Indicates whether the feature is archived or not."
171
+ },
172
+ "description": {
173
+ "type": "string",
174
+ "description": "Human readable description of the feature for documentation purposes."
175
+ },
176
+ "tags": {
177
+ "type": "array",
178
+ "items": {
179
+ "type": "string"
180
+ },
181
+ "description": "Array of tags"
182
+ },
183
+ "defaultVariation": {
184
+ "$ref": "#/$defs/variation_value",
185
+ "description": "Default variation for the feature."
186
+ },
187
+ "variablesSchema": {
188
+ "type": "object",
189
+ "properties": {
190
+ "key": {
191
+ "type": "string",
192
+ "description": "Key of the variable."
193
+ },
194
+ "type": {
195
+ "type": "string",
196
+ "description": "Type of this specific variable.",
197
+ "enum": ["string", "boolean", "integer", "double", "json", "array", "object"]
198
+ },
199
+ "defaultValue": {
200
+ "$ref": "#/$defs/variable_value",
201
+ "description": "Default value for this specific variable."
202
+ }
203
+ },
204
+ "description": "Schema for the feature's variables.",
205
+ "required": ["type"]
206
+ },
207
+ "variations": {
208
+ "type": "array",
209
+ "items": {
210
+ "$ref": "#/$defs/variation"
211
+ },
212
+ "description": "Array of variations for the feature."
213
+ },
214
+ "environments": {
215
+ "additionalProperties": {
216
+ "type": "object",
217
+ "properties": {
218
+ "exposed": {
219
+ "type": "boolean",
220
+ "description": "Indicates whether the feature is exposed to the environment."
221
+ },
222
+ "rules": {
223
+ "type": "array",
224
+ "items": {
225
+ "type": "object",
226
+ "properties": {
227
+ "key": {
228
+ "type": "string",
229
+ "description": "Unique key of the rule among its siblings."
230
+ },
231
+ "segments": {
232
+ "$ref": "#/$defs/segments",
233
+ "description": "Embedded conditions for the rule"
234
+ },
235
+ "percentage": {
236
+ "type": "number",
237
+ "description": "Percentage of the rule between 0 and 100 (inclusive).",
238
+ "minimum": 0,
239
+ "maximum": 100
240
+ },
241
+ "variation": {
242
+ "$ref": "#/$defs/variation_value",
243
+ "description": "Overriding variation value for this rule"
244
+ },
245
+ "variables": {
246
+ "additionalProperties": {
247
+ "$ref": "#/$defs/variable_value",
248
+ "description": "Overriding variable value for this rule"
249
+ }
250
+ }
251
+ }
252
+ },
253
+ "description": "Array of rules for the feature.",
254
+ "required": ["key", "percentage", "segments"]
255
+ },
256
+ "force": {
257
+ "type": "array",
258
+ "items": {
259
+ "type": "object",
260
+ "properties": {
261
+ "segments": {
262
+ "$ref": "#/$defs/segments",
263
+ "description": "Embedded segments"
264
+ },
265
+ "conditions": {
266
+ "$ref": "segment.json#/$defs/multiple_conditions"
267
+ },
268
+ "variation": {
269
+ "$ref": "#/$defs/variation_value",
270
+ "description": "Overriding variation value"
271
+ },
272
+ "variables": {
273
+ "additionalProperties": {
274
+ "$ref": "#/$defs/variable_value",
275
+ "description": "Overriding variable value"
276
+ }
277
+ }
278
+ }
279
+ }
280
+ }
281
+ },
282
+ "description": "Environment specific configuration for the feature.",
283
+ "required": ["rules"]
284
+ }
285
+ }
286
+ },
287
+ "description": "JSON Schema for creating Featurevisor feature, expressed in YAML",
288
+ "required": ["description", "tags", "defaultVariation", "variations"]
289
+ }
@@ -0,0 +1,102 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$defs": {
4
+ "multiple_conditions": {
5
+ "type": "array",
6
+ "items": {
7
+ "anyOf": [{ "$ref": "#/$defs/plain_condition" }, { "$ref": "#/$defs/complex_condition" }]
8
+ }
9
+ },
10
+ "plain_condition": {
11
+ "type": "object",
12
+ "properties": {
13
+ "attribute": {
14
+ "type": "string",
15
+ "description": "Name of the attribute to be used in the condition."
16
+ },
17
+ "operator": {
18
+ "type": "string",
19
+ "description": "Operator to be used in the condition. Allowed values are: equals, notEquals, greaterThan, greaterThanOrEquals, lessThan, lessThanOrEquals, contains, notContains, startsWith, endsWith, semverEquals, semverNotEquals, semverGreaterThan, semverGreaterThanOrEquals, semverLessThan, semverLessThanOrEquals, in, notIn."
20
+ },
21
+ "value": {
22
+ "type": ["string", "number", "boolean", "array"],
23
+ "description": "Value to be used in the condition. Can be a string, number, boolean, or array of strings."
24
+ }
25
+ },
26
+ "required": ["attribute", "operator", "value"]
27
+ },
28
+ "complex_condition": {
29
+ "type": "object",
30
+ "oneOf": [
31
+ { "$ref": "#/$defs/and_condition" },
32
+ { "$ref": "#/$defs/or_condition" },
33
+ { "$ref": "#/$defs/not_condition" }
34
+ ]
35
+ },
36
+ "and_condition": {
37
+ "type": "object",
38
+ "properties": {
39
+ "and": {
40
+ "type": "array",
41
+ "items": {
42
+ "anyOf": [
43
+ { "$ref": "#/$defs/simple_condition" },
44
+ { "$ref": "#/$defs/complex_condition" }
45
+ ]
46
+ },
47
+ "description": "The list of conditions to be combined with the 'and' operator."
48
+ }
49
+ },
50
+ "required": ["and"]
51
+ },
52
+ "or_condition": {
53
+ "type": "object",
54
+ "properties": {
55
+ "or": {
56
+ "type": "array",
57
+ "items": {
58
+ "anyOf": [
59
+ { "$ref": "#/$defs/simple_condition" },
60
+ { "$ref": "#/$defs/complex_condition" }
61
+ ]
62
+ },
63
+ "description": "The list of conditions to be combined with the 'or' operator."
64
+ }
65
+ },
66
+ "required": ["or"]
67
+ },
68
+ "not_condition": {
69
+ "type": "object",
70
+ "properties": {
71
+ "or": {
72
+ "type": "array",
73
+ "items": {
74
+ "anyOf": [
75
+ { "$ref": "#/$defs/simple_condition" },
76
+ { "$ref": "#/$defs/complex_condition" }
77
+ ]
78
+ },
79
+ "description": "The list of conditions to be combined with the 'not' operator."
80
+ }
81
+ },
82
+ "required": ["not"]
83
+ }
84
+ },
85
+ "type": "object",
86
+ "properties": {
87
+ "archived": {
88
+ "type": "boolean",
89
+ "description": "Indicates whether the segment is archived or not."
90
+ },
91
+ "description": {
92
+ "type": "string",
93
+ "description": "Human readable description of the segment for documentation purposes."
94
+ },
95
+ "conditions": {
96
+ "oneOf": [{ "$ref": "#/$defs/multiple_conditions" }, { "$ref": "#/$defs/complex_condition" }],
97
+ "description": "The set of conditions to be evaluated for the segment."
98
+ }
99
+ },
100
+ "description": "JSON Schema for creating Featurevisor segment, expressed in YAML",
101
+ "required": ["description", "conditions"]
102
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/core",
3
- "version": "0.14.1",
3
+ "version": "0.15.0",
4
4
  "description": "Core package of Featurevisor for Node.js usage",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -41,9 +41,9 @@
41
41
  },
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
- "@featurevisor/sdk": "^0.14.1",
45
- "@featurevisor/site": "^0.14.1",
46
- "@featurevisor/types": "^0.14.1",
44
+ "@featurevisor/sdk": "^0.15.0",
45
+ "@featurevisor/site": "^0.15.0",
46
+ "@featurevisor/types": "^0.15.0",
47
47
  "axios": "^1.3.4",
48
48
  "joi": "^17.8.3",
49
49
  "js-yaml": "^4.1.0",
@@ -54,5 +54,5 @@
54
54
  "@types/js-yaml": "^4.0.5",
55
55
  "@types/tar": "^6.1.4"
56
56
  },
57
- "gitHead": "3ddcffdba992a36b564cf4471f0e4982cfd9fc83"
57
+ "gitHead": "254d79ee3bcbd5d9c2f771f66e653ffe5512176e"
58
58
  }