@featurevisor/core 2.26.1 → 3.0.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.
Files changed (390) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/coverage/clover.xml +4991 -3130
  3. package/coverage/coverage-final.json +63 -39
  4. package/coverage/lcov-report/block-navigation.js +1 -1
  5. package/coverage/lcov-report/index.html +248 -98
  6. package/coverage/lcov-report/sorter.js +21 -7
  7. package/coverage/lcov-report/src/assess-distribution/index.html +116 -0
  8. package/coverage/lcov-report/src/assess-distribution/index.ts.html +754 -0
  9. package/coverage/lcov-report/{list → src/benchmark}/index.html +30 -30
  10. package/coverage/lcov-report/src/benchmark/index.ts.html +793 -0
  11. package/coverage/lcov-report/{builder → src/builder}/allocator.ts.html +38 -38
  12. package/coverage/lcov-report/{builder/buildScopedConditions.ts.html → src/builder/applyContextToConditions.ts.html} +80 -65
  13. package/coverage/lcov-report/{builder/buildScopedDatafile.ts.html → src/builder/applyContextToDatafile.ts.html} +92 -92
  14. package/coverage/lcov-report/{builder/buildScopedSegments.ts.html → src/builder/applyContextToSegments.ts.html} +103 -67
  15. package/coverage/lcov-report/{builder → src/builder}/buildDatafile.ts.html +336 -306
  16. package/coverage/lcov-report/src/builder/buildProject.ts.html +1117 -0
  17. package/coverage/lcov-report/src/builder/buildRuntimeDatafiles.ts.html +256 -0
  18. package/coverage/lcov-report/{builder → src/builder}/getFeatureRanges.ts.html +22 -22
  19. package/coverage/lcov-report/{builder → src/builder}/hashes.ts.html +50 -50
  20. package/coverage/lcov-report/{builder → src/builder}/index.html +114 -84
  21. package/coverage/lcov-report/{tester/cliFormat.ts.html → src/builder/index.ts.html} +17 -29
  22. package/coverage/lcov-report/{builder → src/builder}/mutateVariables.ts.html +55 -55
  23. package/coverage/lcov-report/{builder → src/builder}/mutator.ts.html +118 -118
  24. package/coverage/lcov-report/{builder → src/builder}/revision.ts.html +15 -15
  25. package/coverage/lcov-report/{builder → src/builder}/traffic.ts.html +86 -86
  26. package/coverage/lcov-report/src/cli/cli.ts.html +400 -0
  27. package/coverage/lcov-report/{tester → src/cli}/index.html +41 -41
  28. package/coverage/lcov-report/src/cli/plugins.ts.html +214 -0
  29. package/coverage/lcov-report/{config → src/config}/index.html +31 -31
  30. package/coverage/lcov-report/{config → src/config}/index.ts.html +12 -12
  31. package/coverage/lcov-report/{config → src/config}/projectConfig.ts.html +312 -96
  32. package/coverage/lcov-report/{datasource → src/datasource}/adapter.ts.html +28 -73
  33. package/coverage/lcov-report/{datasource → src/datasource}/datasource.ts.html +191 -104
  34. package/coverage/lcov-report/{datasource → src/datasource}/filesystemAdapter.ts.html +233 -635
  35. package/coverage/lcov-report/{datasource → src/datasource}/index.html +48 -48
  36. package/coverage/lcov-report/{datasource → src/datasource}/index.ts.html +14 -14
  37. package/coverage/lcov-report/src/evaluate/index.html +116 -0
  38. package/coverage/lcov-report/src/evaluate/index.ts.html +814 -0
  39. package/coverage/lcov-report/src/find-duplicate-segments/findDuplicateSegments.ts.html +313 -0
  40. package/coverage/lcov-report/src/find-duplicate-segments/index.html +131 -0
  41. package/coverage/lcov-report/src/find-duplicate-segments/index.ts.html +307 -0
  42. package/coverage/lcov-report/src/find-usage/index.html +116 -0
  43. package/coverage/lcov-report/src/find-usage/index.ts.html +1780 -0
  44. package/coverage/lcov-report/src/generate-code/index.html +131 -0
  45. package/coverage/lcov-report/src/generate-code/index.ts.html +403 -0
  46. package/coverage/lcov-report/{generate-code → src/generate-code}/typescript.ts.html +266 -1361
  47. package/coverage/lcov-report/{generate-code → src}/index.html +38 -23
  48. package/coverage/lcov-report/src/info/index.html +116 -0
  49. package/coverage/lcov-report/src/info/index.ts.html +472 -0
  50. package/coverage/lcov-report/src/init/index.html +116 -0
  51. package/coverage/lcov-report/src/init/index.ts.html +280 -0
  52. package/coverage/lcov-report/{linter → src/linter}/attributeSchema.ts.html +160 -157
  53. package/coverage/lcov-report/{linter → src/linter}/checkCircularDependency.ts.html +25 -25
  54. package/coverage/lcov-report/{linter → src/linter}/checkPercentageExceedingSlot.ts.html +42 -42
  55. package/coverage/lcov-report/{linter → src/linter}/conditionSchema.ts.html +207 -207
  56. package/coverage/lcov-report/{linter → src/linter}/featureSchema.ts.html +462 -471
  57. package/coverage/lcov-report/{linter → src/linter}/groupSchema.ts.html +25 -22
  58. package/coverage/lcov-report/{linter → src/linter}/index.html +129 -99
  59. package/coverage/lcov-report/src/linter/index.ts.html +88 -0
  60. package/coverage/lcov-report/{linter → src/linter}/lintProject.ts.html +740 -332
  61. package/coverage/lcov-report/{linter → src/linter}/mutationNotation.ts.html +130 -130
  62. package/coverage/lcov-report/{linter → src/linter}/printError.ts.html +27 -27
  63. package/coverage/lcov-report/{linter → src/linter}/schema.ts.html +153 -150
  64. package/coverage/lcov-report/{linter → src/linter}/segmentSchema.ts.html +18 -15
  65. package/coverage/lcov-report/src/linter/targetSchema.ts.html +223 -0
  66. package/coverage/lcov-report/{linter → src/linter}/testSchema.ts.html +54 -48
  67. package/coverage/lcov-report/{linter → src/linter}/zodHelpers.ts.html +17 -17
  68. package/coverage/lcov-report/src/list/index.html +131 -0
  69. package/coverage/lcov-report/src/list/index.ts.html +2065 -0
  70. package/coverage/lcov-report/{list → src/list}/matrix.ts.html +43 -58
  71. package/coverage/lcov-report/src/promoter/index.html +116 -0
  72. package/coverage/lcov-report/src/promoter/index.ts.html +3883 -0
  73. package/coverage/lcov-report/src/sets.ts.html +313 -0
  74. package/coverage/lcov-report/src/targeting.ts.html +403 -0
  75. package/coverage/lcov-report/src/tester/cliFormat.ts.html +133 -0
  76. package/coverage/lcov-report/{tester → src/tester}/helpers.ts.html +15 -15
  77. package/coverage/lcov-report/src/tester/index.html +206 -0
  78. package/coverage/lcov-report/src/tester/prettyDuration.ts.html +187 -0
  79. package/coverage/lcov-report/src/tester/printTestResult.ts.html +337 -0
  80. package/coverage/lcov-report/src/tester/testFeature.ts.html +1186 -0
  81. package/coverage/lcov-report/src/tester/testProject.ts.html +1018 -0
  82. package/coverage/lcov-report/src/tester/testSegment.ts.html +316 -0
  83. package/coverage/lcov-report/{utils → src/utils}/extractKeys.ts.html +68 -68
  84. package/coverage/lcov-report/{utils → src/utils}/git.ts.html +44 -68
  85. package/coverage/lcov-report/{utils → src/utils}/index.html +44 -44
  86. package/coverage/lcov-report/{utils → src/utils}/index.ts.html +14 -14
  87. package/coverage/lcov-report/{utils → src/utils}/pretty.ts.html +20 -20
  88. package/coverage/lcov.info +10121 -5723
  89. package/jest.config.js +13 -4
  90. package/lib/assess-distribution/index.d.ts +1 -1
  91. package/lib/assess-distribution/index.js +59 -40
  92. package/lib/assess-distribution/index.js.map +1 -1
  93. package/lib/benchmark/index.d.ts +8 -5
  94. package/lib/benchmark/index.js +82 -65
  95. package/lib/benchmark/index.js.map +1 -1
  96. package/lib/builder/applyContextToConditions.d.ts +5 -0
  97. package/lib/builder/{buildScopedConditions.js → applyContextToConditions.js} +19 -14
  98. package/lib/builder/applyContextToConditions.js.map +1 -0
  99. package/lib/builder/applyContextToDatafile.d.ts +2 -0
  100. package/lib/builder/{buildScopedDatafile.js → applyContextToDatafile.js} +26 -26
  101. package/lib/builder/applyContextToDatafile.js.map +1 -0
  102. package/lib/builder/applyContextToSegments.d.ts +5 -0
  103. package/lib/builder/{buildScopedSegments.js → applyContextToSegments.js} +19 -14
  104. package/lib/builder/applyContextToSegments.js.map +1 -0
  105. package/lib/builder/buildDatafile.d.ts +9 -6
  106. package/lib/builder/buildDatafile.js +86 -51
  107. package/lib/builder/buildDatafile.js.map +1 -1
  108. package/lib/builder/buildProject.d.ts +17 -3
  109. package/lib/builder/buildProject.js +151 -59
  110. package/lib/builder/buildProject.js.map +1 -1
  111. package/lib/builder/buildRuntimeDatafiles.d.ts +12 -0
  112. package/lib/builder/buildRuntimeDatafiles.js +35 -0
  113. package/lib/builder/buildRuntimeDatafiles.js.map +1 -0
  114. package/lib/builder/getFeatureRanges.js +34 -1
  115. package/lib/builder/getFeatureRanges.js.map +1 -1
  116. package/lib/builder/hashes.js +34 -1
  117. package/lib/builder/hashes.js.map +1 -1
  118. package/lib/builder/index.d.ts +0 -1
  119. package/lib/builder/index.js +0 -1
  120. package/lib/builder/index.js.map +1 -1
  121. package/lib/cli/cli.js +0 -4
  122. package/lib/cli/cli.js.map +1 -1
  123. package/lib/cli/plugins.js +7 -2
  124. package/lib/cli/plugins.js.map +1 -1
  125. package/lib/config/projectConfig.d.ts +17 -17
  126. package/lib/config/projectConfig.js +101 -15
  127. package/lib/config/projectConfig.js.map +1 -1
  128. package/lib/datasource/adapter.d.ts +7 -9
  129. package/lib/datasource/adapter.js +0 -7
  130. package/lib/datasource/adapter.js.map +1 -1
  131. package/lib/datasource/datasource.d.ts +15 -5
  132. package/lib/datasource/datasource.js +37 -9
  133. package/lib/datasource/datasource.js.map +1 -1
  134. package/lib/datasource/filesystemAdapter.d.ts +4 -10
  135. package/lib/datasource/filesystemAdapter.js +111 -149
  136. package/lib/datasource/filesystemAdapter.js.map +1 -1
  137. package/lib/evaluate/index.d.ts +1 -7
  138. package/lib/evaluate/index.js +81 -67
  139. package/lib/evaluate/index.js.map +1 -1
  140. package/lib/find-duplicate-segments/findDuplicateSegments.js +34 -1
  141. package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
  142. package/lib/find-duplicate-segments/index.js +21 -13
  143. package/lib/find-duplicate-segments/index.js.map +1 -1
  144. package/lib/find-usage/index.js +57 -41
  145. package/lib/find-usage/index.js.map +1 -1
  146. package/lib/generate-code/index.d.ts +1 -1
  147. package/lib/generate-code/index.js +64 -21
  148. package/lib/generate-code/index.js.map +1 -1
  149. package/lib/generate-code/typescript.d.ts +1 -1
  150. package/lib/generate-code/typescript.js +59 -333
  151. package/lib/generate-code/typescript.js.map +1 -1
  152. package/lib/index.d.ts +2 -1
  153. package/lib/index.js +2 -1
  154. package/lib/index.js.map +1 -1
  155. package/lib/info/index.js +57 -16
  156. package/lib/info/index.js.map +1 -1
  157. package/lib/init/index.d.ts +2 -2
  158. package/lib/init/index.js +39 -3
  159. package/lib/init/index.js.map +1 -1
  160. package/lib/linter/attributeSchema.d.ts +1 -0
  161. package/lib/linter/attributeSchema.js +1 -0
  162. package/lib/linter/attributeSchema.js.map +1 -1
  163. package/lib/linter/conditionSchema.js +5 -5
  164. package/lib/linter/conditionSchema.js.map +1 -1
  165. package/lib/linter/featureSchema.d.ts +4 -1
  166. package/lib/linter/featureSchema.js +15 -13
  167. package/lib/linter/featureSchema.js.map +1 -1
  168. package/lib/linter/groupSchema.d.ts +1 -0
  169. package/lib/linter/groupSchema.js +1 -0
  170. package/lib/linter/groupSchema.js.map +1 -1
  171. package/lib/linter/lintProject.d.ts +1 -3
  172. package/lib/linter/lintProject.js +198 -68
  173. package/lib/linter/lintProject.js.map +1 -1
  174. package/lib/linter/schema.js +1 -0
  175. package/lib/linter/schema.js.map +1 -1
  176. package/lib/linter/segmentSchema.d.ts +1 -0
  177. package/lib/linter/segmentSchema.js +1 -0
  178. package/lib/linter/segmentSchema.js.map +1 -1
  179. package/lib/linter/targetSchema.d.ts +16 -0
  180. package/lib/linter/targetSchema.js +40 -0
  181. package/lib/linter/targetSchema.js.map +1 -0
  182. package/lib/linter/testSchema.d.ts +4 -3
  183. package/lib/linter/testSchema.js +9 -4
  184. package/lib/linter/testSchema.js.map +1 -1
  185. package/lib/list/index.d.ts +1 -0
  186. package/lib/list/index.js +131 -12
  187. package/lib/list/index.js.map +1 -1
  188. package/lib/list/matrix.js +3 -7
  189. package/lib/list/matrix.js.map +1 -1
  190. package/lib/promoter/index.d.ts +50 -0
  191. package/lib/promoter/index.js +880 -0
  192. package/lib/promoter/index.js.map +1 -0
  193. package/lib/sets.d.ts +11 -0
  194. package/lib/sets.js +81 -0
  195. package/lib/sets.js.map +1 -0
  196. package/lib/targeting.d.ts +14 -0
  197. package/lib/targeting.js +82 -0
  198. package/lib/targeting.js.map +1 -0
  199. package/lib/tester/cliFormat.d.ts +7 -1
  200. package/lib/tester/cliFormat.js +11 -2
  201. package/lib/tester/cliFormat.js.map +1 -1
  202. package/lib/tester/printTestResult.js +2 -2
  203. package/lib/tester/printTestResult.js.map +1 -1
  204. package/lib/tester/testFeature.d.ts +0 -1
  205. package/lib/tester/testFeature.js +8 -25
  206. package/lib/tester/testFeature.js.map +1 -1
  207. package/lib/tester/testProject.d.ts +2 -3
  208. package/lib/tester/testProject.js +93 -86
  209. package/lib/tester/testProject.js.map +1 -1
  210. package/lib/tester/testSegment.d.ts +1 -1
  211. package/lib/tester/testSegment.js +3 -21
  212. package/lib/tester/testSegment.js.map +1 -1
  213. package/lib/utils/git.js +45 -19
  214. package/lib/utils/git.js.map +1 -1
  215. package/package.json +12 -12
  216. package/src/assess-distribution/index.ts +72 -52
  217. package/src/benchmark/index.ts +124 -91
  218. package/src/builder/{buildScopedConditions.spec.ts → applyContextToConditions.spec.ts} +160 -142
  219. package/src/builder/{buildScopedConditions.ts → applyContextToConditions.ts} +19 -14
  220. package/src/builder/{buildScopedDatafile.spec.ts → applyContextToDatafile.spec.ts} +141 -81
  221. package/src/builder/{buildScopedDatafile.ts → applyContextToDatafile.ts} +33 -33
  222. package/src/builder/{buildScopedSegments.spec.ts → applyContextToSegments.spec.ts} +171 -151
  223. package/src/builder/{buildScopedSegments.ts → applyContextToSegments.ts} +26 -14
  224. package/src/builder/buildDatafile.spec.ts +192 -14
  225. package/src/builder/buildDatafile.ts +74 -64
  226. package/src/builder/buildProject.ts +171 -86
  227. package/src/builder/buildRuntimeDatafiles.ts +57 -0
  228. package/src/builder/index.ts +0 -1
  229. package/src/cli/cli.ts +0 -5
  230. package/src/cli/plugins.ts +7 -2
  231. package/src/config/projectConfig.spec.ts +171 -8
  232. package/src/config/projectConfig.ts +100 -28
  233. package/src/datasource/adapter.ts +8 -23
  234. package/src/datasource/datasource.ts +50 -21
  235. package/src/datasource/filesystemAdapter.spec.ts +133 -74
  236. package/src/datasource/filesystemAdapter.ts +93 -227
  237. package/src/evaluate/index.ts +109 -97
  238. package/src/find-duplicate-segments/index.ts +34 -16
  239. package/src/find-usage/index.ts +89 -44
  240. package/src/generate-code/index.ts +36 -24
  241. package/src/generate-code/typescript.spec.ts +106 -0
  242. package/src/generate-code/typescript.ts +33 -398
  243. package/src/index.ts +2 -1
  244. package/src/info/index.ts +72 -16
  245. package/src/init/index.ts +1 -1
  246. package/src/linter/attributeSchema.ts +1 -0
  247. package/src/linter/conditionSchema.spec.ts +23 -3
  248. package/src/linter/conditionSchema.ts +5 -5
  249. package/src/linter/featureSchema.spec.ts +107 -18
  250. package/src/linter/featureSchema.ts +25 -28
  251. package/src/linter/groupSchema.ts +1 -0
  252. package/src/linter/lintProject.spec.ts +131 -92
  253. package/src/linter/lintProject.ts +233 -97
  254. package/src/linter/schema.ts +1 -0
  255. package/src/linter/segmentSchema.spec.ts +5 -3
  256. package/src/linter/segmentSchema.ts +1 -0
  257. package/src/linter/targetSchema.spec.ts +159 -0
  258. package/src/linter/targetSchema.ts +46 -0
  259. package/src/linter/testSchema.spec.ts +70 -5
  260. package/src/linter/testSchema.ts +12 -10
  261. package/src/list/index.spec.ts +135 -0
  262. package/src/list/index.ts +188 -12
  263. package/src/list/matrix.ts +3 -8
  264. package/src/promoter/index.spec.ts +617 -0
  265. package/src/promoter/index.ts +1266 -0
  266. package/src/sets.ts +76 -0
  267. package/src/targeting.spec.ts +74 -0
  268. package/src/targeting.ts +106 -0
  269. package/src/tester/cliFormat.ts +11 -1
  270. package/src/tester/printTestResult.ts +12 -3
  271. package/src/tester/testFeature.ts +10 -36
  272. package/src/tester/testProject.spec.ts +50 -0
  273. package/src/tester/testProject.ts +89 -140
  274. package/src/tester/testSegment.ts +5 -22
  275. package/src/utils/git.ts +13 -21
  276. package/tsconfig.cjs.json +5 -1
  277. package/tsconfig.typecheck.json +9 -0
  278. package/coverage/lcov-report/builder/convertToV1.ts.html +0 -583
  279. package/lib/builder/allocator.spec.d.ts +0 -1
  280. package/lib/builder/allocator.spec.js +0 -85
  281. package/lib/builder/allocator.spec.js.map +0 -1
  282. package/lib/builder/buildDatafile.spec.d.ts +0 -1
  283. package/lib/builder/buildDatafile.spec.js +0 -233
  284. package/lib/builder/buildDatafile.spec.js.map +0 -1
  285. package/lib/builder/buildScopedConditions.d.ts +0 -5
  286. package/lib/builder/buildScopedConditions.js.map +0 -1
  287. package/lib/builder/buildScopedConditions.spec.d.ts +0 -1
  288. package/lib/builder/buildScopedConditions.spec.js +0 -2167
  289. package/lib/builder/buildScopedConditions.spec.js.map +0 -1
  290. package/lib/builder/buildScopedDatafile.d.ts +0 -2
  291. package/lib/builder/buildScopedDatafile.js.map +0 -1
  292. package/lib/builder/buildScopedDatafile.spec.d.ts +0 -1
  293. package/lib/builder/buildScopedDatafile.spec.js +0 -2277
  294. package/lib/builder/buildScopedDatafile.spec.js.map +0 -1
  295. package/lib/builder/buildScopedSegments.d.ts +0 -5
  296. package/lib/builder/buildScopedSegments.js.map +0 -1
  297. package/lib/builder/buildScopedSegments.spec.d.ts +0 -1
  298. package/lib/builder/buildScopedSegments.spec.js +0 -1062
  299. package/lib/builder/buildScopedSegments.spec.js.map +0 -1
  300. package/lib/builder/convertToV1.d.ts +0 -10
  301. package/lib/builder/convertToV1.js +0 -119
  302. package/lib/builder/convertToV1.js.map +0 -1
  303. package/lib/builder/mutateVariables.spec.d.ts +0 -1
  304. package/lib/builder/mutateVariables.spec.js +0 -1074
  305. package/lib/builder/mutateVariables.spec.js.map +0 -1
  306. package/lib/builder/mutator.spec.d.ts +0 -1
  307. package/lib/builder/mutator.spec.js +0 -368
  308. package/lib/builder/mutator.spec.js.map +0 -1
  309. package/lib/builder/revision.spec.d.ts +0 -1
  310. package/lib/builder/revision.spec.js +0 -21
  311. package/lib/builder/revision.spec.js.map +0 -1
  312. package/lib/builder/traffic.spec.d.ts +0 -1
  313. package/lib/builder/traffic.spec.js +0 -872
  314. package/lib/builder/traffic.spec.js.map +0 -1
  315. package/lib/config/projectConfig.spec.d.ts +0 -1
  316. package/lib/config/projectConfig.spec.js +0 -24
  317. package/lib/config/projectConfig.spec.js.map +0 -1
  318. package/lib/datasource/filesystemAdapter.spec.d.ts +0 -1
  319. package/lib/datasource/filesystemAdapter.spec.js +0 -88
  320. package/lib/datasource/filesystemAdapter.spec.js.map +0 -1
  321. package/lib/generate-code/typescript.spec.d.ts +0 -1
  322. package/lib/generate-code/typescript.spec.js +0 -78
  323. package/lib/generate-code/typescript.spec.js.map +0 -1
  324. package/lib/linter/attributeSchema.spec.d.ts +0 -1
  325. package/lib/linter/attributeSchema.spec.js +0 -266
  326. package/lib/linter/attributeSchema.spec.js.map +0 -1
  327. package/lib/linter/conditionSchema.spec.d.ts +0 -1
  328. package/lib/linter/conditionSchema.spec.js +0 -380
  329. package/lib/linter/conditionSchema.spec.js.map +0 -1
  330. package/lib/linter/featureSchema.spec.d.ts +0 -1
  331. package/lib/linter/featureSchema.spec.js +0 -1552
  332. package/lib/linter/featureSchema.spec.js.map +0 -1
  333. package/lib/linter/lintProject.spec.d.ts +0 -1
  334. package/lib/linter/lintProject.spec.js +0 -211
  335. package/lib/linter/lintProject.spec.js.map +0 -1
  336. package/lib/linter/mutationNotation.spec.d.ts +0 -1
  337. package/lib/linter/mutationNotation.spec.js +0 -598
  338. package/lib/linter/mutationNotation.spec.js.map +0 -1
  339. package/lib/linter/schema.spec.d.ts +0 -1
  340. package/lib/linter/schema.spec.js +0 -535
  341. package/lib/linter/schema.spec.js.map +0 -1
  342. package/lib/linter/segmentSchema.spec.d.ts +0 -1
  343. package/lib/linter/segmentSchema.spec.js +0 -303
  344. package/lib/linter/segmentSchema.spec.js.map +0 -1
  345. package/lib/linter/testSchema.spec.d.ts +0 -1
  346. package/lib/linter/testSchema.spec.js +0 -162
  347. package/lib/linter/testSchema.spec.js.map +0 -1
  348. package/lib/list/matrix.spec.d.ts +0 -1
  349. package/lib/list/matrix.spec.js +0 -42
  350. package/lib/list/matrix.spec.js.map +0 -1
  351. package/lib/site/exportSite.d.ts +0 -2
  352. package/lib/site/exportSite.js +0 -30
  353. package/lib/site/exportSite.js.map +0 -1
  354. package/lib/site/generateHistory.d.ts +0 -3
  355. package/lib/site/generateHistory.js +0 -31
  356. package/lib/site/generateHistory.js.map +0 -1
  357. package/lib/site/generateSiteSearchIndex.d.ts +0 -4
  358. package/lib/site/generateSiteSearchIndex.js +0 -195
  359. package/lib/site/generateSiteSearchIndex.js.map +0 -1
  360. package/lib/site/getLastModifiedFromHistory.d.ts +0 -2
  361. package/lib/site/getLastModifiedFromHistory.js +0 -18
  362. package/lib/site/getLastModifiedFromHistory.js.map +0 -1
  363. package/lib/site/getOwnerAndRepoFromUrl.d.ts +0 -4
  364. package/lib/site/getOwnerAndRepoFromUrl.js +0 -20
  365. package/lib/site/getOwnerAndRepoFromUrl.js.map +0 -1
  366. package/lib/site/getRelativePaths.d.ts +0 -6
  367. package/lib/site/getRelativePaths.js +0 -15
  368. package/lib/site/getRelativePaths.js.map +0 -1
  369. package/lib/site/getRepoDetails.d.ts +0 -8
  370. package/lib/site/getRepoDetails.js +0 -48
  371. package/lib/site/getRepoDetails.js.map +0 -1
  372. package/lib/site/index.d.ts +0 -2
  373. package/lib/site/index.js +0 -43
  374. package/lib/site/index.js.map +0 -1
  375. package/lib/site/serveSite.d.ts +0 -2
  376. package/lib/site/serveSite.js +0 -54
  377. package/lib/site/serveSite.js.map +0 -1
  378. package/lib/tester/helpers.spec.d.ts +0 -1
  379. package/lib/tester/helpers.spec.js +0 -115
  380. package/lib/tester/helpers.spec.js.map +0 -1
  381. package/src/builder/convertToV1.ts +0 -166
  382. package/src/site/exportSite.ts +0 -42
  383. package/src/site/generateHistory.ts +0 -40
  384. package/src/site/generateSiteSearchIndex.ts +0 -258
  385. package/src/site/getLastModifiedFromHistory.ts +0 -21
  386. package/src/site/getOwnerAndRepoFromUrl.ts +0 -17
  387. package/src/site/getRelativePaths.ts +0 -24
  388. package/src/site/getRepoDetails.ts +0 -62
  389. package/src/site/index.ts +0 -46
  390. package/src/site/serveSite.ts +0 -58
@@ -1,14 +1,14 @@
1
1
  import type { DatafileContent } from "@featurevisor/types";
2
2
 
3
3
  import {
4
- buildScopedSegments,
4
+ applyContextToSegments,
5
5
  removeRedundantGroupSegments,
6
- buildScopedGroupSegments,
7
- } from "./buildScopedSegments";
8
- import { DatafileReader, createLogger } from "@featurevisor/sdk";
6
+ applyContextToGroupSegments,
7
+ } from "./applyContextToSegments";
8
+ import { createFeaturevisor } from "@featurevisor/sdk";
9
9
 
10
- describe("core: buildScopedSegments", function () {
11
- describe("buildScopedSegments", function () {
10
+ describe("core: applyContextToSegments", function () {
11
+ describe("applyContextToSegments", function () {
12
12
  const datafileWithSegments: DatafileContent = {
13
13
  schemaVersion: "2",
14
14
  revision: "unknown",
@@ -45,43 +45,43 @@ describe("core: buildScopedSegments", function () {
45
45
  features: {},
46
46
  };
47
47
 
48
- const datafileReaderWithSegments = new DatafileReader({
48
+ const featurevisorWithSegments = createFeaturevisor({
49
49
  datafile: datafileWithSegments,
50
- logger: createLogger({ level: "fatal" }),
50
+ logLevel: "fatal",
51
51
  });
52
52
 
53
- test("buildScopedSegments is a function", function () {
54
- expect(buildScopedSegments).toBeInstanceOf(Function);
53
+ test("applyContextToSegments is a function", function () {
54
+ expect(applyContextToSegments).toBeInstanceOf(Function);
55
55
  });
56
56
 
57
57
  test("simple cases", function () {
58
58
  // "*" remains "*"
59
- expect(buildScopedSegments(datafileReaderWithSegments, "*", {})).toEqual("*");
59
+ expect(applyContextToSegments(featurevisorWithSegments, "*", {})).toEqual("*");
60
60
 
61
61
  // Plain segment that matches
62
62
  expect(
63
- buildScopedSegments(datafileReaderWithSegments, "web", {
63
+ applyContextToSegments(featurevisorWithSegments, "web", {
64
64
  platform: "web",
65
65
  }),
66
66
  ).toEqual("*");
67
67
 
68
68
  // Plain segment that doesn't match
69
69
  expect(
70
- buildScopedSegments(datafileReaderWithSegments, "web", {
70
+ applyContextToSegments(featurevisorWithSegments, "web", {
71
71
  platform: "mobile",
72
72
  }),
73
73
  ).toEqual("web");
74
74
 
75
75
  // Array of segments - partial match (redundant "*" removed)
76
76
  expect(
77
- buildScopedSegments(datafileReaderWithSegments, ["web", "chrome"], {
77
+ applyContextToSegments(featurevisorWithSegments, ["web", "chrome"], {
78
78
  platform: "web",
79
79
  }),
80
80
  ).toEqual(["chrome"]);
81
81
 
82
82
  // Array of segments - full match (all "*" becomes "*")
83
83
  expect(
84
- buildScopedSegments(datafileReaderWithSegments, ["web", "chrome"], {
84
+ applyContextToSegments(featurevisorWithSegments, ["web", "chrome"], {
85
85
  platform: "web",
86
86
  browser: "chrome",
87
87
  }),
@@ -89,7 +89,7 @@ describe("core: buildScopedSegments", function () {
89
89
 
90
90
  // Array of segments - no match
91
91
  expect(
92
- buildScopedSegments(datafileReaderWithSegments, ["web", "chrome"], {
92
+ applyContextToSegments(featurevisorWithSegments, ["web", "chrome"], {
93
93
  platform: "mobile",
94
94
  browser: "safari",
95
95
  }),
@@ -99,8 +99,8 @@ describe("core: buildScopedSegments", function () {
99
99
  test("AND group segments", function () {
100
100
  // AND with all matching segments (all "*" becomes "*")
101
101
  expect(
102
- buildScopedSegments(
103
- datafileReaderWithSegments,
102
+ applyContextToSegments(
103
+ featurevisorWithSegments,
104
104
  {
105
105
  and: ["web", "chrome"],
106
106
  },
@@ -113,8 +113,8 @@ describe("core: buildScopedSegments", function () {
113
113
 
114
114
  // AND with partial match (redundant "*" removed)
115
115
  expect(
116
- buildScopedSegments(
117
- datafileReaderWithSegments,
116
+ applyContextToSegments(
117
+ featurevisorWithSegments,
118
118
  {
119
119
  and: ["web", "chrome"],
120
120
  },
@@ -128,8 +128,8 @@ describe("core: buildScopedSegments", function () {
128
128
 
129
129
  // AND with no matches
130
130
  expect(
131
- buildScopedSegments(
132
- datafileReaderWithSegments,
131
+ applyContextToSegments(
132
+ featurevisorWithSegments,
133
133
  {
134
134
  and: ["web", "chrome"],
135
135
  },
@@ -144,8 +144,8 @@ describe("core: buildScopedSegments", function () {
144
144
 
145
145
  // AND with "*" in it (all "*" becomes "*")
146
146
  expect(
147
- buildScopedSegments(
148
- datafileReaderWithSegments,
147
+ applyContextToSegments(
148
+ featurevisorWithSegments,
149
149
  {
150
150
  and: ["*", "chrome"],
151
151
  },
@@ -159,8 +159,8 @@ describe("core: buildScopedSegments", function () {
159
159
  test("OR group segments", function () {
160
160
  // OR with all matching segments (all "*" becomes "*")
161
161
  expect(
162
- buildScopedSegments(
163
- datafileReaderWithSegments,
162
+ applyContextToSegments(
163
+ featurevisorWithSegments,
164
164
  {
165
165
  or: ["web", "chrome"],
166
166
  },
@@ -173,8 +173,8 @@ describe("core: buildScopedSegments", function () {
173
173
 
174
174
  // OR with partial match (redundant "*" removed, but OR structure remains)
175
175
  expect(
176
- buildScopedSegments(
177
- datafileReaderWithSegments,
176
+ applyContextToSegments(
177
+ featurevisorWithSegments,
178
178
  {
179
179
  or: ["web", "chrome"],
180
180
  },
@@ -188,8 +188,8 @@ describe("core: buildScopedSegments", function () {
188
188
 
189
189
  // OR with no matches
190
190
  expect(
191
- buildScopedSegments(
192
- datafileReaderWithSegments,
191
+ applyContextToSegments(
192
+ featurevisorWithSegments,
193
193
  {
194
194
  or: ["web", "mobile"],
195
195
  },
@@ -203,10 +203,10 @@ describe("core: buildScopedSegments", function () {
203
203
  });
204
204
 
205
205
  test("NOT group segments", function () {
206
- // NOT with matching segment (all "*" becomes "*")
206
+ // NOT with matching segment remains an always-false expression
207
207
  expect(
208
- buildScopedSegments(
209
- datafileReaderWithSegments,
208
+ applyContextToSegments(
209
+ featurevisorWithSegments,
210
210
  {
211
211
  not: ["web"],
212
212
  },
@@ -214,12 +214,14 @@ describe("core: buildScopedSegments", function () {
214
214
  platform: "web",
215
215
  },
216
216
  ),
217
- ).toEqual("*");
217
+ ).toEqual({
218
+ not: ["*"],
219
+ });
218
220
 
219
221
  // NOT with non-matching segment
220
222
  expect(
221
- buildScopedSegments(
222
- datafileReaderWithSegments,
223
+ applyContextToSegments(
224
+ featurevisorWithSegments,
223
225
  {
224
226
  not: ["web"],
225
227
  },
@@ -231,10 +233,10 @@ describe("core: buildScopedSegments", function () {
231
233
  not: ["web"],
232
234
  });
233
235
 
234
- // NOT with multiple segments (all "*" becomes "*")
236
+ // NOT with multiple matching segments remains an always-false expression
235
237
  expect(
236
- buildScopedSegments(
237
- datafileReaderWithSegments,
238
+ applyContextToSegments(
239
+ featurevisorWithSegments,
238
240
  {
239
241
  not: ["web", "chrome"],
240
242
  },
@@ -243,14 +245,16 @@ describe("core: buildScopedSegments", function () {
243
245
  browser: "chrome",
244
246
  },
245
247
  ),
246
- ).toEqual("*");
248
+ ).toEqual({
249
+ not: ["*"],
250
+ });
247
251
  });
248
252
 
249
253
  test("nested AND group segments", function () {
250
254
  // Nested AND with all matching (all "*" becomes "*")
251
255
  expect(
252
- buildScopedSegments(
253
- datafileReaderWithSegments,
256
+ applyContextToSegments(
257
+ featurevisorWithSegments,
254
258
  {
255
259
  and: [
256
260
  "web",
@@ -269,8 +273,8 @@ describe("core: buildScopedSegments", function () {
269
273
 
270
274
  // Nested AND with partial match (redundant "*" removed)
271
275
  expect(
272
- buildScopedSegments(
273
- datafileReaderWithSegments,
276
+ applyContextToSegments(
277
+ featurevisorWithSegments,
274
278
  {
275
279
  and: [
276
280
  "web",
@@ -296,8 +300,8 @@ describe("core: buildScopedSegments", function () {
296
300
  test("nested OR group segments", function () {
297
301
  // Nested OR with outer match (redundant "*" removed, but inner OR remains)
298
302
  expect(
299
- buildScopedSegments(
300
- datafileReaderWithSegments,
303
+ applyContextToSegments(
304
+ featurevisorWithSegments,
301
305
  {
302
306
  or: [
303
307
  "web",
@@ -320,8 +324,8 @@ describe("core: buildScopedSegments", function () {
320
324
 
321
325
  // Nested OR with inner match (redundant "*" removed, but outer OR remains)
322
326
  expect(
323
- buildScopedSegments(
324
- datafileReaderWithSegments,
327
+ applyContextToSegments(
328
+ featurevisorWithSegments,
325
329
  {
326
330
  or: [
327
331
  "web",
@@ -345,10 +349,10 @@ describe("core: buildScopedSegments", function () {
345
349
  });
346
350
 
347
351
  test("nested NOT group segments", function () {
348
- // Nested NOT (all "*" becomes "*")
352
+ // Nested NOT preserves non-broadening false expressions
349
353
  expect(
350
- buildScopedSegments(
351
- datafileReaderWithSegments,
354
+ applyContextToSegments(
355
+ featurevisorWithSegments,
352
356
  {
353
357
  not: [
354
358
  "web",
@@ -362,14 +366,20 @@ describe("core: buildScopedSegments", function () {
362
366
  browser: "chrome",
363
367
  },
364
368
  ),
365
- ).toEqual("*");
369
+ ).toEqual({
370
+ not: [
371
+ {
372
+ not: ["*"],
373
+ },
374
+ ],
375
+ });
366
376
  });
367
377
 
368
378
  test("mixed nested group segments", function () {
369
379
  // AND with nested OR (redundant "*" removed, but OR structure remains if not all match)
370
380
  expect(
371
- buildScopedSegments(
372
- datafileReaderWithSegments,
381
+ applyContextToSegments(
382
+ featurevisorWithSegments,
373
383
  {
374
384
  and: [
375
385
  "web",
@@ -393,8 +403,8 @@ describe("core: buildScopedSegments", function () {
393
403
 
394
404
  // OR with nested AND (redundant "*" removed, but OR structure remains if not all match)
395
405
  expect(
396
- buildScopedSegments(
397
- datafileReaderWithSegments,
406
+ applyContextToSegments(
407
+ featurevisorWithSegments,
398
408
  {
399
409
  or: [
400
410
  "web",
@@ -414,8 +424,8 @@ describe("core: buildScopedSegments", function () {
414
424
 
415
425
  // AND with nested NOT (redundant "*" removed)
416
426
  expect(
417
- buildScopedSegments(
418
- datafileReaderWithSegments,
427
+ applyContextToSegments(
428
+ featurevisorWithSegments,
419
429
  {
420
430
  and: [
421
431
  "web",
@@ -438,8 +448,8 @@ describe("core: buildScopedSegments", function () {
438
448
 
439
449
  // Complex nested structure (redundant "*" removed)
440
450
  expect(
441
- buildScopedSegments(
442
- datafileReaderWithSegments,
451
+ applyContextToSegments(
452
+ featurevisorWithSegments,
443
453
  {
444
454
  and: [
445
455
  "web",
@@ -471,8 +481,8 @@ describe("core: buildScopedSegments", function () {
471
481
  test("arrays with nested group segments", function () {
472
482
  // Array with AND group segment (redundant "*" removed)
473
483
  expect(
474
- buildScopedSegments(
475
- datafileReaderWithSegments,
484
+ applyContextToSegments(
485
+ featurevisorWithSegments,
476
486
  [
477
487
  "web",
478
488
  {
@@ -489,8 +499,8 @@ describe("core: buildScopedSegments", function () {
489
499
 
490
500
  // Array with OR group segment (redundant "*" removed, but OR structure remains if not all match)
491
501
  expect(
492
- buildScopedSegments(
493
- datafileReaderWithSegments,
502
+ applyContextToSegments(
503
+ featurevisorWithSegments,
494
504
  [
495
505
  "web",
496
506
  {
@@ -512,7 +522,7 @@ describe("core: buildScopedSegments", function () {
512
522
  test("segments with complex conditions", function () {
513
523
  // Segment with AND conditions in its definition
514
524
  expect(
515
- buildScopedSegments(datafileReaderWithSegments, "premium", {
525
+ applyContextToSegments(featurevisorWithSegments, "premium", {
516
526
  tier: "premium",
517
527
  status: "active",
518
528
  }),
@@ -520,7 +530,7 @@ describe("core: buildScopedSegments", function () {
520
530
 
521
531
  // Segment with AND conditions that doesn't match
522
532
  expect(
523
- buildScopedSegments(datafileReaderWithSegments, "premium", {
533
+ applyContextToSegments(featurevisorWithSegments, "premium", {
524
534
  tier: "premium",
525
535
  status: "inactive",
526
536
  }),
@@ -529,22 +539,22 @@ describe("core: buildScopedSegments", function () {
529
539
 
530
540
  test("edge cases", function () {
531
541
  // Empty context
532
- expect(buildScopedSegments(datafileReaderWithSegments, "web", {})).toEqual("web");
542
+ expect(applyContextToSegments(featurevisorWithSegments, "web", {})).toEqual("web");
533
543
 
534
544
  // Empty array (all "*" becomes "*")
535
- expect(buildScopedSegments(datafileReaderWithSegments, [], {})).toEqual("*");
545
+ expect(applyContextToSegments(featurevisorWithSegments, [], {})).toEqual("*");
536
546
 
537
547
  // "*" in array with matching segment (all "*" becomes "*")
538
548
  expect(
539
- buildScopedSegments(datafileReaderWithSegments, ["*", "web"], {
549
+ applyContextToSegments(featurevisorWithSegments, ["*", "web"], {
540
550
  platform: "web",
541
551
  }),
542
552
  ).toEqual("*");
543
553
 
544
554
  // AND with empty array (all "*" becomes "*")
545
555
  expect(
546
- buildScopedSegments(
547
- datafileReaderWithSegments,
556
+ applyContextToSegments(
557
+ featurevisorWithSegments,
548
558
  {
549
559
  and: [],
550
560
  },
@@ -554,8 +564,8 @@ describe("core: buildScopedSegments", function () {
554
564
 
555
565
  // OR with empty array (all "*" becomes "*")
556
566
  expect(
557
- buildScopedSegments(
558
- datafileReaderWithSegments,
567
+ applyContextToSegments(
568
+ featurevisorWithSegments,
559
569
  {
560
570
  or: [],
561
571
  },
@@ -629,7 +639,9 @@ describe("core: buildScopedSegments", function () {
629
639
 
630
640
  test("NOT group segments", function () {
631
641
  // All "*" in NOT
632
- expect(removeRedundantGroupSegments({ not: ["*", "*", "*"] })).toEqual("*");
642
+ expect(removeRedundantGroupSegments({ not: ["*", "*", "*"] })).toEqual({
643
+ not: ["*"],
644
+ });
633
645
 
634
646
  // Mixed with "*" in NOT
635
647
  expect(
@@ -726,7 +738,13 @@ describe("core: buildScopedSegments", function () {
726
738
  removeRedundantGroupSegments({
727
739
  not: ["*", { not: ["*", "*", "*"] }, "*"],
728
740
  }),
729
- ).toEqual("*");
741
+ ).toEqual({
742
+ not: [
743
+ {
744
+ not: ["*"],
745
+ },
746
+ ],
747
+ });
730
748
 
731
749
  // Nested NOT with mixed group segments
732
750
  expect(
@@ -898,7 +916,7 @@ describe("core: buildScopedSegments", function () {
898
916
  });
899
917
  });
900
918
 
901
- describe("buildScopedGroupSegments", function () {
919
+ describe("applyContextToGroupSegments", function () {
902
920
  const datafileWithSegments: DatafileContent = {
903
921
  schemaVersion: "2",
904
922
  revision: "unknown",
@@ -935,43 +953,43 @@ describe("core: buildScopedSegments", function () {
935
953
  features: {},
936
954
  };
937
955
 
938
- const datafileReaderWithSegments = new DatafileReader({
956
+ const featurevisorWithSegments = createFeaturevisor({
939
957
  datafile: datafileWithSegments,
940
- logger: createLogger({ level: "fatal" }),
958
+ logLevel: "fatal",
941
959
  });
942
960
 
943
- test("buildScopedGroupSegments is a function", function () {
944
- expect(buildScopedGroupSegments).toBeInstanceOf(Function);
961
+ test("applyContextToGroupSegments is a function", function () {
962
+ expect(applyContextToGroupSegments).toBeInstanceOf(Function);
945
963
  });
946
964
 
947
965
  test("simple cases", function () {
948
966
  // "*" remains "*"
949
- expect(buildScopedGroupSegments(datafileReaderWithSegments, "*", {})).toEqual("*");
967
+ expect(applyContextToGroupSegments(featurevisorWithSegments, "*", {})).toEqual("*");
950
968
 
951
969
  // Plain segment that matches
952
970
  expect(
953
- buildScopedGroupSegments(datafileReaderWithSegments, "web", {
971
+ applyContextToGroupSegments(featurevisorWithSegments, "web", {
954
972
  platform: "web",
955
973
  }),
956
974
  ).toEqual("*");
957
975
 
958
976
  // Plain segment that doesn't match
959
977
  expect(
960
- buildScopedGroupSegments(datafileReaderWithSegments, "web", {
978
+ applyContextToGroupSegments(featurevisorWithSegments, "web", {
961
979
  platform: "mobile",
962
980
  }),
963
981
  ).toEqual("web");
964
982
 
965
983
  // Array of segments - partial match
966
984
  expect(
967
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "chrome"], {
985
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "chrome"], {
968
986
  platform: "web",
969
987
  }),
970
988
  ).toEqual(["*", "chrome"]);
971
989
 
972
990
  // Array of segments - full match (all "*" - will be cleaned by removeRedundantGroupSegments later)
973
991
  expect(
974
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "chrome"], {
992
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "chrome"], {
975
993
  platform: "web",
976
994
  browser: "chrome",
977
995
  }),
@@ -979,7 +997,7 @@ describe("core: buildScopedSegments", function () {
979
997
 
980
998
  // Array of segments - no match
981
999
  expect(
982
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "chrome"], {
1000
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "chrome"], {
983
1001
  platform: "mobile",
984
1002
  browser: "safari",
985
1003
  }),
@@ -989,8 +1007,8 @@ describe("core: buildScopedSegments", function () {
989
1007
  test("AND group segments", function () {
990
1008
  // AND with all matching segments (all "*" becomes "*")
991
1009
  expect(
992
- buildScopedGroupSegments(
993
- datafileReaderWithSegments,
1010
+ applyContextToGroupSegments(
1011
+ featurevisorWithSegments,
994
1012
  {
995
1013
  and: ["web", "chrome"],
996
1014
  },
@@ -1005,8 +1023,8 @@ describe("core: buildScopedSegments", function () {
1005
1023
 
1006
1024
  // AND with partial match
1007
1025
  expect(
1008
- buildScopedGroupSegments(
1009
- datafileReaderWithSegments,
1026
+ applyContextToGroupSegments(
1027
+ featurevisorWithSegments,
1010
1028
  {
1011
1029
  and: ["web", "chrome"],
1012
1030
  },
@@ -1020,8 +1038,8 @@ describe("core: buildScopedSegments", function () {
1020
1038
 
1021
1039
  // AND with no matches
1022
1040
  expect(
1023
- buildScopedGroupSegments(
1024
- datafileReaderWithSegments,
1041
+ applyContextToGroupSegments(
1042
+ featurevisorWithSegments,
1025
1043
  {
1026
1044
  and: ["web", "chrome"],
1027
1045
  },
@@ -1036,8 +1054,8 @@ describe("core: buildScopedSegments", function () {
1036
1054
 
1037
1055
  // AND with "*" in it
1038
1056
  expect(
1039
- buildScopedGroupSegments(
1040
- datafileReaderWithSegments,
1057
+ applyContextToGroupSegments(
1058
+ featurevisorWithSegments,
1041
1059
  {
1042
1060
  and: ["*", "chrome"],
1043
1061
  },
@@ -1053,8 +1071,8 @@ describe("core: buildScopedSegments", function () {
1053
1071
  test("OR group segments", function () {
1054
1072
  // OR with all matching segments (all "*" becomes "*")
1055
1073
  expect(
1056
- buildScopedGroupSegments(
1057
- datafileReaderWithSegments,
1074
+ applyContextToGroupSegments(
1075
+ featurevisorWithSegments,
1058
1076
  {
1059
1077
  or: ["web", "chrome"],
1060
1078
  },
@@ -1069,8 +1087,8 @@ describe("core: buildScopedSegments", function () {
1069
1087
 
1070
1088
  // OR with partial match
1071
1089
  expect(
1072
- buildScopedGroupSegments(
1073
- datafileReaderWithSegments,
1090
+ applyContextToGroupSegments(
1091
+ featurevisorWithSegments,
1074
1092
  {
1075
1093
  or: ["web", "chrome"],
1076
1094
  },
@@ -1084,8 +1102,8 @@ describe("core: buildScopedSegments", function () {
1084
1102
 
1085
1103
  // OR with no matches
1086
1104
  expect(
1087
- buildScopedGroupSegments(
1088
- datafileReaderWithSegments,
1105
+ applyContextToGroupSegments(
1106
+ featurevisorWithSegments,
1089
1107
  {
1090
1108
  or: ["web", "mobile"],
1091
1109
  },
@@ -1101,8 +1119,8 @@ describe("core: buildScopedSegments", function () {
1101
1119
  test("NOT group segments", function () {
1102
1120
  // NOT with matching segment
1103
1121
  expect(
1104
- buildScopedGroupSegments(
1105
- datafileReaderWithSegments,
1122
+ applyContextToGroupSegments(
1123
+ featurevisorWithSegments,
1106
1124
  {
1107
1125
  not: ["web"],
1108
1126
  },
@@ -1116,8 +1134,8 @@ describe("core: buildScopedSegments", function () {
1116
1134
 
1117
1135
  // NOT with non-matching segment
1118
1136
  expect(
1119
- buildScopedGroupSegments(
1120
- datafileReaderWithSegments,
1137
+ applyContextToGroupSegments(
1138
+ featurevisorWithSegments,
1121
1139
  {
1122
1140
  not: ["web"],
1123
1141
  },
@@ -1131,8 +1149,8 @@ describe("core: buildScopedSegments", function () {
1131
1149
 
1132
1150
  // NOT with multiple segments (all "*" becomes "*")
1133
1151
  expect(
1134
- buildScopedGroupSegments(
1135
- datafileReaderWithSegments,
1152
+ applyContextToGroupSegments(
1153
+ featurevisorWithSegments,
1136
1154
  {
1137
1155
  not: ["web", "chrome"],
1138
1156
  },
@@ -1149,8 +1167,8 @@ describe("core: buildScopedSegments", function () {
1149
1167
  test("nested AND group segments", function () {
1150
1168
  // Nested AND with all matching (all "*" becomes "*")
1151
1169
  expect(
1152
- buildScopedGroupSegments(
1153
- datafileReaderWithSegments,
1170
+ applyContextToGroupSegments(
1171
+ featurevisorWithSegments,
1154
1172
  {
1155
1173
  and: [
1156
1174
  "web",
@@ -1176,8 +1194,8 @@ describe("core: buildScopedSegments", function () {
1176
1194
 
1177
1195
  // Nested AND with partial match
1178
1196
  expect(
1179
- buildScopedGroupSegments(
1180
- datafileReaderWithSegments,
1197
+ applyContextToGroupSegments(
1198
+ featurevisorWithSegments,
1181
1199
  {
1182
1200
  and: [
1183
1201
  "web",
@@ -1204,8 +1222,8 @@ describe("core: buildScopedSegments", function () {
1204
1222
  test("nested OR group segments", function () {
1205
1223
  // Nested OR with all matching
1206
1224
  expect(
1207
- buildScopedGroupSegments(
1208
- datafileReaderWithSegments,
1225
+ applyContextToGroupSegments(
1226
+ featurevisorWithSegments,
1209
1227
  {
1210
1228
  or: [
1211
1229
  "web",
@@ -1230,8 +1248,8 @@ describe("core: buildScopedSegments", function () {
1230
1248
 
1231
1249
  // Nested OR with partial match
1232
1250
  expect(
1233
- buildScopedGroupSegments(
1234
- datafileReaderWithSegments,
1251
+ applyContextToGroupSegments(
1252
+ featurevisorWithSegments,
1235
1253
  {
1236
1254
  or: [
1237
1255
  "web",
@@ -1257,8 +1275,8 @@ describe("core: buildScopedSegments", function () {
1257
1275
  test("complex nested structures", function () {
1258
1276
  // Complex nested with AND, OR, NOT
1259
1277
  expect(
1260
- buildScopedGroupSegments(
1261
- datafileReaderWithSegments,
1278
+ applyContextToGroupSegments(
1279
+ featurevisorWithSegments,
1262
1280
  {
1263
1281
  and: [
1264
1282
  "web",
@@ -1291,7 +1309,7 @@ describe("core: buildScopedSegments", function () {
1291
1309
  test("segments with complex conditions", function () {
1292
1310
  // Segment with AND conditions in its definition
1293
1311
  expect(
1294
- buildScopedGroupSegments(datafileReaderWithSegments, "premium", {
1312
+ applyContextToGroupSegments(featurevisorWithSegments, "premium", {
1295
1313
  tier: "premium",
1296
1314
  status: "active",
1297
1315
  }),
@@ -1299,7 +1317,7 @@ describe("core: buildScopedSegments", function () {
1299
1317
 
1300
1318
  // Segment with AND conditions that doesn't match
1301
1319
  expect(
1302
- buildScopedGroupSegments(datafileReaderWithSegments, "premium", {
1320
+ applyContextToGroupSegments(featurevisorWithSegments, "premium", {
1303
1321
  tier: "premium",
1304
1322
  status: "inactive",
1305
1323
  }),
@@ -1308,21 +1326,23 @@ describe("core: buildScopedSegments", function () {
1308
1326
 
1309
1327
  test("removeSegments parameter", function () {
1310
1328
  // Simple segment in removeSegments
1311
- expect(buildScopedGroupSegments(datafileReaderWithSegments, "web", {}, ["web"])).toEqual("*");
1329
+ expect(applyContextToGroupSegments(featurevisorWithSegments, "web", {}, ["web"])).toEqual(
1330
+ "*",
1331
+ );
1312
1332
 
1313
1333
  // Segment not in removeSegments
1314
- expect(buildScopedGroupSegments(datafileReaderWithSegments, "web", {}, ["mobile"])).toEqual(
1334
+ expect(applyContextToGroupSegments(featurevisorWithSegments, "web", {}, ["mobile"])).toEqual(
1315
1335
  "web",
1316
1336
  );
1317
1337
 
1318
1338
  // Array with one segment in removeSegments
1319
1339
  expect(
1320
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "chrome"], {}, ["web"]),
1340
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "chrome"], {}, ["web"]),
1321
1341
  ).toEqual(["*", "chrome"]);
1322
1342
 
1323
1343
  // Array with all segments in removeSegments
1324
1344
  expect(
1325
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "chrome"], {}, [
1345
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "chrome"], {}, [
1326
1346
  "web",
1327
1347
  "chrome",
1328
1348
  ]),
@@ -1330,8 +1350,8 @@ describe("core: buildScopedSegments", function () {
1330
1350
 
1331
1351
  // Array with multiple segments, some in removeSegments
1332
1352
  expect(
1333
- buildScopedGroupSegments(
1334
- datafileReaderWithSegments,
1353
+ applyContextToGroupSegments(
1354
+ featurevisorWithSegments,
1335
1355
  ["web", "chrome", "mobile", "safari"],
1336
1356
  {},
1337
1357
  ["web", "mobile"],
@@ -1340,8 +1360,8 @@ describe("core: buildScopedSegments", function () {
1340
1360
 
1341
1361
  // AND group segment with removeSegments
1342
1362
  expect(
1343
- buildScopedGroupSegments(
1344
- datafileReaderWithSegments,
1363
+ applyContextToGroupSegments(
1364
+ featurevisorWithSegments,
1345
1365
  {
1346
1366
  and: ["web", "chrome"],
1347
1367
  },
@@ -1354,8 +1374,8 @@ describe("core: buildScopedSegments", function () {
1354
1374
 
1355
1375
  // AND group segment with all segments in removeSegments
1356
1376
  expect(
1357
- buildScopedGroupSegments(
1358
- datafileReaderWithSegments,
1377
+ applyContextToGroupSegments(
1378
+ featurevisorWithSegments,
1359
1379
  {
1360
1380
  and: ["web", "chrome"],
1361
1381
  },
@@ -1368,8 +1388,8 @@ describe("core: buildScopedSegments", function () {
1368
1388
 
1369
1389
  // OR group segment with removeSegments
1370
1390
  expect(
1371
- buildScopedGroupSegments(
1372
- datafileReaderWithSegments,
1391
+ applyContextToGroupSegments(
1392
+ featurevisorWithSegments,
1373
1393
  {
1374
1394
  or: ["web", "chrome"],
1375
1395
  },
@@ -1382,8 +1402,8 @@ describe("core: buildScopedSegments", function () {
1382
1402
 
1383
1403
  // OR group segment with all segments in removeSegments
1384
1404
  expect(
1385
- buildScopedGroupSegments(
1386
- datafileReaderWithSegments,
1405
+ applyContextToGroupSegments(
1406
+ featurevisorWithSegments,
1387
1407
  {
1388
1408
  or: ["web", "chrome"],
1389
1409
  },
@@ -1396,8 +1416,8 @@ describe("core: buildScopedSegments", function () {
1396
1416
 
1397
1417
  // NOT group segment with removeSegments
1398
1418
  expect(
1399
- buildScopedGroupSegments(
1400
- datafileReaderWithSegments,
1419
+ applyContextToGroupSegments(
1420
+ featurevisorWithSegments,
1401
1421
  {
1402
1422
  not: ["web", "chrome"],
1403
1423
  },
@@ -1410,8 +1430,8 @@ describe("core: buildScopedSegments", function () {
1410
1430
 
1411
1431
  // NOT group segment with all segments in removeSegments
1412
1432
  expect(
1413
- buildScopedGroupSegments(
1414
- datafileReaderWithSegments,
1433
+ applyContextToGroupSegments(
1434
+ featurevisorWithSegments,
1415
1435
  {
1416
1436
  not: ["web", "chrome"],
1417
1437
  },
@@ -1424,8 +1444,8 @@ describe("core: buildScopedSegments", function () {
1424
1444
 
1425
1445
  // Nested AND with removeSegments
1426
1446
  expect(
1427
- buildScopedGroupSegments(
1428
- datafileReaderWithSegments,
1447
+ applyContextToGroupSegments(
1448
+ featurevisorWithSegments,
1429
1449
  {
1430
1450
  and: [
1431
1451
  "web",
@@ -1448,8 +1468,8 @@ describe("core: buildScopedSegments", function () {
1448
1468
 
1449
1469
  // Nested OR with removeSegments
1450
1470
  expect(
1451
- buildScopedGroupSegments(
1452
- datafileReaderWithSegments,
1471
+ applyContextToGroupSegments(
1472
+ featurevisorWithSegments,
1453
1473
  {
1454
1474
  or: [
1455
1475
  "web",
@@ -1472,8 +1492,8 @@ describe("core: buildScopedSegments", function () {
1472
1492
 
1473
1493
  // Mixed nested structure with removeSegments
1474
1494
  expect(
1475
- buildScopedGroupSegments(
1476
- datafileReaderWithSegments,
1495
+ applyContextToGroupSegments(
1496
+ featurevisorWithSegments,
1477
1497
  {
1478
1498
  and: [
1479
1499
  "web",
@@ -1502,8 +1522,8 @@ describe("core: buildScopedSegments", function () {
1502
1522
 
1503
1523
  // removeSegments combined with matching context
1504
1524
  expect(
1505
- buildScopedGroupSegments(
1506
- datafileReaderWithSegments,
1525
+ applyContextToGroupSegments(
1526
+ featurevisorWithSegments,
1507
1527
  ["web", "chrome"],
1508
1528
  {
1509
1529
  platform: "web",
@@ -1514,8 +1534,8 @@ describe("core: buildScopedSegments", function () {
1514
1534
 
1515
1535
  // removeSegments with segment that would match context
1516
1536
  expect(
1517
- buildScopedGroupSegments(
1518
- datafileReaderWithSegments,
1537
+ applyContextToGroupSegments(
1538
+ featurevisorWithSegments,
1519
1539
  ["web", "chrome"],
1520
1540
  {
1521
1541
  platform: "web",
@@ -1527,8 +1547,8 @@ describe("core: buildScopedSegments", function () {
1527
1547
 
1528
1548
  // Complex: removeSegments, context matching, and nested structures
1529
1549
  expect(
1530
- buildScopedGroupSegments(
1531
- datafileReaderWithSegments,
1550
+ applyContextToGroupSegments(
1551
+ featurevisorWithSegments,
1532
1552
  {
1533
1553
  and: [
1534
1554
  "web",
@@ -1555,18 +1575,18 @@ describe("core: buildScopedSegments", function () {
1555
1575
  });
1556
1576
 
1557
1577
  // Empty removeSegments array (should behave like no removeSegments)
1558
- expect(buildScopedGroupSegments(datafileReaderWithSegments, "web", {}, [])).toEqual("web");
1578
+ expect(applyContextToGroupSegments(featurevisorWithSegments, "web", {}, [])).toEqual("web");
1559
1579
 
1560
1580
  // removeSegments with segment that doesn't exist in datafile
1561
1581
  expect(
1562
- buildScopedGroupSegments(datafileReaderWithSegments, ["web", "nonexistent"], {}, [
1582
+ applyContextToGroupSegments(featurevisorWithSegments, ["web", "nonexistent"], {}, [
1563
1583
  "nonexistent",
1564
1584
  ]),
1565
1585
  ).toEqual(["web", "*"]);
1566
1586
 
1567
1587
  // removeSegments with "*" in array (should still work)
1568
1588
  expect(
1569
- buildScopedGroupSegments(datafileReaderWithSegments, ["*", "web", "chrome"], {}, ["web"]),
1589
+ applyContextToGroupSegments(featurevisorWithSegments, ["*", "web", "chrome"], {}, ["web"]),
1570
1590
  ).toEqual(["*", "*", "chrome"]);
1571
1591
  });
1572
1592
  });