@featurevisor/core 2.26.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/coverage/clover.xml +4991 -3130
- package/coverage/coverage-final.json +63 -39
- package/coverage/lcov-report/block-navigation.js +1 -1
- package/coverage/lcov-report/index.html +248 -98
- package/coverage/lcov-report/sorter.js +21 -7
- package/coverage/lcov-report/src/assess-distribution/index.html +116 -0
- package/coverage/lcov-report/src/assess-distribution/index.ts.html +754 -0
- package/coverage/lcov-report/{list → src/benchmark}/index.html +30 -30
- package/coverage/lcov-report/src/benchmark/index.ts.html +793 -0
- package/coverage/lcov-report/{builder → src/builder}/allocator.ts.html +38 -38
- package/coverage/lcov-report/{builder/buildScopedConditions.ts.html → src/builder/applyContextToConditions.ts.html} +80 -65
- package/coverage/lcov-report/{builder/buildScopedDatafile.ts.html → src/builder/applyContextToDatafile.ts.html} +92 -92
- package/coverage/lcov-report/{builder/buildScopedSegments.ts.html → src/builder/applyContextToSegments.ts.html} +103 -67
- package/coverage/lcov-report/{builder → src/builder}/buildDatafile.ts.html +336 -306
- package/coverage/lcov-report/src/builder/buildProject.ts.html +1117 -0
- package/coverage/lcov-report/src/builder/buildRuntimeDatafiles.ts.html +256 -0
- package/coverage/lcov-report/{builder → src/builder}/getFeatureRanges.ts.html +22 -22
- package/coverage/lcov-report/{builder → src/builder}/hashes.ts.html +50 -50
- package/coverage/lcov-report/{builder → src/builder}/index.html +114 -84
- package/coverage/lcov-report/{tester/cliFormat.ts.html → src/builder/index.ts.html} +17 -29
- package/coverage/lcov-report/{builder → src/builder}/mutateVariables.ts.html +55 -55
- package/coverage/lcov-report/{builder → src/builder}/mutator.ts.html +118 -118
- package/coverage/lcov-report/{builder → src/builder}/revision.ts.html +15 -15
- package/coverage/lcov-report/{builder → src/builder}/traffic.ts.html +86 -86
- package/coverage/lcov-report/src/cli/cli.ts.html +400 -0
- package/coverage/lcov-report/{tester → src/cli}/index.html +41 -41
- package/coverage/lcov-report/src/cli/plugins.ts.html +214 -0
- package/coverage/lcov-report/{config → src/config}/index.html +31 -31
- package/coverage/lcov-report/{config → src/config}/index.ts.html +12 -12
- package/coverage/lcov-report/{config → src/config}/projectConfig.ts.html +312 -96
- package/coverage/lcov-report/{datasource → src/datasource}/adapter.ts.html +28 -73
- package/coverage/lcov-report/{datasource → src/datasource}/datasource.ts.html +191 -104
- package/coverage/lcov-report/{datasource → src/datasource}/filesystemAdapter.ts.html +233 -635
- package/coverage/lcov-report/{datasource → src/datasource}/index.html +48 -48
- package/coverage/lcov-report/{datasource → src/datasource}/index.ts.html +14 -14
- package/coverage/lcov-report/src/evaluate/index.html +116 -0
- package/coverage/lcov-report/src/evaluate/index.ts.html +814 -0
- package/coverage/lcov-report/src/find-duplicate-segments/findDuplicateSegments.ts.html +313 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.html +131 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.ts.html +307 -0
- package/coverage/lcov-report/src/find-usage/index.html +116 -0
- package/coverage/lcov-report/src/find-usage/index.ts.html +1780 -0
- package/coverage/lcov-report/src/generate-code/index.html +131 -0
- package/coverage/lcov-report/src/generate-code/index.ts.html +403 -0
- package/coverage/lcov-report/{generate-code → src/generate-code}/typescript.ts.html +266 -1361
- package/coverage/lcov-report/{generate-code → src}/index.html +38 -23
- package/coverage/lcov-report/src/info/index.html +116 -0
- package/coverage/lcov-report/src/info/index.ts.html +472 -0
- package/coverage/lcov-report/src/init/index.html +116 -0
- package/coverage/lcov-report/src/init/index.ts.html +280 -0
- package/coverage/lcov-report/{linter → src/linter}/attributeSchema.ts.html +160 -157
- package/coverage/lcov-report/{linter → src/linter}/checkCircularDependency.ts.html +25 -25
- package/coverage/lcov-report/{linter → src/linter}/checkPercentageExceedingSlot.ts.html +42 -42
- package/coverage/lcov-report/{linter → src/linter}/conditionSchema.ts.html +207 -207
- package/coverage/lcov-report/{linter → src/linter}/featureSchema.ts.html +462 -471
- package/coverage/lcov-report/{linter → src/linter}/groupSchema.ts.html +25 -22
- package/coverage/lcov-report/{linter → src/linter}/index.html +129 -99
- package/coverage/lcov-report/src/linter/index.ts.html +88 -0
- package/coverage/lcov-report/{linter → src/linter}/lintProject.ts.html +740 -332
- package/coverage/lcov-report/{linter → src/linter}/mutationNotation.ts.html +130 -130
- package/coverage/lcov-report/{linter → src/linter}/printError.ts.html +27 -27
- package/coverage/lcov-report/{linter → src/linter}/schema.ts.html +153 -150
- package/coverage/lcov-report/{linter → src/linter}/segmentSchema.ts.html +18 -15
- package/coverage/lcov-report/src/linter/targetSchema.ts.html +223 -0
- package/coverage/lcov-report/{linter → src/linter}/testSchema.ts.html +54 -48
- package/coverage/lcov-report/{linter → src/linter}/zodHelpers.ts.html +17 -17
- package/coverage/lcov-report/src/list/index.html +131 -0
- package/coverage/lcov-report/src/list/index.ts.html +2065 -0
- package/coverage/lcov-report/{list → src/list}/matrix.ts.html +43 -58
- package/coverage/lcov-report/src/promoter/index.html +116 -0
- package/coverage/lcov-report/src/promoter/index.ts.html +3883 -0
- package/coverage/lcov-report/src/sets.ts.html +313 -0
- package/coverage/lcov-report/src/targeting.ts.html +403 -0
- package/coverage/lcov-report/src/tester/cliFormat.ts.html +133 -0
- package/coverage/lcov-report/{tester → src/tester}/helpers.ts.html +15 -15
- package/coverage/lcov-report/src/tester/index.html +206 -0
- package/coverage/lcov-report/src/tester/prettyDuration.ts.html +187 -0
- package/coverage/lcov-report/src/tester/printTestResult.ts.html +337 -0
- package/coverage/lcov-report/src/tester/testFeature.ts.html +1186 -0
- package/coverage/lcov-report/src/tester/testProject.ts.html +1018 -0
- package/coverage/lcov-report/src/tester/testSegment.ts.html +316 -0
- package/coverage/lcov-report/{utils → src/utils}/extractKeys.ts.html +68 -68
- package/coverage/lcov-report/{utils → src/utils}/git.ts.html +44 -68
- package/coverage/lcov-report/{utils → src/utils}/index.html +44 -44
- package/coverage/lcov-report/{utils → src/utils}/index.ts.html +14 -14
- package/coverage/lcov-report/{utils → src/utils}/pretty.ts.html +20 -20
- package/coverage/lcov.info +10121 -5723
- package/jest.config.js +13 -4
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +59 -40
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.d.ts +8 -5
- package/lib/benchmark/index.js +82 -65
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/applyContextToConditions.d.ts +5 -0
- package/lib/builder/{buildScopedConditions.js → applyContextToConditions.js} +19 -14
- package/lib/builder/applyContextToConditions.js.map +1 -0
- package/lib/builder/applyContextToDatafile.d.ts +2 -0
- package/lib/builder/{buildScopedDatafile.js → applyContextToDatafile.js} +26 -26
- package/lib/builder/applyContextToDatafile.js.map +1 -0
- package/lib/builder/applyContextToSegments.d.ts +5 -0
- package/lib/builder/{buildScopedSegments.js → applyContextToSegments.js} +19 -14
- package/lib/builder/applyContextToSegments.js.map +1 -0
- package/lib/builder/buildDatafile.d.ts +9 -6
- package/lib/builder/buildDatafile.js +86 -51
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +17 -3
- package/lib/builder/buildProject.js +151 -59
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/buildRuntimeDatafiles.d.ts +12 -0
- package/lib/builder/buildRuntimeDatafiles.js +35 -0
- package/lib/builder/buildRuntimeDatafiles.js.map +1 -0
- package/lib/builder/getFeatureRanges.js +34 -1
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.js +34 -1
- package/lib/builder/hashes.js.map +1 -1
- package/lib/builder/index.d.ts +0 -1
- package/lib/builder/index.js +0 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/cli/cli.js +0 -4
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +7 -2
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/projectConfig.d.ts +17 -17
- package/lib/config/projectConfig.js +101 -15
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +7 -9
- package/lib/datasource/adapter.js +0 -7
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +15 -5
- package/lib/datasource/datasource.js +37 -9
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +4 -10
- package/lib/datasource/filesystemAdapter.js +111 -149
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -7
- package/lib/evaluate/index.js +81 -67
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +34 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +21 -13
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.js +57 -41
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.d.ts +1 -1
- package/lib/generate-code/index.js +64 -21
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.d.ts +1 -1
- package/lib/generate-code/typescript.js +59 -333
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +57 -16
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +2 -2
- package/lib/init/index.js +39 -3
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +1 -0
- package/lib/linter/attributeSchema.js +1 -0
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/conditionSchema.js +5 -5
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +4 -1
- package/lib/linter/featureSchema.js +15 -13
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.d.ts +1 -0
- package/lib/linter/groupSchema.js +1 -0
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.d.ts +1 -3
- package/lib/linter/lintProject.js +198 -68
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/schema.js +1 -0
- package/lib/linter/schema.js.map +1 -1
- package/lib/linter/segmentSchema.d.ts +1 -0
- package/lib/linter/segmentSchema.js +1 -0
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/targetSchema.d.ts +16 -0
- package/lib/linter/targetSchema.js +40 -0
- package/lib/linter/targetSchema.js.map +1 -0
- package/lib/linter/testSchema.d.ts +4 -3
- package/lib/linter/testSchema.js +9 -4
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +131 -12
- package/lib/list/index.js.map +1 -1
- package/lib/list/matrix.js +3 -7
- package/lib/list/matrix.js.map +1 -1
- package/lib/promoter/index.d.ts +50 -0
- package/lib/promoter/index.js +880 -0
- package/lib/promoter/index.js.map +1 -0
- package/lib/sets.d.ts +11 -0
- package/lib/sets.js +81 -0
- package/lib/sets.js.map +1 -0
- package/lib/targeting.d.ts +14 -0
- package/lib/targeting.js +82 -0
- package/lib/targeting.js.map +1 -0
- package/lib/tester/cliFormat.d.ts +7 -1
- package/lib/tester/cliFormat.js +11 -2
- package/lib/tester/cliFormat.js.map +1 -1
- package/lib/tester/printTestResult.js +2 -2
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +0 -1
- package/lib/tester/testFeature.js +8 -25
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +2 -3
- package/lib/tester/testProject.js +93 -86
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +1 -1
- package/lib/tester/testSegment.js +3 -21
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/git.js +45 -19
- package/lib/utils/git.js.map +1 -1
- package/package.json +12 -12
- package/src/assess-distribution/index.ts +72 -52
- package/src/benchmark/index.ts +124 -91
- package/src/builder/{buildScopedConditions.spec.ts → applyContextToConditions.spec.ts} +160 -142
- package/src/builder/{buildScopedConditions.ts → applyContextToConditions.ts} +19 -14
- package/src/builder/{buildScopedDatafile.spec.ts → applyContextToDatafile.spec.ts} +141 -81
- package/src/builder/{buildScopedDatafile.ts → applyContextToDatafile.ts} +33 -33
- package/src/builder/{buildScopedSegments.spec.ts → applyContextToSegments.spec.ts} +171 -151
- package/src/builder/{buildScopedSegments.ts → applyContextToSegments.ts} +26 -14
- package/src/builder/buildDatafile.spec.ts +192 -14
- package/src/builder/buildDatafile.ts +74 -64
- package/src/builder/buildProject.ts +171 -86
- package/src/builder/buildRuntimeDatafiles.ts +57 -0
- package/src/builder/index.ts +0 -1
- package/src/cli/cli.ts +0 -5
- package/src/cli/plugins.ts +7 -2
- package/src/config/projectConfig.spec.ts +171 -8
- package/src/config/projectConfig.ts +100 -28
- package/src/datasource/adapter.ts +8 -23
- package/src/datasource/datasource.ts +50 -21
- package/src/datasource/filesystemAdapter.spec.ts +133 -74
- package/src/datasource/filesystemAdapter.ts +93 -227
- package/src/evaluate/index.ts +109 -97
- package/src/find-duplicate-segments/index.ts +34 -16
- package/src/find-usage/index.ts +89 -44
- package/src/generate-code/index.ts +36 -24
- package/src/generate-code/typescript.spec.ts +106 -0
- package/src/generate-code/typescript.ts +33 -398
- package/src/index.ts +2 -1
- package/src/info/index.ts +72 -16
- package/src/init/index.ts +1 -1
- package/src/linter/attributeSchema.ts +1 -0
- package/src/linter/conditionSchema.spec.ts +23 -3
- package/src/linter/conditionSchema.ts +5 -5
- package/src/linter/featureSchema.spec.ts +107 -18
- package/src/linter/featureSchema.ts +25 -28
- package/src/linter/groupSchema.ts +1 -0
- package/src/linter/lintProject.spec.ts +131 -92
- package/src/linter/lintProject.ts +233 -97
- package/src/linter/schema.ts +1 -0
- package/src/linter/segmentSchema.spec.ts +5 -3
- package/src/linter/segmentSchema.ts +1 -0
- package/src/linter/targetSchema.spec.ts +159 -0
- package/src/linter/targetSchema.ts +46 -0
- package/src/linter/testSchema.spec.ts +70 -5
- package/src/linter/testSchema.ts +12 -10
- package/src/list/index.spec.ts +135 -0
- package/src/list/index.ts +188 -12
- package/src/list/matrix.ts +3 -8
- package/src/promoter/index.spec.ts +617 -0
- package/src/promoter/index.ts +1266 -0
- package/src/sets.ts +76 -0
- package/src/targeting.spec.ts +74 -0
- package/src/targeting.ts +106 -0
- package/src/tester/cliFormat.ts +11 -1
- package/src/tester/printTestResult.ts +12 -3
- package/src/tester/testFeature.ts +10 -36
- package/src/tester/testProject.spec.ts +50 -0
- package/src/tester/testProject.ts +89 -140
- package/src/tester/testSegment.ts +5 -22
- package/src/utils/git.ts +13 -21
- package/tsconfig.cjs.json +5 -1
- package/tsconfig.typecheck.json +9 -0
- package/coverage/lcov-report/builder/convertToV1.ts.html +0 -583
- package/lib/builder/allocator.spec.d.ts +0 -1
- package/lib/builder/allocator.spec.js +0 -85
- package/lib/builder/allocator.spec.js.map +0 -1
- package/lib/builder/buildDatafile.spec.d.ts +0 -1
- package/lib/builder/buildDatafile.spec.js +0 -233
- package/lib/builder/buildDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedConditions.d.ts +0 -5
- package/lib/builder/buildScopedConditions.js.map +0 -1
- package/lib/builder/buildScopedConditions.spec.d.ts +0 -1
- package/lib/builder/buildScopedConditions.spec.js +0 -2167
- package/lib/builder/buildScopedConditions.spec.js.map +0 -1
- package/lib/builder/buildScopedDatafile.d.ts +0 -2
- package/lib/builder/buildScopedDatafile.js.map +0 -1
- package/lib/builder/buildScopedDatafile.spec.d.ts +0 -1
- package/lib/builder/buildScopedDatafile.spec.js +0 -2277
- package/lib/builder/buildScopedDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedSegments.d.ts +0 -5
- package/lib/builder/buildScopedSegments.js.map +0 -1
- package/lib/builder/buildScopedSegments.spec.d.ts +0 -1
- package/lib/builder/buildScopedSegments.spec.js +0 -1062
- package/lib/builder/buildScopedSegments.spec.js.map +0 -1
- package/lib/builder/convertToV1.d.ts +0 -10
- package/lib/builder/convertToV1.js +0 -119
- package/lib/builder/convertToV1.js.map +0 -1
- package/lib/builder/mutateVariables.spec.d.ts +0 -1
- package/lib/builder/mutateVariables.spec.js +0 -1074
- package/lib/builder/mutateVariables.spec.js.map +0 -1
- package/lib/builder/mutator.spec.d.ts +0 -1
- package/lib/builder/mutator.spec.js +0 -368
- package/lib/builder/mutator.spec.js.map +0 -1
- package/lib/builder/revision.spec.d.ts +0 -1
- package/lib/builder/revision.spec.js +0 -21
- package/lib/builder/revision.spec.js.map +0 -1
- package/lib/builder/traffic.spec.d.ts +0 -1
- package/lib/builder/traffic.spec.js +0 -872
- package/lib/builder/traffic.spec.js.map +0 -1
- package/lib/config/projectConfig.spec.d.ts +0 -1
- package/lib/config/projectConfig.spec.js +0 -24
- package/lib/config/projectConfig.spec.js.map +0 -1
- package/lib/datasource/filesystemAdapter.spec.d.ts +0 -1
- package/lib/datasource/filesystemAdapter.spec.js +0 -88
- package/lib/datasource/filesystemAdapter.spec.js.map +0 -1
- package/lib/generate-code/typescript.spec.d.ts +0 -1
- package/lib/generate-code/typescript.spec.js +0 -78
- package/lib/generate-code/typescript.spec.js.map +0 -1
- package/lib/linter/attributeSchema.spec.d.ts +0 -1
- package/lib/linter/attributeSchema.spec.js +0 -266
- package/lib/linter/attributeSchema.spec.js.map +0 -1
- package/lib/linter/conditionSchema.spec.d.ts +0 -1
- package/lib/linter/conditionSchema.spec.js +0 -380
- package/lib/linter/conditionSchema.spec.js.map +0 -1
- package/lib/linter/featureSchema.spec.d.ts +0 -1
- package/lib/linter/featureSchema.spec.js +0 -1552
- package/lib/linter/featureSchema.spec.js.map +0 -1
- package/lib/linter/lintProject.spec.d.ts +0 -1
- package/lib/linter/lintProject.spec.js +0 -211
- package/lib/linter/lintProject.spec.js.map +0 -1
- package/lib/linter/mutationNotation.spec.d.ts +0 -1
- package/lib/linter/mutationNotation.spec.js +0 -598
- package/lib/linter/mutationNotation.spec.js.map +0 -1
- package/lib/linter/schema.spec.d.ts +0 -1
- package/lib/linter/schema.spec.js +0 -535
- package/lib/linter/schema.spec.js.map +0 -1
- package/lib/linter/segmentSchema.spec.d.ts +0 -1
- package/lib/linter/segmentSchema.spec.js +0 -303
- package/lib/linter/segmentSchema.spec.js.map +0 -1
- package/lib/linter/testSchema.spec.d.ts +0 -1
- package/lib/linter/testSchema.spec.js +0 -162
- package/lib/linter/testSchema.spec.js.map +0 -1
- package/lib/list/matrix.spec.d.ts +0 -1
- package/lib/list/matrix.spec.js +0 -42
- package/lib/list/matrix.spec.js.map +0 -1
- package/lib/site/exportSite.d.ts +0 -2
- package/lib/site/exportSite.js +0 -30
- package/lib/site/exportSite.js.map +0 -1
- package/lib/site/generateHistory.d.ts +0 -3
- package/lib/site/generateHistory.js +0 -31
- package/lib/site/generateHistory.js.map +0 -1
- package/lib/site/generateSiteSearchIndex.d.ts +0 -4
- package/lib/site/generateSiteSearchIndex.js +0 -195
- package/lib/site/generateSiteSearchIndex.js.map +0 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +0 -2
- package/lib/site/getLastModifiedFromHistory.js +0 -18
- package/lib/site/getLastModifiedFromHistory.js.map +0 -1
- package/lib/site/getOwnerAndRepoFromUrl.d.ts +0 -4
- package/lib/site/getOwnerAndRepoFromUrl.js +0 -20
- package/lib/site/getOwnerAndRepoFromUrl.js.map +0 -1
- package/lib/site/getRelativePaths.d.ts +0 -6
- package/lib/site/getRelativePaths.js +0 -15
- package/lib/site/getRelativePaths.js.map +0 -1
- package/lib/site/getRepoDetails.d.ts +0 -8
- package/lib/site/getRepoDetails.js +0 -48
- package/lib/site/getRepoDetails.js.map +0 -1
- package/lib/site/index.d.ts +0 -2
- package/lib/site/index.js +0 -43
- package/lib/site/index.js.map +0 -1
- package/lib/site/serveSite.d.ts +0 -2
- package/lib/site/serveSite.js +0 -54
- package/lib/site/serveSite.js.map +0 -1
- package/lib/tester/helpers.spec.d.ts +0 -1
- package/lib/tester/helpers.spec.js +0 -115
- package/lib/tester/helpers.spec.js.map +0 -1
- package/src/builder/convertToV1.ts +0 -166
- package/src/site/exportSite.ts +0 -42
- package/src/site/generateHistory.ts +0 -40
- package/src/site/generateSiteSearchIndex.ts +0 -258
- package/src/site/getLastModifiedFromHistory.ts +0 -21
- package/src/site/getOwnerAndRepoFromUrl.ts +0 -17
- package/src/site/getRelativePaths.ts +0 -24
- package/src/site/getRepoDetails.ts +0 -62
- package/src/site/index.ts +0 -46
- package/src/site/serveSite.ts +0 -58
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { DatafileContent } from "@featurevisor/types";
|
|
2
|
-
import {
|
|
2
|
+
import { applyContextToDatafile } from "./applyContextToDatafile";
|
|
3
3
|
|
|
4
|
-
describe("core:
|
|
5
|
-
test("
|
|
6
|
-
expect(
|
|
4
|
+
describe("core: applyContextToDatafile", function () {
|
|
5
|
+
test("applyContextToDatafile is a function", function () {
|
|
6
|
+
expect(applyContextToDatafile).toBeInstanceOf(Function);
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
describe("basic functionality", function () {
|
|
@@ -15,7 +15,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
15
15
|
features: {},
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const result =
|
|
18
|
+
const result = applyContextToDatafile(datafile, {});
|
|
19
19
|
|
|
20
20
|
expect(result).toEqual(datafile);
|
|
21
21
|
});
|
|
@@ -39,7 +39,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const result =
|
|
42
|
+
const result = applyContextToDatafile(datafile, {});
|
|
43
43
|
|
|
44
44
|
expect(result.segments).toEqual({});
|
|
45
45
|
expect(result.features.feature1).toBeDefined();
|
|
@@ -57,7 +57,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
57
57
|
features: {},
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
const result =
|
|
60
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
61
61
|
|
|
62
62
|
expect(result.segments).toEqual({});
|
|
63
63
|
expect(result.features).toEqual({});
|
|
@@ -77,7 +77,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
77
77
|
features: {},
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const result =
|
|
80
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
81
81
|
|
|
82
82
|
expect(result.segments).toEqual({});
|
|
83
83
|
});
|
|
@@ -94,7 +94,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
94
94
|
features: {},
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
const result =
|
|
97
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
98
98
|
|
|
99
99
|
expect(result.segments.web).toBeDefined();
|
|
100
100
|
expect(result.segments.web.conditions).toEqual([
|
|
@@ -114,7 +114,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
114
114
|
features: {},
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
const result =
|
|
117
|
+
const result = applyContextToDatafile(datafile, {});
|
|
118
118
|
|
|
119
119
|
expect(result.segments).toEqual({});
|
|
120
120
|
});
|
|
@@ -137,7 +137,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
137
137
|
features: {},
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const result =
|
|
140
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
141
141
|
|
|
142
142
|
expect(result.segments.web).toBeUndefined();
|
|
143
143
|
expect(result.segments.mobile).toBeDefined();
|
|
@@ -161,7 +161,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
161
161
|
features: {},
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
const result =
|
|
164
|
+
const result = applyContextToDatafile(datafile, { tier: "premium", status: "active" });
|
|
165
165
|
|
|
166
166
|
expect(result.segments).toEqual({});
|
|
167
167
|
});
|
|
@@ -183,7 +183,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
183
183
|
features: {},
|
|
184
184
|
};
|
|
185
185
|
|
|
186
|
-
const result =
|
|
186
|
+
const result = applyContextToDatafile(datafile, { tier: "premium" });
|
|
187
187
|
|
|
188
188
|
expect(result.segments.premium).toBeDefined();
|
|
189
189
|
expect(result.segments.premium.conditions).toEqual({
|
|
@@ -208,7 +208,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
208
208
|
features: {},
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
const result =
|
|
211
|
+
const result = applyContextToDatafile(datafile, { browser: "chrome" });
|
|
212
212
|
|
|
213
213
|
expect(result.segments).toEqual({
|
|
214
214
|
browser: {
|
|
@@ -241,7 +241,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
241
241
|
features: {},
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
-
const result =
|
|
244
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
245
245
|
|
|
246
246
|
expect(result.segments).toEqual({});
|
|
247
247
|
});
|
|
@@ -261,7 +261,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
261
261
|
features: {},
|
|
262
262
|
};
|
|
263
263
|
|
|
264
|
-
const result =
|
|
264
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
265
265
|
|
|
266
266
|
expect(result.segments.combined).toBeDefined();
|
|
267
267
|
expect(result.segments.combined.conditions).toEqual([
|
|
@@ -294,7 +294,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
294
294
|
},
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
-
const result =
|
|
297
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
298
298
|
|
|
299
299
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
300
300
|
});
|
|
@@ -322,7 +322,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
322
322
|
},
|
|
323
323
|
};
|
|
324
324
|
|
|
325
|
-
const result =
|
|
325
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
326
326
|
|
|
327
327
|
expect(result.features.feature1.force?.[0].segments).toEqual("web");
|
|
328
328
|
});
|
|
@@ -346,7 +346,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
346
346
|
},
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
-
const result =
|
|
349
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
350
350
|
|
|
351
351
|
expect(result.features.feature1.force?.[0].conditions).toEqual("*");
|
|
352
352
|
});
|
|
@@ -370,7 +370,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
370
370
|
},
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
-
const result =
|
|
373
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
374
374
|
|
|
375
375
|
expect(result.features.feature1.force?.[0].conditions).toEqual([
|
|
376
376
|
{ attribute: "platform", operator: "equals", value: "web" },
|
|
@@ -403,7 +403,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
403
403
|
},
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
-
const result =
|
|
406
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
407
407
|
|
|
408
408
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
409
409
|
});
|
|
@@ -434,7 +434,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
434
434
|
},
|
|
435
435
|
};
|
|
436
436
|
|
|
437
|
-
const result =
|
|
437
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
438
438
|
|
|
439
439
|
expect(result.features.feature1.force?.[0].segments).toEqual(["chrome"]);
|
|
440
440
|
});
|
|
@@ -465,7 +465,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
465
465
|
},
|
|
466
466
|
};
|
|
467
467
|
|
|
468
|
-
const result =
|
|
468
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
469
469
|
|
|
470
470
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
471
471
|
});
|
|
@@ -496,7 +496,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
496
496
|
},
|
|
497
497
|
};
|
|
498
498
|
|
|
499
|
-
const result =
|
|
499
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
500
500
|
|
|
501
501
|
expect(result.features.feature1.force?.[0].segments).toEqual({ or: ["mobile"] });
|
|
502
502
|
});
|
|
@@ -525,7 +525,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
525
525
|
},
|
|
526
526
|
};
|
|
527
527
|
|
|
528
|
-
const result =
|
|
528
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
529
529
|
|
|
530
530
|
expect(result.features.feature1.force?.[0].conditions).toEqual("*");
|
|
531
531
|
});
|
|
@@ -554,7 +554,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
554
554
|
},
|
|
555
555
|
};
|
|
556
556
|
|
|
557
|
-
const result =
|
|
557
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
558
558
|
|
|
559
559
|
expect(result.features.feature1.force?.[0].conditions).toEqual({
|
|
560
560
|
or: [{ attribute: "platform", operator: "equals", value: "mobile" }],
|
|
@@ -591,7 +591,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
591
591
|
},
|
|
592
592
|
};
|
|
593
593
|
|
|
594
|
-
const result =
|
|
594
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
595
595
|
|
|
596
596
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
597
597
|
expect(result.features.feature1.force?.[1].segments).toEqual("mobile");
|
|
@@ -622,7 +622,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
622
622
|
},
|
|
623
623
|
};
|
|
624
624
|
|
|
625
|
-
const result =
|
|
625
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
626
626
|
|
|
627
627
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
628
628
|
});
|
|
@@ -650,7 +650,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
650
650
|
},
|
|
651
651
|
};
|
|
652
652
|
|
|
653
|
-
const result =
|
|
653
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
654
654
|
|
|
655
655
|
expect(result.features.feature1.traffic[0].segments).toEqual("web");
|
|
656
656
|
});
|
|
@@ -681,7 +681,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
681
681
|
},
|
|
682
682
|
};
|
|
683
683
|
|
|
684
|
-
const result =
|
|
684
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
685
685
|
|
|
686
686
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
687
687
|
});
|
|
@@ -712,7 +712,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
712
712
|
},
|
|
713
713
|
};
|
|
714
714
|
|
|
715
|
-
const result =
|
|
715
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
716
716
|
|
|
717
717
|
expect(result.features.feature1.traffic[0].segments).toEqual(["chrome"]);
|
|
718
718
|
});
|
|
@@ -743,7 +743,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
743
743
|
},
|
|
744
744
|
};
|
|
745
745
|
|
|
746
|
-
const result =
|
|
746
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
747
747
|
|
|
748
748
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
749
749
|
});
|
|
@@ -774,7 +774,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
774
774
|
},
|
|
775
775
|
};
|
|
776
776
|
|
|
777
|
-
const result =
|
|
777
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
778
778
|
|
|
779
779
|
expect(result.features.feature1.traffic[0].segments).toEqual({ or: ["mobile"] });
|
|
780
780
|
});
|
|
@@ -810,7 +810,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
810
810
|
},
|
|
811
811
|
};
|
|
812
812
|
|
|
813
|
-
const result =
|
|
813
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
814
814
|
|
|
815
815
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
816
816
|
expect(result.features.feature1.traffic[1].segments).toEqual("mobile");
|
|
@@ -844,7 +844,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
844
844
|
},
|
|
845
845
|
};
|
|
846
846
|
|
|
847
|
-
const result =
|
|
847
|
+
const result = applyContextToDatafile(datafile, {});
|
|
848
848
|
|
|
849
849
|
expect(result.features.feature1.traffic).toHaveLength(1);
|
|
850
850
|
expect(result.features.feature1.traffic[0].key).toEqual("rule1");
|
|
@@ -873,7 +873,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
873
873
|
},
|
|
874
874
|
};
|
|
875
875
|
|
|
876
|
-
const result =
|
|
876
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
877
877
|
|
|
878
878
|
expect(result.features.feature1.traffic).toHaveLength(1);
|
|
879
879
|
expect(result.features.feature1.traffic[0].key).toEqual("rule1");
|
|
@@ -916,7 +916,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
916
916
|
},
|
|
917
917
|
};
|
|
918
918
|
|
|
919
|
-
const result =
|
|
919
|
+
const result = applyContextToDatafile(datafile, {});
|
|
920
920
|
|
|
921
921
|
expect(result.features.feature1.traffic).toHaveLength(3);
|
|
922
922
|
});
|
|
@@ -949,7 +949,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
949
949
|
},
|
|
950
950
|
};
|
|
951
951
|
|
|
952
|
-
const result =
|
|
952
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
953
953
|
|
|
954
954
|
expect(result.features.feature1.traffic).toHaveLength(1);
|
|
955
955
|
expect(result.features.feature1.traffic[0].key).toEqual("rule1");
|
|
@@ -983,7 +983,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
983
983
|
},
|
|
984
984
|
};
|
|
985
985
|
|
|
986
|
-
const result =
|
|
986
|
+
const result = applyContextToDatafile(datafile, { device: "mobile" });
|
|
987
987
|
|
|
988
988
|
expect(result.features.feature1.traffic[0].variableOverrides?.config[0].segments).toEqual(
|
|
989
989
|
"*",
|
|
@@ -1016,7 +1016,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1016
1016
|
},
|
|
1017
1017
|
};
|
|
1018
1018
|
|
|
1019
|
-
const result =
|
|
1019
|
+
const result = applyContextToDatafile(datafile, { device: "desktop" });
|
|
1020
1020
|
|
|
1021
1021
|
expect(result.features.feature1.traffic[0].variableOverrides?.config[0].segments).toEqual(
|
|
1022
1022
|
"mobile",
|
|
@@ -1050,7 +1050,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1050
1050
|
},
|
|
1051
1051
|
};
|
|
1052
1052
|
|
|
1053
|
-
const result =
|
|
1053
|
+
const result = applyContextToDatafile(datafile, { country: "nl" });
|
|
1054
1054
|
|
|
1055
1055
|
expect(result.features.feature1.traffic[0].variableOverrides?.config[0].conditions).toEqual(
|
|
1056
1056
|
"*",
|
|
@@ -1084,7 +1084,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1084
1084
|
},
|
|
1085
1085
|
};
|
|
1086
1086
|
|
|
1087
|
-
const result =
|
|
1087
|
+
const result = applyContextToDatafile(datafile, { country: "de" });
|
|
1088
1088
|
|
|
1089
1089
|
expect(result.features.feature1.traffic[0].variableOverrides?.config[0].conditions).toEqual([
|
|
1090
1090
|
{ attribute: "country", operator: "equals", value: "nl" },
|
|
@@ -1134,7 +1134,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1134
1134
|
},
|
|
1135
1135
|
};
|
|
1136
1136
|
|
|
1137
|
-
const result =
|
|
1137
|
+
const result = applyContextToDatafile(datafile, {
|
|
1138
1138
|
device: "mobile",
|
|
1139
1139
|
touch: true,
|
|
1140
1140
|
country: "nl",
|
|
@@ -1189,7 +1189,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1189
1189
|
},
|
|
1190
1190
|
};
|
|
1191
1191
|
|
|
1192
|
-
const result =
|
|
1192
|
+
const result = applyContextToDatafile(datafile, {
|
|
1193
1193
|
device: "mobile",
|
|
1194
1194
|
touch: true,
|
|
1195
1195
|
country: "nl",
|
|
@@ -1240,7 +1240,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1240
1240
|
},
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
const result =
|
|
1243
|
+
const result = applyContextToDatafile(datafile, {
|
|
1244
1244
|
platform: "web",
|
|
1245
1245
|
device: "mobile",
|
|
1246
1246
|
});
|
|
@@ -1280,7 +1280,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1280
1280
|
|
|
1281
1281
|
const original = JSON.stringify(datafile);
|
|
1282
1282
|
|
|
1283
|
-
|
|
1283
|
+
applyContextToDatafile(datafile, { device: "mobile" });
|
|
1284
1284
|
|
|
1285
1285
|
expect(JSON.stringify(datafile)).toEqual(original);
|
|
1286
1286
|
});
|
|
@@ -1317,7 +1317,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1317
1317
|
},
|
|
1318
1318
|
};
|
|
1319
1319
|
|
|
1320
|
-
const result =
|
|
1320
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1321
1321
|
|
|
1322
1322
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1323
1323
|
"*",
|
|
@@ -1354,7 +1354,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1354
1354
|
},
|
|
1355
1355
|
};
|
|
1356
1356
|
|
|
1357
|
-
const result =
|
|
1357
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
1358
1358
|
|
|
1359
1359
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1360
1360
|
"web",
|
|
@@ -1387,7 +1387,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1387
1387
|
},
|
|
1388
1388
|
};
|
|
1389
1389
|
|
|
1390
|
-
const result =
|
|
1390
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1391
1391
|
|
|
1392
1392
|
expect(
|
|
1393
1393
|
result.features.feature1.variations?.[0].variableOverrides?.color[0].conditions,
|
|
@@ -1420,7 +1420,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1420
1420
|
},
|
|
1421
1421
|
};
|
|
1422
1422
|
|
|
1423
|
-
const result =
|
|
1423
|
+
const result = applyContextToDatafile(datafile, { platform: "mobile" });
|
|
1424
1424
|
|
|
1425
1425
|
expect(
|
|
1426
1426
|
result.features.feature1.variations?.[0].variableOverrides?.color[0].conditions,
|
|
@@ -1460,7 +1460,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1460
1460
|
},
|
|
1461
1461
|
};
|
|
1462
1462
|
|
|
1463
|
-
const result =
|
|
1463
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
1464
1464
|
|
|
1465
1465
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1466
1466
|
"*",
|
|
@@ -1500,7 +1500,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1500
1500
|
},
|
|
1501
1501
|
};
|
|
1502
1502
|
|
|
1503
|
-
const result =
|
|
1503
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
1504
1504
|
|
|
1505
1505
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1506
1506
|
"*",
|
|
@@ -1540,7 +1540,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1540
1540
|
},
|
|
1541
1541
|
};
|
|
1542
1542
|
|
|
1543
|
-
const result =
|
|
1543
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1544
1544
|
|
|
1545
1545
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1546
1546
|
{ or: ["mobile"] },
|
|
@@ -1578,7 +1578,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1578
1578
|
},
|
|
1579
1579
|
};
|
|
1580
1580
|
|
|
1581
|
-
const result =
|
|
1581
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
1582
1582
|
|
|
1583
1583
|
expect(
|
|
1584
1584
|
result.features.feature1.variations?.[0].variableOverrides?.color[0].conditions,
|
|
@@ -1616,7 +1616,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1616
1616
|
},
|
|
1617
1617
|
};
|
|
1618
1618
|
|
|
1619
|
-
const result =
|
|
1619
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1620
1620
|
|
|
1621
1621
|
expect(
|
|
1622
1622
|
result.features.feature1.variations?.[0].variableOverrides?.color[0].conditions,
|
|
@@ -1662,7 +1662,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1662
1662
|
},
|
|
1663
1663
|
};
|
|
1664
1664
|
|
|
1665
|
-
const result =
|
|
1665
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1666
1666
|
|
|
1667
1667
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1668
1668
|
"*",
|
|
@@ -1708,7 +1708,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1708
1708
|
},
|
|
1709
1709
|
};
|
|
1710
1710
|
|
|
1711
|
-
const result =
|
|
1711
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1712
1712
|
|
|
1713
1713
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1714
1714
|
"*",
|
|
@@ -1762,7 +1762,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1762
1762
|
},
|
|
1763
1763
|
};
|
|
1764
1764
|
|
|
1765
|
-
const result =
|
|
1765
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1766
1766
|
|
|
1767
1767
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
1768
1768
|
"*",
|
|
@@ -1819,7 +1819,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1819
1819
|
},
|
|
1820
1820
|
};
|
|
1821
1821
|
|
|
1822
|
-
const result =
|
|
1822
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
1823
1823
|
|
|
1824
1824
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
1825
1825
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
@@ -1864,13 +1864,13 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1864
1864
|
},
|
|
1865
1865
|
};
|
|
1866
1866
|
|
|
1867
|
-
const result =
|
|
1867
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1868
1868
|
|
|
1869
1869
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
1870
1870
|
expect(result.features.feature2.traffic[0].segments).toEqual("mobile");
|
|
1871
1871
|
});
|
|
1872
1872
|
|
|
1873
|
-
test("segment used in multiple places -
|
|
1873
|
+
test("segment used in multiple places - context applied everywhere", function () {
|
|
1874
1874
|
const datafile: DatafileContent = {
|
|
1875
1875
|
schemaVersion: "2",
|
|
1876
1876
|
revision: "unknown",
|
|
@@ -1912,7 +1912,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1912
1912
|
},
|
|
1913
1913
|
};
|
|
1914
1914
|
|
|
1915
|
-
const result =
|
|
1915
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
1916
1916
|
|
|
1917
1917
|
expect(result.segments).toEqual({});
|
|
1918
1918
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
@@ -1961,7 +1961,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
1961
1961
|
},
|
|
1962
1962
|
};
|
|
1963
1963
|
|
|
1964
|
-
const result =
|
|
1964
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
1965
1965
|
|
|
1966
1966
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
1967
1967
|
expect(result.features.feature1.force?.[0].segments).toEqual({ or: ["mobile"] });
|
|
@@ -2009,7 +2009,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2009
2009
|
},
|
|
2010
2010
|
};
|
|
2011
2011
|
|
|
2012
|
-
const result =
|
|
2012
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
2013
2013
|
|
|
2014
2014
|
expect(result.features.feature1.force?.[0].conditions).toEqual("*");
|
|
2015
2015
|
expect(
|
|
@@ -2034,7 +2034,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2034
2034
|
},
|
|
2035
2035
|
};
|
|
2036
2036
|
|
|
2037
|
-
const result =
|
|
2037
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2038
2038
|
|
|
2039
2039
|
expect(result.features.feature1).toBeDefined();
|
|
2040
2040
|
expect(result.features.feature1.traffic).toEqual([]);
|
|
@@ -2054,7 +2054,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2054
2054
|
},
|
|
2055
2055
|
};
|
|
2056
2056
|
|
|
2057
|
-
const result =
|
|
2057
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2058
2058
|
|
|
2059
2059
|
expect(result.features.feature1.force).toEqual([]);
|
|
2060
2060
|
});
|
|
@@ -2073,7 +2073,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2073
2073
|
},
|
|
2074
2074
|
};
|
|
2075
2075
|
|
|
2076
|
-
const result =
|
|
2076
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2077
2077
|
|
|
2078
2078
|
expect(result.features.feature1.variations).toEqual([]);
|
|
2079
2079
|
});
|
|
@@ -2096,7 +2096,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2096
2096
|
},
|
|
2097
2097
|
};
|
|
2098
2098
|
|
|
2099
|
-
const result =
|
|
2099
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2100
2100
|
|
|
2101
2101
|
expect(result.features.feature1.variations?.[0].variableOverrides).toBeUndefined();
|
|
2102
2102
|
});
|
|
@@ -2120,7 +2120,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2120
2120
|
},
|
|
2121
2121
|
};
|
|
2122
2122
|
|
|
2123
|
-
const result =
|
|
2123
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2124
2124
|
|
|
2125
2125
|
expect(result.features.feature1.variations?.[0].variableOverrides).toEqual({});
|
|
2126
2126
|
});
|
|
@@ -2151,7 +2151,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2151
2151
|
},
|
|
2152
2152
|
};
|
|
2153
2153
|
|
|
2154
|
-
const result =
|
|
2154
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2155
2155
|
|
|
2156
2156
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
2157
2157
|
"*",
|
|
@@ -2182,7 +2182,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2182
2182
|
},
|
|
2183
2183
|
};
|
|
2184
2184
|
|
|
2185
|
-
const result =
|
|
2185
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
2186
2186
|
|
|
2187
2187
|
expect(result.features.feature1.force?.[0].segments).toEqual("*");
|
|
2188
2188
|
expect(result.features.feature1.force?.[0].conditions).toBeDefined();
|
|
@@ -2212,7 +2212,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2212
2212
|
},
|
|
2213
2213
|
};
|
|
2214
2214
|
|
|
2215
|
-
const result =
|
|
2215
|
+
const result = applyContextToDatafile(datafile, {});
|
|
2216
2216
|
|
|
2217
2217
|
expect(result.features.feature1.traffic).toHaveLength(1);
|
|
2218
2218
|
});
|
|
@@ -2240,7 +2240,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2240
2240
|
},
|
|
2241
2241
|
};
|
|
2242
2242
|
|
|
2243
|
-
const result =
|
|
2243
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
2244
2244
|
|
|
2245
2245
|
expect(result.segments).toEqual({});
|
|
2246
2246
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
@@ -2258,7 +2258,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2258
2258
|
features: {},
|
|
2259
2259
|
};
|
|
2260
2260
|
|
|
2261
|
-
const result =
|
|
2261
|
+
const result = applyContextToDatafile(datafile, {
|
|
2262
2262
|
platform: "web",
|
|
2263
2263
|
extraAttribute: "extraValue",
|
|
2264
2264
|
});
|
|
@@ -2281,7 +2281,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2281
2281
|
features: {},
|
|
2282
2282
|
};
|
|
2283
2283
|
|
|
2284
|
-
const result =
|
|
2284
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
2285
2285
|
|
|
2286
2286
|
expect(result.segments).toEqual({});
|
|
2287
2287
|
});
|
|
@@ -2301,7 +2301,10 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2301
2301
|
features: {},
|
|
2302
2302
|
};
|
|
2303
2303
|
|
|
2304
|
-
const result =
|
|
2304
|
+
const result = applyContextToDatafile(datafile, {
|
|
2305
|
+
platform: "mobile",
|
|
2306
|
+
browser: "safari",
|
|
2307
|
+
});
|
|
2305
2308
|
|
|
2306
2309
|
expect(result.segments.web).toBeDefined();
|
|
2307
2310
|
expect(result.segments.chrome).toBeDefined();
|
|
@@ -2345,7 +2348,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2345
2348
|
},
|
|
2346
2349
|
};
|
|
2347
2350
|
|
|
2348
|
-
const result =
|
|
2351
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
2349
2352
|
|
|
2350
2353
|
expect(result.features.feature1.traffic).toHaveLength(1);
|
|
2351
2354
|
expect(result.features.feature1.traffic[0].key).toEqual("rule1");
|
|
@@ -2381,7 +2384,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2381
2384
|
},
|
|
2382
2385
|
};
|
|
2383
2386
|
|
|
2384
|
-
const result =
|
|
2387
|
+
const result = applyContextToDatafile(datafile, { platform: "web" });
|
|
2385
2388
|
|
|
2386
2389
|
expect(result.segments).toEqual({});
|
|
2387
2390
|
expect(result.features.feature1.variations?.[0].variableOverrides?.color[0].segments).toEqual(
|
|
@@ -2449,7 +2452,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2449
2452
|
},
|
|
2450
2453
|
};
|
|
2451
2454
|
|
|
2452
|
-
const result =
|
|
2455
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
2453
2456
|
|
|
2454
2457
|
expect(result.segments.web).toBeUndefined();
|
|
2455
2458
|
expect(result.segments.chrome).toBeUndefined();
|
|
@@ -2513,7 +2516,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2513
2516
|
},
|
|
2514
2517
|
};
|
|
2515
2518
|
|
|
2516
|
-
const result =
|
|
2519
|
+
const result = applyContextToDatafile(datafile, { platform: "web", browser: "chrome" });
|
|
2517
2520
|
|
|
2518
2521
|
expect(result.features.feature1.traffic[0].segments).toEqual("*");
|
|
2519
2522
|
expect(result.features.feature1.force?.[0].conditions).toEqual({
|
|
@@ -2531,6 +2534,63 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2531
2534
|
});
|
|
2532
2535
|
});
|
|
2533
2536
|
|
|
2537
|
+
test("datafile specialization preserves NOT rules as non-broadening expressions", function () {
|
|
2538
|
+
const datafile: DatafileContent = {
|
|
2539
|
+
schemaVersion: "2",
|
|
2540
|
+
revision: "unknown",
|
|
2541
|
+
segments: {
|
|
2542
|
+
web: {
|
|
2543
|
+
conditions: [{ attribute: "platform", operator: "equals", value: "web" }],
|
|
2544
|
+
},
|
|
2545
|
+
chrome: {
|
|
2546
|
+
conditions: [{ attribute: "browser", operator: "equals", value: "chrome" }],
|
|
2547
|
+
},
|
|
2548
|
+
},
|
|
2549
|
+
features: {
|
|
2550
|
+
feature1: {
|
|
2551
|
+
bucketBy: ["userId"],
|
|
2552
|
+
traffic: [
|
|
2553
|
+
{
|
|
2554
|
+
key: "not-web",
|
|
2555
|
+
segments: {
|
|
2556
|
+
not: ["web"],
|
|
2557
|
+
},
|
|
2558
|
+
percentage: 100000,
|
|
2559
|
+
},
|
|
2560
|
+
{
|
|
2561
|
+
key: "not-web-and-chrome",
|
|
2562
|
+
segments: {
|
|
2563
|
+
not: ["web", "chrome"],
|
|
2564
|
+
},
|
|
2565
|
+
percentage: 100000,
|
|
2566
|
+
},
|
|
2567
|
+
],
|
|
2568
|
+
},
|
|
2569
|
+
},
|
|
2570
|
+
};
|
|
2571
|
+
|
|
2572
|
+
const webResult = applyContextToDatafile(datafile, { platform: "web" });
|
|
2573
|
+
|
|
2574
|
+
expect(webResult.features.feature1.traffic[0].segments).toEqual({
|
|
2575
|
+
not: ["*"],
|
|
2576
|
+
});
|
|
2577
|
+
expect(webResult.features.feature1.traffic[1].segments).toEqual({
|
|
2578
|
+
not: ["chrome"],
|
|
2579
|
+
});
|
|
2580
|
+
|
|
2581
|
+
const webChromeResult = applyContextToDatafile(datafile, {
|
|
2582
|
+
platform: "web",
|
|
2583
|
+
browser: "chrome",
|
|
2584
|
+
});
|
|
2585
|
+
|
|
2586
|
+
expect(webChromeResult.features.feature1.traffic[0].segments).toEqual({
|
|
2587
|
+
not: ["*"],
|
|
2588
|
+
});
|
|
2589
|
+
expect(webChromeResult.features.feature1.traffic[1].segments).toEqual({
|
|
2590
|
+
not: ["*"],
|
|
2591
|
+
});
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2534
2594
|
test("datafile immutability - original not modified", function () {
|
|
2535
2595
|
const datafile: DatafileContent = {
|
|
2536
2596
|
schemaVersion: "2",
|
|
@@ -2557,7 +2617,7 @@ describe("core: buildScopedDatafile", function () {
|
|
|
2557
2617
|
const originalSegments = JSON.stringify(datafile.segments);
|
|
2558
2618
|
const originalTraffic = JSON.stringify(datafile.features.feature1.traffic);
|
|
2559
2619
|
|
|
2560
|
-
|
|
2620
|
+
applyContextToDatafile(datafile, { platform: "web" });
|
|
2561
2621
|
|
|
2562
2622
|
expect(JSON.stringify(datafile.segments)).toEqual(originalSegments);
|
|
2563
2623
|
expect(JSON.stringify(datafile.features.feature1.traffic)).toEqual(originalTraffic);
|