@featurevisor/sdk 0.38.0 → 0.39.1

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.39.1](https://github.com/fahad19/featurevisor/compare/v0.39.0...v0.39.1) (2023-07-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * SDK README updates ([#106](https://github.com/fahad19/featurevisor/issues/106)) ([1c6ac53](https://github.com/fahad19/featurevisor/commit/1c6ac5311ac0d8df748cbb67e1e5b426038fee71))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.39.0](https://github.com/fahad19/featurevisor/compare/v0.38.0...v0.39.0) (2023-07-16)
18
+
19
+
20
+ ### Features
21
+
22
+ * drop type specific activate methods ([#105](https://github.com/fahad19/featurevisor/issues/105)) ([5faca24](https://github.com/fahad19/featurevisor/commit/5faca24e29665a03919ebf467bfb6a9c70c8e648))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.38.0](https://github.com/fahad19/featurevisor/compare/v0.37.1...v0.38.0) (2023-07-16)
7
29
 
8
30
 
package/README.md CHANGED
@@ -23,6 +23,7 @@ Visit [https://featurevisor.com/docs/sdks/](https://featurevisor.com/docs/sdks/)
23
23
  - [`refreshInterval`](#refreshinterval)
24
24
  - [`stickyFeatures`](#stickyfeatures)
25
25
  - [API](#api)
26
+ - [`isEnabled`](#isenabled)
26
27
  - [`getVariation`](#getvariation)
27
28
  - [`getVariable`](#getvariable)
28
29
  - [`activate`](#activate)
@@ -134,7 +135,10 @@ Pass set of initial features with their variation and (optional) variables that
134
135
  const sdk = createInstance({
135
136
  initialFeatures: {
136
137
  myFeatureKey: {
137
- variation: true,
138
+ enabled: true,
139
+
140
+ // optional
141
+ variation: "treatment",
138
142
  variables: {
139
143
  myVariableKey: "my-variable-value"
140
144
  }
@@ -281,7 +285,10 @@ If a feature key is not present in this object, the SDK will continue to evaluat
281
285
  const sdk = createInstance({
282
286
  stickyFeatures: {
283
287
  myFeatureKey: {
284
- variation: true,
288
+ enabled: true,
289
+
290
+ // optional
291
+ variation: "treatment",
285
292
  variables: {
286
293
  myVariableKey: "my-variable-value"
287
294
  }
@@ -294,16 +301,13 @@ const sdk = createInstance({
294
301
 
295
302
  These methods are available once the SDK instance is created:
296
303
 
297
- ### `getVariation`
304
+ ### `isEnabled`
298
305
 
299
- > `getVariation(featureKey: string, context: Context): VariationValue`
306
+ > `isEnabled(featureKey: string, context: Context): boolean`
300
307
 
301
- Also supports additional type specific methods:
308
+ ### `getVariation`
302
309
 
303
- - `getVariationBoolean`
304
- - `getVariationString`
305
- - `getVariationInteger`
306
- - `getVariationDouble`
310
+ > `getVariation(featureKey: string, context: Context): VariationValue`
307
311
 
308
312
  ### `getVariable`
309
313
 
@@ -327,13 +331,6 @@ Same as `getVariation`, but also calls the `onActivation` callback.
327
331
 
328
332
  This is a convenience method meant to be called when you know the User has been exposed to your Feature, and you also want to track the activation.
329
333
 
330
- Also supports additional type specific methods:
331
-
332
- - `activateBoolean`
333
- - `activateString`
334
- - `activateInteger`
335
- - `activateDouble`
336
-
337
334
  ### `isReady`
338
335
 
339
336
  > `isReady(): boolean`
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1689537214377" clover="3.2.0">
3
- <project timestamp="1689537214377" name="All files">
4
- <metrics statements="573" coveredstatements="331" conditionals="322" coveredconditionals="157" methods="98" coveredmethods="58" elements="993" coveredelements="546" complexity="0" loc="573" ncloc="573" packages="1" files="8" classes="8"/>
2
+ <coverage generated="1689539060494" clover="3.2.0">
3
+ <project timestamp="1689539060494" name="All files">
4
+ <metrics statements="565" coveredstatements="331" conditionals="318" coveredconditionals="157" methods="94" coveredmethods="58" elements="977" coveredelements="546" complexity="0" loc="565" ncloc="565" packages="1" files="8" classes="8"/>
5
5
  <file name="bucket.ts" path="/home/runner/work/featurevisor/featurevisor/packages/sdk/src/bucket.ts">
6
6
  <metrics statements="8" coveredstatements="8" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="1"/>
7
7
  <line num="1" count="2" type="stmt"/>
@@ -163,7 +163,7 @@
163
163
  <line num="100" count="0" type="stmt"/>
164
164
  </file>
165
165
  <file name="instance.ts" path="/home/runner/work/featurevisor/featurevisor/packages/sdk/src/instance.ts">
166
- <metrics statements="381" coveredstatements="196" conditionals="203" coveredconditionals="76" methods="51" coveredmethods="25"/>
166
+ <metrics statements="373" coveredstatements="196" conditionals="199" coveredconditionals="76" methods="47" coveredmethods="25"/>
167
167
  <line num="22" count="1" type="stmt"/>
168
168
  <line num="23" count="1" type="stmt"/>
169
169
  <line num="24" count="1" type="stmt"/>
@@ -441,110 +441,102 @@
441
441
  <line num="847" count="1" type="stmt"/>
442
442
  <line num="849" count="0" type="stmt"/>
443
443
  <line num="851" count="0" type="stmt"/>
444
- <line num="856" count="0" type="stmt"/>
445
- <line num="858" count="0" type="stmt"/>
446
- <line num="862" count="0" type="stmt"/>
447
- <line num="864" count="0" type="stmt"/>
444
+ <line num="865" count="0" type="stmt"/>
445
+ <line num="866" count="0" type="cond" truecount="0" falsecount="2"/>
448
446
  <line num="868" count="0" type="stmt"/>
449
- <line num="870" count="0" type="stmt"/>
450
- <line num="874" count="0" type="stmt"/>
447
+ <line num="870" count="0" type="cond" truecount="0" falsecount="1"/>
448
+ <line num="871" count="0" type="stmt"/>
451
449
  <line num="876" count="0" type="stmt"/>
450
+ <line num="878" count="0" type="stmt"/>
451
+ <line num="882" count="0" type="cond" truecount="0" falsecount="3"/>
452
+ <line num="883" count="0" type="stmt"/>
453
+ <line num="885" count="0" type="cond" truecount="0" falsecount="1"/>
454
+ <line num="886" count="0" type="stmt"/>
455
+ <line num="888" count="0" type="cond" truecount="0" falsecount="1"/>
452
456
  <line num="889" count="0" type="stmt"/>
453
- <line num="890" count="0" type="cond" truecount="0" falsecount="2"/>
454
- <line num="892" count="0" type="stmt"/>
455
- <line num="894" count="0" type="cond" truecount="0" falsecount="1"/>
456
- <line num="895" count="0" type="stmt"/>
457
- <line num="900" count="0" type="stmt"/>
458
- <line num="902" count="0" type="stmt"/>
459
- <line num="906" count="0" type="cond" truecount="0" falsecount="3"/>
460
- <line num="907" count="0" type="stmt"/>
461
- <line num="909" count="0" type="cond" truecount="0" falsecount="1"/>
457
+ <line num="896" count="0" type="stmt"/>
458
+ <line num="898" count="0" type="stmt"/>
459
+ <line num="904" count="0" type="cond" truecount="0" falsecount="1"/>
462
460
  <line num="910" count="0" type="stmt"/>
463
461
  <line num="912" count="0" type="cond" truecount="0" falsecount="1"/>
464
- <line num="913" count="0" type="stmt"/>
465
- <line num="920" count="0" type="stmt"/>
466
- <line num="922" count="0" type="stmt"/>
467
- <line num="928" count="0" type="cond" truecount="0" falsecount="1"/>
468
- <line num="934" count="0" type="stmt"/>
469
- <line num="936" count="0" type="cond" truecount="0" falsecount="1"/>
470
- <line num="937" count="0" type="cond" truecount="0" falsecount="1"/>
462
+ <line num="913" count="0" type="cond" truecount="0" falsecount="1"/>
463
+ <line num="914" count="0" type="stmt"/>
464
+ <line num="921" count="0" type="stmt"/>
465
+ <line num="923" count="0" type="stmt"/>
466
+ <line num="928" count="0" type="stmt"/>
467
+ <line num="931" count="0" type="cond" truecount="0" falsecount="1"/>
468
+ <line num="932" count="0" type="stmt"/>
471
469
  <line num="938" count="0" type="stmt"/>
472
- <line num="945" count="0" type="stmt"/>
473
- <line num="947" count="0" type="stmt"/>
474
- <line num="952" count="0" type="stmt"/>
475
- <line num="955" count="0" type="cond" truecount="0" falsecount="1"/>
476
- <line num="956" count="0" type="stmt"/>
477
- <line num="962" count="0" type="stmt"/>
478
- <line num="964" count="0" type="stmt"/>
479
- <line num="967" count="0" type="cond" truecount="0" falsecount="2"/>
480
- <line num="968" count="0" type="stmt"/>
481
- <line num="972" count="0" type="cond" truecount="0" falsecount="1"/>
482
- <line num="973" count="0" type="stmt"/>
483
- <line num="979" count="0" type="stmt"/>
484
- <line num="981" count="0" type="stmt"/>
485
- <line num="984" count="0" type="cond" truecount="0" falsecount="2"/>
486
- <line num="987" count="0" type="stmt"/>
487
- <line num="989" count="0" type="cond" truecount="0" falsecount="4"/>
488
- <line num="990" count="0" type="stmt"/>
489
- <line num="998" count="0" type="stmt"/>
490
- <line num="1000" count="0" type="stmt"/>
491
- <line num="1004" count="0" type="stmt"/>
470
+ <line num="940" count="0" type="stmt"/>
471
+ <line num="943" count="0" type="cond" truecount="0" falsecount="2"/>
472
+ <line num="944" count="0" type="stmt"/>
473
+ <line num="948" count="0" type="cond" truecount="0" falsecount="1"/>
474
+ <line num="949" count="0" type="stmt"/>
475
+ <line num="955" count="0" type="stmt"/>
476
+ <line num="957" count="0" type="stmt"/>
477
+ <line num="960" count="0" type="cond" truecount="0" falsecount="2"/>
478
+ <line num="963" count="0" type="stmt"/>
479
+ <line num="965" count="0" type="cond" truecount="0" falsecount="4"/>
480
+ <line num="966" count="0" type="stmt"/>
481
+ <line num="974" count="0" type="stmt"/>
482
+ <line num="976" count="0" type="stmt"/>
483
+ <line num="980" count="0" type="stmt"/>
484
+ <line num="982" count="0" type="stmt"/>
485
+ <line num="990" count="0" type="cond" truecount="0" falsecount="1"/>
486
+ <line num="992" count="0" type="cond" truecount="0" falsecount="1"/>
487
+ <line num="996" count="0" type="stmt"/>
492
488
  <line num="1006" count="0" type="stmt"/>
493
- <line num="1014" count="0" type="cond" truecount="0" falsecount="1"/>
494
- <line num="1016" count="0" type="cond" truecount="0" falsecount="1"/>
489
+ <line num="1008" count="0" type="stmt"/>
490
+ <line num="1012" count="0" type="cond" truecount="0" falsecount="4"/>
491
+ <line num="1013" count="0" type="stmt"/>
492
+ <line num="1015" count="0" type="cond" truecount="0" falsecount="3"/>
493
+ <line num="1016" count="0" type="stmt"/>
494
+ <line num="1018" count="0" type="cond" truecount="0" falsecount="1"/>
495
+ <line num="1019" count="0" type="cond" truecount="0" falsecount="1"/>
495
496
  <line num="1020" count="0" type="stmt"/>
496
- <line num="1030" count="0" type="stmt"/>
497
- <line num="1032" count="0" type="stmt"/>
498
- <line num="1036" count="0" type="cond" truecount="0" falsecount="4"/>
499
- <line num="1037" count="0" type="stmt"/>
500
- <line num="1039" count="0" type="cond" truecount="0" falsecount="3"/>
501
- <line num="1040" count="0" type="stmt"/>
502
- <line num="1042" count="0" type="cond" truecount="0" falsecount="1"/>
503
- <line num="1043" count="0" type="cond" truecount="0" falsecount="1"/>
504
- <line num="1044" count="0" type="stmt"/>
505
- <line num="1045" count="0" type="cond" truecount="0" falsecount="1"/>
506
- <line num="1046" count="0" type="stmt"/>
507
- <line num="1052" count="0" type="cond" truecount="0" falsecount="1"/>
508
- <line num="1053" count="0" type="stmt"/>
509
- <line num="1062" count="0" type="stmt"/>
510
- <line num="1065" count="0" type="cond" truecount="0" falsecount="1"/>
511
- <line num="1066" count="0" type="stmt"/>
512
- <line num="1076" count="0" type="stmt"/>
513
- <line num="1078" count="0" type="stmt"/>
514
- <line num="1082" count="0" type="cond" truecount="0" falsecount="1"/>
515
- <line num="1083" count="0" type="stmt"/>
516
- <line num="1093" count="0" type="stmt"/>
517
- <line num="1095" count="0" type="stmt"/>
518
- <line num="1103" count="0" type="stmt"/>
519
- <line num="1112" count="0" type="stmt"/>
520
- <line num="1114" count="0" type="stmt"/>
521
- <line num="1116" count="0" type="stmt"/>
497
+ <line num="1021" count="0" type="cond" truecount="0" falsecount="1"/>
498
+ <line num="1022" count="0" type="stmt"/>
499
+ <line num="1028" count="0" type="cond" truecount="0" falsecount="1"/>
500
+ <line num="1029" count="0" type="stmt"/>
501
+ <line num="1038" count="0" type="stmt"/>
502
+ <line num="1041" count="0" type="cond" truecount="0" falsecount="1"/>
503
+ <line num="1042" count="0" type="stmt"/>
504
+ <line num="1052" count="0" type="stmt"/>
505
+ <line num="1054" count="0" type="stmt"/>
506
+ <line num="1058" count="0" type="cond" truecount="0" falsecount="1"/>
507
+ <line num="1059" count="0" type="stmt"/>
508
+ <line num="1069" count="0" type="stmt"/>
509
+ <line num="1071" count="0" type="stmt"/>
510
+ <line num="1079" count="0" type="stmt"/>
511
+ <line num="1088" count="0" type="stmt"/>
512
+ <line num="1090" count="0" type="stmt"/>
513
+ <line num="1092" count="0" type="stmt"/>
514
+ <line num="1099" count="0" type="stmt"/>
515
+ <line num="1108" count="0" type="stmt"/>
516
+ <line num="1109" count="0" type="stmt"/>
517
+ <line num="1111" count="0" type="cond" truecount="0" falsecount="1"/>
518
+ <line num="1112" count="0" type="cond" truecount="0" falsecount="1"/>
519
+ <line num="1117" count="0" type="stmt"/>
520
+ <line num="1120" count="0" type="stmt"/>
522
521
  <line num="1123" count="0" type="stmt"/>
523
- <line num="1132" count="0" type="stmt"/>
524
- <line num="1133" count="0" type="stmt"/>
525
- <line num="1135" count="0" type="cond" truecount="0" falsecount="1"/>
526
- <line num="1136" count="0" type="cond" truecount="0" falsecount="1"/>
527
- <line num="1141" count="0" type="stmt"/>
528
- <line num="1144" count="0" type="stmt"/>
529
- <line num="1147" count="0" type="stmt"/>
530
- <line num="1149" count="0" type="stmt"/>
531
- <line num="1151" count="0" type="stmt"/>
532
- <line num="1160" count="0" type="stmt"/>
533
- <line num="1162" count="0" type="stmt"/>
534
- <line num="1170" count="0" type="stmt"/>
535
- <line num="1172" count="0" type="stmt"/>
536
- <line num="1180" count="0" type="stmt"/>
537
- <line num="1182" count="0" type="stmt"/>
538
- <line num="1190" count="0" type="stmt"/>
539
- <line num="1192" count="0" type="stmt"/>
540
- <line num="1200" count="0" type="stmt"/>
541
- <line num="1202" count="0" type="stmt"/>
542
- <line num="1210" count="0" type="stmt"/>
543
- <line num="1212" count="0" type="stmt"/>
544
- <line num="1220" count="0" type="stmt"/>
545
- <line num="1222" count="0" type="stmt"/>
546
- <line num="1226" count="1" type="stmt"/>
547
- <line num="1227" count="10" type="stmt"/>
522
+ <line num="1125" count="0" type="stmt"/>
523
+ <line num="1127" count="0" type="stmt"/>
524
+ <line num="1136" count="0" type="stmt"/>
525
+ <line num="1138" count="0" type="stmt"/>
526
+ <line num="1146" count="0" type="stmt"/>
527
+ <line num="1148" count="0" type="stmt"/>
528
+ <line num="1156" count="0" type="stmt"/>
529
+ <line num="1158" count="0" type="stmt"/>
530
+ <line num="1166" count="0" type="stmt"/>
531
+ <line num="1168" count="0" type="stmt"/>
532
+ <line num="1176" count="0" type="stmt"/>
533
+ <line num="1178" count="0" type="stmt"/>
534
+ <line num="1186" count="0" type="stmt"/>
535
+ <line num="1188" count="0" type="stmt"/>
536
+ <line num="1196" count="0" type="stmt"/>
537
+ <line num="1198" count="0" type="stmt"/>
538
+ <line num="1202" count="1" type="stmt"/>
539
+ <line num="1203" count="10" type="stmt"/>
548
540
  </file>
549
541
  <file name="logger.ts" path="/home/runner/work/featurevisor/featurevisor/packages/sdk/src/logger.ts">
550
542
  <metrics statements="22" coveredstatements="13" conditionals="11" coveredconditionals="5" methods="9" coveredmethods="5"/>