@featurevisor/core 0.53.2 → 0.53.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintcache +1 -1
- package/CHANGELOG.md +16 -0
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/lib/builder/allocator.js.html +1 -1
- package/coverage/lcov-report/lib/builder/index.html +1 -1
- package/coverage/lcov-report/lib/builder/traffic.js.html +1 -1
- package/coverage/lcov-report/src/builder/allocator.ts.html +1 -1
- package/coverage/lcov-report/src/builder/index.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +1 -1
- package/lib/builder/buildDatafile.d.ts +1 -1
- package/lib/builder/buildDatafile.js +241 -168
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +1 -2
- package/lib/builder/buildProject.js +95 -45
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/getFeatureRanges.d.ts +1 -1
- package/lib/builder/getFeatureRanges.js +92 -31
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/datasource/datasource.d.ts +23 -17
- package/lib/datasource/datasource.js +166 -69
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/parsers.js +2 -2
- package/lib/datasource/parsers.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.d.ts +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +75 -18
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.d.ts +1 -1
- package/lib/find-duplicate-segments/index.js +56 -9
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/generate-code/index.d.ts +1 -1
- package/lib/generate-code/index.js +67 -23
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.d.ts +1 -1
- package/lib/generate-code/typescript.js +139 -72
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/linter/checkCircularDependency.d.ts +1 -1
- package/lib/linter/checkCircularDependency.js +78 -22
- package/lib/linter/checkCircularDependency.js.map +1 -1
- package/lib/linter/groupSchema.js +79 -28
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.js +119 -103
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/restore.d.ts +1 -1
- package/lib/restore.js +53 -11
- package/lib/restore.js.map +1 -1
- package/lib/site/exportSite.d.ts +1 -1
- package/lib/site/exportSite.js +64 -21
- package/lib/site/exportSite.js.map +1 -1
- package/lib/site/generateSiteSearchIndex.d.ts +1 -1
- package/lib/site/generateSiteSearchIndex.js +203 -111
- package/lib/site/generateSiteSearchIndex.js.map +1 -1
- package/lib/tester/testFeature.d.ts +1 -1
- package/lib/tester/testFeature.js +130 -60
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +1 -1
- package/lib/tester/testProject.js +105 -48
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +1 -1
- package/lib/tester/testSegment.js +69 -21
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils.d.ts +0 -2
- package/lib/utils.js +1 -15
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/builder/buildDatafile.ts +9 -9
- package/src/builder/buildProject.ts +4 -24
- package/src/builder/getFeatureRanges.ts +4 -4
- package/src/datasource/datasource.ts +66 -60
- package/src/datasource/parsers.ts +2 -2
- package/src/find-duplicate-segments/findDuplicateSegments.ts +9 -6
- package/src/find-duplicate-segments/index.ts +5 -2
- package/src/generate-code/index.ts +2 -2
- package/src/generate-code/typescript.ts +42 -25
- package/src/linter/checkCircularDependency.ts +4 -4
- package/src/linter/groupSchema.ts +3 -3
- package/src/linter/lintProject.ts +53 -60
- package/src/restore.ts +1 -1
- package/src/site/exportSite.ts +2 -2
- package/src/site/generateSiteSearchIndex.ts +14 -14
- package/src/tester/testFeature.ts +12 -13
- package/src/tester/testProject.ts +8 -5
- package/src/tester/testSegment.ts +3 -3
- package/src/utils.ts +0 -18
|
@@ -1,6 +1,42 @@
|
|
|
1
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
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildProject = exports.
|
|
39
|
+
exports.buildProject = exports.getDatafilePath = void 0;
|
|
4
40
|
var fs = require("fs");
|
|
5
41
|
var path = require("path");
|
|
6
42
|
var mkdirp = require("mkdirp");
|
|
@@ -12,52 +48,66 @@ function getDatafilePath(projectConfig, environment, tag) {
|
|
|
12
48
|
return path.join(projectConfig.outputDirectoryPath, environment, fileName);
|
|
13
49
|
}
|
|
14
50
|
exports.getDatafilePath = getDatafilePath;
|
|
15
|
-
function getExistingStateFilePath(projectConfig, environment) {
|
|
16
|
-
return path.join(projectConfig.stateDirectoryPath, "existing-state-".concat(environment, ".json"));
|
|
17
|
-
}
|
|
18
|
-
exports.getExistingStateFilePath = getExistingStateFilePath;
|
|
19
51
|
function buildProject(rootDirectoryPath, projectConfig, cliOptions) {
|
|
20
52
|
if (cliOptions === void 0) { cliOptions = {}; }
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var tags, environments, pkg, datasource, _i, environments_1, environment, existingState, _a, tags_1, tag, datafileContent, outputEnvironmentDirPath, outputFilePath, shortPath;
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
tags = projectConfig.tags;
|
|
59
|
+
environments = projectConfig.environments;
|
|
60
|
+
pkg = require(path.join(rootDirectoryPath, "package.json"));
|
|
61
|
+
datasource = new datasource_1.Datasource(projectConfig);
|
|
62
|
+
_i = 0, environments_1 = environments;
|
|
63
|
+
_b.label = 1;
|
|
64
|
+
case 1:
|
|
65
|
+
if (!(_i < environments_1.length)) return [3 /*break*/, 9];
|
|
66
|
+
environment = environments_1[_i];
|
|
67
|
+
console.log("\nBuilding datafiles for environment: ".concat(environment));
|
|
68
|
+
return [4 /*yield*/, datasource.readState(environment)];
|
|
69
|
+
case 2:
|
|
70
|
+
existingState = _b.sent();
|
|
71
|
+
_a = 0, tags_1 = tags;
|
|
72
|
+
_b.label = 3;
|
|
73
|
+
case 3:
|
|
74
|
+
if (!(_a < tags_1.length)) return [3 /*break*/, 6];
|
|
75
|
+
tag = tags_1[_a];
|
|
76
|
+
console.log("\n => Tag: ".concat(tag));
|
|
77
|
+
return [4 /*yield*/, (0, buildDatafile_1.buildDatafile)(projectConfig, datasource, {
|
|
78
|
+
schemaVersion: config_1.SCHEMA_VERSION,
|
|
79
|
+
revision: cliOptions.revision || pkg.version,
|
|
80
|
+
environment: environment,
|
|
81
|
+
tag: tag,
|
|
82
|
+
}, existingState)];
|
|
83
|
+
case 4:
|
|
84
|
+
datafileContent = _b.sent();
|
|
85
|
+
outputEnvironmentDirPath = path.join(projectConfig.outputDirectoryPath, environment);
|
|
86
|
+
mkdirp.sync(outputEnvironmentDirPath);
|
|
87
|
+
outputFilePath = getDatafilePath(projectConfig, environment, tag);
|
|
88
|
+
fs.writeFileSync(outputFilePath, projectConfig.prettyDatafile
|
|
89
|
+
? JSON.stringify(datafileContent, null, 2)
|
|
90
|
+
: JSON.stringify(datafileContent));
|
|
91
|
+
shortPath = outputFilePath.replace(rootDirectoryPath + path.sep, "");
|
|
92
|
+
console.log(" Datafile generated: ".concat(shortPath));
|
|
93
|
+
_b.label = 5;
|
|
94
|
+
case 5:
|
|
95
|
+
_a++;
|
|
96
|
+
return [3 /*break*/, 3];
|
|
97
|
+
case 6:
|
|
98
|
+
// write state for environment
|
|
99
|
+
return [4 /*yield*/, datasource.writeState(environment, existingState)];
|
|
100
|
+
case 7:
|
|
101
|
+
// write state for environment
|
|
102
|
+
_b.sent();
|
|
103
|
+
_b.label = 8;
|
|
104
|
+
case 8:
|
|
105
|
+
_i++;
|
|
106
|
+
return [3 /*break*/, 1];
|
|
107
|
+
case 9: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
61
111
|
}
|
|
62
112
|
exports.buildProject = buildProject;
|
|
63
113
|
//# sourceMappingURL=buildProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildProject.js","sourceRoot":"","sources":["../../src/builder/buildProject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildProject.js","sourceRoot":"","sources":["../../src/builder/buildProject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AACzB,2BAA6B;AAE7B,+BAAiC;AAIjC,oCAA0D;AAC1D,4CAA2C;AAE3C,iDAAgD;AAEhD,SAAgB,eAAe,CAC7B,aAA4B,EAC5B,WAA2B,EAC3B,GAAW;IAEX,IAAM,QAAQ,GAAG,uBAAgB,GAAG,UAAO,CAAC;IAE5C,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;AAC7E,CAAC;AARD,0CAQC;AAMD,SAAsB,YAAY,CAChC,iBAAiB,EACjB,aAA4B,EAC5B,UAAgC;IAAhC,2BAAA,EAAA,eAAgC;;;;;;oBAE1B,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;oBAC1B,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC;oBAE1C,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;oBAC5D,UAAU,GAAG,IAAI,uBAAU,CAAC,aAAa,CAAC,CAAC;0BAEX,EAAZ,6BAAY;;;yBAAZ,CAAA,0BAAY,CAAA;oBAA3B,WAAW;oBACpB,OAAO,CAAC,GAAG,CAAC,gDAAyC,WAAW,CAAE,CAAC,CAAC;oBAE/B,qBAAM,UAAU,CAAC,SAAS,CAAC,WAAW,CAAC,EAAA;;oBAAtE,aAAa,GAAkB,SAAuC;0BAEtD,EAAJ,aAAI;;;yBAAJ,CAAA,kBAAI,CAAA;oBAAX,GAAG;oBACZ,OAAO,CAAC,GAAG,CAAC,sBAAe,GAAG,CAAE,CAAC,CAAC;oBACV,qBAAM,IAAA,6BAAa,EACzC,aAAa,EACb,UAAU,EACV;4BACE,aAAa,EAAE,uBAAc;4BAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,GAAG,CAAC,OAAO;4BAC5C,WAAW,EAAE,WAAW;4BACxB,GAAG,EAAE,GAAG;yBACT,EACD,aAAa,CACd,EAAA;;oBAVK,eAAe,GAAG,SAUvB;oBAGK,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;oBAC3F,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;oBAEhC,cAAc,GAAG,eAAe,CAAC,aAAa,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;oBACxE,EAAE,CAAC,aAAa,CACd,cAAc,EACd,aAAa,CAAC,cAAc;wBAC1B,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;wBAC1C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CACpC,CAAC;oBACI,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC3E,OAAO,CAAC,GAAG,CAAC,mCAA4B,SAAS,CAAE,CAAC,CAAC;;;oBA1BrC,IAAI,CAAA;;;gBA6BtB,8BAA8B;gBAC9B,qBAAM,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,EAAA;;oBADvD,8BAA8B;oBAC9B,SAAuD,CAAC;;;oBAnChC,IAAY,CAAA;;;;;;CAqCvC;AAhDD,oCAgDC"}
|
|
@@ -8,4 +8,4 @@ export interface FeatureRangesResult {
|
|
|
8
8
|
[key: string]: boolean;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
export declare function getFeatureRanges(projectConfig: ProjectConfig, datasource: Datasource): FeatureRangesResult
|
|
11
|
+
export declare function getFeatureRanges(projectConfig: ProjectConfig, datasource: Datasource): Promise<FeatureRangesResult>;
|
|
@@ -10,41 +10,102 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
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
|
+
};
|
|
13
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
50
|
exports.getFeatureRanges = void 0;
|
|
15
51
|
var fs = require("fs");
|
|
16
52
|
function getFeatureRanges(projectConfig, datasource) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
+
var featureRanges, featureIsInGroup, groups, groupFiles, _loop_1, _i, groupFiles_1, groupKey;
|
|
55
|
+
return __generator(this, function (_a) {
|
|
56
|
+
switch (_a.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
featureRanges = new Map();
|
|
59
|
+
featureIsInGroup = {};
|
|
60
|
+
groups = [];
|
|
61
|
+
if (!fs.existsSync(projectConfig.groupsDirectoryPath)) return [3 /*break*/, 5];
|
|
62
|
+
return [4 /*yield*/, datasource.listGroups()];
|
|
63
|
+
case 1:
|
|
64
|
+
groupFiles = _a.sent();
|
|
65
|
+
_loop_1 = function (groupKey) {
|
|
66
|
+
var parsedGroup, accumulatedPercentage;
|
|
67
|
+
return __generator(this, function (_b) {
|
|
68
|
+
switch (_b.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, datasource.readGroup(groupKey)];
|
|
70
|
+
case 1:
|
|
71
|
+
parsedGroup = _b.sent();
|
|
72
|
+
groups.push(__assign(__assign({}, parsedGroup), { key: groupKey }));
|
|
73
|
+
accumulatedPercentage = 0;
|
|
74
|
+
parsedGroup.slots.forEach(function (slot, slotIndex) {
|
|
75
|
+
var isFirstSlot = slotIndex === 0;
|
|
76
|
+
if (slot.feature) {
|
|
77
|
+
var featureKey = slot.feature;
|
|
78
|
+
if (typeof featureKey === "string") {
|
|
79
|
+
featureIsInGroup[featureKey] = true;
|
|
80
|
+
}
|
|
81
|
+
var featureRangesForFeature = featureRanges.get(featureKey) || [];
|
|
82
|
+
var start = isFirstSlot ? accumulatedPercentage : accumulatedPercentage + 1;
|
|
83
|
+
var end = accumulatedPercentage + slot.percentage * 1000;
|
|
84
|
+
featureRangesForFeature.push([start, end]);
|
|
85
|
+
featureRanges.set(slot.feature, featureRangesForFeature);
|
|
86
|
+
}
|
|
87
|
+
accumulatedPercentage += slot.percentage * 1000;
|
|
88
|
+
});
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
_i = 0, groupFiles_1 = groupFiles;
|
|
94
|
+
_a.label = 2;
|
|
95
|
+
case 2:
|
|
96
|
+
if (!(_i < groupFiles_1.length)) return [3 /*break*/, 5];
|
|
97
|
+
groupKey = groupFiles_1[_i];
|
|
98
|
+
return [5 /*yield**/, _loop_1(groupKey)];
|
|
99
|
+
case 3:
|
|
100
|
+
_a.sent();
|
|
101
|
+
_a.label = 4;
|
|
102
|
+
case 4:
|
|
103
|
+
_i++;
|
|
104
|
+
return [3 /*break*/, 2];
|
|
105
|
+
case 5: return [2 /*return*/, { featureRanges: featureRanges, featureIsInGroup: featureIsInGroup }];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
48
109
|
}
|
|
49
110
|
exports.getFeatureRanges = getFeatureRanges;
|
|
50
111
|
//# sourceMappingURL=getFeatureRanges.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFeatureRanges.js","sourceRoot":"","sources":["../../src/builder/getFeatureRanges.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getFeatureRanges.js","sourceRoot":"","sources":["../../src/builder/getFeatureRanges.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AAczB,SAAsB,gBAAgB,CACpC,aAA4B,EAC5B,UAAsB;;;;;;oBAEhB,aAAa,GAAG,IAAI,GAAG,EAAuB,CAAC;oBAC/C,gBAAgB,GAAG,EAAE,CAAC;oBAEtB,MAAM,GAAY,EAAE,CAAC;yBACvB,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,mBAAmB,CAAC,EAAhD,wBAAgD;oBAC/B,qBAAM,UAAU,CAAC,UAAU,EAAE,EAAA;;oBAA1C,UAAU,GAAG,SAA6B;wCAErC,QAAQ;;;;wCACG,qBAAM,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAA;;oCAAlD,WAAW,GAAG,SAAoC;oCAExD,MAAM,CAAC,IAAI,uBACN,WAAW,KACd,GAAG,EAAE,QAAQ,IACb,CAAC;oCAEC,qBAAqB,GAAG,CAAC,CAAC;oCAC9B,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,SAAS;wCACjD,IAAM,WAAW,GAAG,SAAS,KAAK,CAAC,CAAC;wCAEpC,IAAI,IAAI,CAAC,OAAO,EAAE;4CAChB,IAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC;4CAEhC,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;gDAClC,gBAAgB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;6CACrC;4CAED,IAAM,uBAAuB,GAAG,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;4CAEpE,IAAM,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,GAAG,CAAC,CAAC;4CAC9E,IAAM,GAAG,GAAG,qBAAqB,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;4CAE3D,uBAAuB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;4CAE3C,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;yCAC1D;wCAED,qBAAqB,IAAI,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;oCAClD,CAAC,CAAC,CAAC;;;;;0BA9B4B,EAAV,yBAAU;;;yBAAV,CAAA,wBAAU,CAAA;oBAAtB,QAAQ;kDAAR,QAAQ;;;;;oBAAI,IAAU,CAAA;;wBAkCnC,sBAAO,EAAE,aAAa,eAAA,EAAE,gBAAgB,kBAAA,EAAE,EAAC;;;;CAC5C;AA9CD,4CA8CC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ParsedFeature, Segment, Attribute, Group, FeatureKey, Test, EnvironmentKey, ExistingState } from "@featurevisor/types";
|
|
2
2
|
import { ProjectConfig } from "../config";
|
|
3
3
|
export type EntityType = "feature" | "group" | "segment" | "attribute" | "test";
|
|
4
|
+
export declare function getExistingStateFilePath(projectConfig: ProjectConfig, environment: EnvironmentKey): string;
|
|
4
5
|
export declare class Datasource {
|
|
5
6
|
private config;
|
|
6
7
|
private extension;
|
|
@@ -8,26 +9,31 @@ export declare class Datasource {
|
|
|
8
9
|
constructor(config: ProjectConfig);
|
|
9
10
|
getExtension(): any;
|
|
10
11
|
/**
|
|
11
|
-
* Common methods
|
|
12
|
+
* Common methods for entities
|
|
12
13
|
*/
|
|
13
|
-
listEntities(entityType: EntityType): string[]
|
|
14
|
+
listEntities(entityType: EntityType): Promise<string[]>;
|
|
14
15
|
getEntityDirectoryPath(entityType: EntityType): string;
|
|
15
16
|
getEntityPath(entityType: EntityType, entityKey: string): string;
|
|
16
|
-
entityExists(entityType: EntityType, entityKey: string): boolean
|
|
17
|
-
readEntity(entityType: EntityType, entityKey: string): string
|
|
18
|
-
parseEntity<T>(entityType: EntityType, entityKey: string): T
|
|
17
|
+
entityExists(entityType: EntityType, entityKey: string): Promise<boolean>;
|
|
18
|
+
readEntity(entityType: EntityType, entityKey: string): Promise<string>;
|
|
19
|
+
parseEntity<T>(entityType: EntityType, entityKey: string): Promise<T>;
|
|
20
|
+
/**
|
|
21
|
+
* State
|
|
22
|
+
*/
|
|
23
|
+
readState(environment: EnvironmentKey): Promise<ExistingState>;
|
|
24
|
+
writeState(environment: EnvironmentKey, existingState: ExistingState): Promise<void>;
|
|
19
25
|
/**
|
|
20
26
|
* Entity specific methods
|
|
21
27
|
*/
|
|
22
|
-
listFeatures(
|
|
23
|
-
readFeature(featureKey: string): ParsedFeature
|
|
24
|
-
getRequiredFeaturesChain(featureKey: FeatureKey, chain?: Set<string>): Set<FeatureKey
|
|
25
|
-
listSegments(
|
|
26
|
-
readSegment(segmentKey: string): Segment
|
|
27
|
-
listAttributes(
|
|
28
|
-
readAttribute(attributeKey: string): Attribute
|
|
29
|
-
listGroups(
|
|
30
|
-
readGroup(groupKey: string): Group
|
|
31
|
-
listTests(): string[]
|
|
32
|
-
readTest(testKey: string): Test
|
|
28
|
+
listFeatures(): Promise<string[]>;
|
|
29
|
+
readFeature(featureKey: string): Promise<ParsedFeature>;
|
|
30
|
+
getRequiredFeaturesChain(featureKey: FeatureKey, chain?: Set<string>): Promise<Set<FeatureKey>>;
|
|
31
|
+
listSegments(): Promise<string[]>;
|
|
32
|
+
readSegment(segmentKey: string): Promise<Segment>;
|
|
33
|
+
listAttributes(): Promise<string[]>;
|
|
34
|
+
readAttribute(attributeKey: string): Promise<Attribute>;
|
|
35
|
+
listGroups(): Promise<string[]>;
|
|
36
|
+
readGroup(groupKey: string): Promise<Group>;
|
|
37
|
+
listTests(): Promise<string[]>;
|
|
38
|
+
readTest(testKey: string): Promise<Test>;
|
|
33
39
|
}
|