@featurevisor/core 0.0.3

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.
@@ -0,0 +1,636 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var traffic_1 = require("./traffic");
4
+ describe("core: Traffic", function () {
5
+ it("should be a function", function () {
6
+ expect(typeof traffic_1.getNewTraffic).toEqual("function");
7
+ });
8
+ it("should allocate traffic for 100-0 weight on two variations", function () {
9
+ var result = (0, traffic_1.getNewTraffic)(
10
+ // parsed variations from YAML
11
+ [
12
+ {
13
+ type: "string",
14
+ value: "on",
15
+ weight: 100,
16
+ },
17
+ {
18
+ type: "string",
19
+ value: "off",
20
+ weight: 0,
21
+ },
22
+ ],
23
+ // parsed rollouts from YAML
24
+ [
25
+ {
26
+ key: "1",
27
+ segments: "*",
28
+ percentage: 80,
29
+ },
30
+ ],
31
+ // existing feature from previous release
32
+ undefined);
33
+ expect(result).toEqual([
34
+ {
35
+ key: "1",
36
+ segments: "*",
37
+ percentage: 80000,
38
+ allocation: [
39
+ {
40
+ variation: "on",
41
+ percentage: 80000,
42
+ },
43
+ {
44
+ variation: "off",
45
+ percentage: 0,
46
+ },
47
+ ],
48
+ },
49
+ ]);
50
+ });
51
+ it("should allocate traffic for 50-50 weight on two variations", function () {
52
+ var result = (0, traffic_1.getNewTraffic)(
53
+ // parsed variations from YAML
54
+ [
55
+ {
56
+ type: "string",
57
+ value: "on",
58
+ weight: 50,
59
+ },
60
+ {
61
+ type: "string",
62
+ value: "off",
63
+ weight: 50,
64
+ },
65
+ ],
66
+ // parsed rollouts from YAML
67
+ [
68
+ {
69
+ key: "1",
70
+ segments: "*",
71
+ percentage: 80,
72
+ },
73
+ ],
74
+ // existing feature from previous release
75
+ undefined);
76
+ expect(result).toEqual([
77
+ {
78
+ key: "1",
79
+ segments: "*",
80
+ percentage: 80000,
81
+ allocation: [
82
+ {
83
+ variation: "on",
84
+ percentage: 40000,
85
+ },
86
+ {
87
+ variation: "off",
88
+ percentage: 40000,
89
+ },
90
+ ],
91
+ },
92
+ ]);
93
+ });
94
+ it("should allocate traffic for weight with two decimal places among three variations", function () {
95
+ var result = (0, traffic_1.getNewTraffic)(
96
+ // parsed variations from YAML
97
+ [
98
+ {
99
+ type: "string",
100
+ value: "yes",
101
+ weight: 33.33,
102
+ },
103
+ {
104
+ type: "string",
105
+ value: "no",
106
+ weight: 33.33,
107
+ },
108
+ {
109
+ type: "string",
110
+ value: "maybe",
111
+ weight: 33.34,
112
+ },
113
+ ],
114
+ // parsed rollouts from YAML
115
+ [
116
+ {
117
+ key: "1",
118
+ segments: "*",
119
+ percentage: 100,
120
+ },
121
+ ],
122
+ // existing feature from previous release
123
+ undefined);
124
+ expect(result).toEqual([
125
+ {
126
+ key: "1",
127
+ segments: "*",
128
+ percentage: 100000,
129
+ allocation: [
130
+ {
131
+ variation: "yes",
132
+ percentage: 33330,
133
+ },
134
+ {
135
+ variation: "no",
136
+ percentage: 33330,
137
+ },
138
+ {
139
+ variation: "maybe",
140
+ percentage: 33340,
141
+ },
142
+ ],
143
+ },
144
+ ]);
145
+ });
146
+ it("should allocate against previous known allocation, increasing from 80% to 90%, with same variations and weight", function () {
147
+ var result = (0, traffic_1.getNewTraffic)(
148
+ // parsed variations from YAML
149
+ [
150
+ {
151
+ type: "string",
152
+ value: "on",
153
+ weight: 50,
154
+ },
155
+ {
156
+ type: "string",
157
+ value: "off",
158
+ weight: 50,
159
+ },
160
+ ],
161
+ // parsed rollouts from YAML
162
+ [
163
+ {
164
+ key: "1",
165
+ segments: "*",
166
+ percentage: 90,
167
+ },
168
+ ],
169
+ // existing feature from previous release
170
+ {
171
+ variations: [
172
+ {
173
+ value: "on",
174
+ weight: 50,
175
+ },
176
+ {
177
+ value: "off",
178
+ weight: 50,
179
+ },
180
+ ],
181
+ traffic: [
182
+ {
183
+ key: "1",
184
+ percentage: 80000,
185
+ allocation: [
186
+ {
187
+ variation: "on",
188
+ percentage: 40000,
189
+ },
190
+ {
191
+ variation: "off",
192
+ percentage: 40000,
193
+ },
194
+ ],
195
+ },
196
+ ],
197
+ });
198
+ expect(result).toEqual([
199
+ {
200
+ key: "1",
201
+ segments: "*",
202
+ percentage: 90000,
203
+ allocation: [
204
+ // existing
205
+ {
206
+ variation: "on",
207
+ percentage: 40000,
208
+ },
209
+ {
210
+ variation: "off",
211
+ percentage: 40000,
212
+ },
213
+ // new
214
+ {
215
+ variation: "on",
216
+ percentage: 5000,
217
+ },
218
+ {
219
+ variation: "off",
220
+ percentage: 5000,
221
+ },
222
+ ],
223
+ },
224
+ ]);
225
+ });
226
+ it("should allocate against previous known allocation, decreasing from 80% to 70%, with same variations and weight", function () {
227
+ var result = (0, traffic_1.getNewTraffic)(
228
+ // parsed variations from YAML
229
+ [
230
+ {
231
+ type: "string",
232
+ value: "on",
233
+ weight: 50,
234
+ },
235
+ {
236
+ type: "string",
237
+ value: "off",
238
+ weight: 50,
239
+ },
240
+ ],
241
+ // parsed rollouts from YAML
242
+ [
243
+ {
244
+ key: "1",
245
+ segments: "*",
246
+ percentage: 70,
247
+ },
248
+ ],
249
+ // existing feature from previous release
250
+ {
251
+ variations: [
252
+ {
253
+ value: "on",
254
+ weight: 50,
255
+ },
256
+ {
257
+ value: "off",
258
+ weight: 50,
259
+ },
260
+ ],
261
+ traffic: [
262
+ {
263
+ key: "1",
264
+ percentage: 80000,
265
+ allocation: [
266
+ {
267
+ variation: "on",
268
+ percentage: 40000,
269
+ },
270
+ {
271
+ variation: "off",
272
+ percentage: 40000,
273
+ },
274
+ ],
275
+ },
276
+ ],
277
+ });
278
+ expect(result).toEqual([
279
+ {
280
+ key: "1",
281
+ segments: "*",
282
+ percentage: 70000,
283
+ allocation: [
284
+ {
285
+ variation: "on",
286
+ percentage: 35000,
287
+ },
288
+ {
289
+ variation: "off",
290
+ percentage: 35000,
291
+ },
292
+ ],
293
+ },
294
+ ]);
295
+ });
296
+ it("should allocate against previous known allocation, increasing from 80% to 90%, with new added variation", function () {
297
+ var result = (0, traffic_1.getNewTraffic)(
298
+ // parsed variations from YAML
299
+ [
300
+ {
301
+ type: "string",
302
+ value: "a",
303
+ weight: 33.33,
304
+ },
305
+ {
306
+ type: "string",
307
+ value: "b",
308
+ weight: 33.33,
309
+ },
310
+ {
311
+ type: "string",
312
+ value: "c",
313
+ weight: 33.34,
314
+ },
315
+ ],
316
+ // parsed rollouts from YAML
317
+ [
318
+ {
319
+ key: "1",
320
+ segments: "*",
321
+ percentage: 90,
322
+ },
323
+ ],
324
+ // existing feature from previous release
325
+ {
326
+ variations: [
327
+ {
328
+ value: "a",
329
+ weight: 50,
330
+ },
331
+ {
332
+ value: "b",
333
+ weight: 50,
334
+ },
335
+ ],
336
+ traffic: [
337
+ {
338
+ key: "1",
339
+ percentage: 80000,
340
+ allocation: [
341
+ {
342
+ variation: "a",
343
+ percentage: 40000,
344
+ },
345
+ {
346
+ variation: "b",
347
+ percentage: 40000,
348
+ },
349
+ ],
350
+ },
351
+ ],
352
+ });
353
+ expect(result).toEqual([
354
+ {
355
+ key: "1",
356
+ segments: "*",
357
+ percentage: 90000,
358
+ allocation: [
359
+ {
360
+ variation: "a",
361
+ percentage: 29997,
362
+ },
363
+ {
364
+ variation: "b",
365
+ percentage: 29997,
366
+ },
367
+ {
368
+ variation: "c",
369
+ percentage: 30006,
370
+ },
371
+ ],
372
+ },
373
+ ]);
374
+ });
375
+ it("should allocate against previous known allocation, increasing from 80% to 100%, with new added variation, totalling 4 variations", function () {
376
+ var result = (0, traffic_1.getNewTraffic)(
377
+ // parsed variations from YAML
378
+ [
379
+ {
380
+ type: "string",
381
+ value: "a",
382
+ weight: 25,
383
+ },
384
+ {
385
+ type: "string",
386
+ value: "b",
387
+ weight: 25,
388
+ },
389
+ {
390
+ type: "string",
391
+ value: "c",
392
+ weight: 25,
393
+ },
394
+ {
395
+ type: "string",
396
+ value: "d",
397
+ weight: 25,
398
+ },
399
+ ],
400
+ // parsed rollouts from YAML
401
+ [
402
+ {
403
+ key: "1",
404
+ segments: "*",
405
+ percentage: 100,
406
+ },
407
+ ],
408
+ // existing feature from previous release
409
+ {
410
+ variations: [
411
+ {
412
+ value: "a",
413
+ weight: 50,
414
+ },
415
+ {
416
+ value: "b",
417
+ weight: 50,
418
+ },
419
+ ],
420
+ traffic: [
421
+ {
422
+ key: "1",
423
+ percentage: 80000,
424
+ allocation: [
425
+ {
426
+ variation: "a",
427
+ percentage: 40000,
428
+ },
429
+ {
430
+ variation: "b",
431
+ percentage: 40000,
432
+ },
433
+ ],
434
+ },
435
+ ],
436
+ });
437
+ expect(result).toEqual([
438
+ {
439
+ key: "1",
440
+ segments: "*",
441
+ percentage: 100000,
442
+ allocation: [
443
+ {
444
+ variation: "a",
445
+ percentage: 25000,
446
+ },
447
+ {
448
+ variation: "b",
449
+ percentage: 25000,
450
+ },
451
+ {
452
+ variation: "c",
453
+ percentage: 25000,
454
+ },
455
+ {
456
+ variation: "d",
457
+ percentage: 25000,
458
+ },
459
+ ],
460
+ },
461
+ ]);
462
+ });
463
+ it("should allocate against previous known allocation, staying at same 100%, removing variations from 4 to 2", function () {
464
+ var result = (0, traffic_1.getNewTraffic)(
465
+ // parsed variations from YAML
466
+ [
467
+ {
468
+ type: "string",
469
+ value: "a",
470
+ weight: 50,
471
+ },
472
+ {
473
+ type: "string",
474
+ value: "b",
475
+ weight: 50,
476
+ },
477
+ ],
478
+ // parsed rollouts from YAML
479
+ [
480
+ {
481
+ key: "1",
482
+ segments: "*",
483
+ percentage: 100,
484
+ },
485
+ ],
486
+ // existing feature from previous release
487
+ {
488
+ variations: [
489
+ {
490
+ value: "a",
491
+ weight: 25,
492
+ },
493
+ {
494
+ value: "b",
495
+ weight: 25,
496
+ },
497
+ {
498
+ value: "c",
499
+ weight: 25,
500
+ },
501
+ {
502
+ value: "d",
503
+ weight: 25,
504
+ },
505
+ ],
506
+ traffic: [
507
+ {
508
+ key: "1",
509
+ percentage: 100000,
510
+ allocation: [
511
+ {
512
+ variation: "a",
513
+ percentage: 25000,
514
+ },
515
+ {
516
+ variation: "b",
517
+ percentage: 25000,
518
+ },
519
+ {
520
+ variation: "c",
521
+ percentage: 25000,
522
+ },
523
+ {
524
+ variation: "d",
525
+ percentage: 25000,
526
+ },
527
+ ],
528
+ },
529
+ ],
530
+ });
531
+ expect(result).toEqual([
532
+ {
533
+ key: "1",
534
+ segments: "*",
535
+ percentage: 100000,
536
+ allocation: [
537
+ {
538
+ variation: "a",
539
+ percentage: 50000,
540
+ },
541
+ {
542
+ variation: "b",
543
+ percentage: 50000,
544
+ },
545
+ ],
546
+ },
547
+ ]);
548
+ });
549
+ it("should allocate against previous known allocation, decreasing from 100% to 80%, removing variations from 4 to 2", function () {
550
+ var result = (0, traffic_1.getNewTraffic)(
551
+ // parsed variations from YAML
552
+ [
553
+ {
554
+ type: "string",
555
+ value: "a",
556
+ weight: 50,
557
+ },
558
+ {
559
+ type: "string",
560
+ value: "b",
561
+ weight: 50,
562
+ },
563
+ ],
564
+ // parsed rollouts from YAML
565
+ [
566
+ {
567
+ key: "1",
568
+ segments: "*",
569
+ percentage: 80,
570
+ },
571
+ ],
572
+ // existing feature from previous release
573
+ {
574
+ variations: [
575
+ {
576
+ value: "a",
577
+ weight: 25,
578
+ },
579
+ {
580
+ value: "b",
581
+ weight: 25,
582
+ },
583
+ {
584
+ value: "c",
585
+ weight: 25,
586
+ },
587
+ {
588
+ value: "d",
589
+ weight: 25,
590
+ },
591
+ ],
592
+ traffic: [
593
+ {
594
+ key: "1",
595
+ percentage: 100000,
596
+ allocation: [
597
+ {
598
+ variation: "a",
599
+ percentage: 25000,
600
+ },
601
+ {
602
+ variation: "b",
603
+ percentage: 25000,
604
+ },
605
+ {
606
+ variation: "c",
607
+ percentage: 25000,
608
+ },
609
+ {
610
+ variation: "d",
611
+ percentage: 25000,
612
+ },
613
+ ],
614
+ },
615
+ ],
616
+ });
617
+ expect(result).toEqual([
618
+ {
619
+ key: "1",
620
+ segments: "*",
621
+ percentage: 80000,
622
+ allocation: [
623
+ {
624
+ variation: "a",
625
+ percentage: 40000,
626
+ },
627
+ {
628
+ variation: "b",
629
+ percentage: 40000,
630
+ },
631
+ ],
632
+ },
633
+ ]);
634
+ });
635
+ });
636
+ //# sourceMappingURL=traffic.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traffic.spec.js","sourceRoot":"","sources":["../src/traffic.spec.ts"],"names":[],"mappings":";;AACA,qCAA0C;AAE1C,QAAQ,CAAC,eAAe,EAAE;IACxB,EAAE,CAAC,sBAAsB,EAAE;QACzB,MAAM,CAAC,OAAO,uBAAa,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE;QAC/D,IAAM,MAAM,GAAG,IAAA,uBAAa;QAC1B,8BAA8B;QAC9B;YACE;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,GAAG;aACZ;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,CAAC;aACV;SACF;QAED,4BAA4B;QAC5B;YACE;gBACE,GAAG,EAAE,GAAG;gBACR,QAAQ,EAAE,GAAG;gBACb,UAAU,EAAE,EAAE;aACf;SACF;QAED,yCAAyC;QACzC,SAAS,CACV,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB;gBACE,GAAG,EAAE,GAAG;gBACR,QAAQ,EAAE,GAAG;gBACb,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE;oBACV;wBACE,SAAS,EAAE,IAAI;wBACf,UAAU,EAAE,KAAK;qBAClB;oBACD;wBACE,SAAS,EAAE,KAAK;wBAChB,UAAU,EAAE,CAAC;qBACd;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE;QAC/D,IAAM,MAAM,GAAG,IAAA,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;4BACE,SAAS,EAAE,GAAG;4BACd,UAAU,EAAE,KAAK;yBAClB;wBACD;4BACE,SAAS,EAAE,GAAG;4BACd,UAAU,EAAE,KAAK;yBAClB;wBACD;4BACE,SAAS,EAAE,GAAG;4BACd,UAAU,EAAE,KAAK;yBAClB;wBACD;4BACE,SAAS,EAAE,GAAG;4BACd,UAAU,EAAE,KAAK;yBAClB;qBACF;iBACF;aACF;SACF,CACF,CAAC;QAEF,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB;gBACE,GAAG,EAAE,GAAG;gBACR,QAAQ,EAAE,GAAG;gBACb,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE;oBACV;wBACE,SAAS,EAAE,GAAG;wBACd,UAAU,EAAE,KAAK;qBAClB;oBACD;wBACE,SAAS,EAAE,GAAG;wBACd,UAAU,EAAE,KAAK;qBAClB;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/lib/utils.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { Condition, GroupSegment, SegmentKey } from "@featurevisor/types";
2
+ export declare function getYAMLFiles(directoryPath: string): string[];
3
+ export declare function parseYaml(content: string): unknown;
4
+ export declare function extractSegmentKeysFromGroupSegments(segments: GroupSegment | GroupSegment[]): Set<SegmentKey>;
5
+ export declare function extractAttributeKeysFromConditions(conditions: Condition | Condition[]): Set<string>;