@featurevisor/core 1.16.0 → 1.18.0

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 (39) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/coverage/clover.xml +2 -2
  4. package/coverage/lcov-report/index.html +1 -1
  5. package/coverage/lcov-report/lib/builder/allocator.js.html +1 -1
  6. package/coverage/lcov-report/lib/builder/index.html +1 -1
  7. package/coverage/lcov-report/lib/builder/revision.js.html +1 -1
  8. package/coverage/lcov-report/lib/builder/traffic.js.html +1 -1
  9. package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +1 -1
  10. package/coverage/lcov-report/lib/tester/index.html +1 -1
  11. package/coverage/lcov-report/lib/tester/matrix.js.html +1 -1
  12. package/coverage/lcov-report/src/builder/allocator.ts.html +1 -1
  13. package/coverage/lcov-report/src/builder/index.html +1 -1
  14. package/coverage/lcov-report/src/builder/revision.ts.html +1 -1
  15. package/coverage/lcov-report/src/builder/traffic.ts.html +1 -1
  16. package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +1 -1
  17. package/coverage/lcov-report/src/tester/index.html +1 -1
  18. package/coverage/lcov-report/src/tester/matrix.ts.html +1 -1
  19. package/lib/assess-distribution/index.d.ts +11 -0
  20. package/lib/assess-distribution/index.js +165 -0
  21. package/lib/assess-distribution/index.js.map +1 -0
  22. package/lib/evaluate/index.d.ts +9 -0
  23. package/lib/evaluate/index.js +158 -0
  24. package/lib/evaluate/index.js.map +1 -0
  25. package/lib/index.d.ts +2 -0
  26. package/lib/index.js +2 -0
  27. package/lib/index.js.map +1 -1
  28. package/lib/utils/index.d.ts +1 -0
  29. package/lib/utils/index.js +1 -0
  30. package/lib/utils/index.js.map +1 -1
  31. package/lib/utils/pretty.d.ts +2 -0
  32. package/lib/utils/pretty.js +14 -0
  33. package/lib/utils/pretty.js.map +1 -0
  34. package/package.json +3 -3
  35. package/src/assess-distribution/index.ts +167 -0
  36. package/src/evaluate/index.ts +149 -0
  37. package/src/index.ts +2 -0
  38. package/src/utils/index.ts +1 -0
  39. package/src/utils/pretty.ts +12 -0
package/.eslintcache CHANGED
@@ -1 +1 @@
1
- [{"/home/runner/work/featurevisor/featurevisor/packages/core/src/benchmark/index.ts":"1","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.spec.ts":"2","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.ts":"3","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildDatafile.ts":"4","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildProject.ts":"5","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/getFeatureRanges.ts":"6","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/index.ts":"7","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.spec.ts":"8","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.ts":"9","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.spec.ts":"10","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.ts":"11","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/index.ts":"12","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/parsers.ts":"13","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/projectConfig.ts":"14","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/adapter.ts":"15","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/datasource.ts":"16","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/filesystemAdapter.ts":"17","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/index.ts":"18","/home/runner/work/featurevisor/featurevisor/packages/core/src/dependencies.ts":"19","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/findDuplicateSegments.ts":"20","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/index.ts":"21","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-usage/index.ts":"22","/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/index.ts":"23","/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/typescript.ts":"24","/home/runner/work/featurevisor/featurevisor/packages/core/src/index.ts":"25","/home/runner/work/featurevisor/featurevisor/packages/core/src/init/index.ts":"26","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/attributeSchema.ts":"27","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkCircularDependency.ts":"28","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkPercentageExceedingSlot.ts":"29","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/conditionSchema.ts":"30","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/featureSchema.ts":"31","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/groupSchema.ts":"32","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/index.ts":"33","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/lintProject.ts":"34","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/printError.ts":"35","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/segmentSchema.ts":"36","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/testSchema.ts":"37","/home/runner/work/featurevisor/featurevisor/packages/core/src/restore/index.ts":"38","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/exportSite.ts":"39","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateHistory.ts":"40","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateSiteSearchIndex.ts":"41","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getLastModifiedFromHistory.ts":"42","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getOwnerAndRepoFromUrl.ts":"43","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRelativePaths.ts":"44","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRepoDetails.ts":"45","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/index.ts":"46","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/serveSite.ts":"47","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfArraysAreEqual.ts":"48","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.spec.ts":"49","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.ts":"50","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/cliFormat.ts":"51","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/index.ts":"52","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.spec.ts":"53","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.ts":"54","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/prettyDuration.ts":"55","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/printTestResult.ts":"56","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testFeature.ts":"57","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testProject.ts":"58","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testSegment.ts":"59","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/extractKeys.ts":"60","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/git.ts":"61","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/index.ts":"62"},{"size":3741,"mtime":1712332974389,"results":"63","hashOfConfig":"64"},{"size":3214,"mtime":1712332974389,"results":"65","hashOfConfig":"64"},{"size":1014,"mtime":1712332974389,"results":"66","hashOfConfig":"64"},{"size":10477,"mtime":1712332974389,"results":"67","hashOfConfig":"64"},{"size":2673,"mtime":1712332974389,"results":"68","hashOfConfig":"64"},{"size":1755,"mtime":1712332974389,"results":"69","hashOfConfig":"64"},{"size":65,"mtime":1712332974389,"results":"70","hashOfConfig":"64"},{"size":688,"mtime":1712332974389,"results":"71","hashOfConfig":"64"},{"size":760,"mtime":1712332974389,"results":"72","hashOfConfig":"64"},{"size":12889,"mtime":1712332974389,"results":"73","hashOfConfig":"64"},{"size":4894,"mtime":1712332974389,"results":"74","hashOfConfig":"64"},{"size":60,"mtime":1712332974389,"results":"75","hashOfConfig":"64"},{"size":1035,"mtime":1712332974389,"results":"76","hashOfConfig":"64"},{"size":4326,"mtime":1712332974389,"results":"77","hashOfConfig":"64"},{"size":1423,"mtime":1712332974389,"results":"78","hashOfConfig":"64"},{"size":5208,"mtime":1712332974389,"results":"79","hashOfConfig":"64"},{"size":10198,"mtime":1712332974389,"results":"80","hashOfConfig":"64"},{"size":94,"mtime":1712332974389,"results":"81","hashOfConfig":"64"},{"size":279,"mtime":1712332974389,"results":"82","hashOfConfig":"64"},{"size":1033,"mtime":1712332974389,"results":"83","hashOfConfig":"64"},{"size":540,"mtime":1712332974389,"results":"84","hashOfConfig":"64"},{"size":9681,"mtime":1712332974389,"results":"85","hashOfConfig":"64"},{"size":1476,"mtime":1712332974389,"results":"86","hashOfConfig":"64"},{"size":6250,"mtime":1712332974389,"results":"87","hashOfConfig":"64"},{"size":377,"mtime":1712332974389,"results":"88","hashOfConfig":"64"},{"size":1308,"mtime":1712332974389,"results":"89","hashOfConfig":"64"},{"size":359,"mtime":1712332974389,"results":"90","hashOfConfig":"64"},{"size":1119,"mtime":1712332974389,"results":"91","hashOfConfig":"64"},{"size":1464,"mtime":1712332974389,"results":"92","hashOfConfig":"64"},{"size":4007,"mtime":1712332974389,"results":"93","hashOfConfig":"64"},{"size":7758,"mtime":1712332974389,"results":"94","hashOfConfig":"64"},{"size":1221,"mtime":1712332974389,"results":"95","hashOfConfig":"64"},{"size":31,"mtime":1712332974389,"results":"96","hashOfConfig":"64"},{"size":9986,"mtime":1712332974389,"results":"97","hashOfConfig":"64"},{"size":982,"mtime":1712332974389,"results":"98","hashOfConfig":"64"},{"size":364,"mtime":1712332974389,"results":"99","hashOfConfig":"64"},{"size":2432,"mtime":1712332974389,"results":"100","hashOfConfig":"64"},{"size":641,"mtime":1712332974389,"results":"101","hashOfConfig":"64"},{"size":1481,"mtime":1712332974389,"results":"102","hashOfConfig":"64"},{"size":1178,"mtime":1712332974389,"results":"103","hashOfConfig":"64"},{"size":6187,"mtime":1712332974389,"results":"104","hashOfConfig":"64"},{"size":516,"mtime":1712332974389,"results":"105","hashOfConfig":"64"},{"size":496,"mtime":1712332974389,"results":"106","hashOfConfig":"64"},{"size":607,"mtime":1712332974389,"results":"107","hashOfConfig":"64"},{"size":1560,"mtime":1712332974389,"results":"108","hashOfConfig":"64"},{"size":59,"mtime":1712332974389,"results":"109","hashOfConfig":"64"},{"size":1681,"mtime":1712332974389,"results":"110","hashOfConfig":"64"},{"size":298,"mtime":1712332974389,"results":"111","hashOfConfig":"64"},{"size":932,"mtime":1712332974389,"results":"112","hashOfConfig":"64"},{"size":468,"mtime":1712332974389,"results":"113","hashOfConfig":"64"},{"size":212,"mtime":1712332974389,"results":"114","hashOfConfig":"64"},{"size":62,"mtime":1712332974389,"results":"115","hashOfConfig":"64"},{"size":1188,"mtime":1712332974389,"results":"116","hashOfConfig":"64"},{"size":5021,"mtime":1712332974389,"results":"117","hashOfConfig":"64"},{"size":516,"mtime":1712332974389,"results":"118","hashOfConfig":"64"},{"size":1691,"mtime":1712332974389,"results":"119","hashOfConfig":"64"},{"size":6968,"mtime":1712332974389,"results":"120","hashOfConfig":"64"},{"size":5702,"mtime":1712332974389,"results":"121","hashOfConfig":"64"},{"size":2328,"mtime":1712332974389,"results":"122","hashOfConfig":"64"},{"size":1993,"mtime":1712332974389,"results":"123","hashOfConfig":"64"},{"size":3641,"mtime":1712332974389,"results":"124","hashOfConfig":"64"},{"size":54,"mtime":1712332974389,"results":"125","hashOfConfig":"64"},{"filePath":"126","messages":"127","suppressedMessages":"128","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"2syfed",{"filePath":"129","messages":"130","suppressedMessages":"131","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"132","messages":"133","suppressedMessages":"134","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"135","messages":"136","suppressedMessages":"137","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"138","messages":"139","suppressedMessages":"140","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"141","messages":"142","suppressedMessages":"143","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"144","messages":"145","suppressedMessages":"146","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"147","messages":"148","suppressedMessages":"149","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"150","messages":"151","suppressedMessages":"152","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"153","messages":"154","suppressedMessages":"155","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"156","messages":"157","suppressedMessages":"158","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"159","messages":"160","suppressedMessages":"161","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"162","messages":"163","suppressedMessages":"164","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"165","messages":"166","suppressedMessages":"167","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"168","messages":"169","suppressedMessages":"170","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"171","messages":"172","suppressedMessages":"173","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"174","messages":"175","suppressedMessages":"176","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"177","messages":"178","suppressedMessages":"179","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"180","messages":"181","suppressedMessages":"182","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"183","messages":"184","suppressedMessages":"185","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"186","messages":"187","suppressedMessages":"188","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"189","messages":"190","suppressedMessages":"191","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"192","messages":"193","suppressedMessages":"194","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"195","messages":"196","suppressedMessages":"197","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"198","messages":"199","suppressedMessages":"200","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"201","messages":"202","suppressedMessages":"203","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"204","messages":"205","suppressedMessages":"206","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"207","messages":"208","suppressedMessages":"209","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"210","messages":"211","suppressedMessages":"212","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"213","messages":"214","suppressedMessages":"215","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"216","messages":"217","suppressedMessages":"218","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"219","messages":"220","suppressedMessages":"221","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"222","messages":"223","suppressedMessages":"224","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"225","messages":"226","suppressedMessages":"227","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"228","messages":"229","suppressedMessages":"230","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"231","messages":"232","suppressedMessages":"233","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"234","messages":"235","suppressedMessages":"236","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"237","messages":"238","suppressedMessages":"239","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"240","messages":"241","suppressedMessages":"242","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"243","messages":"244","suppressedMessages":"245","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"246","messages":"247","suppressedMessages":"248","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"249","messages":"250","suppressedMessages":"251","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"252","messages":"253","suppressedMessages":"254","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"255","messages":"256","suppressedMessages":"257","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"258","messages":"259","suppressedMessages":"260","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"261","messages":"262","suppressedMessages":"263","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"264","messages":"265","suppressedMessages":"266","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"267","messages":"268","suppressedMessages":"269","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"270","messages":"271","suppressedMessages":"272","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"273","messages":"274","suppressedMessages":"275","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"276","messages":"277","suppressedMessages":"278","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"279","messages":"280","suppressedMessages":"281","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"282","messages":"283","suppressedMessages":"284","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"285","messages":"286","suppressedMessages":"287","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"288","messages":"289","suppressedMessages":"290","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"291","messages":"292","suppressedMessages":"293","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"294","messages":"295","suppressedMessages":"296","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"297","messages":"298","suppressedMessages":"299","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"300","messages":"301","suppressedMessages":"302","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"303","messages":"304","suppressedMessages":"305","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"306","messages":"307","suppressedMessages":"308","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"309","messages":"310","suppressedMessages":"311","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/featurevisor/featurevisor/packages/core/src/benchmark/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildDatafile.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/getFeatureRanges.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/parsers.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/projectConfig.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/adapter.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/datasource.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/filesystemAdapter.ts",[],["312","313"],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/dependencies.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/findDuplicateSegments.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-usage/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/typescript.ts",[],["314"],"/home/runner/work/featurevisor/featurevisor/packages/core/src/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/init/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/attributeSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkCircularDependency.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkPercentageExceedingSlot.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/conditionSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/featureSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/groupSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/lintProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/printError.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/segmentSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/testSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/restore/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/exportSite.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateHistory.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateSiteSearchIndex.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getLastModifiedFromHistory.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getOwnerAndRepoFromUrl.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRelativePaths.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRepoDetails.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/serveSite.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfArraysAreEqual.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/cliFormat.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/prettyDuration.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/printTestResult.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testFeature.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testSegment.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/extractKeys.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/git.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/index.ts",[],[],{"ruleId":"315","severity":2,"message":"316","line":22,"column":7,"nodeType":"317","messageId":"318","endLine":22,"endColumn":18,"suppressions":"319"},{"ruleId":"320","severity":2,"message":"321","line":22,"column":21,"nodeType":"322","messageId":"323","endLine":22,"endColumn":81,"fix":"324","suppressions":"325"},{"ruleId":"315","severity":2,"message":"326","line":51,"column":10,"nodeType":"317","messageId":"318","endLine":51,"endColumn":38,"suppressions":"327"},"@typescript-eslint/no-unused-vars","'commitRegex' is assigned a value but never used.","Identifier","unusedVar",["328"],"no-regex-spaces","Spaces are hard to count. Use {3}.","Literal","multipleSpaces",{"range":"329","text":"330"},["331"],"'getFeaturevisorTypeFromValue' is defined but never used.",["332"],{"kind":"333","justification":"334"},[515,518]," {3}",{"kind":"333","justification":"334"},{"kind":"333","justification":"334"},"directive",""]
1
+ [{"/home/runner/work/featurevisor/featurevisor/packages/core/src/assess-distribution/index.ts":"1","/home/runner/work/featurevisor/featurevisor/packages/core/src/benchmark/index.ts":"2","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.spec.ts":"3","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.ts":"4","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildDatafile.ts":"5","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildProject.ts":"6","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/getFeatureRanges.ts":"7","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/index.ts":"8","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.spec.ts":"9","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.ts":"10","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.spec.ts":"11","/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.ts":"12","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/index.ts":"13","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/parsers.ts":"14","/home/runner/work/featurevisor/featurevisor/packages/core/src/config/projectConfig.ts":"15","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/adapter.ts":"16","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/datasource.ts":"17","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/filesystemAdapter.ts":"18","/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/index.ts":"19","/home/runner/work/featurevisor/featurevisor/packages/core/src/dependencies.ts":"20","/home/runner/work/featurevisor/featurevisor/packages/core/src/evaluate/index.ts":"21","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/findDuplicateSegments.ts":"22","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/index.ts":"23","/home/runner/work/featurevisor/featurevisor/packages/core/src/find-usage/index.ts":"24","/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/index.ts":"25","/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/typescript.ts":"26","/home/runner/work/featurevisor/featurevisor/packages/core/src/index.ts":"27","/home/runner/work/featurevisor/featurevisor/packages/core/src/init/index.ts":"28","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/attributeSchema.ts":"29","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkCircularDependency.ts":"30","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkPercentageExceedingSlot.ts":"31","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/conditionSchema.ts":"32","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/featureSchema.ts":"33","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/groupSchema.ts":"34","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/index.ts":"35","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/lintProject.ts":"36","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/printError.ts":"37","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/segmentSchema.ts":"38","/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/testSchema.ts":"39","/home/runner/work/featurevisor/featurevisor/packages/core/src/restore/index.ts":"40","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/exportSite.ts":"41","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateHistory.ts":"42","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateSiteSearchIndex.ts":"43","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getLastModifiedFromHistory.ts":"44","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getOwnerAndRepoFromUrl.ts":"45","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRelativePaths.ts":"46","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRepoDetails.ts":"47","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/index.ts":"48","/home/runner/work/featurevisor/featurevisor/packages/core/src/site/serveSite.ts":"49","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfArraysAreEqual.ts":"50","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.spec.ts":"51","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.ts":"52","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/cliFormat.ts":"53","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/index.ts":"54","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.spec.ts":"55","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.ts":"56","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/prettyDuration.ts":"57","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/printTestResult.ts":"58","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testFeature.ts":"59","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testProject.ts":"60","/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testSegment.ts":"61","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/extractKeys.ts":"62","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/git.ts":"63","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/index.ts":"64","/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/pretty.ts":"65"},{"size":4276,"mtime":1713285711966,"results":"66","hashOfConfig":"67"},{"size":3741,"mtime":1713285711966,"results":"68","hashOfConfig":"67"},{"size":3214,"mtime":1713285711966,"results":"69","hashOfConfig":"67"},{"size":1014,"mtime":1713285711966,"results":"70","hashOfConfig":"67"},{"size":10477,"mtime":1713285711966,"results":"71","hashOfConfig":"67"},{"size":2673,"mtime":1713285711966,"results":"72","hashOfConfig":"67"},{"size":1755,"mtime":1713285711966,"results":"73","hashOfConfig":"67"},{"size":65,"mtime":1713285711966,"results":"74","hashOfConfig":"67"},{"size":688,"mtime":1713285711966,"results":"75","hashOfConfig":"67"},{"size":760,"mtime":1713285711966,"results":"76","hashOfConfig":"67"},{"size":12889,"mtime":1713285711966,"results":"77","hashOfConfig":"67"},{"size":4894,"mtime":1713285711966,"results":"78","hashOfConfig":"67"},{"size":60,"mtime":1713285711966,"results":"79","hashOfConfig":"67"},{"size":1035,"mtime":1713285711966,"results":"80","hashOfConfig":"67"},{"size":4326,"mtime":1713285711966,"results":"81","hashOfConfig":"67"},{"size":1423,"mtime":1713285711966,"results":"82","hashOfConfig":"67"},{"size":5208,"mtime":1713285711966,"results":"83","hashOfConfig":"67"},{"size":10198,"mtime":1713285711966,"results":"84","hashOfConfig":"67"},{"size":94,"mtime":1713285711966,"results":"85","hashOfConfig":"67"},{"size":279,"mtime":1713285711966,"results":"86","hashOfConfig":"67"},{"size":3942,"mtime":1713285711966,"results":"87","hashOfConfig":"67"},{"size":1033,"mtime":1713285711966,"results":"88","hashOfConfig":"67"},{"size":540,"mtime":1713285711966,"results":"89","hashOfConfig":"67"},{"size":9681,"mtime":1713285711966,"results":"90","hashOfConfig":"67"},{"size":1476,"mtime":1713285711966,"results":"91","hashOfConfig":"67"},{"size":6250,"mtime":1713285711966,"results":"92","hashOfConfig":"67"},{"size":444,"mtime":1713285711966,"results":"93","hashOfConfig":"67"},{"size":1308,"mtime":1713285711966,"results":"94","hashOfConfig":"67"},{"size":359,"mtime":1713285711966,"results":"95","hashOfConfig":"67"},{"size":1119,"mtime":1713285711966,"results":"96","hashOfConfig":"67"},{"size":1464,"mtime":1713285711966,"results":"97","hashOfConfig":"67"},{"size":4007,"mtime":1713285711970,"results":"98","hashOfConfig":"67"},{"size":7758,"mtime":1713285711970,"results":"99","hashOfConfig":"67"},{"size":1221,"mtime":1713285711970,"results":"100","hashOfConfig":"67"},{"size":31,"mtime":1713285711970,"results":"101","hashOfConfig":"67"},{"size":9986,"mtime":1713285711970,"results":"102","hashOfConfig":"67"},{"size":982,"mtime":1713285711970,"results":"103","hashOfConfig":"67"},{"size":364,"mtime":1713285711970,"results":"104","hashOfConfig":"67"},{"size":2432,"mtime":1713285711970,"results":"105","hashOfConfig":"67"},{"size":641,"mtime":1713285711970,"results":"106","hashOfConfig":"67"},{"size":1481,"mtime":1713285711970,"results":"107","hashOfConfig":"67"},{"size":1178,"mtime":1713285711970,"results":"108","hashOfConfig":"67"},{"size":6187,"mtime":1713285711970,"results":"109","hashOfConfig":"67"},{"size":516,"mtime":1713285711970,"results":"110","hashOfConfig":"67"},{"size":496,"mtime":1713285711970,"results":"111","hashOfConfig":"67"},{"size":607,"mtime":1713285711970,"results":"112","hashOfConfig":"67"},{"size":1560,"mtime":1713285711970,"results":"113","hashOfConfig":"67"},{"size":59,"mtime":1713285711970,"results":"114","hashOfConfig":"67"},{"size":1681,"mtime":1713285711970,"results":"115","hashOfConfig":"67"},{"size":298,"mtime":1713285711970,"results":"116","hashOfConfig":"67"},{"size":932,"mtime":1713285711970,"results":"117","hashOfConfig":"67"},{"size":468,"mtime":1713285711970,"results":"118","hashOfConfig":"67"},{"size":212,"mtime":1713285711970,"results":"119","hashOfConfig":"67"},{"size":62,"mtime":1713285711970,"results":"120","hashOfConfig":"67"},{"size":1188,"mtime":1713285711970,"results":"121","hashOfConfig":"67"},{"size":5021,"mtime":1713285711970,"results":"122","hashOfConfig":"67"},{"size":516,"mtime":1713285711970,"results":"123","hashOfConfig":"67"},{"size":1691,"mtime":1713285711970,"results":"124","hashOfConfig":"67"},{"size":6968,"mtime":1713285711970,"results":"125","hashOfConfig":"67"},{"size":5702,"mtime":1713285711970,"results":"126","hashOfConfig":"67"},{"size":2328,"mtime":1713285711970,"results":"127","hashOfConfig":"67"},{"size":1993,"mtime":1713285711970,"results":"128","hashOfConfig":"67"},{"size":3641,"mtime":1713285711970,"results":"129","hashOfConfig":"67"},{"size":80,"mtime":1713285711970,"results":"130","hashOfConfig":"67"},{"size":304,"mtime":1713285711970,"results":"131","hashOfConfig":"67"},{"filePath":"132","messages":"133","suppressedMessages":"134","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1aopjcr",{"filePath":"135","messages":"136","suppressedMessages":"137","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"138","messages":"139","suppressedMessages":"140","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"141","messages":"142","suppressedMessages":"143","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"144","messages":"145","suppressedMessages":"146","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"147","messages":"148","suppressedMessages":"149","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"150","messages":"151","suppressedMessages":"152","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"153","messages":"154","suppressedMessages":"155","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"156","messages":"157","suppressedMessages":"158","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"159","messages":"160","suppressedMessages":"161","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"162","messages":"163","suppressedMessages":"164","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"165","messages":"166","suppressedMessages":"167","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"168","messages":"169","suppressedMessages":"170","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"171","messages":"172","suppressedMessages":"173","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"174","messages":"175","suppressedMessages":"176","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"177","messages":"178","suppressedMessages":"179","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"180","messages":"181","suppressedMessages":"182","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"183","messages":"184","suppressedMessages":"185","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"186","messages":"187","suppressedMessages":"188","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"189","messages":"190","suppressedMessages":"191","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"192","messages":"193","suppressedMessages":"194","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"195","messages":"196","suppressedMessages":"197","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"198","messages":"199","suppressedMessages":"200","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"201","messages":"202","suppressedMessages":"203","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"204","messages":"205","suppressedMessages":"206","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"207","messages":"208","suppressedMessages":"209","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"210","messages":"211","suppressedMessages":"212","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"213","messages":"214","suppressedMessages":"215","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"216","messages":"217","suppressedMessages":"218","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"219","messages":"220","suppressedMessages":"221","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"222","messages":"223","suppressedMessages":"224","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"225","messages":"226","suppressedMessages":"227","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"228","messages":"229","suppressedMessages":"230","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"231","messages":"232","suppressedMessages":"233","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"234","messages":"235","suppressedMessages":"236","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"237","messages":"238","suppressedMessages":"239","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"240","messages":"241","suppressedMessages":"242","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"243","messages":"244","suppressedMessages":"245","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"246","messages":"247","suppressedMessages":"248","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"249","messages":"250","suppressedMessages":"251","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"252","messages":"253","suppressedMessages":"254","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"255","messages":"256","suppressedMessages":"257","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"258","messages":"259","suppressedMessages":"260","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"261","messages":"262","suppressedMessages":"263","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"264","messages":"265","suppressedMessages":"266","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"267","messages":"268","suppressedMessages":"269","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"270","messages":"271","suppressedMessages":"272","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"273","messages":"274","suppressedMessages":"275","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"276","messages":"277","suppressedMessages":"278","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"279","messages":"280","suppressedMessages":"281","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"282","messages":"283","suppressedMessages":"284","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"285","messages":"286","suppressedMessages":"287","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"288","messages":"289","suppressedMessages":"290","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"291","messages":"292","suppressedMessages":"293","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"294","messages":"295","suppressedMessages":"296","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"297","messages":"298","suppressedMessages":"299","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"300","messages":"301","suppressedMessages":"302","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"303","messages":"304","suppressedMessages":"305","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"306","messages":"307","suppressedMessages":"308","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"309","messages":"310","suppressedMessages":"311","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"312","messages":"313","suppressedMessages":"314","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"315","messages":"316","suppressedMessages":"317","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"318","messages":"319","suppressedMessages":"320","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"321","messages":"322","suppressedMessages":"323","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"324","messages":"325","suppressedMessages":"326","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/runner/work/featurevisor/featurevisor/packages/core/src/assess-distribution/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/benchmark/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/allocator.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildDatafile.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/buildProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/getFeatureRanges.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/revision.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/builder/traffic.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/parsers.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/config/projectConfig.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/adapter.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/datasource.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/filesystemAdapter.ts",[],["327","328"],"/home/runner/work/featurevisor/featurevisor/packages/core/src/datasource/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/dependencies.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/evaluate/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/findDuplicateSegments.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-duplicate-segments/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/find-usage/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/generate-code/typescript.ts",[],["329"],"/home/runner/work/featurevisor/featurevisor/packages/core/src/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/init/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/attributeSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkCircularDependency.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/checkPercentageExceedingSlot.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/conditionSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/featureSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/groupSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/lintProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/printError.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/segmentSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/linter/testSchema.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/restore/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/exportSite.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateHistory.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/generateSiteSearchIndex.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getLastModifiedFromHistory.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getOwnerAndRepoFromUrl.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRelativePaths.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/getRepoDetails.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/site/serveSite.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfArraysAreEqual.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/checkIfObjectsAreEqual.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/cliFormat.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.spec.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/matrix.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/prettyDuration.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/printTestResult.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testFeature.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testProject.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/tester/testSegment.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/extractKeys.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/git.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/index.ts",[],[],"/home/runner/work/featurevisor/featurevisor/packages/core/src/utils/pretty.ts",[],[],{"ruleId":"330","severity":2,"message":"331","line":22,"column":7,"nodeType":"332","messageId":"333","endLine":22,"endColumn":18,"suppressions":"334"},{"ruleId":"335","severity":2,"message":"336","line":22,"column":21,"nodeType":"337","messageId":"338","endLine":22,"endColumn":81,"fix":"339","suppressions":"340"},{"ruleId":"330","severity":2,"message":"341","line":51,"column":10,"nodeType":"332","messageId":"333","endLine":51,"endColumn":38,"suppressions":"342"},"@typescript-eslint/no-unused-vars","'commitRegex' is assigned a value but never used.","Identifier","unusedVar",["343"],"no-regex-spaces","Spaces are hard to count. Use {3}.","Literal","multipleSpaces",{"range":"344","text":"345"},["346"],"'getFeaturevisorTypeFromValue' is defined but never used.",["347"],{"kind":"348","justification":"349"},[515,518]," {3}",{"kind":"348","justification":"349"},{"kind":"348","justification":"349"},"directive",""]
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.18.0](https://github.com/featurevisor/featurevisor/compare/v1.17.0...v1.18.0) (2024-04-16)
7
+
8
+
9
+ ### Features
10
+
11
+ * assess traffic distribution via CLI ([#297](https://github.com/featurevisor/featurevisor/issues/297)) ([2063ad9](https://github.com/featurevisor/featurevisor/commit/2063ad9a5408071bfb1636c748cabe616065191d))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.17.0](https://github.com/featurevisor/featurevisor/compare/v1.16.0...v1.17.0) (2024-04-07)
18
+
19
+
20
+ ### Features
21
+
22
+ * evaluate features in CLI ([#295](https://github.com/featurevisor/featurevisor/issues/295)) ([5a3332a](https://github.com/featurevisor/featurevisor/commit/5a3332a226a3b4901445fe2fe04baa8320e94f48))
23
+
24
+
25
+
26
+
27
+
6
28
  # [1.16.0](https://github.com/featurevisor/featurevisor/compare/v1.15.0...v1.16.0) (2024-04-05)
7
29
 
8
30
  **Note:** Version bump only for package @featurevisor/core
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1712333112101" clover="3.2.0">
3
- <project timestamp="1712333112101" name="All files">
2
+ <coverage generated="1713285850110" clover="3.2.0">
3
+ <project timestamp="1713285850110" name="All files">
4
4
  <metrics statements="377" coveredstatements="256" conditionals="190" coveredconditionals="119" methods="54" coveredmethods="37" elements="621" coveredelements="412" complexity="0" loc="377" ncloc="377" packages="4" files="10" classes="10"/>
5
5
  <package name="lib.builder">
6
6
  <metrics statements="104" coveredstatements="98" conditionals="58" coveredconditionals="48" methods="15" coveredmethods="15"/>
@@ -146,7 +146,7 @@
146
146
  <div class='footer quiet pad2 space-top1 center small'>
147
147
  Code coverage generated by
148
148
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
149
- at 2024-04-05T16:05:12.062Z
149
+ at 2024-04-16T16:44:10.022Z
150
150
  </div>
151
151
  <script src="prettify.js"></script>
152
152
  <script>
@@ -175,7 +175,7 @@ exports.getUpdatedAvailableRangesAfterFilling = getUpdatedAvailableRangesAfterFi
175
175
  <div class='footer quiet pad2 space-top1 center small'>
176
176
  Code coverage generated by
177
177
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
178
- at 2024-04-05T16:05:12.062Z
178
+ at 2024-04-16T16:44:10.022Z
179
179
  </div>
180
180
  <script src="../../prettify.js"></script>
181
181
  <script>
@@ -131,7 +131,7 @@
131
131
  <div class='footer quiet pad2 space-top1 center small'>
132
132
  Code coverage generated by
133
133
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134
- at 2024-04-05T16:05:12.062Z
134
+ at 2024-04-16T16:44:10.022Z
135
135
  </div>
136
136
  <script src="../../prettify.js"></script>
137
137
  <script>
@@ -136,7 +136,7 @@ exports.getNextRevision = getNextRevision;
136
136
  <div class='footer quiet pad2 space-top1 center small'>
137
137
  Code coverage generated by
138
138
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
139
- at 2024-04-05T16:05:12.062Z
139
+ at 2024-04-16T16:44:10.022Z
140
140
  </div>
141
141
  <script src="../../prettify.js"></script>
142
142
  <script>
@@ -454,7 +454,7 @@ exports.getTraffic = getTraffic;
454
454
  <div class='footer quiet pad2 space-top1 center small'>
455
455
  Code coverage generated by
456
456
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
457
- at 2024-04-05T16:05:12.062Z
457
+ at 2024-04-16T16:44:10.022Z
458
458
  </div>
459
459
  <script src="../../prettify.js"></script>
460
460
  <script>
@@ -139,7 +139,7 @@ exports.checkIfObjectsAreEqual = checkIfObjectsAreEqual;
139
139
  <div class='footer quiet pad2 space-top1 center small'>
140
140
  Code coverage generated by
141
141
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
142
- at 2024-04-05T16:05:12.062Z
142
+ at 2024-04-16T16:44:10.022Z
143
143
  </div>
144
144
  <script src="../../prettify.js"></script>
145
145
  <script>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2024-04-05T16:05:12.062Z
119
+ at 2024-04-16T16:44:10.022Z
120
120
  </div>
121
121
  <script src="../../prettify.js"></script>
122
122
  <script>
@@ -472,7 +472,7 @@ exports.getSegmentAssertionsFromMatrix = getSegmentAssertionsFromMatrix;
472
472
  <div class='footer quiet pad2 space-top1 center small'>
473
473
  Code coverage generated by
474
474
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
475
- at 2024-04-05T16:05:12.062Z
475
+ at 2024-04-16T16:44:10.022Z
476
476
  </div>
477
477
  <script src="../../prettify.js"></script>
478
478
  <script>
@@ -193,7 +193,7 @@ export function getUpdatedAvailableRangesAfterFilling(
193
193
  <div class='footer quiet pad2 space-top1 center small'>
194
194
  Code coverage generated by
195
195
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
196
- at 2024-04-05T16:05:12.062Z
196
+ at 2024-04-16T16:44:10.022Z
197
197
  </div>
198
198
  <script src="../../prettify.js"></script>
199
199
  <script>
@@ -131,7 +131,7 @@
131
131
  <div class='footer quiet pad2 space-top1 center small'>
132
132
  Code coverage generated by
133
133
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
134
- at 2024-04-05T16:05:12.062Z
134
+ at 2024-04-16T16:44:10.022Z
135
135
  </div>
136
136
  <script src="../../prettify.js"></script>
137
137
  <script>
@@ -136,7 +136,7 @@
136
136
  <div class='footer quiet pad2 space-top1 center small'>
137
137
  Code coverage generated by
138
138
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
139
- at 2024-04-05T16:05:12.062Z
139
+ at 2024-04-16T16:44:10.022Z
140
140
  </div>
141
141
  <script src="../../prettify.js"></script>
142
142
  <script>
@@ -565,7 +565,7 @@ export function getTraffic(
565
565
  <div class='footer quiet pad2 space-top1 center small'>
566
566
  Code coverage generated by
567
567
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
568
- at 2024-04-05T16:05:12.062Z
568
+ at 2024-04-16T16:44:10.022Z
569
569
  </div>
570
570
  <script src="../../prettify.js"></script>
571
571
  <script>
@@ -142,7 +142,7 @@
142
142
  <div class='footer quiet pad2 space-top1 center small'>
143
143
  Code coverage generated by
144
144
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
145
- at 2024-04-05T16:05:12.062Z
145
+ at 2024-04-16T16:44:10.022Z
146
146
  </div>
147
147
  <script src="../../prettify.js"></script>
148
148
  <script>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2024-04-05T16:05:12.062Z
119
+ at 2024-04-16T16:44:10.022Z
120
120
  </div>
121
121
  <script src="../../prettify.js"></script>
122
122
  <script>
@@ -625,7 +625,7 @@ export function <span class="fstat-no" title="function not covered" >getSegmentA
625
625
  <div class='footer quiet pad2 space-top1 center small'>
626
626
  Code coverage generated by
627
627
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
628
- at 2024-04-05T16:05:12.062Z
628
+ at 2024-04-16T16:44:10.022Z
629
629
  </div>
630
630
  <script src="../../prettify.js"></script>
631
631
  <script>
@@ -0,0 +1,11 @@
1
+ import { FeatureKey, AttributeKey, Context } from "@featurevisor/types";
2
+ import { Dependencies } from "../dependencies";
3
+ export interface AssessDistributionOptions {
4
+ environment: string;
5
+ feature: FeatureKey;
6
+ context: Context;
7
+ n: number;
8
+ populateUuid?: AttributeKey[];
9
+ verbose?: boolean;
10
+ }
11
+ export declare function assessDistribution(deps: Dependencies, options: AssessDistributionOptions): Promise<void>;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.assessDistribution = void 0;
51
+ var crypto_1 = require("crypto");
52
+ var sdk_1 = require("@featurevisor/sdk");
53
+ var builder_1 = require("../builder");
54
+ var config_1 = require("../config");
55
+ var utils_1 = require("../utils");
56
+ var UUID_LENGTHS = [4, 2, 2, 2, 6];
57
+ function generateUUID() {
58
+ return UUID_LENGTHS.map(function (len) { return (0, crypto_1.randomBytes)(len).toString("hex"); }).join("-");
59
+ }
60
+ function printCounts(evaluations, n, sort) {
61
+ if (sort === void 0) { sort = true; }
62
+ var entries = Object.entries(evaluations);
63
+ if (sort) {
64
+ entries = entries.sort(function (a, b) {
65
+ if (a[1] > b[1]) {
66
+ return -1;
67
+ }
68
+ if (a[1] < b[1]) {
69
+ return 1;
70
+ }
71
+ return 0;
72
+ });
73
+ }
74
+ var longestValueLength = Object.keys(evaluations).reduce(function (acc, curr) { return (curr.length > acc ? curr.length : acc); }, 0);
75
+ var highestCount = Object.values(evaluations).reduce(function (acc, curr) { return (curr > acc ? curr : acc); }, 0);
76
+ var prettyHighestCountLength = (0, utils_1.prettyNumber)(highestCount).length;
77
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
78
+ var _a = entries_1[_i], value = _a[0], count = _a[1];
79
+ console.log(" - ".concat(value, ":").padEnd(longestValueLength + 5, " "), "\t".concat((0, utils_1.prettyNumber)(count).padStart(prettyHighestCountLength, " ")), "\t".concat((0, utils_1.prettyPercentage)(count, n).padStart(7, " ")));
80
+ }
81
+ }
82
+ function createContext(providedContext, populateUuid) {
83
+ var context = __assign({}, providedContext);
84
+ if (populateUuid) {
85
+ for (var _i = 0, populateUuid_1 = populateUuid; _i < populateUuid_1.length; _i++) {
86
+ var key = populateUuid_1[_i];
87
+ context[key] = generateUUID();
88
+ }
89
+ }
90
+ return context;
91
+ }
92
+ function assessDistribution(deps, options) {
93
+ return __awaiter(this, void 0, void 0, function () {
94
+ var projectConfig, datasource, datafileBuildStart, existingState, datafileContent, datafileBuildDuration, f, hasVariations, feature, flagEvaluations, variationEvaluations, i, context, flagEvaluation, variationEvaluation;
95
+ return __generator(this, function (_a) {
96
+ switch (_a.label) {
97
+ case 0:
98
+ projectConfig = deps.projectConfig, datasource = deps.datasource;
99
+ console.log("\nAssessing distribution for feature: \"".concat(options.feature, "\"..."));
100
+ datafileBuildStart = Date.now();
101
+ console.log("\n\nBuilding datafile containing all features for \"".concat(options.environment, "\"..."));
102
+ return [4 /*yield*/, datasource.readState(options.environment)];
103
+ case 1:
104
+ existingState = _a.sent();
105
+ return [4 /*yield*/, (0, builder_1.buildDatafile)(projectConfig, datasource, {
106
+ schemaVersion: config_1.SCHEMA_VERSION,
107
+ revision: "include-all-features",
108
+ environment: options.environment,
109
+ }, existingState)];
110
+ case 2:
111
+ datafileContent = _a.sent();
112
+ datafileBuildDuration = Date.now() - datafileBuildStart;
113
+ console.log("Datafile build duration: ".concat(datafileBuildDuration, "ms"));
114
+ f = (0, sdk_1.createInstance)({
115
+ datafile: datafileContent,
116
+ });
117
+ console.log("\n\n...SDK initialized\n");
118
+ hasVariations = false;
119
+ feature = f.getFeature(options.feature);
120
+ if (feature && feature.variations) {
121
+ hasVariations = true;
122
+ }
123
+ flagEvaluations = {
124
+ enabled: 0,
125
+ disabled: 0,
126
+ };
127
+ variationEvaluations = {};
128
+ console.log("\nEvaluating ".concat((0, utils_1.prettyNumber)(options.n), " times..."));
129
+ for (i = 0; i < options.n; i++) {
130
+ context = createContext(options.context, options.populateUuid);
131
+ if (options.verbose) {
132
+ console.log("[".concat(i + 1, "/").concat(options.n, "] Evaluating against context: ").concat(JSON.stringify(context)));
133
+ }
134
+ flagEvaluation = f.isEnabled(options.feature, context);
135
+ if (flagEvaluation) {
136
+ flagEvaluations.enabled++;
137
+ }
138
+ else {
139
+ flagEvaluations.disabled++;
140
+ }
141
+ // variation
142
+ if (hasVariations) {
143
+ variationEvaluation = f.getVariation(options.feature, context);
144
+ if (!variationEvaluations[variationEvaluation]) {
145
+ variationEvaluations[variationEvaluation] = 0;
146
+ }
147
+ variationEvaluations[variationEvaluation]++;
148
+ }
149
+ }
150
+ /**
151
+ * Print results
152
+ */
153
+ console.log("\n\nFlag evaluations:\n");
154
+ printCounts(flagEvaluations, options.n);
155
+ if (hasVariations) {
156
+ console.log("\n\nVariation evaluations:\n");
157
+ printCounts(variationEvaluations, options.n);
158
+ }
159
+ return [2 /*return*/];
160
+ }
161
+ });
162
+ });
163
+ }
164
+ exports.assessDistribution = assessDistribution;
165
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assess-distribution/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAqC;AAGrC,yCAAmD;AAGnD,sCAA2C;AAC3C,oCAA2C;AAC3C,kCAA0D;AAE1D,IAAM,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAErC,SAAS,YAAY;IACnB,OAAO,YAAY,CAAC,GAAG,CAAC,UAAC,GAAG,IAAK,OAAA,IAAA,oBAAW,EAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAhC,CAAgC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC;AAID,SAAS,WAAW,CAAC,WAA6B,EAAE,CAAS,EAAE,IAAW;IAAX,qBAAA,EAAA,WAAW;IACxE,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE1C,IAAI,IAAI,EAAE;QACR,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;gBACf,OAAO,CAAC,CAAC,CAAC;aACX;YAED,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,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BACvC,WAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;oBAExC,IAAI,aAAa,EAAE;wBACjB,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;wBAC5C,WAAW,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;qBAC9C;;;;;CACF;AAzFD,gDAyFC"}
@@ -0,0 +1,9 @@
1
+ import { Dependencies } from "../dependencies";
2
+ export interface EvaluateOptions {
3
+ environment: string;
4
+ feature: string;
5
+ context: Record<string, unknown>;
6
+ print?: boolean;
7
+ pretty?: boolean;
8
+ }
9
+ export declare function evaluateFeature(deps: Dependencies, options: EvaluateOptions): Promise<void>;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.evaluateFeature = void 0;
40
+ var sdk_1 = require("@featurevisor/sdk");
41
+ var config_1 = require("../config");
42
+ var builder_1 = require("../builder");
43
+ function printEvaluationDetails(evaluation) {
44
+ var ignoreKeys = ["featureKey", "variableKey", "traffic", "force"];
45
+ for (var _i = 0, _a = Object.entries(evaluation); _i < _a.length; _i++) {
46
+ var _b = _a[_i], key = _b[0], value = _b[1];
47
+ if (ignoreKeys.indexOf(key) !== -1) {
48
+ continue;
49
+ }
50
+ if (key === "variation") {
51
+ console.log("-", "".concat(key, ":"), value === null || value === void 0 ? void 0 : value.value);
52
+ continue;
53
+ }
54
+ if (key === "variableSchema") {
55
+ console.log("-", "variableType:", value.type);
56
+ console.log("-", "defaultValue:", value.defaultValue);
57
+ continue;
58
+ }
59
+ console.log("-", "".concat(key, ":"), value);
60
+ }
61
+ }
62
+ function printHeader(message) {
63
+ console.log("\n\n###############");
64
+ console.log("# ".concat(message));
65
+ console.log("###############\n");
66
+ }
67
+ function evaluateFeature(deps, options) {
68
+ var _a;
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var datasource, projectConfig, existingState, datafileContent, logs, f, flagEvaluation, variationEvaluation, variableEvaluations, feature, allEvaluations, _i, _b, _c, key, value;
71
+ return __generator(this, function (_d) {
72
+ switch (_d.label) {
73
+ case 0:
74
+ datasource = deps.datasource, projectConfig = deps.projectConfig;
75
+ return [4 /*yield*/, datasource.readState(options.environment)];
76
+ case 1:
77
+ existingState = _d.sent();
78
+ return [4 /*yield*/, (0, builder_1.buildDatafile)(projectConfig, datasource, {
79
+ schemaVersion: config_1.SCHEMA_VERSION,
80
+ revision: "include-all-features",
81
+ environment: options.environment,
82
+ }, existingState)];
83
+ case 2:
84
+ datafileContent = _d.sent();
85
+ logs = [];
86
+ f = (0, sdk_1.createInstance)({
87
+ datafile: datafileContent,
88
+ logger: (0, sdk_1.createLogger)({
89
+ levels: ["error", "warn", "info", "debug"],
90
+ handler: function (level, message, details) {
91
+ logs.push({
92
+ level: level,
93
+ message: message,
94
+ details: details,
95
+ });
96
+ },
97
+ }),
98
+ });
99
+ flagEvaluation = f.evaluateFlag(options.feature, options.context);
100
+ variationEvaluation = f.evaluateVariation(options.feature, options.context);
101
+ variableEvaluations = {};
102
+ feature = f.getFeature(options.feature);
103
+ if (feature === null || feature === void 0 ? void 0 : feature.variablesSchema) {
104
+ feature.variablesSchema.forEach(function (v) {
105
+ var variableEvaluation = f.evaluateVariable(options.feature, v.key, options.context);
106
+ variableEvaluations[v.key] = variableEvaluation;
107
+ });
108
+ }
109
+ allEvaluations = {
110
+ flag: flagEvaluation,
111
+ variation: variationEvaluation,
112
+ variables: variableEvaluations,
113
+ };
114
+ if (options.print) {
115
+ console.log(options.pretty ? JSON.stringify(allEvaluations, null, 2) : JSON.stringify(allEvaluations));
116
+ return [2 /*return*/];
117
+ }
118
+ console.log("");
119
+ console.log("Evaluating feature \"".concat(options.feature, "\" in environment \"").concat(options.environment, "\"..."));
120
+ console.log("Against context: ".concat(JSON.stringify(options.context)));
121
+ // flag
122
+ printHeader("Is enabled?");
123
+ console.log("Value:", flagEvaluation.enabled);
124
+ console.log("\nDetails:\n");
125
+ printEvaluationDetails(flagEvaluation);
126
+ // variation
127
+ printHeader("Variation");
128
+ if (feature === null || feature === void 0 ? void 0 : feature.variations) {
129
+ console.log("Value:", JSON.stringify((_a = variationEvaluation.variation) === null || _a === void 0 ? void 0 : _a.value));
130
+ console.log("\nDetails:\n");
131
+ printEvaluationDetails(variationEvaluation);
132
+ }
133
+ else {
134
+ console.log("No variations defined.");
135
+ }
136
+ // variables
137
+ if (feature === null || feature === void 0 ? void 0 : feature.variablesSchema) {
138
+ for (_i = 0, _b = Object.entries(variableEvaluations); _i < _b.length; _i++) {
139
+ _c = _b[_i], key = _c[0], value = _c[1];
140
+ printHeader("Variable: ".concat(key));
141
+ console.log("Value:", typeof value.variableValue !== "undefined"
142
+ ? JSON.stringify(value.variableValue)
143
+ : value.variableValue);
144
+ console.log("\nDetails:\n");
145
+ printEvaluationDetails(value);
146
+ }
147
+ }
148
+ else {
149
+ printHeader("Variables");
150
+ console.log("No variables defined.");
151
+ }
152
+ return [2 /*return*/];
153
+ }
154
+ });
155
+ });
156
+ }
157
+ exports.evaluateFeature = evaluateFeature;
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/evaluate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA6E;AAG7E,oCAA2C;AAC3C,sCAA2C;AAE3C,SAAS,sBAAsB,CAAC,UAAsB;IACpD,IAAM,UAAU,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAErE,KAA2B,UAA0B,EAA1B,KAAA,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAA1B,cAA0B,EAA1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A8D,EAAnC,KAAA,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAnC,cAAmC,EAAnC,IAAmC,EAAE;4BAArD,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;4BACpB,WAAW,CAAC,oBAAa,GAAG,CAAE,CAAC,CAAC;4BAEhC,OAAO,CAAC,GAAG,CACT,QAAQ,EACR,OAAO,KAAK,CAAC,aAAa,KAAK,WAAW;gCACxC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC;gCACrC,CAAC,CAAC,KAAK,CAAC,aAAa,CACxB,CAAC;4BACF,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;4BAE5B,sBAAsB,CAAC,KAAK,CAAC,CAAC;yBAC/B;qBACF;yBAAM;wBACL,WAAW,CAAC,WAAW,CAAC,CAAC;wBAEzB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;qBACtC;;;;;CACF;AAxGD,0CAwGC"}
package/lib/index.d.ts CHANGED
@@ -11,3 +11,5 @@ export * from "./find-usage";
11
11
  export * from "./dependencies";
12
12
  export * from "./datasource";
13
13
  export * from "./benchmark";
14
+ export * from "./evaluate";
15
+ export * from "./assess-distribution";
package/lib/index.js CHANGED
@@ -27,4 +27,6 @@ __exportStar(require("./find-usage"), exports);
27
27
  __exportStar(require("./dependencies"), exports);
28
28
  __exportStar(require("./datasource"), exports);
29
29
  __exportStar(require("./benchmark"), exports);
30
+ __exportStar(require("./evaluate"), exports);
31
+ __exportStar(require("./assess-distribution"), exports);
30
32
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,4DAA0C;AAC1C,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B;AAC7B,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,2CAAyB;AACzB,yCAAuB;AACvB,yCAAuB;AACvB,kDAAgC;AAChC,4CAA0B;AAC1B,4DAA0C;AAC1C,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B;AAC7B,8CAA4B;AAC5B,6CAA2B;AAC3B,wDAAsC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./extractKeys";
2
2
  export * from "./git";
3
+ export * from "./pretty";
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./extractKeys"), exports);
18
18
  __exportStar(require("./git"), exports);
19
+ __exportStar(require("./pretty"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wCAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,wCAAsB;AACtB,2CAAyB"}
@@ -0,0 +1,2 @@
1
+ export declare function prettyNumber(n: number): string;
2
+ export declare function prettyPercentage(value: number, total: number, precision?: number, suffix?: string): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prettyPercentage = exports.prettyNumber = void 0;
4
+ function prettyNumber(n) {
5
+ return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6
+ }
7
+ exports.prettyNumber = prettyNumber;
8
+ function prettyPercentage(value, total, precision, suffix) {
9
+ if (precision === void 0) { precision = 2; }
10
+ if (suffix === void 0) { suffix = "%"; }
11
+ return "".concat(((value / total) * 100).toFixed(precision)).concat(suffix);
12
+ }
13
+ exports.prettyPercentage = prettyPercentage;
14
+ //# sourceMappingURL=pretty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pretty.js","sourceRoot":"","sources":["../../src/utils/pretty.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AAC5D,CAAC;AAFD,oCAEC;AAED,SAAgB,gBAAgB,CAC9B,KAAa,EACb,KAAa,EACb,SAAqB,EACrB,MAAoB;IADpB,0BAAA,EAAA,aAAqB;IACrB,uBAAA,EAAA,YAAoB;IAEpB,OAAO,UAAG,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,SAAG,MAAM,CAAE,CAAC;AAClE,CAAC;AAPD,4CAOC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@featurevisor/core",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Core package of Featurevisor for Node.js usage",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
- "@featurevisor/sdk": "^1.16.0",
47
+ "@featurevisor/sdk": "^1.17.0",
48
48
  "@featurevisor/site": "^1.7.1",
49
49
  "@featurevisor/types": "^1.3.0",
50
50
  "axios": "^1.3.4",
@@ -57,5 +57,5 @@
57
57
  "@types/js-yaml": "^4.0.5",
58
58
  "@types/tar": "^6.1.4"
59
59
  },
60
- "gitHead": "9d73296020b22eab52d9d511cb933199551b5a21"
60
+ "gitHead": "beedecac433ebb53ec5c856ecdf5bf8c5ea159fd"
61
61
  }
@@ -0,0 +1,167 @@
1
+ import { randomBytes } from "crypto";
2
+
3
+ import { FeatureKey, AttributeKey, Context } from "@featurevisor/types";
4
+ import { createInstance } from "@featurevisor/sdk";
5
+
6
+ import { Dependencies } from "../dependencies";
7
+ import { buildDatafile } from "../builder";
8
+ import { SCHEMA_VERSION } from "../config";
9
+ import { prettyPercentage, prettyNumber } from "../utils";
10
+
11
+ const UUID_LENGTHS = [4, 2, 2, 2, 6];
12
+
13
+ function generateUUID(): string {
14
+ return UUID_LENGTHS.map((len) => randomBytes(len).toString("hex")).join("-");
15
+ }
16
+
17
+ type EvaluationsCount = Record<string, number>;
18
+
19
+ function printCounts(evaluations: EvaluationsCount, n: number, sort = true) {
20
+ let entries = Object.entries(evaluations);
21
+
22
+ if (sort) {
23
+ entries = entries.sort((a, b) => {
24
+ if (a[1] > b[1]) {
25
+ return -1;
26
+ }
27
+
28
+ if (a[1] < b[1]) {
29
+ return 1;
30
+ }
31
+
32
+ return 0;
33
+ });
34
+ }
35
+
36
+ const longestValueLength = Object.keys(evaluations).reduce(
37
+ (acc, curr) => (curr.length > acc ? curr.length : acc),
38
+ 0,
39
+ );
40
+
41
+ const highestCount = Object.values(evaluations).reduce(
42
+ (acc, curr) => (curr > acc ? curr : acc),
43
+ 0,
44
+ );
45
+ const prettyHighestCountLength = prettyNumber(highestCount).length;
46
+
47
+ for (const [value, count] of entries) {
48
+ console.log(
49
+ ` - ${value}:`.padEnd(longestValueLength + 5, " "),
50
+ `\t${prettyNumber(count).padStart(prettyHighestCountLength, " ")}`,
51
+ `\t${prettyPercentage(count, n).padStart(7, " ")}`,
52
+ );
53
+ }
54
+ }
55
+
56
+ function createContext(providedContext: Context, populateUuid?: AttributeKey[]): Context {
57
+ const context = { ...providedContext };
58
+
59
+ if (populateUuid) {
60
+ for (const key of populateUuid) {
61
+ context[key] = generateUUID();
62
+ }
63
+ }
64
+
65
+ return context;
66
+ }
67
+
68
+ export interface AssessDistributionOptions {
69
+ environment: string;
70
+ feature: FeatureKey;
71
+ context: Context;
72
+ n: number;
73
+
74
+ populateUuid?: AttributeKey[];
75
+ verbose?: boolean;
76
+ }
77
+
78
+ export async function assessDistribution(deps: Dependencies, options: AssessDistributionOptions) {
79
+ const { projectConfig, datasource } = deps;
80
+
81
+ console.log(`\nAssessing distribution for feature: "${options.feature}"...`);
82
+
83
+ /**
84
+ * Prepare datafile
85
+ */
86
+ const datafileBuildStart = Date.now();
87
+ console.log(`\n\nBuilding datafile containing all features for "${options.environment}"...`);
88
+ const existingState = await datasource.readState(options.environment);
89
+ const datafileContent = await buildDatafile(
90
+ projectConfig,
91
+ datasource,
92
+ {
93
+ schemaVersion: SCHEMA_VERSION,
94
+ revision: "include-all-features",
95
+ environment: options.environment,
96
+ },
97
+ existingState,
98
+ );
99
+ const datafileBuildDuration = Date.now() - datafileBuildStart;
100
+ console.log(`Datafile build duration: ${datafileBuildDuration}ms`);
101
+
102
+ /**
103
+ * Initialize SDK
104
+ */
105
+ const f = createInstance({
106
+ datafile: datafileContent,
107
+ });
108
+ console.log("\n\n...SDK initialized\n");
109
+
110
+ /**
111
+ * Evaluations
112
+ */
113
+ let hasVariations = false;
114
+ const feature = f.getFeature(options.feature);
115
+
116
+ if (feature && feature.variations) {
117
+ hasVariations = true;
118
+ }
119
+
120
+ const flagEvaluations: EvaluationsCount = {
121
+ enabled: 0,
122
+ disabled: 0,
123
+ };
124
+
125
+ const variationEvaluations: EvaluationsCount = {};
126
+
127
+ console.log(`\nEvaluating ${prettyNumber(options.n)} times...`);
128
+
129
+ for (let i = 0; i < options.n; i++) {
130
+ const context = createContext(options.context, options.populateUuid);
131
+ if (options.verbose) {
132
+ console.log(`[${i + 1}/${options.n}] Evaluating against context: ${JSON.stringify(context)}`);
133
+ }
134
+
135
+ // flag
136
+ const flagEvaluation = f.isEnabled(options.feature, context);
137
+
138
+ if (flagEvaluation) {
139
+ flagEvaluations.enabled++;
140
+ } else {
141
+ flagEvaluations.disabled++;
142
+ }
143
+
144
+ // variation
145
+ if (hasVariations) {
146
+ const variationEvaluation = f.getVariation(options.feature, context) as string;
147
+
148
+ if (!variationEvaluations[variationEvaluation]) {
149
+ variationEvaluations[variationEvaluation] = 0;
150
+ }
151
+
152
+ variationEvaluations[variationEvaluation]++;
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Print results
158
+ */
159
+
160
+ console.log("\n\nFlag evaluations:\n");
161
+ printCounts(flagEvaluations, options.n);
162
+
163
+ if (hasVariations) {
164
+ console.log("\n\nVariation evaluations:\n");
165
+ printCounts(variationEvaluations, options.n);
166
+ }
167
+ }
@@ -0,0 +1,149 @@
1
+ import { Context } from "@featurevisor/types";
2
+ import { Evaluation, createInstance, createLogger } from "@featurevisor/sdk";
3
+
4
+ import { Dependencies } from "../dependencies";
5
+ import { SCHEMA_VERSION } from "../config";
6
+ import { buildDatafile } from "../builder";
7
+
8
+ function printEvaluationDetails(evaluation: Evaluation) {
9
+ const ignoreKeys = ["featureKey", "variableKey", "traffic", "force"];
10
+
11
+ for (const [key, value] of Object.entries(evaluation)) {
12
+ if (ignoreKeys.indexOf(key) !== -1) {
13
+ continue;
14
+ }
15
+
16
+ if (key === "variation") {
17
+ console.log(`-`, `${key}:`, value?.value);
18
+ continue;
19
+ }
20
+
21
+ if (key === "variableSchema") {
22
+ console.log(`-`, `variableType:`, value.type);
23
+ console.log(`-`, `defaultValue:`, value.defaultValue);
24
+ continue;
25
+ }
26
+
27
+ console.log(`-`, `${key}:`, value);
28
+ }
29
+ }
30
+
31
+ function printHeader(message: string) {
32
+ console.log("\n\n###############");
33
+ console.log(`# ${message}`);
34
+ console.log("###############\n");
35
+ }
36
+
37
+ export interface EvaluateOptions {
38
+ environment: string;
39
+ feature: string;
40
+ context: Record<string, unknown>;
41
+ print?: boolean;
42
+ pretty?: boolean;
43
+ }
44
+
45
+ export async function evaluateFeature(deps: Dependencies, options: EvaluateOptions) {
46
+ const { datasource, projectConfig } = deps;
47
+
48
+ const existingState = await datasource.readState(options.environment);
49
+ const datafileContent = await buildDatafile(
50
+ projectConfig,
51
+ datasource,
52
+ {
53
+ schemaVersion: SCHEMA_VERSION,
54
+ revision: "include-all-features",
55
+ environment: options.environment,
56
+ },
57
+ existingState,
58
+ );
59
+
60
+ const logs: Array<any> = [];
61
+ const f = createInstance({
62
+ datafile: datafileContent,
63
+ logger: createLogger({
64
+ levels: ["error", "warn", "info", "debug"],
65
+ handler: (level, message, details) => {
66
+ logs.push({
67
+ level,
68
+ message,
69
+ details,
70
+ });
71
+ },
72
+ }),
73
+ });
74
+
75
+ const flagEvaluation = f.evaluateFlag(options.feature, options.context as Context);
76
+ const variationEvaluation = f.evaluateVariation(options.feature, options.context as Context);
77
+ const variableEvaluations: Record<string, Evaluation> = {};
78
+
79
+ const feature = f.getFeature(options.feature);
80
+ if (feature?.variablesSchema) {
81
+ feature.variablesSchema.forEach((v) => {
82
+ const variableEvaluation = f.evaluateVariable(
83
+ options.feature,
84
+ v.key,
85
+ options.context as Context,
86
+ );
87
+ variableEvaluations[v.key] = variableEvaluation;
88
+ });
89
+ }
90
+
91
+ const allEvaluations = {
92
+ flag: flagEvaluation,
93
+ variation: variationEvaluation,
94
+ variables: variableEvaluations,
95
+ };
96
+
97
+ if (options.print) {
98
+ console.log(
99
+ options.pretty ? JSON.stringify(allEvaluations, null, 2) : JSON.stringify(allEvaluations),
100
+ );
101
+
102
+ return;
103
+ }
104
+
105
+ console.log("");
106
+ console.log(`Evaluating feature "${options.feature}" in environment "${options.environment}"...`);
107
+ console.log(`Against context: ${JSON.stringify(options.context)}`);
108
+
109
+ // flag
110
+ printHeader("Is enabled?");
111
+
112
+ console.log("Value:", flagEvaluation.enabled);
113
+ console.log("\nDetails:\n");
114
+
115
+ printEvaluationDetails(flagEvaluation);
116
+
117
+ // variation
118
+ printHeader("Variation");
119
+
120
+ if (feature?.variations) {
121
+ console.log("Value:", JSON.stringify(variationEvaluation.variation?.value));
122
+ console.log("\nDetails:\n");
123
+
124
+ printEvaluationDetails(variationEvaluation);
125
+ } else {
126
+ console.log("No variations defined.");
127
+ }
128
+
129
+ // variables
130
+ if (feature?.variablesSchema) {
131
+ for (const [key, value] of Object.entries(variableEvaluations)) {
132
+ printHeader(`Variable: ${key}`);
133
+
134
+ console.log(
135
+ "Value:",
136
+ typeof value.variableValue !== "undefined"
137
+ ? JSON.stringify(value.variableValue)
138
+ : value.variableValue,
139
+ );
140
+ console.log("\nDetails:\n");
141
+
142
+ printEvaluationDetails(value);
143
+ }
144
+ } else {
145
+ printHeader("Variables");
146
+
147
+ console.log("No variables defined.");
148
+ }
149
+ }
package/src/index.ts CHANGED
@@ -11,3 +11,5 @@ export * from "./find-usage";
11
11
  export * from "./dependencies";
12
12
  export * from "./datasource";
13
13
  export * from "./benchmark";
14
+ export * from "./evaluate";
15
+ export * from "./assess-distribution";
@@ -1,2 +1,3 @@
1
1
  export * from "./extractKeys";
2
2
  export * from "./git";
3
+ export * from "./pretty";
@@ -0,0 +1,12 @@
1
+ export function prettyNumber(n: number) {
2
+ return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
3
+ }
4
+
5
+ export function prettyPercentage(
6
+ value: number,
7
+ total: number,
8
+ precision: number = 2,
9
+ suffix: string = "%",
10
+ ): string {
11
+ return `${((value / total) * 100).toFixed(precision)}${suffix}`;
12
+ }