@featurevisor/core 1.35.2 → 2.0.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.
- package/CHANGELOG.md +8 -0
- package/README.md +0 -6
- package/coverage/clover.xml +321 -237
- package/coverage/coverage-final.json +8 -8
- package/coverage/lcov-report/index.html +77 -47
- package/coverage/lcov-report/lib/builder/allocator.js.html +14 -14
- package/coverage/lcov-report/lib/builder/index.html +16 -16
- package/coverage/lcov-report/lib/builder/revision.js.html +3 -3
- package/coverage/lcov-report/lib/builder/traffic.js.html +90 -63
- package/coverage/lcov-report/lib/list/index.html +116 -0
- package/coverage/lcov-report/lib/{tester → list}/matrix.js.html +90 -66
- package/coverage/lcov-report/lib/tester/helpers.js.html +295 -0
- package/coverage/lcov-report/lib/tester/index.html +20 -35
- package/coverage/lcov-report/src/builder/allocator.ts.html +2 -2
- package/coverage/lcov-report/src/builder/index.html +15 -15
- package/coverage/lcov-report/src/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/src/builder/traffic.ts.html +101 -23
- package/coverage/lcov-report/src/list/index.html +116 -0
- package/coverage/lcov-report/src/{tester → list}/matrix.ts.html +87 -21
- package/coverage/lcov-report/src/tester/helpers.ts.html +313 -0
- package/coverage/lcov-report/src/tester/index.html +20 -35
- package/coverage/lcov.info +592 -436
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +102 -162
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.js +87 -143
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/allocator.d.ts +1 -1
- package/lib/builder/allocator.js +12 -12
- package/lib/builder/allocator.js.map +1 -1
- package/lib/builder/allocator.spec.js +22 -22
- package/lib/builder/allocator.spec.js.map +1 -1
- package/lib/builder/buildDatafile.d.ts +4 -3
- package/lib/builder/buildDatafile.js +311 -388
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +2 -1
- package/lib/builder/buildProject.js +96 -183
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/convertToV1.d.ts +10 -0
- package/lib/builder/convertToV1.js +119 -0
- package/lib/builder/convertToV1.js.map +1 -0
- package/lib/builder/getFeatureRanges.d.ts +1 -1
- package/lib/builder/getFeatureRanges.js +32 -105
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.d.ts +4 -0
- package/lib/builder/hashes.js +70 -0
- package/lib/builder/hashes.js.map +1 -0
- package/lib/builder/revision.js +2 -2
- package/lib/builder/revision.js.map +1 -1
- package/lib/builder/revision.spec.js +1 -1
- package/lib/builder/revision.spec.js.map +1 -1
- package/lib/builder/traffic.d.ts +1 -1
- package/lib/builder/traffic.js +57 -48
- package/lib/builder/traffic.js.map +1 -1
- package/lib/builder/traffic.spec.js +14 -14
- package/lib/builder/traffic.spec.js.map +1 -1
- package/lib/cli/cli.js +60 -129
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +14 -16
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/parsers.js +1 -1
- package/lib/config/parsers.js.map +1 -1
- package/lib/config/projectConfig.d.ts +8 -6
- package/lib/config/projectConfig.js +31 -72
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +1 -1
- package/lib/datasource/adapter.js +2 -5
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +2 -1
- package/lib/datasource/datasource.js +107 -148
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +1 -1
- package/lib/datasource/filesystemAdapter.js +224 -360
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -1
- package/lib/evaluate/index.js +120 -188
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.d.ts +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +40 -128
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +27 -82
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.d.ts +7 -5
- package/lib/find-usage/index.js +333 -507
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.js +36 -91
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.js +117 -157
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +45 -133
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +1 -1
- package/lib/init/index.js +16 -64
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +21 -6
- package/lib/linter/attributeSchema.js +18 -4
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/checkCircularDependency.d.ts +1 -1
- package/lib/linter/checkCircularDependency.js +22 -80
- package/lib/linter/checkCircularDependency.js.map +1 -1
- package/lib/linter/checkPercentageExceedingSlot.d.ts +1 -1
- package/lib/linter/checkPercentageExceedingSlot.js +36 -76
- package/lib/linter/checkPercentageExceedingSlot.js.map +1 -1
- package/lib/linter/conditionSchema.d.ts +1 -1
- package/lib/linter/conditionSchema.js +89 -41
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +345 -197
- package/lib/linter/featureSchema.js +313 -172
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.js +6 -6
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.js +306 -480
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/printError.js +7 -7
- package/lib/linter/printError.js.map +1 -1
- package/lib/linter/segmentSchema.js +2 -2
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/testSchema.d.ts +155 -3
- package/lib/linter/testSchema.js +47 -17
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +349 -517
- package/lib/list/index.js.map +1 -1
- package/lib/{tester → list}/matrix.d.ts +1 -1
- package/lib/{tester → list}/matrix.js +50 -42
- package/lib/list/matrix.js.map +1 -0
- package/lib/{tester → list}/matrix.spec.js +7 -7
- package/lib/list/matrix.spec.js.map +1 -0
- package/lib/site/exportSite.js +25 -71
- package/lib/site/exportSite.js.map +1 -1
- package/lib/site/generateHistory.d.ts +1 -1
- package/lib/site/generateHistory.js +26 -82
- package/lib/site/generateHistory.js.map +1 -1
- package/lib/site/generateSiteSearchIndex.d.ts +1 -1
- package/lib/site/generateSiteSearchIndex.js +182 -259
- package/lib/site/generateSiteSearchIndex.js.map +1 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +1 -1
- package/lib/site/getLastModifiedFromHistory.js +2 -2
- package/lib/site/getLastModifiedFromHistory.js.map +1 -1
- package/lib/site/getOwnerAndRepoFromUrl.js +6 -6
- package/lib/site/getOwnerAndRepoFromUrl.js.map +1 -1
- package/lib/site/getRelativePaths.js +7 -7
- package/lib/site/getRelativePaths.js.map +1 -1
- package/lib/site/getRepoDetails.js +20 -20
- package/lib/site/getRepoDetails.js.map +1 -1
- package/lib/site/index.js +25 -73
- package/lib/site/index.js.map +1 -1
- package/lib/site/serveSite.js +10 -10
- package/lib/site/serveSite.js.map +1 -1
- package/lib/tester/helpers.d.ts +2 -0
- package/lib/tester/helpers.js +71 -0
- package/lib/tester/helpers.js.map +1 -0
- package/lib/tester/helpers.spec.js +115 -0
- package/lib/tester/helpers.spec.js.map +1 -0
- package/lib/tester/index.d.ts +0 -1
- package/lib/tester/index.js +0 -1
- package/lib/tester/index.js.map +1 -1
- package/lib/tester/prettyDuration.js +11 -11
- package/lib/tester/prettyDuration.js.map +1 -1
- package/lib/tester/printTestResult.d.ts +1 -1
- package/lib/tester/printTestResult.js +35 -15
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +4 -2
- package/lib/tester/testFeature.js +264 -226
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +3 -7
- package/lib/tester/testProject.js +145 -246
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +5 -2
- package/lib/tester/testSegment.js +65 -102
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/extractKeys.d.ts +2 -1
- package/lib/utils/extractKeys.js +57 -12
- package/lib/utils/extractKeys.js.map +1 -1
- package/lib/utils/git.d.ts +1 -1
- package/lib/utils/git.js +23 -23
- package/lib/utils/git.js.map +1 -1
- package/lib/utils/pretty.js +2 -4
- package/lib/utils/pretty.js.map +1 -1
- package/package.json +5 -6
- package/src/assess-distribution/index.ts +3 -2
- package/src/benchmark/index.ts +3 -3
- package/src/builder/allocator.spec.ts +1 -1
- package/src/builder/allocator.ts +1 -1
- package/src/builder/buildDatafile.ts +161 -124
- package/src/builder/buildProject.ts +6 -3
- package/src/builder/convertToV1.ts +166 -0
- package/src/builder/getFeatureRanges.ts +1 -1
- package/src/builder/hashes.ts +109 -0
- package/src/builder/traffic.ts +41 -15
- package/src/cli/cli.ts +1 -1
- package/src/cli/plugins.ts +0 -2
- package/src/config/projectConfig.ts +13 -10
- package/src/datasource/adapter.ts +1 -1
- package/src/datasource/datasource.ts +23 -2
- package/src/datasource/filesystemAdapter.ts +11 -12
- package/src/evaluate/index.ts +7 -6
- package/src/find-duplicate-segments/findDuplicateSegments.ts +1 -1
- package/src/find-usage/index.ts +111 -44
- package/src/generate-code/index.ts +1 -3
- package/src/generate-code/typescript.ts +7 -29
- package/src/index.ts +0 -1
- package/src/info/index.ts +2 -2
- package/src/init/index.ts +2 -2
- package/src/linter/attributeSchema.ts +18 -2
- package/src/linter/checkCircularDependency.ts +1 -1
- package/src/linter/checkPercentageExceedingSlot.ts +28 -8
- package/src/linter/conditionSchema.ts +66 -10
- package/src/linter/featureSchema.ts +312 -116
- package/src/linter/lintProject.ts +9 -4
- package/src/linter/testSchema.ts +42 -3
- package/src/list/index.ts +18 -30
- package/src/{tester → list}/matrix.ts +33 -11
- package/src/site/exportSite.ts +2 -4
- package/src/site/generateHistory.ts +1 -1
- package/src/site/generateSiteSearchIndex.ts +58 -50
- package/src/site/getLastModifiedFromHistory.ts +1 -1
- package/src/tester/helpers.spec.ts +149 -0
- package/src/tester/helpers.ts +76 -0
- package/src/tester/index.ts +0 -1
- package/src/tester/printTestResult.ts +25 -3
- package/src/tester/testFeature.ts +270 -124
- package/src/tester/testProject.ts +28 -49
- package/src/tester/testSegment.ts +48 -40
- package/src/utils/extractKeys.ts +58 -1
- package/src/utils/git.ts +1 -1
- package/tsconfig.cjs.json +1 -0
- package/coverage/lcov-report/lib/tester/checkIfObjectsAreEqual.js.html +0 -151
- package/coverage/lcov-report/src/tester/checkIfObjectsAreEqual.ts.html +0 -157
- package/lib/restore/index.d.ts +0 -4
- package/lib/restore/index.js +0 -91
- package/lib/restore/index.js.map +0 -1
- package/lib/tester/checkIfArraysAreEqual.d.ts +0 -1
- package/lib/tester/checkIfArraysAreEqual.js +0 -18
- package/lib/tester/checkIfArraysAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.d.ts +0 -1
- package/lib/tester/checkIfObjectsAreEqual.js +0 -23
- package/lib/tester/checkIfObjectsAreEqual.js.map +0 -1
- package/lib/tester/checkIfObjectsAreEqual.spec.js +0 -26
- package/lib/tester/checkIfObjectsAreEqual.spec.js.map +0 -1
- package/lib/tester/matrix.js.map +0 -1
- package/lib/tester/matrix.spec.js.map +0 -1
- package/src/restore/index.ts +0 -42
- package/src/tester/checkIfArraysAreEqual.ts +0 -16
- package/src/tester/checkIfObjectsAreEqual.spec.ts +0 -31
- package/src/tester/checkIfObjectsAreEqual.ts +0 -24
- /package/lib/{tester → list}/matrix.spec.d.ts +0 -0
- /package/lib/tester/{checkIfObjectsAreEqual.spec.d.ts → helpers.spec.d.ts} +0 -0
- /package/src/{tester → list}/matrix.spec.ts +0 -0
|
@@ -1,208 +1,167 @@
|
|
|
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.Datasource = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
4
|
+
class Datasource {
|
|
5
|
+
constructor(config, rootDirectoryPath) {
|
|
42
6
|
this.config = config;
|
|
43
7
|
this.rootDirectoryPath = rootDirectoryPath;
|
|
44
8
|
this.adapter = new config.adapter(config, rootDirectoryPath);
|
|
45
9
|
}
|
|
46
|
-
// @
|
|
47
|
-
|
|
10
|
+
// @NOTE: only site generator needs it, find a way to get it out of here later
|
|
11
|
+
getExtension() {
|
|
48
12
|
return this.config.parser.extension;
|
|
49
|
-
}
|
|
13
|
+
}
|
|
50
14
|
/**
|
|
51
15
|
* State
|
|
52
16
|
*/
|
|
53
|
-
|
|
17
|
+
readState(environment) {
|
|
54
18
|
return this.adapter.readState(environment);
|
|
55
|
-
}
|
|
56
|
-
|
|
19
|
+
}
|
|
20
|
+
writeState(environment, existingState) {
|
|
57
21
|
return this.adapter.writeState(environment, existingState);
|
|
58
|
-
}
|
|
22
|
+
}
|
|
59
23
|
/**
|
|
60
24
|
* Revision
|
|
61
25
|
*/
|
|
62
|
-
|
|
26
|
+
readRevision() {
|
|
63
27
|
return this.adapter.readRevision();
|
|
64
|
-
}
|
|
65
|
-
|
|
28
|
+
}
|
|
29
|
+
writeRevision(revision) {
|
|
66
30
|
return this.adapter.writeRevision(revision);
|
|
67
|
-
}
|
|
31
|
+
}
|
|
68
32
|
/**
|
|
69
33
|
* Datafile
|
|
70
34
|
*/
|
|
71
|
-
|
|
35
|
+
readDatafile(options) {
|
|
72
36
|
return this.adapter.readDatafile(options);
|
|
73
|
-
}
|
|
74
|
-
|
|
37
|
+
}
|
|
38
|
+
writeDatafile(datafileContent, options) {
|
|
75
39
|
return this.adapter.writeDatafile(datafileContent, options);
|
|
76
|
-
}
|
|
40
|
+
}
|
|
77
41
|
/**
|
|
78
42
|
* Entity specific methods
|
|
79
43
|
*/
|
|
80
44
|
// features
|
|
81
|
-
|
|
45
|
+
listFeatures() {
|
|
82
46
|
return this.adapter.listEntities("feature");
|
|
83
|
-
}
|
|
84
|
-
|
|
47
|
+
}
|
|
48
|
+
featureExists(featureKey) {
|
|
85
49
|
return this.adapter.entityExists("feature", featureKey);
|
|
86
|
-
}
|
|
87
|
-
|
|
50
|
+
}
|
|
51
|
+
readFeature(featureKey) {
|
|
88
52
|
return this.adapter.readEntity("feature", featureKey);
|
|
89
|
-
}
|
|
90
|
-
|
|
53
|
+
}
|
|
54
|
+
writeFeature(featureKey, feature) {
|
|
91
55
|
return this.adapter.writeEntity("feature", featureKey, feature);
|
|
92
|
-
}
|
|
93
|
-
|
|
56
|
+
}
|
|
57
|
+
deleteFeature(featureKey) {
|
|
94
58
|
return this.adapter.deleteEntity("feature", featureKey);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_b.label = 2;
|
|
115
|
-
case 2:
|
|
116
|
-
if (!(_i < _a.length)) return [3 /*break*/, 5];
|
|
117
|
-
r = _a[_i];
|
|
118
|
-
requiredKey = typeof r === "string" ? r : r.key;
|
|
119
|
-
if (chain.has(requiredKey)) {
|
|
120
|
-
throw new Error("Circular dependency detected: ".concat(chain.toString()));
|
|
121
|
-
}
|
|
122
|
-
return [4 /*yield*/, this.getRequiredFeaturesChain(requiredKey, chain)];
|
|
123
|
-
case 3:
|
|
124
|
-
_b.sent();
|
|
125
|
-
_b.label = 4;
|
|
126
|
-
case 4:
|
|
127
|
-
_i++;
|
|
128
|
-
return [3 /*break*/, 2];
|
|
129
|
-
case 5: return [2 /*return*/, chain];
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
};
|
|
59
|
+
}
|
|
60
|
+
async getRequiredFeaturesChain(featureKey, chain = new Set()) {
|
|
61
|
+
chain.add(featureKey);
|
|
62
|
+
if (!this.adapter.entityExists("feature", featureKey)) {
|
|
63
|
+
throw new Error(`Feature not found: ${featureKey}`);
|
|
64
|
+
}
|
|
65
|
+
const feature = await this.readFeature(featureKey);
|
|
66
|
+
if (!feature.required) {
|
|
67
|
+
return chain;
|
|
68
|
+
}
|
|
69
|
+
for (const r of feature.required) {
|
|
70
|
+
const requiredKey = typeof r === "string" ? r : r.key;
|
|
71
|
+
if (chain.has(requiredKey)) {
|
|
72
|
+
throw new Error(`Circular dependency detected: ${chain.toString()}`);
|
|
73
|
+
}
|
|
74
|
+
await this.getRequiredFeaturesChain(requiredKey, chain);
|
|
75
|
+
}
|
|
76
|
+
return chain;
|
|
77
|
+
}
|
|
134
78
|
// segments
|
|
135
|
-
|
|
79
|
+
listSegments() {
|
|
136
80
|
return this.adapter.listEntities("segment");
|
|
137
|
-
}
|
|
138
|
-
|
|
81
|
+
}
|
|
82
|
+
segmentExists(segmentKey) {
|
|
139
83
|
return this.adapter.entityExists("segment", segmentKey);
|
|
140
|
-
}
|
|
141
|
-
|
|
84
|
+
}
|
|
85
|
+
readSegment(segmentKey) {
|
|
142
86
|
return this.adapter.readEntity("segment", segmentKey);
|
|
143
|
-
}
|
|
144
|
-
|
|
87
|
+
}
|
|
88
|
+
writeSegment(segmentKey, segment) {
|
|
145
89
|
return this.adapter.writeEntity("segment", segmentKey, segment);
|
|
146
|
-
}
|
|
147
|
-
|
|
90
|
+
}
|
|
91
|
+
deleteSegment(segmentKey) {
|
|
148
92
|
return this.adapter.deleteEntity("segment", segmentKey);
|
|
149
|
-
}
|
|
93
|
+
}
|
|
150
94
|
// attributes
|
|
151
|
-
|
|
95
|
+
listAttributes() {
|
|
152
96
|
return this.adapter.listEntities("attribute");
|
|
153
|
-
}
|
|
154
|
-
|
|
97
|
+
}
|
|
98
|
+
async listFlattenedAttributes() {
|
|
99
|
+
const attributes = await this.listAttributes();
|
|
100
|
+
const result = [];
|
|
101
|
+
for (const key of attributes) {
|
|
102
|
+
const attribute = await this.readAttribute(key);
|
|
103
|
+
result.push(key);
|
|
104
|
+
if (attribute.type === "object") {
|
|
105
|
+
// @NOTE: in future, this can be recursive
|
|
106
|
+
const propertyKeys = Object.keys(attribute.properties || {});
|
|
107
|
+
for (const propertyKey of propertyKeys) {
|
|
108
|
+
result.push(`${key}.${propertyKey}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
114
|
+
attributeExists(attributeKey) {
|
|
155
115
|
return this.adapter.entityExists("attribute", attributeKey);
|
|
156
|
-
}
|
|
157
|
-
|
|
116
|
+
}
|
|
117
|
+
readAttribute(attributeKey) {
|
|
158
118
|
return this.adapter.readEntity("attribute", attributeKey);
|
|
159
|
-
}
|
|
160
|
-
|
|
119
|
+
}
|
|
120
|
+
writeAttribute(attributeKey, attribute) {
|
|
161
121
|
return this.adapter.writeEntity("attribute", attributeKey, attribute);
|
|
162
|
-
}
|
|
163
|
-
|
|
122
|
+
}
|
|
123
|
+
deleteAttribute(attributeKey) {
|
|
164
124
|
return this.adapter.deleteEntity("attribute", attributeKey);
|
|
165
|
-
}
|
|
125
|
+
}
|
|
166
126
|
// groups
|
|
167
|
-
|
|
127
|
+
listGroups() {
|
|
168
128
|
return this.adapter.listEntities("group");
|
|
169
|
-
}
|
|
170
|
-
|
|
129
|
+
}
|
|
130
|
+
groupExists(groupKey) {
|
|
171
131
|
return this.adapter.entityExists("group", groupKey);
|
|
172
|
-
}
|
|
173
|
-
|
|
132
|
+
}
|
|
133
|
+
readGroup(groupKey) {
|
|
174
134
|
return this.adapter.readEntity("group", groupKey);
|
|
175
|
-
}
|
|
176
|
-
|
|
135
|
+
}
|
|
136
|
+
writeGroup(groupKey, group) {
|
|
177
137
|
return this.adapter.writeEntity("group", groupKey, group);
|
|
178
|
-
}
|
|
179
|
-
|
|
138
|
+
}
|
|
139
|
+
deleteGroup(groupKey) {
|
|
180
140
|
return this.adapter.deleteEntity("group", groupKey);
|
|
181
|
-
}
|
|
141
|
+
}
|
|
182
142
|
// tests
|
|
183
|
-
|
|
143
|
+
listTests() {
|
|
184
144
|
return this.adapter.listEntities("test");
|
|
185
|
-
}
|
|
186
|
-
|
|
145
|
+
}
|
|
146
|
+
readTest(testKey) {
|
|
187
147
|
return this.adapter.readEntity("test", testKey);
|
|
188
|
-
}
|
|
189
|
-
|
|
148
|
+
}
|
|
149
|
+
writeTest(testKey, test) {
|
|
190
150
|
return this.adapter.writeEntity("test", testKey, test);
|
|
191
|
-
}
|
|
192
|
-
|
|
151
|
+
}
|
|
152
|
+
deleteTest(testKey) {
|
|
193
153
|
return this.adapter.deleteEntity("test", testKey);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return
|
|
197
|
-
}
|
|
154
|
+
}
|
|
155
|
+
getTestSpecName(testKey) {
|
|
156
|
+
return `${testKey}.${this.getExtension()}`;
|
|
157
|
+
}
|
|
198
158
|
// history
|
|
199
|
-
|
|
159
|
+
listHistoryEntries(entityType, entityKey) {
|
|
200
160
|
return this.adapter.listHistoryEntries(entityType, entityKey);
|
|
201
|
-
}
|
|
202
|
-
|
|
161
|
+
}
|
|
162
|
+
readCommit(commitHash, entityType, entityKey) {
|
|
203
163
|
return this.adapter.readCommit(commitHash, entityType, entityKey);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
}());
|
|
164
|
+
}
|
|
165
|
+
}
|
|
207
166
|
exports.Datasource = Datasource;
|
|
208
167
|
//# sourceMappingURL=datasource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../src/datasource/datasource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datasource.js","sourceRoot":"","sources":["../../src/datasource/datasource.ts"],"names":[],"mappings":";;;AAmBA,MAAa,UAAU;IAGrB,YACU,MAAqB,EACrB,iBAA0B;QAD1B,WAAM,GAAN,MAAM,CAAe;QACrB,sBAAiB,GAAjB,iBAAiB,CAAS;QAElC,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC/D,CAAC;IAED,8EAA8E;IAC9E,YAAY;QACV,OAAQ,IAAI,CAAC,MAAM,CAAC,MAAuB,CAAC,SAAS,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,WAAmC;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,UAAU,CAAC,WAAmC,EAAE,aAA4B;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,aAAa,CAAC,QAAgB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAAwB;QACnC,OAAO,IAAI,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U,EAAE,SAAS,CAAC,CAAC;IACpE,CAAC;CACF;AAvND,gCAuNC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExistingState, EnvironmentKey, DatafileContent, EntityType, HistoryEntry, Commit, CommitHash } from "@featurevisor/types";
|
|
1
|
+
import type { ExistingState, EnvironmentKey, DatafileContent, EntityType, HistoryEntry, Commit, CommitHash } from "@featurevisor/types";
|
|
2
2
|
import { Adapter, DatafileOptions } from "./adapter";
|
|
3
3
|
import { ProjectConfig } from "../config";
|
|
4
4
|
export declare function getExistingStateFilePath(projectConfig: ProjectConfig, environment: EnvironmentKey | false): string;
|