@featurevisor/core 0.37.1 → 0.39.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 +19 -0
- package/coverage/clover.xml +110 -106
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +21 -21
- package/coverage/lcov-report/lib/allocator.js.html +1 -1
- package/coverage/lcov-report/lib/index.html +15 -15
- package/coverage/lcov-report/lib/traffic.js.html +44 -29
- package/coverage/lcov-report/src/allocator.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +15 -15
- package/coverage/lcov-report/src/traffic.ts.html +48 -30
- package/coverage/lcov.info +197 -182
- package/lib/builder.d.ts +9 -1
- package/lib/builder.js +65 -53
- package/lib/builder.js.map +1 -1
- package/lib/generate-code/typescript.js +2 -2
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/linter.js +11 -11
- package/lib/linter.js.map +1 -1
- package/lib/site.js +27 -25
- package/lib/site.js.map +1 -1
- package/lib/tester.js +14 -1
- package/lib/tester.js.map +1 -1
- package/lib/traffic.d.ts +2 -2
- package/lib/traffic.js +23 -18
- package/lib/traffic.js.map +1 -1
- package/package.json +5 -5
- package/src/builder.ts +83 -61
- package/src/generate-code/typescript.ts +6 -2
- package/src/linter.ts +11 -16
- package/src/site.ts +29 -27
- package/src/tester.ts +18 -1
- package/src/traffic.ts +29 -23
package/coverage/lcov.info
CHANGED
|
@@ -47,22 +47,22 @@ end_of_record
|
|
|
47
47
|
TN:
|
|
48
48
|
SF:lib/traffic.js
|
|
49
49
|
FN:6,detectIfVariationsChanged
|
|
50
|
-
FN:
|
|
50
|
+
FN:12,(anonymous_1)
|
|
51
51
|
FN:17,(anonymous_2)
|
|
52
|
-
FN:
|
|
53
|
-
FN:
|
|
54
|
-
FN:
|
|
55
|
-
FN:
|
|
56
|
-
FN:
|
|
57
|
-
FN:
|
|
58
|
-
FN:
|
|
59
|
-
FN:
|
|
60
|
-
FN:
|
|
52
|
+
FN:26,getRulePercentageDiff
|
|
53
|
+
FN:35,detectIfRangesChanged
|
|
54
|
+
FN:46,getTraffic
|
|
55
|
+
FN:56,(anonymous_6)
|
|
56
|
+
FN:75,(anonymous_7)
|
|
57
|
+
FN:86,(anonymous_8)
|
|
58
|
+
FN:98,(anonymous_9)
|
|
59
|
+
FN:105,(anonymous_10)
|
|
60
|
+
FN:114,(anonymous_11)
|
|
61
61
|
FNF:12
|
|
62
62
|
FNH:12
|
|
63
63
|
FNDA:9,detectIfVariationsChanged
|
|
64
|
-
FNDA:
|
|
65
|
-
FNDA:
|
|
64
|
+
FNDA:15,(anonymous_1)
|
|
65
|
+
FNDA:16,(anonymous_2)
|
|
66
66
|
FNDA:9,getRulePercentageDiff
|
|
67
67
|
FNDA:9,detectIfRangesChanged
|
|
68
68
|
FNDA:9,getTraffic
|
|
@@ -79,100 +79,108 @@ DA:5,1
|
|
|
79
79
|
DA:8,9
|
|
80
80
|
DA:9,3
|
|
81
81
|
DA:11,6
|
|
82
|
-
DA:
|
|
83
|
-
DA:
|
|
84
|
-
DA:
|
|
85
|
-
DA:
|
|
86
|
-
DA:
|
|
87
|
-
DA:25,
|
|
88
|
-
DA:
|
|
89
|
-
DA:
|
|
90
|
-
DA:
|
|
91
|
-
DA:
|
|
92
|
-
DA:34,
|
|
93
|
-
DA:
|
|
94
|
-
DA:
|
|
95
|
-
DA:
|
|
96
|
-
DA:
|
|
97
|
-
DA:
|
|
98
|
-
DA:
|
|
99
|
-
DA:52,9
|
|
82
|
+
DA:13,15
|
|
83
|
+
DA:14,15
|
|
84
|
+
DA:17,6
|
|
85
|
+
DA:18,16
|
|
86
|
+
DA:19,16
|
|
87
|
+
DA:25,1
|
|
88
|
+
DA:28,9
|
|
89
|
+
DA:29,3
|
|
90
|
+
DA:31,6
|
|
91
|
+
DA:32,6
|
|
92
|
+
DA:34,1
|
|
93
|
+
DA:37,9
|
|
94
|
+
DA:38,3
|
|
95
|
+
DA:40,6
|
|
96
|
+
DA:41,6
|
|
97
|
+
DA:43,0
|
|
98
|
+
DA:45,1
|
|
100
99
|
DA:53,9
|
|
101
|
-
DA:54,9
|
|
102
100
|
DA:55,9
|
|
103
|
-
DA:
|
|
104
|
-
DA:
|
|
101
|
+
DA:56,9
|
|
102
|
+
DA:57,9
|
|
103
|
+
DA:58,9
|
|
105
104
|
DA:67,9
|
|
106
105
|
DA:68,0
|
|
107
|
-
DA:
|
|
108
|
-
DA:
|
|
109
|
-
DA:73,9
|
|
106
|
+
DA:70,9
|
|
107
|
+
DA:71,0
|
|
110
108
|
DA:74,9
|
|
111
109
|
DA:75,9
|
|
112
|
-
DA:
|
|
113
|
-
DA:
|
|
114
|
-
DA:
|
|
115
|
-
DA:
|
|
116
|
-
DA:
|
|
117
|
-
DA:85,
|
|
118
|
-
DA:
|
|
119
|
-
DA:
|
|
120
|
-
DA:
|
|
121
|
-
DA:
|
|
122
|
-
DA:
|
|
123
|
-
DA:
|
|
124
|
-
DA:97,
|
|
110
|
+
DA:76,9
|
|
111
|
+
DA:77,9
|
|
112
|
+
DA:78,9
|
|
113
|
+
DA:82,9
|
|
114
|
+
DA:83,9
|
|
115
|
+
DA:85,1
|
|
116
|
+
DA:86,1
|
|
117
|
+
DA:87,2
|
|
118
|
+
DA:88,2
|
|
119
|
+
DA:92,2
|
|
120
|
+
DA:93,2
|
|
121
|
+
DA:95,1
|
|
122
|
+
DA:97,9
|
|
123
|
+
DA:98,9
|
|
124
|
+
DA:99,22
|
|
125
125
|
DA:100,22
|
|
126
126
|
DA:101,22
|
|
127
|
-
DA:
|
|
128
|
-
DA:
|
|
129
|
-
DA:
|
|
130
|
-
DA:
|
|
131
|
-
DA:
|
|
132
|
-
DA:
|
|
133
|
-
DA:
|
|
134
|
-
DA:
|
|
135
|
-
DA:
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
DA:104,22
|
|
128
|
+
DA:105,22
|
|
129
|
+
DA:106,21
|
|
130
|
+
DA:111,22
|
|
131
|
+
DA:114,9
|
|
132
|
+
DA:115,23
|
|
133
|
+
DA:116,0
|
|
134
|
+
DA:118,23
|
|
135
|
+
DA:120,9
|
|
136
|
+
DA:122,9
|
|
137
|
+
DA:124,1
|
|
138
|
+
LF:63
|
|
139
|
+
LH:59
|
|
138
140
|
BRDA:8,0,0,3
|
|
139
141
|
BRDA:8,0,1,6
|
|
140
|
-
BRDA:
|
|
141
|
-
BRDA:
|
|
142
|
-
BRDA:
|
|
143
|
-
BRDA:
|
|
144
|
-
BRDA:
|
|
145
|
-
BRDA:
|
|
146
|
-
BRDA:
|
|
147
|
-
BRDA:
|
|
148
|
-
BRDA:
|
|
149
|
-
BRDA:
|
|
150
|
-
BRDA:
|
|
151
|
-
BRDA:
|
|
152
|
-
BRDA:
|
|
153
|
-
BRDA:
|
|
154
|
-
BRDA:
|
|
155
|
-
BRDA:
|
|
156
|
-
BRDA:
|
|
157
|
-
BRDA:
|
|
158
|
-
BRDA:
|
|
159
|
-
BRDA:
|
|
160
|
-
BRDA:75,11,0,
|
|
142
|
+
BRDA:8,1,0,9
|
|
143
|
+
BRDA:8,1,1,6
|
|
144
|
+
BRDA:11,2,0,6
|
|
145
|
+
BRDA:11,2,1,0
|
|
146
|
+
BRDA:28,3,0,3
|
|
147
|
+
BRDA:28,3,1,6
|
|
148
|
+
BRDA:37,4,0,3
|
|
149
|
+
BRDA:37,4,1,6
|
|
150
|
+
BRDA:40,5,0,6
|
|
151
|
+
BRDA:40,5,1,0
|
|
152
|
+
BRDA:55,6,0,0
|
|
153
|
+
BRDA:55,6,1,9
|
|
154
|
+
BRDA:55,7,0,9
|
|
155
|
+
BRDA:55,7,1,0
|
|
156
|
+
BRDA:60,8,0,0
|
|
157
|
+
BRDA:60,8,1,9
|
|
158
|
+
BRDA:67,9,0,0
|
|
159
|
+
BRDA:67,9,1,9
|
|
160
|
+
BRDA:70,10,0,0
|
|
161
|
+
BRDA:70,10,1,9
|
|
162
|
+
BRDA:75,11,0,3
|
|
161
163
|
BRDA:75,11,1,6
|
|
162
|
-
BRDA:75,
|
|
163
|
-
BRDA:75,
|
|
164
|
-
BRDA:
|
|
165
|
-
BRDA:
|
|
166
|
-
BRDA:
|
|
167
|
-
BRDA:
|
|
168
|
-
BRDA:
|
|
169
|
-
BRDA:
|
|
170
|
-
BRDA:
|
|
171
|
-
BRDA:
|
|
172
|
-
BRDA:
|
|
173
|
-
BRDA:
|
|
174
|
-
|
|
175
|
-
|
|
164
|
+
BRDA:75,12,0,9
|
|
165
|
+
BRDA:75,12,1,9
|
|
166
|
+
BRDA:78,13,0,9
|
|
167
|
+
BRDA:78,13,1,6
|
|
168
|
+
BRDA:78,13,2,2
|
|
169
|
+
BRDA:78,13,3,1
|
|
170
|
+
BRDA:83,14,0,1
|
|
171
|
+
BRDA:83,14,1,8
|
|
172
|
+
BRDA:83,15,0,9
|
|
173
|
+
BRDA:83,15,1,6
|
|
174
|
+
BRDA:97,16,0,9
|
|
175
|
+
BRDA:97,16,1,0
|
|
176
|
+
BRDA:101,17,0,20
|
|
177
|
+
BRDA:101,17,1,2
|
|
178
|
+
BRDA:115,18,0,0
|
|
179
|
+
BRDA:115,18,1,23
|
|
180
|
+
BRDA:115,19,0,23
|
|
181
|
+
BRDA:115,19,1,23
|
|
182
|
+
BRF:42
|
|
183
|
+
BRH:33
|
|
176
184
|
end_of_record
|
|
177
185
|
TN:
|
|
178
186
|
SF:src/allocator.ts
|
|
@@ -220,22 +228,22 @@ end_of_record
|
|
|
220
228
|
TN:
|
|
221
229
|
SF:src/traffic.ts
|
|
222
230
|
FN:6,detectIfVariationsChanged
|
|
223
|
-
FN:
|
|
231
|
+
FN:15,(anonymous_1)
|
|
224
232
|
FN:20,(anonymous_2)
|
|
225
|
-
FN:
|
|
226
|
-
FN:
|
|
227
|
-
FN:
|
|
228
|
-
FN:
|
|
229
|
-
FN:
|
|
230
|
-
FN:
|
|
231
|
-
FN:
|
|
232
|
-
FN:
|
|
233
|
-
FN:
|
|
233
|
+
FN:28,getRulePercentageDiff
|
|
234
|
+
FN:41,detectIfRangesChanged
|
|
235
|
+
FN:56,getTraffic
|
|
236
|
+
FN:71,(anonymous_6)
|
|
237
|
+
FN:95,(anonymous_7)
|
|
238
|
+
FN:111,(anonymous_8)
|
|
239
|
+
FN:126,(anonymous_9)
|
|
240
|
+
FN:135,(anonymous_10)
|
|
241
|
+
FN:149,(anonymous_11)
|
|
234
242
|
FNF:12
|
|
235
243
|
FNH:12
|
|
236
244
|
FNDA:9,detectIfVariationsChanged
|
|
237
|
-
FNDA:
|
|
238
|
-
FNDA:
|
|
245
|
+
FNDA:15,(anonymous_1)
|
|
246
|
+
FNDA:16,(anonymous_2)
|
|
239
247
|
FNDA:9,getRulePercentageDiff
|
|
240
248
|
FNDA:9,detectIfRangesChanged
|
|
241
249
|
FNDA:9,getTraffic
|
|
@@ -251,86 +259,93 @@ DA:6,1
|
|
|
251
259
|
DA:10,9
|
|
252
260
|
DA:11,3
|
|
253
261
|
DA:14,6
|
|
254
|
-
DA:
|
|
255
|
-
DA:
|
|
256
|
-
DA:
|
|
257
|
-
DA:28,
|
|
258
|
-
DA:
|
|
259
|
-
DA:
|
|
260
|
-
DA:
|
|
261
|
-
DA:
|
|
262
|
-
DA:41,
|
|
263
|
-
DA:
|
|
264
|
-
DA:
|
|
265
|
-
DA:
|
|
266
|
-
DA:
|
|
267
|
-
DA:
|
|
268
|
-
DA:
|
|
262
|
+
DA:15,15
|
|
263
|
+
DA:18,6
|
|
264
|
+
DA:20,16
|
|
265
|
+
DA:28,1
|
|
266
|
+
DA:32,9
|
|
267
|
+
DA:33,3
|
|
268
|
+
DA:36,6
|
|
269
|
+
DA:38,6
|
|
270
|
+
DA:41,1
|
|
271
|
+
DA:45,9
|
|
272
|
+
DA:46,3
|
|
273
|
+
DA:49,6
|
|
274
|
+
DA:50,6
|
|
275
|
+
DA:53,0
|
|
276
|
+
DA:56,1
|
|
269
277
|
DA:65,9
|
|
270
|
-
DA:
|
|
271
|
-
DA:
|
|
272
|
-
DA:
|
|
273
|
-
DA:
|
|
274
|
-
DA:82,0
|
|
278
|
+
DA:69,9
|
|
279
|
+
DA:71,9
|
|
280
|
+
DA:72,9
|
|
281
|
+
DA:74,9
|
|
275
282
|
DA:85,9
|
|
276
283
|
DA:86,0
|
|
277
|
-
DA:
|
|
278
|
-
DA:
|
|
279
|
-
DA:
|
|
280
|
-
DA:
|
|
284
|
+
DA:89,9
|
|
285
|
+
DA:90,0
|
|
286
|
+
DA:94,9
|
|
287
|
+
DA:95,9
|
|
281
288
|
DA:96,9
|
|
282
|
-
DA:
|
|
283
|
-
DA:
|
|
284
|
-
DA:105,
|
|
285
|
-
DA:107,
|
|
286
|
-
DA:
|
|
287
|
-
DA:
|
|
288
|
-
DA:
|
|
289
|
-
DA:
|
|
290
|
-
DA:
|
|
291
|
-
DA:122,
|
|
292
|
-
DA:
|
|
293
|
-
DA:
|
|
289
|
+
DA:97,9
|
|
290
|
+
DA:100,9
|
|
291
|
+
DA:105,9
|
|
292
|
+
DA:107,9
|
|
293
|
+
DA:109,1
|
|
294
|
+
DA:111,1
|
|
295
|
+
DA:112,2
|
|
296
|
+
DA:117,2
|
|
297
|
+
DA:119,2
|
|
298
|
+
DA:122,1
|
|
299
|
+
DA:125,9
|
|
300
|
+
DA:126,9
|
|
301
|
+
DA:127,22
|
|
294
302
|
DA:128,22
|
|
295
303
|
DA:130,22
|
|
296
|
-
DA:
|
|
297
|
-
DA:
|
|
298
|
-
DA:
|
|
299
|
-
DA:
|
|
300
|
-
DA:
|
|
301
|
-
DA:
|
|
302
|
-
DA:151,
|
|
303
|
-
DA:154,
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
DA:133,22
|
|
305
|
+
DA:135,22
|
|
306
|
+
DA:136,21
|
|
307
|
+
DA:142,22
|
|
308
|
+
DA:149,9
|
|
309
|
+
DA:150,23
|
|
310
|
+
DA:151,0
|
|
311
|
+
DA:154,23
|
|
312
|
+
DA:157,9
|
|
313
|
+
DA:160,9
|
|
314
|
+
LF:58
|
|
315
|
+
LH:54
|
|
306
316
|
BRDA:10,0,0,3
|
|
307
|
-
BRDA:
|
|
308
|
-
BRDA:
|
|
309
|
-
BRDA:
|
|
310
|
-
BRDA:
|
|
311
|
-
BRDA:
|
|
312
|
-
BRDA:
|
|
313
|
-
BRDA:
|
|
314
|
-
BRDA:
|
|
315
|
-
BRDA:
|
|
316
|
-
BRDA:
|
|
317
|
-
BRDA:
|
|
318
|
-
BRDA:
|
|
319
|
-
BRDA:
|
|
320
|
-
BRDA:
|
|
321
|
-
BRDA:
|
|
322
|
-
BRDA:
|
|
323
|
-
BRDA:
|
|
324
|
-
BRDA:
|
|
325
|
-
BRDA:
|
|
326
|
-
BRDA:
|
|
327
|
-
BRDA:
|
|
328
|
-
BRDA:
|
|
329
|
-
BRDA:
|
|
330
|
-
BRDA:
|
|
331
|
-
BRDA:
|
|
332
|
-
BRDA:
|
|
333
|
-
BRDA:
|
|
334
|
-
|
|
335
|
-
|
|
317
|
+
BRDA:10,1,0,9
|
|
318
|
+
BRDA:10,1,1,6
|
|
319
|
+
BRDA:14,2,0,6
|
|
320
|
+
BRDA:14,2,1,0
|
|
321
|
+
BRDA:32,3,0,3
|
|
322
|
+
BRDA:45,4,0,3
|
|
323
|
+
BRDA:49,5,0,6
|
|
324
|
+
BRDA:69,6,0,0
|
|
325
|
+
BRDA:69,6,1,9
|
|
326
|
+
BRDA:69,7,0,9
|
|
327
|
+
BRDA:69,7,1,0
|
|
328
|
+
BRDA:77,8,0,0
|
|
329
|
+
BRDA:77,8,1,9
|
|
330
|
+
BRDA:85,9,0,0
|
|
331
|
+
BRDA:89,10,0,0
|
|
332
|
+
BRDA:95,11,0,3
|
|
333
|
+
BRDA:95,11,1,6
|
|
334
|
+
BRDA:95,12,0,9
|
|
335
|
+
BRDA:95,12,1,9
|
|
336
|
+
BRDA:100,13,0,9
|
|
337
|
+
BRDA:100,13,1,6
|
|
338
|
+
BRDA:100,13,2,2
|
|
339
|
+
BRDA:100,13,3,1
|
|
340
|
+
BRDA:107,14,0,1
|
|
341
|
+
BRDA:107,15,0,9
|
|
342
|
+
BRDA:107,15,1,6
|
|
343
|
+
BRDA:125,16,0,9
|
|
344
|
+
BRDA:130,17,0,20
|
|
345
|
+
BRDA:130,17,1,2
|
|
346
|
+
BRDA:150,18,0,0
|
|
347
|
+
BRDA:150,19,0,23
|
|
348
|
+
BRDA:150,19,1,23
|
|
349
|
+
BRF:33
|
|
350
|
+
BRH:26
|
|
336
351
|
end_of_record
|
package/lib/builder.d.ts
CHANGED
|
@@ -8,9 +8,17 @@ export interface BuildOptions {
|
|
|
8
8
|
}
|
|
9
9
|
export declare function getDatafilePath(projectConfig: ProjectConfig, environment: EnvironmentKey, tag: string): string;
|
|
10
10
|
export declare function getExistingStateFilePath(projectConfig: ProjectConfig, environment: EnvironmentKey): string;
|
|
11
|
-
export
|
|
11
|
+
export type FeatureRanges = Map<FeatureKey, Range[]>;
|
|
12
|
+
interface FeatureRangesResult {
|
|
13
|
+
featureRanges: FeatureRanges;
|
|
14
|
+
featureIsInGroup: {
|
|
15
|
+
[key: string]: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function getFeatureRanges(projectConfig: ProjectConfig): FeatureRangesResult;
|
|
12
19
|
export declare function buildDatafile(projectConfig: ProjectConfig, options: BuildOptions, existingState: ExistingState): DatafileContent;
|
|
13
20
|
export interface BuildCLIOptions {
|
|
14
21
|
revision?: string;
|
|
15
22
|
}
|
|
16
23
|
export declare function buildProject(rootDirectoryPath: any, projectConfig: ProjectConfig, cliOptions?: BuildCLIOptions): void;
|
|
24
|
+
export {};
|
package/lib/builder.js
CHANGED
|
@@ -29,6 +29,7 @@ function getExistingStateFilePath(projectConfig, environment) {
|
|
|
29
29
|
exports.getExistingStateFilePath = getExistingStateFilePath;
|
|
30
30
|
function getFeatureRanges(projectConfig) {
|
|
31
31
|
var featureRanges = new Map();
|
|
32
|
+
var featureIsInGroup = {}; // featureKey => boolean
|
|
32
33
|
var groups = [];
|
|
33
34
|
if (fs.existsSync(projectConfig.groupsDirectoryPath)) {
|
|
34
35
|
var groupFiles = fs
|
|
@@ -44,6 +45,9 @@ function getFeatureRanges(projectConfig) {
|
|
|
44
45
|
var isFirstSlot = slotIndex === 0;
|
|
45
46
|
if (slot.feature) {
|
|
46
47
|
var featureKey = slot.feature;
|
|
48
|
+
if (typeof featureKey === "string") {
|
|
49
|
+
featureIsInGroup[featureKey] = true;
|
|
50
|
+
}
|
|
47
51
|
var featureRangesForFeature = featureRanges.get(featureKey) || [];
|
|
48
52
|
var start = isFirstSlot ? accumulatedPercentage : accumulatedPercentage + 1;
|
|
49
53
|
var end = accumulatedPercentage + slot.percentage * 1000;
|
|
@@ -58,7 +62,7 @@ function getFeatureRanges(projectConfig) {
|
|
|
58
62
|
_loop_1(groupFile);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
|
-
return featureRanges;
|
|
65
|
+
return { featureRanges: featureRanges, featureIsInGroup: featureIsInGroup };
|
|
62
66
|
}
|
|
63
67
|
exports.getFeatureRanges = getFeatureRanges;
|
|
64
68
|
function buildDatafile(projectConfig, options, existingState) {
|
|
@@ -71,7 +75,7 @@ function buildDatafile(projectConfig, options, existingState) {
|
|
|
71
75
|
};
|
|
72
76
|
var segmentKeysUsedByTag = new Set();
|
|
73
77
|
var attributeKeysUsedByTag = new Set();
|
|
74
|
-
var
|
|
78
|
+
var _a = getFeatureRanges(projectConfig), featureRanges = _a.featureRanges, featureIsInGroup = _a.featureIsInGroup;
|
|
75
79
|
// features
|
|
76
80
|
var features = [];
|
|
77
81
|
var featuresDirectory = projectConfig.featuresDirectoryPath;
|
|
@@ -91,66 +95,72 @@ function buildDatafile(projectConfig, options, existingState) {
|
|
|
91
95
|
if (parsedFeature.environments[options.environment].expose === false) {
|
|
92
96
|
continue;
|
|
93
97
|
}
|
|
94
|
-
for (var
|
|
95
|
-
var parsedRule = _b
|
|
98
|
+
for (var _b = 0, _c = parsedFeature.environments[options.environment].rules; _b < _c.length; _b++) {
|
|
99
|
+
var parsedRule = _c[_b];
|
|
96
100
|
var extractedSegmentKeys = (0, utils_1.extractSegmentKeysFromGroupSegments)(parsedRule.segments);
|
|
97
101
|
extractedSegmentKeys.forEach(function (segmentKey) { return segmentKeysUsedByTag.add(segmentKey); });
|
|
98
102
|
}
|
|
99
103
|
var feature = {
|
|
100
104
|
key: featureKey,
|
|
101
|
-
defaultVariation: parsedFeature.defaultVariation,
|
|
102
105
|
bucketBy: parsedFeature.bucketBy || projectConfig.defaultBucketBy,
|
|
103
|
-
variations: parsedFeature.variations
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (!variation.variables) {
|
|
109
|
-
return mappedVariation;
|
|
110
|
-
}
|
|
111
|
-
mappedVariation.variables = variation.variables.map(function (variable) {
|
|
112
|
-
var mappedVariable = {
|
|
113
|
-
key: variable.key,
|
|
114
|
-
value: variable.value,
|
|
106
|
+
variations: Array.isArray(parsedFeature.variations)
|
|
107
|
+
? parsedFeature.variations.map(function (variation) {
|
|
108
|
+
var mappedVariation = {
|
|
109
|
+
value: variation.value,
|
|
110
|
+
weight: variation.weight, // @TODO: added so state files can maintain weight info, but datafiles don't need this. find a way to remove it from datafiles later
|
|
115
111
|
};
|
|
116
|
-
if (!
|
|
117
|
-
return
|
|
112
|
+
if (!variation.variables) {
|
|
113
|
+
return mappedVariation;
|
|
118
114
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return
|
|
126
|
-
conditions: JSON.stringify(override.conditions),
|
|
127
|
-
value: override.value,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if (typeof override.segments !== "undefined") {
|
|
131
|
-
var extractedSegmentKeys = (0, utils_1.extractSegmentKeysFromGroupSegments)(override.segments);
|
|
132
|
-
extractedSegmentKeys.forEach(function (segmentKey) { return segmentKeysUsedByTag.add(segmentKey); });
|
|
133
|
-
return {
|
|
134
|
-
segments: JSON.stringify(override.segments),
|
|
135
|
-
value: override.value,
|
|
136
|
-
};
|
|
115
|
+
mappedVariation.variables = variation.variables.map(function (variable) {
|
|
116
|
+
var mappedVariable = {
|
|
117
|
+
key: variable.key,
|
|
118
|
+
value: variable.value,
|
|
119
|
+
};
|
|
120
|
+
if (!variable.overrides) {
|
|
121
|
+
return mappedVariable;
|
|
137
122
|
}
|
|
138
|
-
|
|
123
|
+
mappedVariable.overrides = variable.overrides.map(function (override) {
|
|
124
|
+
if (typeof override.conditions !== "undefined") {
|
|
125
|
+
var extractedAttributeKeys = (0, utils_1.extractAttributeKeysFromConditions)(override.conditions);
|
|
126
|
+
extractedAttributeKeys.forEach(function (attributeKey) {
|
|
127
|
+
return attributeKeysUsedByTag.add(attributeKey);
|
|
128
|
+
});
|
|
129
|
+
return {
|
|
130
|
+
conditions: JSON.stringify(override.conditions),
|
|
131
|
+
value: override.value,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (typeof override.segments !== "undefined") {
|
|
135
|
+
var extractedSegmentKeys = (0, utils_1.extractSegmentKeysFromGroupSegments)(override.segments);
|
|
136
|
+
extractedSegmentKeys.forEach(function (segmentKey) {
|
|
137
|
+
return segmentKeysUsedByTag.add(segmentKey);
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
segments: JSON.stringify(override.segments),
|
|
141
|
+
value: override.value,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return override;
|
|
145
|
+
});
|
|
146
|
+
return mappedVariable;
|
|
139
147
|
});
|
|
140
|
-
return
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
}),
|
|
148
|
+
return mappedVariation;
|
|
149
|
+
})
|
|
150
|
+
: undefined,
|
|
144
151
|
traffic: (0, traffic_1.getTraffic)(parsedFeature.variations, parsedFeature.environments[options.environment].rules, existingState.features[featureKey], featureRanges.get(featureKey) || []),
|
|
152
|
+
ranges: featureRanges.get(featureKey) || undefined,
|
|
145
153
|
};
|
|
146
154
|
// update state in memory, so that next datafile build can use it (in case it contains the same feature)
|
|
147
155
|
existingState.features[featureKey] = {
|
|
148
|
-
variations: feature.variations
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
variations: Array.isArray(feature.variations)
|
|
157
|
+
? feature.variations.map(function (v) {
|
|
158
|
+
return {
|
|
159
|
+
value: v.value,
|
|
160
|
+
weight: v.weight || 0,
|
|
161
|
+
};
|
|
162
|
+
})
|
|
163
|
+
: undefined,
|
|
154
164
|
traffic: feature.traffic.map(function (t) {
|
|
155
165
|
return {
|
|
156
166
|
key: t.key,
|
|
@@ -163,8 +173,10 @@ function buildDatafile(projectConfig, options, existingState) {
|
|
|
163
173
|
}),
|
|
164
174
|
};
|
|
165
175
|
}),
|
|
166
|
-
ranges: featureRanges.get(feature.key) || undefined,
|
|
167
176
|
};
|
|
177
|
+
if (featureIsInGroup[featureKey] === true) {
|
|
178
|
+
feature.ranges = featureRanges.get(feature.key);
|
|
179
|
+
}
|
|
168
180
|
if (parsedFeature.variablesSchema) {
|
|
169
181
|
feature.variablesSchema = parsedFeature.variablesSchema;
|
|
170
182
|
}
|
|
@@ -179,8 +191,8 @@ function buildDatafile(projectConfig, options, existingState) {
|
|
|
179
191
|
var segmentsDirectory = projectConfig.segmentsDirectoryPath;
|
|
180
192
|
if (fs.existsSync(segmentsDirectory)) {
|
|
181
193
|
var segmentFiles = fs.readdirSync(segmentsDirectory).filter(function (f) { return f.endsWith(".yml"); });
|
|
182
|
-
for (var
|
|
183
|
-
var segmentFile = segmentFiles_1[
|
|
194
|
+
for (var _d = 0, segmentFiles_1 = segmentFiles; _d < segmentFiles_1.length; _d++) {
|
|
195
|
+
var segmentFile = segmentFiles_1[_d];
|
|
184
196
|
var segmentKey = path.basename(segmentFile, ".yml");
|
|
185
197
|
var segmentFilePath = path.join(segmentsDirectory, segmentFile);
|
|
186
198
|
var parsedSegment = (0, utils_1.parseYaml)(fs.readFileSync(segmentFilePath, "utf8"));
|
|
@@ -206,8 +218,8 @@ function buildDatafile(projectConfig, options, existingState) {
|
|
|
206
218
|
var attributesDirectory = projectConfig.attributesDirectoryPath;
|
|
207
219
|
if (fs.existsSync(attributesDirectory)) {
|
|
208
220
|
var attributeFiles = fs.readdirSync(attributesDirectory).filter(function (f) { return f.endsWith(".yml"); });
|
|
209
|
-
for (var
|
|
210
|
-
var attributeFile = attributeFiles_1[
|
|
221
|
+
for (var _e = 0, attributeFiles_1 = attributeFiles; _e < attributeFiles_1.length; _e++) {
|
|
222
|
+
var attributeFile = attributeFiles_1[_e];
|
|
211
223
|
var attributeKey = path.basename(attributeFile, ".yml");
|
|
212
224
|
var attributeFilePath = path.join(attributesDirectory, attributeFile);
|
|
213
225
|
var parsedAttribute = (0, utils_1.parseYaml)(fs.readFileSync(attributeFilePath, "utf8"));
|