@featurevisor/sdk 1.2.3 → 1.11.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/.eslintcache +1 -1
- package/CHANGELOG.md +19 -0
- package/coverage/clover.xml +325 -322
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov-report/bucket.ts.html +1 -1
- package/coverage/lcov-report/conditions.ts.html +58 -10
- 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 +35 -5
- package/coverage/lcov-report/index.html +11 -11
- package/coverage/lcov-report/instance.ts.html +33 -6
- package/coverage/lcov-report/logger.ts.html +11 -11
- package/coverage/lcov-report/segments.ts.html +15 -9
- package/coverage/lcov.info +575 -572
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/index.js.map +1 -1
- package/lib/conditions.d.ts +2 -1
- package/lib/conditions.js +18 -6
- package/lib/conditions.js.map +1 -1
- package/lib/feature.d.ts +4 -3
- package/lib/feature.js +7 -7
- package/lib/feature.js.map +1 -1
- package/lib/instance.js +8 -8
- package/lib/instance.js.map +1 -1
- package/lib/segments.d.ts +3 -2
- package/lib/segments.js +8 -8
- package/lib/segments.js.map +1 -1
- package/package.json +3 -3
- package/src/conditions.spec.ts +358 -192
- package/src/conditions.ts +20 -4
- package/src/feature.ts +13 -3
- package/src/instance.ts +13 -4
- package/src/segments.spec.ts +56 -28
- package/src/segments.ts +9 -7
|
@@ -119,10 +119,13 @@
|
|
|
119
119
|
<a name='L54'></a><a href='#L54'>54</a>
|
|
120
120
|
<a name='L55'></a><a href='#L55'>55</a>
|
|
121
121
|
<a name='L56'></a><a href='#L56'>56</a>
|
|
122
|
-
<a name='L57'></a><a href='#L57'>57</a
|
|
122
|
+
<a name='L57'></a><a href='#L57'>57</a>
|
|
123
|
+
<a name='L58'></a><a href='#L58'>58</a>
|
|
124
|
+
<a name='L59'></a><a href='#L59'>59</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
123
125
|
<span class="cline-any cline-yes">2x</span>
|
|
124
126
|
<span class="cline-any cline-neutral"> </span>
|
|
125
127
|
<span class="cline-any cline-neutral"> </span>
|
|
128
|
+
<span class="cline-any cline-neutral"> </span>
|
|
126
129
|
<span class="cline-any cline-yes">2x</span>
|
|
127
130
|
<span class="cline-any cline-yes">133x</span>
|
|
128
131
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -132,6 +135,7 @@
|
|
|
132
135
|
<span class="cline-any cline-neutral"> </span>
|
|
133
136
|
<span class="cline-any cline-neutral"> </span>
|
|
134
137
|
<span class="cline-any cline-neutral"> </span>
|
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
|
135
139
|
<span class="cline-any cline-yes">342x</span>
|
|
136
140
|
<span class="cline-any cline-yes">84x</span>
|
|
137
141
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -178,15 +182,17 @@
|
|
|
178
182
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { Context, GroupSegment, Segment, Condition } from "@featurevisor/types";
|
|
179
183
|
import { allConditionsAreMatched } from "./conditions";
|
|
180
184
|
import { DatafileReader } from "./datafileReader";
|
|
185
|
+
import { Logger } from "./logger";
|
|
181
186
|
|
|
182
|
-
export function segmentIsMatched(segment: Segment, context: Context): boolean {
|
|
183
|
-
return allConditionsAreMatched(segment.conditions as Condition | Condition[], context);
|
|
187
|
+
export function segmentIsMatched(segment: Segment, context: Context, logger: Logger): boolean {
|
|
188
|
+
return allConditionsAreMatched(segment.conditions as Condition | Condition[], context, logger);
|
|
184
189
|
}
|
|
185
190
|
|
|
186
191
|
export function allGroupSegmentsAreMatched(
|
|
187
192
|
groupSegments: GroupSegment | GroupSegment[] | "*",
|
|
188
193
|
context: Context,
|
|
189
194
|
datafileReader: DatafileReader,
|
|
195
|
+
logger: Logger,
|
|
190
196
|
): boolean {
|
|
191
197
|
if (groupSegments === "*") {
|
|
192
198
|
return true;
|
|
@@ -196,7 +202,7 @@ export function allGroupSegmentsAreMatched(
|
|
|
196
202
|
const segment = datafileReader.getSegment(groupSegments);
|
|
197
203
|
|
|
198
204
|
if (segment) {
|
|
199
|
-
return segmentIsMatched(segment, context);
|
|
205
|
+
return segmentIsMatched(segment, context, logger);
|
|
200
206
|
}
|
|
201
207
|
|
|
202
208
|
<span class="cstat-no" title="statement not covered" > return false;</span>
|
|
@@ -205,27 +211,27 @@ export function allGroupSegmentsAreMatched(
|
|
|
205
211
|
if (typeof groupSegments === "object") {
|
|
206
212
|
if ("and" in groupSegments && Array.isArray(groupSegments.and)) {
|
|
207
213
|
return groupSegments.and.every((groupSegment) =>
|
|
208
|
-
allGroupSegmentsAreMatched(groupSegment, context, datafileReader),
|
|
214
|
+
allGroupSegmentsAreMatched(groupSegment, context, datafileReader, logger),
|
|
209
215
|
);
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
if ("or" in groupSegments && Array.isArray(groupSegments.or)) {
|
|
213
219
|
return groupSegments.or.some((groupSegment) =>
|
|
214
|
-
allGroupSegmentsAreMatched(groupSegment, context, datafileReader),
|
|
220
|
+
allGroupSegmentsAreMatched(groupSegment, context, datafileReader, logger),
|
|
215
221
|
);
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
if ("not" in groupSegments && Array.isArray(groupSegments.not)) {
|
|
219
225
|
return groupSegments.not.every(
|
|
220
226
|
(groupSegment) =>
|
|
221
|
-
allGroupSegmentsAreMatched(groupSegment, context, datafileReader) === false,
|
|
227
|
+
allGroupSegmentsAreMatched(groupSegment, context, datafileReader, logger) === false,
|
|
222
228
|
);
|
|
223
229
|
}
|
|
224
230
|
}
|
|
225
231
|
|
|
226
232
|
if (Array.isArray(groupSegments)) {
|
|
227
233
|
return groupSegments.every((groupSegment) =>
|
|
228
|
-
allGroupSegmentsAreMatched(groupSegment, context, datafileReader),
|
|
234
|
+
allGroupSegmentsAreMatched(groupSegment, context, datafileReader, logger),
|
|
229
235
|
);
|
|
230
236
|
}
|
|
231
237
|
|
|
@@ -238,7 +244,7 @@ export function allGroupSegmentsAreMatched(
|
|
|
238
244
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
239
245
|
Code coverage generated by
|
|
240
246
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
241
|
-
at 2024-
|
|
247
|
+
at 2024-03-14T17:04:39.207Z
|
|
242
248
|
</div>
|
|
243
249
|
<script src="prettify.js"></script>
|
|
244
250
|
<script>
|