@featurevisor/sdk 0.41.0 → 0.42.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 +19 -0
- package/coverage/clover.xml +22 -18
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/bucket.ts.html +1 -1
- package/coverage/lcov-report/conditions.ts.html +1 -1
- package/coverage/lcov-report/datafileReader.ts.html +1 -1
- package/coverage/lcov-report/emitter.ts.html +1 -1
- package/coverage/lcov-report/feature.ts.html +1 -1
- package/coverage/lcov-report/index.html +11 -11
- package/coverage/lcov-report/instance.ts.html +1 -1
- package/coverage/lcov-report/logger.ts.html +18 -6
- package/coverage/lcov-report/segments.ts.html +1 -1
- package/coverage/lcov.info +33 -29
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/lib/logger.js +4 -0
- package/lib/logger.js.map +1 -1
- package/package.json +3 -3
- package/src/logger.ts +4 -0
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">59.59% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>357/
|
|
28
|
+
<span class='fraction'>357/599</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">59.72% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>350/
|
|
49
|
+
<span class='fraction'>350/586</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -170,17 +170,17 @@
|
|
|
170
170
|
|
|
171
171
|
<tr>
|
|
172
172
|
<td class="file medium" data-value="logger.ts"><a href="logger.ts.html">logger.ts</a></td>
|
|
173
|
-
<td data-value="
|
|
174
|
-
<div class="chart"><div class="cover-fill" style="width:
|
|
173
|
+
<td data-value="51.85" class="pic medium">
|
|
174
|
+
<div class="chart"><div class="cover-fill" style="width: 51%"></div><div class="cover-empty" style="width: 49%"></div></div>
|
|
175
175
|
</td>
|
|
176
|
-
<td data-value="
|
|
177
|
-
<td data-value="
|
|
176
|
+
<td data-value="51.85" class="pct medium">51.85%</td>
|
|
177
|
+
<td data-value="27" class="abs medium">14/27</td>
|
|
178
178
|
<td data-value="45.45" class="pct low">45.45%</td>
|
|
179
179
|
<td data-value="11" class="abs low">5/11</td>
|
|
180
180
|
<td data-value="55.55" class="pct medium">55.55%</td>
|
|
181
181
|
<td data-value="9" class="abs medium">5/9</td>
|
|
182
|
-
<td data-value="
|
|
183
|
-
<td data-value="
|
|
182
|
+
<td data-value="50" class="pct medium">50%</td>
|
|
183
|
+
<td data-value="26" class="abs medium">13/26</td>
|
|
184
184
|
</tr>
|
|
185
185
|
|
|
186
186
|
<tr>
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
207
207
|
Code coverage generated by
|
|
208
208
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
209
|
-
at 2023-
|
|
209
|
+
at 2023-08-01T15:54:51.038Z
|
|
210
210
|
</div>
|
|
211
211
|
<script src="prettify.js"></script>
|
|
212
212
|
<script>
|
|
@@ -3802,7 +3802,7 @@ export function createInstance(options: InstanceOptions): FeaturevisorInstance {
|
|
|
3802
3802
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
3803
3803
|
Code coverage generated by
|
|
3804
3804
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
3805
|
-
at 2023-
|
|
3805
|
+
at 2023-08-01T15:54:51.038Z
|
|
3806
3806
|
</div>
|
|
3807
3807
|
<script src="prettify.js"></script>
|
|
3808
3808
|
<script>
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">51.85% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>14/
|
|
28
|
+
<span class='fraction'>14/27</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">50% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>13/
|
|
49
|
+
<span class='fraction'>13/26</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -149,7 +149,11 @@
|
|
|
149
149
|
<a name='L84'></a><a href='#L84'>84</a>
|
|
150
150
|
<a name='L85'></a><a href='#L85'>85</a>
|
|
151
151
|
<a name='L86'></a><a href='#L86'>86</a>
|
|
152
|
-
<a name='L87'></a><a href='#L87'>87</a
|
|
152
|
+
<a name='L87'></a><a href='#L87'>87</a>
|
|
153
|
+
<a name='L88'></a><a href='#L88'>88</a>
|
|
154
|
+
<a name='L89'></a><a href='#L89'>89</a>
|
|
155
|
+
<a name='L90'></a><a href='#L90'>90</a>
|
|
156
|
+
<a name='L91'></a><a href='#L91'>91</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
153
157
|
<span class="cline-any cline-neutral"> </span>
|
|
154
158
|
<span class="cline-any cline-neutral"> </span>
|
|
155
159
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -184,12 +188,16 @@
|
|
|
184
188
|
<span class="cline-any cline-no"> </span>
|
|
185
189
|
<span class="cline-any cline-neutral"> </span>
|
|
186
190
|
<span class="cline-any cline-no"> </span>
|
|
191
|
+
<span class="cline-any cline-no"> </span>
|
|
187
192
|
<span class="cline-any cline-neutral"> </span>
|
|
188
193
|
<span class="cline-any cline-no"> </span>
|
|
194
|
+
<span class="cline-any cline-no"> </span>
|
|
189
195
|
<span class="cline-any cline-neutral"> </span>
|
|
190
196
|
<span class="cline-any cline-no"> </span>
|
|
197
|
+
<span class="cline-any cline-no"> </span>
|
|
191
198
|
<span class="cline-any cline-neutral"> </span>
|
|
192
199
|
<span class="cline-any cline-no"> </span>
|
|
200
|
+
<span class="cline-any cline-no"> </span>
|
|
193
201
|
<span class="cline-any cline-neutral"> </span>
|
|
194
202
|
<span class="cline-any cline-neutral"> </span>
|
|
195
203
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -270,12 +278,16 @@ export const defaultLogHandler: LogHandler = function <span class="fstat-no" tit
|
|
|
270
278
|
<span class="cstat-no" title="statement not covered" > switch (level) {</span>
|
|
271
279
|
case "debug":
|
|
272
280
|
<span class="cstat-no" title="statement not covered" > console.log(loggerPrefix, message, details);</span>
|
|
281
|
+
<span class="cstat-no" title="statement not covered" > break;</span>
|
|
273
282
|
case "info":
|
|
274
283
|
<span class="cstat-no" title="statement not covered" > console.info(loggerPrefix, message, details);</span>
|
|
284
|
+
<span class="cstat-no" title="statement not covered" > break;</span>
|
|
275
285
|
case "warn":
|
|
276
286
|
<span class="cstat-no" title="statement not covered" > console.warn(loggerPrefix, message, details);</span>
|
|
287
|
+
<span class="cstat-no" title="statement not covered" > break;</span>
|
|
277
288
|
case "error":
|
|
278
289
|
<span class="cstat-no" title="statement not covered" > console.error(loggerPrefix, message, details);</span>
|
|
290
|
+
<span class="cstat-no" title="statement not covered" > break;</span>
|
|
279
291
|
}
|
|
280
292
|
};
|
|
281
293
|
|
|
@@ -328,7 +340,7 @@ export function createLogger(options: CreateLoggerOptions = {}): Logger {
|
|
|
328
340
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
329
341
|
Code coverage generated by
|
|
330
342
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
331
|
-
at 2023-
|
|
343
|
+
at 2023-08-01T15:54:51.038Z
|
|
332
344
|
</div>
|
|
333
345
|
<script src="prettify.js"></script>
|
|
334
346
|
<script>
|
|
@@ -238,7 +238,7 @@ export function allGroupSegmentsAreMatched(
|
|
|
238
238
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
239
239
|
Code coverage generated by
|
|
240
240
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
241
|
-
at 2023-
|
|
241
|
+
at 2023-08-01T15:54:51.038Z
|
|
242
242
|
</div>
|
|
243
243
|
<script src="prettify.js"></script>
|
|
244
244
|
<script>
|
package/coverage/lcov.info
CHANGED
|
@@ -1051,14 +1051,14 @@ end_of_record
|
|
|
1051
1051
|
TN:
|
|
1052
1052
|
SF:src/logger.ts
|
|
1053
1053
|
FN:28,defaultLogHandler
|
|
1054
|
-
FN:
|
|
1055
|
-
FN:
|
|
1056
|
-
FN:
|
|
1057
|
-
FN:
|
|
1058
|
-
FN:
|
|
1059
|
-
FN:
|
|
1060
|
-
FN:
|
|
1061
|
-
FN:
|
|
1054
|
+
FN:53,(anonymous_1)
|
|
1055
|
+
FN:58,(anonymous_2)
|
|
1056
|
+
FN:62,(anonymous_3)
|
|
1057
|
+
FN:68,(anonymous_4)
|
|
1058
|
+
FN:72,(anonymous_5)
|
|
1059
|
+
FN:76,(anonymous_6)
|
|
1060
|
+
FN:80,(anonymous_7)
|
|
1061
|
+
FN:85,createLogger
|
|
1062
1062
|
FNF:9
|
|
1063
1063
|
FNH:5
|
|
1064
1064
|
FNDA:0,defaultLogHandler
|
|
@@ -1075,36 +1075,40 @@ DA:18,1
|
|
|
1075
1075
|
DA:28,1
|
|
1076
1076
|
DA:33,0
|
|
1077
1077
|
DA:35,0
|
|
1078
|
-
DA:
|
|
1078
|
+
DA:36,0
|
|
1079
|
+
DA:38,0
|
|
1079
1080
|
DA:39,0
|
|
1080
1081
|
DA:41,0
|
|
1081
|
-
DA:
|
|
1082
|
-
DA:
|
|
1083
|
-
DA:
|
|
1084
|
-
DA:
|
|
1085
|
-
DA:
|
|
1086
|
-
DA:
|
|
1087
|
-
DA:
|
|
1088
|
-
DA:
|
|
1089
|
-
DA:
|
|
1082
|
+
DA:42,0
|
|
1083
|
+
DA:44,0
|
|
1084
|
+
DA:45,0
|
|
1085
|
+
DA:49,1
|
|
1086
|
+
DA:54,14
|
|
1087
|
+
DA:55,14
|
|
1088
|
+
DA:59,0
|
|
1089
|
+
DA:63,19
|
|
1090
|
+
DA:64,0
|
|
1091
|
+
DA:69,18
|
|
1092
|
+
DA:73,1
|
|
1090
1093
|
DA:77,0
|
|
1091
|
-
DA:81,
|
|
1092
|
-
DA:
|
|
1093
|
-
DA:
|
|
1094
|
-
DA:
|
|
1095
|
-
|
|
1094
|
+
DA:81,0
|
|
1095
|
+
DA:85,1
|
|
1096
|
+
DA:86,14
|
|
1097
|
+
DA:87,14
|
|
1098
|
+
DA:89,14
|
|
1099
|
+
LF:26
|
|
1096
1100
|
LH:13
|
|
1097
1101
|
BRDA:31,0,0,0
|
|
1098
1102
|
BRDA:33,1,0,0
|
|
1099
1103
|
BRDA:33,1,1,0
|
|
1100
1104
|
BRDA:33,1,2,0
|
|
1101
1105
|
BRDA:33,1,3,0
|
|
1102
|
-
BRDA:
|
|
1103
|
-
BRDA:
|
|
1104
|
-
BRDA:
|
|
1105
|
-
BRDA:
|
|
1106
|
-
BRDA:
|
|
1107
|
-
BRDA:
|
|
1106
|
+
BRDA:63,2,0,0
|
|
1107
|
+
BRDA:85,3,0,14
|
|
1108
|
+
BRDA:86,4,0,14
|
|
1109
|
+
BRDA:86,4,1,14
|
|
1110
|
+
BRDA:87,5,0,14
|
|
1111
|
+
BRDA:87,5,1,14
|
|
1108
1112
|
BRF:11
|
|
1109
1113
|
BRH:5
|
|
1110
1114
|
end_of_record
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FeaturevisorSDK=t():e.FeaturevisorSDK=t()}(this,(()=>(()=>{var e={480:(e,t,r)=>{"use strict";r.r(t),r.d(t,{compare:()=>n,compareVersions:()=>i,satisfies:()=>o,validate:()=>a});const i=(e,t)=>{const r=u(e),i=u(t),a=r.pop(),n=i.pop(),o=d(r,i);return 0!==o?o:a&&n?d(a.split("."),n.split(".")):a||n?a?-1:1:0},a=e=>"string"==typeof e&&/^[v\d]/.test(e)&&s.test(e),n=(e,t,r)=>{v(r);const a=i(e,t);return h[r].includes(a)},o=(e,t)=>{if(t.includes("||"))return t.split("||").some((t=>o(e,t)));if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every((t=>o(e,t)));const r=t.match(/^([<>=~^]+)/),i=r?r[1]:"=";if("^"!==i&&"~"!==i)return n(e,t,i);const[a,s,l,,f]=u(e),[c,h,g,,v]=u(t),y=[a,s,l],p=[c,null!=h?h:"x",null!=g?g:"x"];if(v){if(!f)return!1;if(0!==d(y,p))return!1;if(-1===d(f.split("."),v.split(".")))return!1}const b=p.findIndex((e=>"0"!==e))+1,m="~"===i?2:b>1?b:1;return 0===d(y.slice(0,m),p.slice(0,m))&&-1!==d(y.slice(m),p.slice(m))},s=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,u=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(s);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},l=e=>"*"===e||"x"===e||"X"===e,f=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},c=(e,t)=>{if(l(e)||l(t))return 0;const[r,i]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(f(e),f(t));return r>i?1:r<i?-1:0},d=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){const i=c(e[r]||"0",t[r]||"0");if(0!==i)return i}return 0},h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},g=Object.keys(h),v=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===g.indexOf(e))throw new Error(`Invalid operator, expected one of ${g.join("|")}`)}},77:e=>{!function(){const t=e=>(new TextEncoder).encode(e);function r(e,r){let i,a,n,o,s,u,l,f;for("string"==typeof e&&(e=t(e)),i=3&e.length,a=e.length-i,n=r,s=3432918353,u=461845907,f=0;f<a;)l=255&e[f]|(255&e[++f])<<8|(255&e[++f])<<16|(255&e[++f])<<24,++f,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,n^=l,n=n<<13|n>>>19,o=5*(65535&n)+((5*(n>>>16)&65535)<<16)&4294967295,n=27492+(65535&o)+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e[f+2])<<16;case 2:l^=(255&e[f+1])<<8;case 1:l^=255&e[f],l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,n^=l}return n^=e.length,n^=n>>>16,n=2246822507*(65535&n)+((2246822507*(n>>>16)&65535)<<16)&4294967295,n^=n>>>13,n=3266489909*(65535&n)+((3266489909*(n>>>16)&65535)<<16)&4294967295,n^=n>>>16,n>>>0}const i=r;i.v2=function(e,r){"string"==typeof e&&(e=t(e));let i,a=e.length,n=r^a,o=0;for(;a>=4;)i=255&e[o]|(255&e[++o])<<8|(255&e[++o])<<16|(255&e[++o])<<24,i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16),i^=i>>>24,i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^i,a-=4,++o;switch(a){case 3:n^=(255&e[o+2])<<16;case 2:n^=(255&e[o+1])<<8;case 1:n^=255&e[o],n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)}return n^=n>>>13,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),n^=n>>>15,n>>>0},i.v3=r,e.exports=i}()},725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBucketedNumber=t.MAX_BUCKETED_NUMBER=void 0;var i=r(77),a=Math.pow(2,32);t.MAX_BUCKETED_NUMBER=1e5,t.getBucketedNumber=function(e){var r=i.v3(e,1)/a;return Math.floor(r*t.MAX_BUCKETED_NUMBER)}},243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allConditionsAreMatched=t.conditionIsMatched=void 0;var i=r(480);function a(e,t){var r=e.attribute,a=e.operator,n=e.value;if("equals"===a)return t[r]===n;if("notEquals"===a)return t[r]!==n;if("before"===a||"after"===a){var o=(u=t[r])instanceof Date?u:new Date(u),s=n instanceof Date?n:new Date(n);return"before"===a?o<s:o>s}if("string"==typeof t[r]&&Array.isArray(n)){var u=t[r];if("in"===a)return-1!==n.indexOf(u);if("notIn"===a)return-1===n.indexOf(u)}else if("string"==typeof t[r]&&"string"==typeof n){if(u=t[r],"contains"===a)return-1!==u.indexOf(n);if("notContains"===a)return-1===u.indexOf(n);if("startsWith"===a)return u.startsWith(n);if("endsWith"===a)return u.endsWith(n);if("semverEquals"===a)return 0===(0,i.compareVersions)(u,n);if("semverNotEquals"===a)return 0!==(0,i.compareVersions)(u,n);if("semverGreaterThan"===a)return 1===(0,i.compareVersions)(u,n);if("semverGreaterThanOrEquals"===a)return(0,i.compareVersions)(u,n)>=0;if("semverLessThan"===a)return-1===(0,i.compareVersions)(u,n);if("semverLessThanOrEquals"===a)return(0,i.compareVersions)(u,n)<=0}else if("number"==typeof t[r]&&"number"==typeof n){if(u=t[r],"greaterThan"===a)return u>n;if("greaterThanOrEquals"===a)return u>=n;if("lessThan"===a)return u<n;if("lessThanOrEquals"===a)return u<=n}return!1}t.conditionIsMatched=a,t.allConditionsAreMatched=function e(t,r){return"attribute"in t?a(t,r):"and"in t&&Array.isArray(t.and)?t.and.every((function(t){return e(t,r)})):"or"in t&&Array.isArray(t.or)?t.or.some((function(t){return e(t,r)})):"not"in t&&Array.isArray(t.not)?t.not.every((function(i){return!1===e({and:t.not},r)})):!!Array.isArray(t)&&t.every((function(t){return e(t,r)}))}},913:(e,t)=>{"use strict";function r(e,t){if("string"==typeof e[t]&&"*"!==e[t])try{e[t]=JSON.parse(e[t])}catch(e){console.error("Error parsing JSON",e)}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.DatafileReader=t.parseJsonConditionsIfStringified=void 0,t.parseJsonConditionsIfStringified=r;var i=function(){function e(e){this.schemaVersion=e.schemaVersion,this.revision=e.revision,this.segments=e.segments,this.attributes=e.attributes,this.features=e.features}return e.prototype.getRevision=function(){return this.revision},e.prototype.getSchemaVersion=function(){return this.schemaVersion},e.prototype.getAllAttributes=function(){return this.attributes},e.prototype.getAttribute=function(e){return this.attributes.find((function(t){return t.key===e}))},e.prototype.getSegment=function(e){var t=this.segments.find((function(t){return t.key===e}));if(t)return r(t,"conditions")},e.prototype.getFeature=function(e){var t=this.features.find((function(t){return t.key===e}));if(t)return t},e}();t.DatafileReader=i},186:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var r=function(){function e(){this._listeners={}}return e.prototype.addListener=function(e,t){void 0===this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t)},e.prototype.removeListener=function(e,t){if(void 0!==this._listeners[e]){var r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}},e.prototype.removeAllListeners=function(e){var t=this;e?this._listeners[e]=[]:Object.keys(this._listeners).forEach((function(e){t._listeners[e]=[]}))},e.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];void 0!==this._listeners[e]&&this._listeners[e].forEach((function(e){e.apply(void 0,t)}))},e}();t.Emitter=r},522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findForceFromFeature=t.getMatchedTrafficAndAllocation=t.getMatchedTraffic=t.getMatchedAllocation=void 0;var i=r(590),a=r(243);function n(e,t){for(var r=0,i=e.allocation;r<i.length;r++){var a=i[r],n=a.range,o=n[0],s=n[1];if(a.range&&o<=t&&s>=t)return a}}t.getMatchedAllocation=n,t.getMatchedTraffic=function(e,t,r){return e.find((function(e){return!!(0,i.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,t,r)}))},t.getMatchedTrafficAndAllocation=function(e,t,r,a,o){var s;return{matchedTraffic:e.find((function(e){return!!(0,i.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,t,a)&&!!(s=n(e,r))})),matchedAllocation:s}},t.findForceFromFeature=function(e,t,r){if(e.force)return e.force.find((function(e){return e.conditions?(0,a.allConditionsAreMatched)(e.conditions,t):!!e.segments&&(0,i.allGroupSegmentsAreMatched)(e.segments,t,r)}))}},97:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,a)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(725),t),a(r(681),t),a(r(687),t),a(r(243),t)},681:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createInstance=t.FeaturevisorInstance=t.getValueByType=t.EvaluationReason=void 0;var i,a=r(687),n=r(913),o=r(186),s=r(725),u=r(522),l=r(243),f=r(590),c=".",d={schemaVersion:"1",revision:"unknown",attributes:[],segments:[],features:[]};function h(e,t){return t?t(e):fetch(e).then((function(e){return e.json()}))}function g(e,t){try{if(void 0===e)return;switch(t){case"string":return"string"==typeof e?e:void 0;case"integer":return parseInt(e,10);case"double":return parseFloat(e);case"boolean":return!0===e;case"array":return Array.isArray(e)?e:void 0;case"object":return"object"==typeof e?e:void 0;default:return e}}catch(e){return}}!function(e){e.NOT_FOUND="not_found",e.NO_VARIATIONS="no_variations",e.DISABLED="disabled",e.REQUIRED="required",e.OUT_OF_RANGE="out_of_range",e.FORCED="forced",e.INITIAL="initial",e.STICKY="sticky",e.RULE="rule",e.ALLOCATED="allocated",e.DEFAULTED="defaulted",e.OVERRIDE="override",e.ERROR="error"}(i=t.EvaluationReason||(t.EvaluationReason={})),t.getValueByType=g;var v=function(){function e(e){var t=this;this.bucketKeySeparator=e.bucketKeySeparator||c,this.configureBucketKey=e.configureBucketKey,this.configureBucketValue=e.configureBucketValue,this.datafileUrl=e.datafileUrl,this.handleDatafileFetch=e.handleDatafileFetch,this.initialFeatures=e.initialFeatures,this.interceptContext=e.interceptContext,this.logger=e.logger||(0,a.createLogger)(),this.refreshInterval=e.refreshInterval,this.stickyFeatures=e.stickyFeatures,this.emitter=new o.Emitter,this.statuses={ready:!1,refreshInProgress:!1},e.onReady&&this.emitter.addListener("ready",e.onReady),e.onRefresh&&this.emitter.addListener("refresh",e.onRefresh),e.onUpdate&&this.emitter.addListener("update",e.onUpdate),e.onActivation&&this.emitter.addListener("activation",e.onActivation);var r=this.emitter.addListener.bind(this.emitter);this.on=r,this.addListener=r;var i=this.emitter.removeListener.bind(this.emitter);if(this.off=i,this.removeListener=i,this.removeAllListeners=this.emitter.removeAllListeners.bind(this.emitter),e.datafileUrl)this.setDatafile(e.datafile||d),h(e.datafileUrl,e.handleDatafileFetch).then((function(e){t.setDatafile(e),t.statuses.ready=!0,t.emitter.emit("ready"),t.refreshInterval&&t.startRefreshing()})).catch((function(e){t.logger.error("failed to fetch datafile",{error:e})}));else{if(!e.datafile)throw new Error("Featurevisor SDK instance cannot be created without both `datafile` and `datafileUrl` options");this.setDatafile(e.datafile),this.statuses.ready=!0,setTimeout((function(){t.emitter.emit("ready")}),0)}}return e.prototype.setDatafile=function(e){try{this.datafileReader=new n.DatafileReader("string"==typeof e?JSON.parse(e):e)}catch(e){this.logger.error("could not parse datafile",{error:e})}},e.prototype.setStickyFeatures=function(e){this.stickyFeatures=e},e.prototype.getRevision=function(){return this.datafileReader.getRevision()},e.prototype.getFeature=function(e){return"string"==typeof e?this.datafileReader.getFeature(e):e},e.prototype.getBucketKey=function(e,t){var r,i,a=e.key;if("string"==typeof e.bucketBy)r="plain",i=[e.bucketBy];else if(Array.isArray(e.bucketBy))r="and",i=e.bucketBy;else{if("object"!=typeof e.bucketBy||!Array.isArray(e.bucketBy.or))throw this.logger.error("invalid bucketBy",{featureKey:a,bucketBy:e.bucketBy}),new Error("invalid bucketBy");r="or",i=e.bucketBy.or}var n=[];i.forEach((function(e){var i=t[e];void 0!==i&&("plain"===r||"and"===r||0===n.length)&&n.push(i)})),n.push(a);var o=n.join(this.bucketKeySeparator);return this.configureBucketKey?this.configureBucketKey(e,t,o):o},e.prototype.getBucketValue=function(e,t){var r=this.getBucketKey(e,t),i=(0,s.getBucketedNumber)(r);return this.configureBucketValue?this.configureBucketValue(e,t,i):i},e.prototype.isReady=function(){return this.statuses.ready},e.prototype.refresh=function(){var e=this;return this.logger.debug("refreshing datafile"),this.statuses.refreshInProgress?this.logger.warn("refresh in progress, skipping"):this.datafileUrl?(this.statuses.refreshInProgress=!0,void h(this.datafileUrl,this.handleDatafileFetch).then((function(t){var r=e.getRevision()!==t.revision;e.setDatafile(t),e.logger.info("refreshed datafile"),e.emitter.emit("refresh"),r&&e.emitter.emit("update"),e.statuses.refreshInProgress=!1})).catch((function(t){e.logger.error("failed to refresh datafile",{error:t}),e.statuses.refreshInProgress=!1}))):this.logger.error("cannot refresh since `datafileUrl` is not provided")},e.prototype.startRefreshing=function(){var e=this;return this.datafileUrl?this.intervalId?this.logger.warn("refreshing has already started"):this.refreshInterval?void(this.intervalId=setInterval((function(){e.refresh()}),1e3*this.refreshInterval)):this.logger.warn("no `refreshInterval` option provided"):this.logger.error("cannot start refreshing since `datafileUrl` is not provided")},e.prototype.stopRefreshing=function(){if(!this.intervalId)return this.logger.warn("refreshing has not started yet");clearInterval(this.intervalId)},e.prototype.evaluateFlag=function(e,t){var r,a=this;void 0===t&&(t={});try{var n="string"==typeof e?e:e.key;if(this.stickyFeatures&&this.stickyFeatures[n]&&void 0!==this.stickyFeatures[n].enabled)return r={featureKey:n,reason:i.STICKY,enabled:this.stickyFeatures[n].enabled,sticky:this.stickyFeatures[n]},this.logger.debug("using sticky enabled",r),r;if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[n]&&void 0!==this.initialFeatures[n].enabled)return r={featureKey:n,reason:i.INITIAL,enabled:this.initialFeatures[n].enabled,initial:this.initialFeatures[n]},this.logger.debug("using initial enabled",r),r;var o=this.getFeature(e);if(!o)return r={featureKey:n,reason:i.NOT_FOUND},this.logger.warn("feature not found",r),r;var s=this.interceptContext?this.interceptContext(t):t,l=(0,u.findForceFromFeature)(o,t,this.datafileReader);if(l&&void 0!==l.enabled)return r={featureKey:o.key,reason:i.FORCED,enabled:l.enabled},this.logger.debug("forced enabled found",r),r;if(o.required&&o.required.length>0){var f=o.required.every((function(e){var t,r;return"string"==typeof e?t=e:(t=e.key,r=e.variation),!!a.isEnabled(t,s)&&(void 0===r||a.getVariation(t,s)===r)}));if(!f)return{featureKey:o.key,reason:i.REQUIRED,enabled:f}}var c=this.getBucketValue(o,s),d=(0,u.getMatchedTraffic)(o.traffic,s,this.datafileReader);if(d){if(o.ranges&&o.ranges.length>0)return o.ranges.find((function(e){return c>=e[0]&&c<e[1]}))?r={featureKey:o.key,reason:i.ALLOCATED,enabled:void 0===d.enabled||d.enabled,bucketValue:c}:(r={featureKey:o.key,reason:i.OUT_OF_RANGE,enabled:!1,bucketValue:c},this.logger.debug("not matched",r),r);if(void 0!==d.enabled)return r={featureKey:o.key,reason:i.OVERRIDE,enabled:d.enabled,bucketValue:c,ruleKey:d.key,traffic:d},this.logger.debug("override from rule",r),r;if(c<d.percentage)return{featureKey:o.key,reason:i.RULE,enabled:!0,bucketValue:c,ruleKey:d.key,traffic:d}}return{featureKey:o.key,reason:i.ERROR,enabled:!1,bucketValue:c}}catch(t){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,error:t}}},e.prototype.isEnabled=function(e,t){void 0===t&&(t={});try{return!0===this.evaluateFlag(e,t).enabled}catch(t){return this.logger.error("isEnabled",{featureKey:e,error:t}),!1}},e.prototype.evaluateVariation=function(e,t){var r;void 0===t&&(t={});try{var a="string"==typeof e?e:e.key;if(!1===this.evaluateFlag(e,t).enabled)return r={featureKey:a,reason:i.DISABLED},this.logger.debug("feature is disabled",r),r;if(this.stickyFeatures&&this.stickyFeatures[a]&&void 0!==(n=this.stickyFeatures[a].variation))return r={featureKey:a,reason:i.STICKY,variationValue:n},this.logger.debug("using sticky variation",r),r;if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[a]&&void 0!==this.initialFeatures[a].variation){var n=this.initialFeatures[a].variation;return r={featureKey:a,reason:i.INITIAL,variationValue:n},this.logger.debug("using initial variation",r),r}var o=this.getFeature(e);if(!o)return r={featureKey:a,reason:i.NOT_FOUND},this.logger.warn("feature not found",r),r;if(!o.variations||0===o.variations.length)return r={featureKey:a,reason:i.NO_VARIATIONS},this.logger.warn("no variations",r),r;var s=this.interceptContext?this.interceptContext(t):t,l=(0,u.findForceFromFeature)(o,t,this.datafileReader);if(l&&l.variation&&(g=o.variations.find((function(e){return e.value===l.variation}))))return r={featureKey:o.key,reason:i.FORCED,variation:g},this.logger.debug("forced variation found",r),r;var f=this.getBucketValue(o,s),c=(0,u.getMatchedTrafficAndAllocation)(o.traffic,s,f,this.datafileReader,this.logger),d=c.matchedTraffic,h=c.matchedAllocation;if(d){var g;if(d.variation&&(g=o.variations.find((function(e){return e.value===d.variation}))))return r={featureKey:o.key,reason:i.RULE,variation:g,bucketValue:f,ruleKey:d.key},this.logger.debug("override from rule",r),r;if(h&&h.variation&&(g=o.variations.find((function(e){return e.value===h.variation}))))return r={featureKey:o.key,reason:i.ALLOCATED,bucketValue:f,variation:g},this.logger.debug("allocated variation",r),r}return r={featureKey:o.key,reason:i.ERROR,bucketValue:f},this.logger.debug("no matched variation",r),r}catch(t){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,error:t}}},e.prototype.getVariation=function(e,t){void 0===t&&(t={});try{var r=this.evaluateVariation(e,t);return void 0!==r.variationValue?r.variationValue:r.variation?r.variation.value:void 0}catch(t){return void this.logger.error("getVariation",{featureKey:e,error:t})}},e.prototype.activate=function(e,t){void 0===t&&(t={});try{var r=this.evaluateVariation(e,t),i=r.variation?r.variation.value:r.variationValue;if(void 0===i)return;var a=this.interceptContext?this.interceptContext(t):t,n={};return this.datafileReader.getAllAttributes().filter((function(e){return!0===e.capture})).forEach((function(e){void 0!==a[e.key]&&(n[e.key]=t[e.key])})),this.emitter.emit("activation",e,i,a,n,r),i}catch(t){return void this.logger.error("activate",{featureKey:e,error:t})}},e.prototype.evaluateVariable=function(e,t,r){var a,n=this;void 0===r&&(r={});try{var o,s="string"==typeof e?e:e.key;if(!1===this.evaluateFlag(e,r).enabled)return a={featureKey:s,reason:i.DISABLED},this.logger.debug("feature is disabled",a),a;if(this.stickyFeatures&&this.stickyFeatures[s]&&(o=this.stickyFeatures[s].variables)){var c=o[t];if(void 0!==c)return a={featureKey:s,reason:i.STICKY,variableKey:t,variableValue:c},this.logger.debug("using sticky variable",a),a}if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[s]&&(o=this.initialFeatures[s].variables)&&void 0!==o[t])return a={featureKey:s,reason:i.INITIAL,variableKey:t,variableValue:o[t]},this.logger.debug("using initial variable",a),a;var d=this.getFeature(e);if(!d)return a={featureKey:s,reason:i.NOT_FOUND,variableKey:t},this.logger.warn("feature not found in datafile",a),a;var h=Array.isArray(d.variablesSchema)?d.variablesSchema.find((function(e){return e.key===t})):void 0;if(!h)return a={featureKey:s,reason:i.NOT_FOUND,variableKey:t},this.logger.warn("variable schema not found",a),a;var g=this.interceptContext?this.interceptContext(r):r,v=(0,u.findForceFromFeature)(d,r,this.datafileReader);if(v&&v.variables&&void 0!==v.variables[t])return a={featureKey:d.key,reason:i.FORCED,variableKey:t,variableSchema:h,variableValue:v.variables[t]},this.logger.debug("forced variable",a),a;var y=this.getBucketValue(d,g),p=(0,u.getMatchedTrafficAndAllocation)(d.traffic,g,y,this.datafileReader,this.logger),b=p.matchedTraffic,m=p.matchedAllocation;if(b){if(b.variables&&void 0!==b.variables[t])return a={featureKey:d.key,reason:i.RULE,variableKey:t,variableSchema:h,variableValue:b.variables[t],bucketValue:y,ruleKey:b.key},this.logger.debug("override from rule",a),a;if(m&&m.variation&&Array.isArray(d.variations)){var k=d.variations.find((function(e){return e.value===m.variation}));if(k&&k.variables){var A=k.variables.find((function(e){return e.key===t}));if(A){if(A.overrides){var V=A.overrides.find((function(e){return e.conditions?(0,l.allConditionsAreMatched)("string"==typeof e.conditions?JSON.parse(e.conditions):e.conditions,g):!!e.segments&&(0,f.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,g,n.datafileReader)}));if(V)return a={featureKey:d.key,reason:i.OVERRIDE,variableKey:t,variableSchema:h,variableValue:V.value,bucketValue:y,ruleKey:b.key},this.logger.debug("variable override",a),a}if(void 0!==A.value)return a={featureKey:d.key,reason:i.ALLOCATED,variableKey:t,variableSchema:h,variableValue:A.value,bucketValue:y,ruleKey:b.key},this.logger.debug("allocated variable",a),a}}}}return a={featureKey:d.key,reason:i.DEFAULTED,variableKey:t,variableSchema:h,variableValue:h.defaultValue,bucketValue:y},this.logger.debug("using default value",a),a}catch(r){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,variableKey:t,error:r}}},e.prototype.getVariable=function(e,t,r){void 0===r&&(r={});try{var i=this.evaluateVariable(e,t,r);return void 0!==i.variableValue?i.variableSchema&&"json"===i.variableSchema.type&&"string"==typeof i.variableValue?JSON.parse(i.variableValue):i.variableValue:void 0}catch(r){return void this.logger.error("getVariable",{featureKey:e,variableKey:t,error:r})}},e.prototype.getVariableBoolean=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"boolean")},e.prototype.getVariableString=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"string")},e.prototype.getVariableInteger=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"integer")},e.prototype.getVariableDouble=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"double")},e.prototype.getVariableArray=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"array")},e.prototype.getVariableObject=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"object")},e.prototype.getVariableJSON=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"json")},e}();t.FeaturevisorInstance=v,t.createInstance=function(e){return new v(e)}},687:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createLogger=t.Logger=t.defaultLogHandler=t.defaultLogLevels=t.loggerPrefix=void 0,t.loggerPrefix="[Featurevisor]",t.defaultLogLevels=["warn","error"],t.defaultLogHandler=function(e,r,i){switch(void 0===i&&(i={}),e){case"debug":console.log(t.loggerPrefix,r,i);case"info":console.info(t.loggerPrefix,r,i);case"warn":console.warn(t.loggerPrefix,r,i);case"error":console.error(t.loggerPrefix,r,i)}};var r=function(){function e(e){this.levels=e.levels,this.handle=e.handler}return e.prototype.setLevels=function(e){this.levels=e},e.prototype.log=function(e,t,r){-1!==this.levels.indexOf(e)&&this.handle(e,t,r)},e.prototype.debug=function(e,t){this.log("debug",e,t)},e.prototype.info=function(e,t){this.log("info",e,t)},e.prototype.warn=function(e,t){this.log("warn",e,t)},e.prototype.error=function(e,t){this.log("error",e,t)},e}();t.Logger=r,t.createLogger=function(e){void 0===e&&(e={});var i=e.levels||t.defaultLogLevels,a=e.handler||t.defaultLogHandler;return new r({levels:i,handler:a})}},590:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allGroupSegmentsAreMatched=t.segmentIsMatched=void 0;var i=r(243);function a(e,t){return(0,i.allConditionsAreMatched)(e.conditions,t)}t.segmentIsMatched=a,t.allGroupSegmentsAreMatched=function e(t,r,i){if("*"===t)return!0;if("string"==typeof t){var n=i.getSegment(t);return!!n&&a(n,r)}if("object"==typeof t){if("and"in t&&Array.isArray(t.and))return t.and.every((function(t){return e(t,r,i)}));if("or"in t&&Array.isArray(t.or))return t.or.some((function(t){return e(t,r,i)}));if("not"in t&&Array.isArray(t.not))return t.not.every((function(t){return!1===e(t,r,i)}))}return!!Array.isArray(t)&&t.every((function(t){return e(t,r,i)}))}}},t={};function r(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}return r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(97)})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FeaturevisorSDK=t():e.FeaturevisorSDK=t()}(this,(()=>(()=>{var e={480:(e,t,r)=>{"use strict";r.r(t),r.d(t,{compare:()=>n,compareVersions:()=>i,satisfies:()=>o,validate:()=>a});const i=(e,t)=>{const r=u(e),i=u(t),a=r.pop(),n=i.pop(),o=d(r,i);return 0!==o?o:a&&n?d(a.split("."),n.split(".")):a||n?a?-1:1:0},a=e=>"string"==typeof e&&/^[v\d]/.test(e)&&s.test(e),n=(e,t,r)=>{v(r);const a=i(e,t);return h[r].includes(a)},o=(e,t)=>{if(t.includes("||"))return t.split("||").some((t=>o(e,t)));if(t.includes(" "))return t.trim().replace(/\s{2,}/g," ").split(" ").every((t=>o(e,t)));const r=t.match(/^([<>=~^]+)/),i=r?r[1]:"=";if("^"!==i&&"~"!==i)return n(e,t,i);const[a,s,l,,f]=u(e),[c,h,g,,v]=u(t),y=[a,s,l],p=[c,null!=h?h:"x",null!=g?g:"x"];if(v){if(!f)return!1;if(0!==d(y,p))return!1;if(-1===d(f.split("."),v.split(".")))return!1}const b=p.findIndex((e=>"0"!==e))+1,m="~"===i?2:b>1?b:1;return 0===d(y.slice(0,m),p.slice(0,m))&&-1!==d(y.slice(m),p.slice(m))},s=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,u=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(s);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},l=e=>"*"===e||"x"===e||"X"===e,f=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},c=(e,t)=>{if(l(e)||l(t))return 0;const[r,i]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(f(e),f(t));return r>i?1:r<i?-1:0},d=(e,t)=>{for(let r=0;r<Math.max(e.length,t.length);r++){const i=c(e[r]||"0",t[r]||"0");if(0!==i)return i}return 0},h={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1]},g=Object.keys(h),v=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===g.indexOf(e))throw new Error(`Invalid operator, expected one of ${g.join("|")}`)}},77:e=>{!function(){const t=e=>(new TextEncoder).encode(e);function r(e,r){let i,a,n,o,s,u,l,f;for("string"==typeof e&&(e=t(e)),i=3&e.length,a=e.length-i,n=r,s=3432918353,u=461845907,f=0;f<a;)l=255&e[f]|(255&e[++f])<<8|(255&e[++f])<<16|(255&e[++f])<<24,++f,l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,n^=l,n=n<<13|n>>>19,o=5*(65535&n)+((5*(n>>>16)&65535)<<16)&4294967295,n=27492+(65535&o)+((58964+(o>>>16)&65535)<<16);switch(l=0,i){case 3:l^=(255&e[f+2])<<16;case 2:l^=(255&e[f+1])<<8;case 1:l^=255&e[f],l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295,l=l<<15|l>>>17,l=(65535&l)*u+(((l>>>16)*u&65535)<<16)&4294967295,n^=l}return n^=e.length,n^=n>>>16,n=2246822507*(65535&n)+((2246822507*(n>>>16)&65535)<<16)&4294967295,n^=n>>>13,n=3266489909*(65535&n)+((3266489909*(n>>>16)&65535)<<16)&4294967295,n^=n>>>16,n>>>0}const i=r;i.v2=function(e,r){"string"==typeof e&&(e=t(e));let i,a=e.length,n=r^a,o=0;for(;a>=4;)i=255&e[o]|(255&e[++o])<<8|(255&e[++o])<<16|(255&e[++o])<<24,i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16),i^=i>>>24,i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^i,a-=4,++o;switch(a){case 3:n^=(255&e[o+2])<<16;case 2:n^=(255&e[o+1])<<8;case 1:n^=255&e[o],n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)}return n^=n>>>13,n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16),n^=n>>>15,n>>>0},i.v3=r,e.exports=i}()},725:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBucketedNumber=t.MAX_BUCKETED_NUMBER=void 0;var i=r(77),a=Math.pow(2,32);t.MAX_BUCKETED_NUMBER=1e5,t.getBucketedNumber=function(e){var r=i.v3(e,1)/a;return Math.floor(r*t.MAX_BUCKETED_NUMBER)}},243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allConditionsAreMatched=t.conditionIsMatched=void 0;var i=r(480);function a(e,t){var r=e.attribute,a=e.operator,n=e.value;if("equals"===a)return t[r]===n;if("notEquals"===a)return t[r]!==n;if("before"===a||"after"===a){var o=(u=t[r])instanceof Date?u:new Date(u),s=n instanceof Date?n:new Date(n);return"before"===a?o<s:o>s}if("string"==typeof t[r]&&Array.isArray(n)){var u=t[r];if("in"===a)return-1!==n.indexOf(u);if("notIn"===a)return-1===n.indexOf(u)}else if("string"==typeof t[r]&&"string"==typeof n){if(u=t[r],"contains"===a)return-1!==u.indexOf(n);if("notContains"===a)return-1===u.indexOf(n);if("startsWith"===a)return u.startsWith(n);if("endsWith"===a)return u.endsWith(n);if("semverEquals"===a)return 0===(0,i.compareVersions)(u,n);if("semverNotEquals"===a)return 0!==(0,i.compareVersions)(u,n);if("semverGreaterThan"===a)return 1===(0,i.compareVersions)(u,n);if("semverGreaterThanOrEquals"===a)return(0,i.compareVersions)(u,n)>=0;if("semverLessThan"===a)return-1===(0,i.compareVersions)(u,n);if("semverLessThanOrEquals"===a)return(0,i.compareVersions)(u,n)<=0}else if("number"==typeof t[r]&&"number"==typeof n){if(u=t[r],"greaterThan"===a)return u>n;if("greaterThanOrEquals"===a)return u>=n;if("lessThan"===a)return u<n;if("lessThanOrEquals"===a)return u<=n}return!1}t.conditionIsMatched=a,t.allConditionsAreMatched=function e(t,r){return"attribute"in t?a(t,r):"and"in t&&Array.isArray(t.and)?t.and.every((function(t){return e(t,r)})):"or"in t&&Array.isArray(t.or)?t.or.some((function(t){return e(t,r)})):"not"in t&&Array.isArray(t.not)?t.not.every((function(i){return!1===e({and:t.not},r)})):!!Array.isArray(t)&&t.every((function(t){return e(t,r)}))}},913:(e,t)=>{"use strict";function r(e,t){if("string"==typeof e[t]&&"*"!==e[t])try{e[t]=JSON.parse(e[t])}catch(e){console.error("Error parsing JSON",e)}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.DatafileReader=t.parseJsonConditionsIfStringified=void 0,t.parseJsonConditionsIfStringified=r;var i=function(){function e(e){this.schemaVersion=e.schemaVersion,this.revision=e.revision,this.segments=e.segments,this.attributes=e.attributes,this.features=e.features}return e.prototype.getRevision=function(){return this.revision},e.prototype.getSchemaVersion=function(){return this.schemaVersion},e.prototype.getAllAttributes=function(){return this.attributes},e.prototype.getAttribute=function(e){return this.attributes.find((function(t){return t.key===e}))},e.prototype.getSegment=function(e){var t=this.segments.find((function(t){return t.key===e}));if(t)return r(t,"conditions")},e.prototype.getFeature=function(e){var t=this.features.find((function(t){return t.key===e}));if(t)return t},e}();t.DatafileReader=i},186:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var r=function(){function e(){this._listeners={}}return e.prototype.addListener=function(e,t){void 0===this._listeners[e]&&(this._listeners[e]=[]),this._listeners[e].push(t)},e.prototype.removeListener=function(e,t){if(void 0!==this._listeners[e]){var r=this._listeners[e].indexOf(t);-1!==r&&this._listeners[e].splice(r,1)}},e.prototype.removeAllListeners=function(e){var t=this;e?this._listeners[e]=[]:Object.keys(this._listeners).forEach((function(e){t._listeners[e]=[]}))},e.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];void 0!==this._listeners[e]&&this._listeners[e].forEach((function(e){e.apply(void 0,t)}))},e}();t.Emitter=r},522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findForceFromFeature=t.getMatchedTrafficAndAllocation=t.getMatchedTraffic=t.getMatchedAllocation=void 0;var i=r(590),a=r(243);function n(e,t){for(var r=0,i=e.allocation;r<i.length;r++){var a=i[r],n=a.range,o=n[0],s=n[1];if(a.range&&o<=t&&s>=t)return a}}t.getMatchedAllocation=n,t.getMatchedTraffic=function(e,t,r){return e.find((function(e){return!!(0,i.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,t,r)}))},t.getMatchedTrafficAndAllocation=function(e,t,r,a,o){var s;return{matchedTraffic:e.find((function(e){return!!(0,i.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,t,a)&&!!(s=n(e,r))})),matchedAllocation:s}},t.findForceFromFeature=function(e,t,r){if(e.force)return e.force.find((function(e){return e.conditions?(0,a.allConditionsAreMatched)(e.conditions,t):!!e.segments&&(0,i.allGroupSegmentsAreMatched)(e.segments,t,r)}))}},97:function(e,t,r){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var a=Object.getOwnPropertyDescriptor(t,r);a&&!("get"in a?!t.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,a)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),a=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||i(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),a(r(725),t),a(r(681),t),a(r(687),t),a(r(243),t)},681:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createInstance=t.FeaturevisorInstance=t.getValueByType=t.EvaluationReason=void 0;var i,a=r(687),n=r(913),o=r(186),s=r(725),u=r(522),l=r(243),f=r(590),c=".",d={schemaVersion:"1",revision:"unknown",attributes:[],segments:[],features:[]};function h(e,t){return t?t(e):fetch(e).then((function(e){return e.json()}))}function g(e,t){try{if(void 0===e)return;switch(t){case"string":return"string"==typeof e?e:void 0;case"integer":return parseInt(e,10);case"double":return parseFloat(e);case"boolean":return!0===e;case"array":return Array.isArray(e)?e:void 0;case"object":return"object"==typeof e?e:void 0;default:return e}}catch(e){return}}!function(e){e.NOT_FOUND="not_found",e.NO_VARIATIONS="no_variations",e.DISABLED="disabled",e.REQUIRED="required",e.OUT_OF_RANGE="out_of_range",e.FORCED="forced",e.INITIAL="initial",e.STICKY="sticky",e.RULE="rule",e.ALLOCATED="allocated",e.DEFAULTED="defaulted",e.OVERRIDE="override",e.ERROR="error"}(i=t.EvaluationReason||(t.EvaluationReason={})),t.getValueByType=g;var v=function(){function e(e){var t=this;this.bucketKeySeparator=e.bucketKeySeparator||c,this.configureBucketKey=e.configureBucketKey,this.configureBucketValue=e.configureBucketValue,this.datafileUrl=e.datafileUrl,this.handleDatafileFetch=e.handleDatafileFetch,this.initialFeatures=e.initialFeatures,this.interceptContext=e.interceptContext,this.logger=e.logger||(0,a.createLogger)(),this.refreshInterval=e.refreshInterval,this.stickyFeatures=e.stickyFeatures,this.emitter=new o.Emitter,this.statuses={ready:!1,refreshInProgress:!1},e.onReady&&this.emitter.addListener("ready",e.onReady),e.onRefresh&&this.emitter.addListener("refresh",e.onRefresh),e.onUpdate&&this.emitter.addListener("update",e.onUpdate),e.onActivation&&this.emitter.addListener("activation",e.onActivation);var r=this.emitter.addListener.bind(this.emitter);this.on=r,this.addListener=r;var i=this.emitter.removeListener.bind(this.emitter);if(this.off=i,this.removeListener=i,this.removeAllListeners=this.emitter.removeAllListeners.bind(this.emitter),e.datafileUrl)this.setDatafile(e.datafile||d),h(e.datafileUrl,e.handleDatafileFetch).then((function(e){t.setDatafile(e),t.statuses.ready=!0,t.emitter.emit("ready"),t.refreshInterval&&t.startRefreshing()})).catch((function(e){t.logger.error("failed to fetch datafile",{error:e})}));else{if(!e.datafile)throw new Error("Featurevisor SDK instance cannot be created without both `datafile` and `datafileUrl` options");this.setDatafile(e.datafile),this.statuses.ready=!0,setTimeout((function(){t.emitter.emit("ready")}),0)}}return e.prototype.setDatafile=function(e){try{this.datafileReader=new n.DatafileReader("string"==typeof e?JSON.parse(e):e)}catch(e){this.logger.error("could not parse datafile",{error:e})}},e.prototype.setStickyFeatures=function(e){this.stickyFeatures=e},e.prototype.getRevision=function(){return this.datafileReader.getRevision()},e.prototype.getFeature=function(e){return"string"==typeof e?this.datafileReader.getFeature(e):e},e.prototype.getBucketKey=function(e,t){var r,i,a=e.key;if("string"==typeof e.bucketBy)r="plain",i=[e.bucketBy];else if(Array.isArray(e.bucketBy))r="and",i=e.bucketBy;else{if("object"!=typeof e.bucketBy||!Array.isArray(e.bucketBy.or))throw this.logger.error("invalid bucketBy",{featureKey:a,bucketBy:e.bucketBy}),new Error("invalid bucketBy");r="or",i=e.bucketBy.or}var n=[];i.forEach((function(e){var i=t[e];void 0!==i&&("plain"===r||"and"===r||0===n.length)&&n.push(i)})),n.push(a);var o=n.join(this.bucketKeySeparator);return this.configureBucketKey?this.configureBucketKey(e,t,o):o},e.prototype.getBucketValue=function(e,t){var r=this.getBucketKey(e,t),i=(0,s.getBucketedNumber)(r);return this.configureBucketValue?this.configureBucketValue(e,t,i):i},e.prototype.isReady=function(){return this.statuses.ready},e.prototype.refresh=function(){var e=this;return this.logger.debug("refreshing datafile"),this.statuses.refreshInProgress?this.logger.warn("refresh in progress, skipping"):this.datafileUrl?(this.statuses.refreshInProgress=!0,void h(this.datafileUrl,this.handleDatafileFetch).then((function(t){var r=e.getRevision()!==t.revision;e.setDatafile(t),e.logger.info("refreshed datafile"),e.emitter.emit("refresh"),r&&e.emitter.emit("update"),e.statuses.refreshInProgress=!1})).catch((function(t){e.logger.error("failed to refresh datafile",{error:t}),e.statuses.refreshInProgress=!1}))):this.logger.error("cannot refresh since `datafileUrl` is not provided")},e.prototype.startRefreshing=function(){var e=this;return this.datafileUrl?this.intervalId?this.logger.warn("refreshing has already started"):this.refreshInterval?void(this.intervalId=setInterval((function(){e.refresh()}),1e3*this.refreshInterval)):this.logger.warn("no `refreshInterval` option provided"):this.logger.error("cannot start refreshing since `datafileUrl` is not provided")},e.prototype.stopRefreshing=function(){if(!this.intervalId)return this.logger.warn("refreshing has not started yet");clearInterval(this.intervalId)},e.prototype.evaluateFlag=function(e,t){var r,a=this;void 0===t&&(t={});try{var n="string"==typeof e?e:e.key;if(this.stickyFeatures&&this.stickyFeatures[n]&&void 0!==this.stickyFeatures[n].enabled)return r={featureKey:n,reason:i.STICKY,enabled:this.stickyFeatures[n].enabled,sticky:this.stickyFeatures[n]},this.logger.debug("using sticky enabled",r),r;if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[n]&&void 0!==this.initialFeatures[n].enabled)return r={featureKey:n,reason:i.INITIAL,enabled:this.initialFeatures[n].enabled,initial:this.initialFeatures[n]},this.logger.debug("using initial enabled",r),r;var o=this.getFeature(e);if(!o)return r={featureKey:n,reason:i.NOT_FOUND},this.logger.warn("feature not found",r),r;var s=this.interceptContext?this.interceptContext(t):t,l=(0,u.findForceFromFeature)(o,t,this.datafileReader);if(l&&void 0!==l.enabled)return r={featureKey:o.key,reason:i.FORCED,enabled:l.enabled},this.logger.debug("forced enabled found",r),r;if(o.required&&o.required.length>0){var f=o.required.every((function(e){var t,r;return"string"==typeof e?t=e:(t=e.key,r=e.variation),!!a.isEnabled(t,s)&&(void 0===r||a.getVariation(t,s)===r)}));if(!f)return{featureKey:o.key,reason:i.REQUIRED,enabled:f}}var c=this.getBucketValue(o,s),d=(0,u.getMatchedTraffic)(o.traffic,s,this.datafileReader);if(d){if(o.ranges&&o.ranges.length>0)return o.ranges.find((function(e){return c>=e[0]&&c<e[1]}))?r={featureKey:o.key,reason:i.ALLOCATED,enabled:void 0===d.enabled||d.enabled,bucketValue:c}:(r={featureKey:o.key,reason:i.OUT_OF_RANGE,enabled:!1,bucketValue:c},this.logger.debug("not matched",r),r);if(void 0!==d.enabled)return r={featureKey:o.key,reason:i.OVERRIDE,enabled:d.enabled,bucketValue:c,ruleKey:d.key,traffic:d},this.logger.debug("override from rule",r),r;if(c<d.percentage)return{featureKey:o.key,reason:i.RULE,enabled:!0,bucketValue:c,ruleKey:d.key,traffic:d}}return{featureKey:o.key,reason:i.ERROR,enabled:!1,bucketValue:c}}catch(t){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,error:t}}},e.prototype.isEnabled=function(e,t){void 0===t&&(t={});try{return!0===this.evaluateFlag(e,t).enabled}catch(t){return this.logger.error("isEnabled",{featureKey:e,error:t}),!1}},e.prototype.evaluateVariation=function(e,t){var r;void 0===t&&(t={});try{var a="string"==typeof e?e:e.key;if(!1===this.evaluateFlag(e,t).enabled)return r={featureKey:a,reason:i.DISABLED},this.logger.debug("feature is disabled",r),r;if(this.stickyFeatures&&this.stickyFeatures[a]&&void 0!==(n=this.stickyFeatures[a].variation))return r={featureKey:a,reason:i.STICKY,variationValue:n},this.logger.debug("using sticky variation",r),r;if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[a]&&void 0!==this.initialFeatures[a].variation){var n=this.initialFeatures[a].variation;return r={featureKey:a,reason:i.INITIAL,variationValue:n},this.logger.debug("using initial variation",r),r}var o=this.getFeature(e);if(!o)return r={featureKey:a,reason:i.NOT_FOUND},this.logger.warn("feature not found",r),r;if(!o.variations||0===o.variations.length)return r={featureKey:a,reason:i.NO_VARIATIONS},this.logger.warn("no variations",r),r;var s=this.interceptContext?this.interceptContext(t):t,l=(0,u.findForceFromFeature)(o,t,this.datafileReader);if(l&&l.variation&&(g=o.variations.find((function(e){return e.value===l.variation}))))return r={featureKey:o.key,reason:i.FORCED,variation:g},this.logger.debug("forced variation found",r),r;var f=this.getBucketValue(o,s),c=(0,u.getMatchedTrafficAndAllocation)(o.traffic,s,f,this.datafileReader,this.logger),d=c.matchedTraffic,h=c.matchedAllocation;if(d){var g;if(d.variation&&(g=o.variations.find((function(e){return e.value===d.variation}))))return r={featureKey:o.key,reason:i.RULE,variation:g,bucketValue:f,ruleKey:d.key},this.logger.debug("override from rule",r),r;if(h&&h.variation&&(g=o.variations.find((function(e){return e.value===h.variation}))))return r={featureKey:o.key,reason:i.ALLOCATED,bucketValue:f,variation:g},this.logger.debug("allocated variation",r),r}return r={featureKey:o.key,reason:i.ERROR,bucketValue:f},this.logger.debug("no matched variation",r),r}catch(t){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,error:t}}},e.prototype.getVariation=function(e,t){void 0===t&&(t={});try{var r=this.evaluateVariation(e,t);return void 0!==r.variationValue?r.variationValue:r.variation?r.variation.value:void 0}catch(t){return void this.logger.error("getVariation",{featureKey:e,error:t})}},e.prototype.activate=function(e,t){void 0===t&&(t={});try{var r=this.evaluateVariation(e,t),i=r.variation?r.variation.value:r.variationValue;if(void 0===i)return;var a=this.interceptContext?this.interceptContext(t):t,n={};return this.datafileReader.getAllAttributes().filter((function(e){return!0===e.capture})).forEach((function(e){void 0!==a[e.key]&&(n[e.key]=t[e.key])})),this.emitter.emit("activation",e,i,a,n,r),i}catch(t){return void this.logger.error("activate",{featureKey:e,error:t})}},e.prototype.evaluateVariable=function(e,t,r){var a,n=this;void 0===r&&(r={});try{var o,s="string"==typeof e?e:e.key;if(!1===this.evaluateFlag(e,r).enabled)return a={featureKey:s,reason:i.DISABLED},this.logger.debug("feature is disabled",a),a;if(this.stickyFeatures&&this.stickyFeatures[s]&&(o=this.stickyFeatures[s].variables)){var c=o[t];if(void 0!==c)return a={featureKey:s,reason:i.STICKY,variableKey:t,variableValue:c},this.logger.debug("using sticky variable",a),a}if(this.statuses&&!this.statuses.ready&&this.initialFeatures&&this.initialFeatures[s]&&(o=this.initialFeatures[s].variables)&&void 0!==o[t])return a={featureKey:s,reason:i.INITIAL,variableKey:t,variableValue:o[t]},this.logger.debug("using initial variable",a),a;var d=this.getFeature(e);if(!d)return a={featureKey:s,reason:i.NOT_FOUND,variableKey:t},this.logger.warn("feature not found in datafile",a),a;var h=Array.isArray(d.variablesSchema)?d.variablesSchema.find((function(e){return e.key===t})):void 0;if(!h)return a={featureKey:s,reason:i.NOT_FOUND,variableKey:t},this.logger.warn("variable schema not found",a),a;var g=this.interceptContext?this.interceptContext(r):r,v=(0,u.findForceFromFeature)(d,r,this.datafileReader);if(v&&v.variables&&void 0!==v.variables[t])return a={featureKey:d.key,reason:i.FORCED,variableKey:t,variableSchema:h,variableValue:v.variables[t]},this.logger.debug("forced variable",a),a;var y=this.getBucketValue(d,g),p=(0,u.getMatchedTrafficAndAllocation)(d.traffic,g,y,this.datafileReader,this.logger),b=p.matchedTraffic,m=p.matchedAllocation;if(b){if(b.variables&&void 0!==b.variables[t])return a={featureKey:d.key,reason:i.RULE,variableKey:t,variableSchema:h,variableValue:b.variables[t],bucketValue:y,ruleKey:b.key},this.logger.debug("override from rule",a),a;if(m&&m.variation&&Array.isArray(d.variations)){var k=d.variations.find((function(e){return e.value===m.variation}));if(k&&k.variables){var A=k.variables.find((function(e){return e.key===t}));if(A){if(A.overrides){var V=A.overrides.find((function(e){return e.conditions?(0,l.allConditionsAreMatched)("string"==typeof e.conditions?JSON.parse(e.conditions):e.conditions,g):!!e.segments&&(0,f.allGroupSegmentsAreMatched)("string"==typeof e.segments&&"*"!==e.segments?JSON.parse(e.segments):e.segments,g,n.datafileReader)}));if(V)return a={featureKey:d.key,reason:i.OVERRIDE,variableKey:t,variableSchema:h,variableValue:V.value,bucketValue:y,ruleKey:b.key},this.logger.debug("variable override",a),a}if(void 0!==A.value)return a={featureKey:d.key,reason:i.ALLOCATED,variableKey:t,variableSchema:h,variableValue:A.value,bucketValue:y,ruleKey:b.key},this.logger.debug("allocated variable",a),a}}}}return a={featureKey:d.key,reason:i.DEFAULTED,variableKey:t,variableSchema:h,variableValue:h.defaultValue,bucketValue:y},this.logger.debug("using default value",a),a}catch(r){return{featureKey:"string"==typeof e?e:e.key,reason:i.ERROR,variableKey:t,error:r}}},e.prototype.getVariable=function(e,t,r){void 0===r&&(r={});try{var i=this.evaluateVariable(e,t,r);return void 0!==i.variableValue?i.variableSchema&&"json"===i.variableSchema.type&&"string"==typeof i.variableValue?JSON.parse(i.variableValue):i.variableValue:void 0}catch(r){return void this.logger.error("getVariable",{featureKey:e,variableKey:t,error:r})}},e.prototype.getVariableBoolean=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"boolean")},e.prototype.getVariableString=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"string")},e.prototype.getVariableInteger=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"integer")},e.prototype.getVariableDouble=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"double")},e.prototype.getVariableArray=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"array")},e.prototype.getVariableObject=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"object")},e.prototype.getVariableJSON=function(e,t,r){return void 0===r&&(r={}),g(this.getVariable(e,t,r),"json")},e}();t.FeaturevisorInstance=v,t.createInstance=function(e){return new v(e)}},687:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createLogger=t.Logger=t.defaultLogHandler=t.defaultLogLevels=t.loggerPrefix=void 0,t.loggerPrefix="[Featurevisor]",t.defaultLogLevels=["warn","error"],t.defaultLogHandler=function(e,r,i){switch(void 0===i&&(i={}),e){case"debug":console.log(t.loggerPrefix,r,i);break;case"info":console.info(t.loggerPrefix,r,i);break;case"warn":console.warn(t.loggerPrefix,r,i);break;case"error":console.error(t.loggerPrefix,r,i)}};var r=function(){function e(e){this.levels=e.levels,this.handle=e.handler}return e.prototype.setLevels=function(e){this.levels=e},e.prototype.log=function(e,t,r){-1!==this.levels.indexOf(e)&&this.handle(e,t,r)},e.prototype.debug=function(e,t){this.log("debug",e,t)},e.prototype.info=function(e,t){this.log("info",e,t)},e.prototype.warn=function(e,t){this.log("warn",e,t)},e.prototype.error=function(e,t){this.log("error",e,t)},e}();t.Logger=r,t.createLogger=function(e){void 0===e&&(e={});var i=e.levels||t.defaultLogLevels,a=e.handler||t.defaultLogHandler;return new r({levels:i,handler:a})}},590:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allGroupSegmentsAreMatched=t.segmentIsMatched=void 0;var i=r(243);function a(e,t){return(0,i.allConditionsAreMatched)(e.conditions,t)}t.segmentIsMatched=a,t.allGroupSegmentsAreMatched=function e(t,r,i){if("*"===t)return!0;if("string"==typeof t){var n=i.getSegment(t);return!!n&&a(n,r)}if("object"==typeof t){if("and"in t&&Array.isArray(t.and))return t.and.every((function(t){return e(t,r,i)}));if("or"in t&&Array.isArray(t.or))return t.or.some((function(t){return e(t,r,i)}));if("not"in t&&Array.isArray(t.not))return t.not.every((function(t){return!1===e(t,r,i)}))}return!!Array.isArray(t)&&t.every((function(t){return e(t,r,i)}))}}},t={};function r(i){var a=t[i];if(void 0!==a)return a.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,r),n.exports}return r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(97)})()));
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.gz
CHANGED
|
Binary file
|