@appland/scanner 1.54.1 → 1.57.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 +31 -0
- package/built/algorithms/dataStructures/graph/Graph.js +53 -62
- package/built/algorithms/dataStructures/graph/GraphEdge.js +13 -16
- package/built/algorithms/dataStructures/graph/GraphVertex.js +37 -42
- package/built/algorithms/dataStructures/linked-list/LinkedList.js +33 -38
- package/built/algorithms/dataStructures/linked-list/LinkedListNode.js +6 -10
- package/built/algorithms/graph/depth-first-search/index.js +7 -8
- package/built/algorithms/graph/detect-cycle/index.js +15 -16
- package/built/algorithms/utils/Comparator.js +19 -21
- package/built/analyzer/recordSecrets.js +7 -30
- package/built/analyzer/secretsRegexes.js +8 -9
- package/built/appMapIndex.js +18 -20
- package/built/check.js +16 -18
- package/built/checkInstance.js +26 -48
- package/built/cli/ci/command.js +61 -147
- package/built/cli/ci/options.js +0 -1
- package/built/cli/codeVersionArgs.js +0 -1
- package/built/cli/exitCode.js +0 -1
- package/built/cli/fail.js +2 -3
- package/built/cli/merge/command.js +21 -63
- package/built/cli/merge/options.js +0 -1
- package/built/cli/reportUploadURL.js +2 -3
- package/built/cli/resolveAppId.js +34 -85
- package/built/cli/scan/command.js +58 -233
- package/built/cli/scan/formatReport.js +44 -0
- package/built/cli/scan/options.js +0 -1
- package/built/cli/scan/scanner.js +38 -117
- package/built/cli/scan/singleScan.js +80 -0
- package/built/cli/scan/watchScan.js +84 -0
- package/built/cli/scan.js +39 -132
- package/built/cli/scanArgs.js +2 -4
- package/built/cli/scanOptions.js +0 -1
- package/built/cli/updateCommitStatus.js +10 -47
- package/built/cli/upload/command.js +21 -65
- package/built/cli/upload/options.js +0 -1
- package/built/cli/upload/pruneAppMap.js +16 -0
- package/built/cli/upload.js +91 -172
- package/built/cli/validateFile.js +13 -48
- package/built/cli.js +34 -21
- package/built/configuration/configurationProvider.js +148 -227
- package/built/configuration/schema/options.json +76 -76
- package/built/configuration/types/checkConfig.js +0 -1
- package/built/configuration/types/configuration.js +0 -1
- package/built/configuration/types/matchEventConfig.js +0 -1
- package/built/configuration/types/matchPatternConfig.js +0 -1
- package/built/database/index.js +33 -127
- package/built/database/visit.js +16 -66
- package/built/errors.js +4 -30
- package/built/eventUtil.js +10 -35
- package/built/findings.js +3 -4
- package/built/integration/appland/app/exists.js +33 -76
- package/built/integration/appland/app/listFindingStatus.js +5 -38
- package/built/integration/appland/appMap/create.js +38 -89
- package/built/integration/appland/location.js +0 -1
- package/built/integration/appland/mapset/create.js +34 -85
- package/built/integration/appland/retry.js +10 -11
- package/built/integration/appland/retryOptions.js +0 -1
- package/built/integration/appland/scannerJob/create.js +34 -84
- package/built/integration/appland/scannerJob/merge.js +28 -74
- package/built/integration/appland/scannerJob.js +0 -1
- package/built/integration/github/commitStatus.js +3 -4
- package/built/integration/vars.js +1 -2
- package/built/openapi/index.js +39 -83
- package/built/report/appMapMetadata.js +0 -1
- package/built/report/findingSummary.js +0 -1
- package/built/report/findingsReport.js +14 -16
- package/built/report/scanResults.js +18 -45
- package/built/report/scanSummary.js +0 -1
- package/built/report/summaryReport.js +12 -13
- package/built/ruleChecker.js +146 -297
- package/built/rules/authzBeforeAuthn.js +25 -59
- package/built/rules/circularDependency.js +69 -101
- package/built/rules/deserializationOfUntrustedData.js +29 -63
- package/built/rules/execOfUntrustedCommand.js +28 -62
- package/built/rules/http-500/metadata.js +0 -1
- package/built/rules/http-500/rule.js +2 -3
- package/built/rules/illegalPackageDependency.js +16 -18
- package/built/rules/incompatibleHttpClientRequest.js +30 -69
- package/built/rules/insecureCompare.js +12 -13
- package/built/rules/jobNotCancelled.js +13 -45
- package/built/rules/lib/hasParameterOrReceiver.js +4 -7
- package/built/rules/lib/matchEvent.js +12 -13
- package/built/rules/lib/matchPattern.js +6 -7
- package/built/rules/lib/metadata.js +0 -1
- package/built/rules/lib/parseRuleDescription.js +5 -6
- package/built/rules/lib/precedingEvents.js +7 -75
- package/built/rules/lib/rpcWithoutProtection.js +5 -28
- package/built/rules/lib/sanitizesData.js +0 -1
- package/built/rules/lib/util.js +48 -25
- package/built/rules/logoutWithoutSessionReset.js +24 -58
- package/built/rules/missingAuthentication.js +28 -28
- package/built/rules/missingContentType.js +8 -9
- package/built/rules/nPlusOneQuery.js +35 -87
- package/built/rules/queryFromInvalidPackage.js +17 -19
- package/built/rules/queryFromView.js +13 -16
- package/built/rules/rpcWithoutCircuitBreaker.js +14 -84
- package/built/rules/saveWithoutValidation.js +8 -9
- package/built/rules/secretInLog.js +30 -93
- package/built/rules/slowFunctionCall.js +16 -20
- package/built/rules/slowHttpServerRequest.js +9 -11
- package/built/rules/slowQuery.js +9 -12
- package/built/rules/tooManyJoins.js +26 -51
- package/built/rules/tooManyUpdates.js +25 -105
- package/built/rules/unbatchedMaterializedQuery.js +26 -30
- package/built/rules/updateInGetRequest.js +30 -45
- package/built/scope/commandScope.js +24 -144
- package/built/scope/httpClientRequestScope.js +11 -98
- package/built/scope/httpServerRequestScope.js +11 -98
- package/built/scope/rootScope.js +11 -98
- package/built/scope/scopeImpl.js +10 -82
- package/built/scope/scopeIterator.js +6 -10
- package/built/scope/sqlTransactionScope.js +24 -122
- package/built/sqlWarning.js +9 -35
- package/built/telemetry.js +215 -0
- package/built/wellKnownLabels.js +0 -1
- package/package.json +10 -4
- package/built/algorithms/dataStructures/graph/Graph.js.map +0 -1
- package/built/algorithms/dataStructures/graph/GraphEdge.js.map +0 -1
- package/built/algorithms/dataStructures/graph/GraphVertex.js.map +0 -1
- package/built/algorithms/dataStructures/linked-list/LinkedList.js.map +0 -1
- package/built/algorithms/dataStructures/linked-list/LinkedListNode.js.map +0 -1
- package/built/algorithms/graph/depth-first-search/index.js.map +0 -1
- package/built/algorithms/graph/detect-cycle/index.js.map +0 -1
- package/built/algorithms/utils/Comparator.js.map +0 -1
- package/built/analyzer/recordSecrets.js.map +0 -1
- package/built/analyzer/secretsRegexes.js.map +0 -1
- package/built/appMapIndex.js.map +0 -1
- package/built/check.js.map +0 -1
- package/built/checkInstance.js.map +0 -1
- package/built/cli/ci/command.js.map +0 -1
- package/built/cli/ci/options.js.map +0 -1
- package/built/cli/codeVersionArgs.js.map +0 -1
- package/built/cli/exitCode.js.map +0 -1
- package/built/cli/fail.js.map +0 -1
- package/built/cli/merge/command.js.map +0 -1
- package/built/cli/merge/options.js.map +0 -1
- package/built/cli/reportUploadURL.js.map +0 -1
- package/built/cli/resolveAppId.js.map +0 -1
- package/built/cli/scan/command.js.map +0 -1
- package/built/cli/scan/options.js.map +0 -1
- package/built/cli/scan/scanner.js.map +0 -1
- package/built/cli/scan.js.map +0 -1
- package/built/cli/scanArgs.js.map +0 -1
- package/built/cli/scanOptions.js.map +0 -1
- package/built/cli/updateCommitStatus.js.map +0 -1
- package/built/cli/upload/command.js.map +0 -1
- package/built/cli/upload/options.js.map +0 -1
- package/built/cli/upload.js.map +0 -1
- package/built/cli/validateFile.js.map +0 -1
- package/built/cli.js.map +0 -1
- package/built/configuration/configurationProvider.js.map +0 -1
- package/built/configuration/types/checkConfig.js.map +0 -1
- package/built/configuration/types/configuration.js.map +0 -1
- package/built/configuration/types/matchEventConfig.js.map +0 -1
- package/built/configuration/types/matchPatternConfig.js.map +0 -1
- package/built/database/index.js.map +0 -1
- package/built/database/visit.js.map +0 -1
- package/built/errors.js.map +0 -1
- package/built/eventUtil.js.map +0 -1
- package/built/findings.js.map +0 -1
- package/built/integration/appland/app/exists.js.map +0 -1
- package/built/integration/appland/app/listFindingStatus.js.map +0 -1
- package/built/integration/appland/appMap/create.js.map +0 -1
- package/built/integration/appland/location.js.map +0 -1
- package/built/integration/appland/mapset/create.js.map +0 -1
- package/built/integration/appland/retry.js.map +0 -1
- package/built/integration/appland/retryOptions.js.map +0 -1
- package/built/integration/appland/scannerJob/create.js.map +0 -1
- package/built/integration/appland/scannerJob/merge.js.map +0 -1
- package/built/integration/appland/scannerJob.js.map +0 -1
- package/built/integration/github/commitStatus.js.map +0 -1
- package/built/integration/vars.js.map +0 -1
- package/built/openapi/index.js.map +0 -1
- package/built/openapi/method.js +0 -120
- package/built/openapi/method.js.map +0 -1
- package/built/openapi/model.js +0 -49
- package/built/openapi/model.js.map +0 -1
- package/built/openapi/path.js +0 -36
- package/built/openapi/path.js.map +0 -1
- package/built/openapi/provider.js +0 -133
- package/built/openapi/provider.js.map +0 -1
- package/built/openapi/response.js +0 -59
- package/built/openapi/response.js.map +0 -1
- package/built/openapi/rpcRequest.js +0 -130
- package/built/openapi/rpcRequest.js.map +0 -1
- package/built/openapi/schema.js +0 -42
- package/built/openapi/schema.js.map +0 -1
- package/built/openapi/securitySchemes.js +0 -32
- package/built/openapi/securitySchemes.js.map +0 -1
- package/built/openapi/statusCodes.js +0 -68
- package/built/openapi/statusCodes.js.map +0 -1
- package/built/openapi/util.js +0 -91
- package/built/openapi/util.js.map +0 -1
- package/built/report/appMapMetadata.js.map +0 -1
- package/built/report/findingSummary.js.map +0 -1
- package/built/report/findingsReport.js.map +0 -1
- package/built/report/scanResults.js.map +0 -1
- package/built/report/scanSummary.js.map +0 -1
- package/built/report/summaryReport.js.map +0 -1
- package/built/ruleChecker.js.map +0 -1
- package/built/rules/authzBeforeAuthn.js.map +0 -1
- package/built/rules/circularDependency.js.map +0 -1
- package/built/rules/deserializationOfUntrustedData.js.map +0 -1
- package/built/rules/execOfUntrustedCommand.js.map +0 -1
- package/built/rules/http-500/metadata.js.map +0 -1
- package/built/rules/http-500/rule.js.map +0 -1
- package/built/rules/illegalPackageDependency.js.map +0 -1
- package/built/rules/incompatibleHttpClientRequest.js.map +0 -1
- package/built/rules/insecureCompare.js.map +0 -1
- package/built/rules/jobNotCancelled.js.map +0 -1
- package/built/rules/lib/hasParameterOrReceiver.js.map +0 -1
- package/built/rules/lib/matchEvent.js.map +0 -1
- package/built/rules/lib/matchPattern.js.map +0 -1
- package/built/rules/lib/metadata.js.map +0 -1
- package/built/rules/lib/parseRuleDescription.js.map +0 -1
- package/built/rules/lib/precedingEvents.js.map +0 -1
- package/built/rules/lib/rpcWithoutProtection.js.map +0 -1
- package/built/rules/lib/sanitizesData.js.map +0 -1
- package/built/rules/lib/util.js.map +0 -1
- package/built/rules/logoutWithoutSessionReset.js.map +0 -1
- package/built/rules/missingAuthentication.js.map +0 -1
- package/built/rules/missingContentType.js.map +0 -1
- package/built/rules/nPlusOneQuery.js.map +0 -1
- package/built/rules/queryFromInvalidPackage.js.map +0 -1
- package/built/rules/queryFromView.js.map +0 -1
- package/built/rules/rpcWithoutCircuitBreaker.js.map +0 -1
- package/built/rules/saveWithoutValidation.js.map +0 -1
- package/built/rules/secretInLog.js.map +0 -1
- package/built/rules/slowFunctionCall.js.map +0 -1
- package/built/rules/slowHttpServerRequest.js.map +0 -1
- package/built/rules/slowQuery.js.map +0 -1
- package/built/rules/tooManyJoins.js.map +0 -1
- package/built/rules/tooManyUpdates.js.map +0 -1
- package/built/rules/unbatchedMaterializedQuery.js.map +0 -1
- package/built/rules/updateInGetRequest.js.map +0 -1
- package/built/scope/commandScope.js.map +0 -1
- package/built/scope/httpClientRequestScope.js.map +0 -1
- package/built/scope/httpServerRequestScope.js.map +0 -1
- package/built/scope/rootScope.js.map +0 -1
- package/built/scope/scopeImpl.js.map +0 -1
- package/built/scope/scopeIterator.js.map +0 -1
- package/built/scope/sqlTransactionScope.js.map +0 -1
- package/built/sqlWarning.js.map +0 -1
- package/built/wellKnownLabels.js.map +0 -1
package/built/eventUtil.js
CHANGED
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
3
|
exports.cloneEvent = exports.cloneCodeObject = void 0;
|
|
29
|
-
|
|
4
|
+
const models_1 = require("@appland/models");
|
|
30
5
|
function cloneCodeObject(sourceObject) {
|
|
31
|
-
|
|
32
|
-
sourceObject
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
const codeObjects = [
|
|
7
|
+
sourceObject,
|
|
8
|
+
...sourceObject.ancestors(),
|
|
9
|
+
];
|
|
10
|
+
let currentSourceObject = codeObjects.pop();
|
|
11
|
+
let lastClonedObject;
|
|
36
12
|
while (currentSourceObject) {
|
|
37
13
|
lastClonedObject = new models_1.CodeObject(currentSourceObject.data, lastClonedObject);
|
|
38
14
|
currentSourceObject = codeObjects.pop();
|
|
@@ -47,15 +23,14 @@ function cloneEvent(sourceEvent) {
|
|
|
47
23
|
// as a convienence, so we may run into errors if we don't restore this relationship. For example,
|
|
48
24
|
// accessing `elapsedTime` on a call event will retrieve the value from the associated return
|
|
49
25
|
// event.
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
const linkedEvent = new models_1.Event(sourceEvent.linkedEvent);
|
|
27
|
+
const event = new models_1.Event(sourceEvent);
|
|
52
28
|
event.linkedEvent = linkedEvent;
|
|
53
29
|
// The codeObject is used as well so it'll need a clone.
|
|
54
|
-
|
|
30
|
+
const codeObject = cloneCodeObject(sourceEvent.codeObject);
|
|
55
31
|
if (codeObject) {
|
|
56
32
|
event.codeObject = codeObject;
|
|
57
33
|
}
|
|
58
34
|
return event;
|
|
59
35
|
}
|
|
60
36
|
exports.cloneEvent = cloneEvent;
|
|
61
|
-
//# sourceMappingURL=eventUtil.js.map
|
package/built/findings.js
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newFindings = void 0;
|
|
4
4
|
function newFindings(findings, findingStatuses) {
|
|
5
|
-
|
|
5
|
+
const statusByFindingDigest = findingStatuses.reduce((memo, findingStatus) => {
|
|
6
6
|
memo.set(findingStatus.identity_hash, findingStatus.status);
|
|
7
7
|
return memo;
|
|
8
8
|
}, new Map());
|
|
9
|
-
return findings.filter(
|
|
10
|
-
|
|
9
|
+
return findings.filter((finding) => {
|
|
10
|
+
const status = statusByFindingDigest.get(finding.hash);
|
|
11
11
|
return !status || status === 'new';
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
exports.newFindings = newFindings;
|
|
15
|
-
//# sourceMappingURL=findings.js.map
|
|
@@ -8,91 +8,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
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 (_) 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
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
13
|
};
|
|
41
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
15
|
exports.exists = void 0;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function exists(appId, retryOptions) {
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
const src_1 = require("@appland/client/dist/src");
|
|
17
|
+
const util_1 = require("../../../rules/lib/util");
|
|
18
|
+
const retry_1 = __importDefault(require("../retry"));
|
|
19
|
+
function exists(appId, retryOptions = {}) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const commandDescription = `Checking if app ${appId} exists`;
|
|
22
|
+
if ((0, util_1.verbose)())
|
|
23
|
+
console.log(commandDescription);
|
|
24
|
+
const retrier = (0, retry_1.default)(commandDescription, retryOptions, makeRequest);
|
|
49
25
|
function makeRequest() {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
method: 'HEAD',
|
|
62
|
-
headers: request.headers,
|
|
63
|
-
}, resolve);
|
|
64
|
-
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
65
|
-
req.end();
|
|
66
|
-
}).then((0, src_1.retryOn503)(retrier))];
|
|
67
|
-
}
|
|
68
|
-
});
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const requestPath = ['api', appId].join('/');
|
|
28
|
+
const request = yield (0, src_1.buildRequest)(requestPath);
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const req = request.requestFunction(request.url, {
|
|
31
|
+
method: 'HEAD',
|
|
32
|
+
headers: request.headers,
|
|
33
|
+
}, resolve);
|
|
34
|
+
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
35
|
+
req.end();
|
|
36
|
+
}).then((0, src_1.retryOn503)(retrier));
|
|
69
37
|
});
|
|
70
38
|
}
|
|
71
|
-
|
|
72
|
-
var _this = this;
|
|
73
|
-
return __generator(this, function (_a) {
|
|
74
|
-
commandDescription = "Checking if app ".concat(appId, " exists");
|
|
39
|
+
return makeRequest().then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
75
40
|
if ((0, util_1.verbose)())
|
|
76
|
-
console.log(commandDescription);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
else if (response.statusCode < 300) {
|
|
89
|
-
return [2 /*return*/, true];
|
|
90
|
-
}
|
|
91
|
-
throw new Error("Unexpected status code: ".concat(response.statusCode));
|
|
92
|
-
});
|
|
93
|
-
}); })];
|
|
94
|
-
});
|
|
41
|
+
console.log(`${commandDescription}: statusCode=${response.statusCode}`);
|
|
42
|
+
if (!response.statusCode) {
|
|
43
|
+
throw new Error('No status code was provided by the server');
|
|
44
|
+
}
|
|
45
|
+
if (response.statusCode === 404) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
else if (response.statusCode < 300) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
throw new Error(`Unexpected status code: ${response.statusCode}`);
|
|
52
|
+
}));
|
|
95
53
|
});
|
|
96
54
|
}
|
|
97
55
|
exports.exists = exists;
|
|
98
|
-
//# sourceMappingURL=exists.js.map
|
|
@@ -8,44 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
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 (_) 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
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
-
return
|
|
43
|
-
switch (_a.label) {
|
|
44
|
-
case 0: return [4 /*yield*/, new src_1.App(appId).listFindingStatus()];
|
|
45
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
46
|
-
}
|
|
47
|
-
});
|
|
12
|
+
const src_1 = require("@appland/client/dist/src");
|
|
13
|
+
function listFindingStatus(appId) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return yield new src_1.App(appId).listFindingStatus();
|
|
48
16
|
});
|
|
49
17
|
}
|
|
50
|
-
exports.default =
|
|
51
|
-
//# sourceMappingURL=listFindingStatus.js.map
|
|
18
|
+
exports.default = listFindingStatus;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,93 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
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 (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
13
|
};
|
|
52
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
15
|
exports.create = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function create(data, options, retryOptions) {
|
|
58
|
-
|
|
59
|
-
|
|
16
|
+
const src_1 = require("@appland/client/dist/src");
|
|
17
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
18
|
+
const retry_1 = __importDefault(require("../retry"));
|
|
19
|
+
function create(data, options, retryOptions = {}) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const retrier = (0, retry_1.default)(`Upload AppMap`, retryOptions, makeRequest);
|
|
60
22
|
function makeRequest() {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
method: 'POST',
|
|
80
|
-
headers: __assign(__assign({}, request.headers), form.getHeaders()),
|
|
81
|
-
}, resolve);
|
|
82
|
-
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
83
|
-
form.pipe(req);
|
|
84
|
-
}).then((0, src_1.retryOn503)(retrier))];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const form = new form_data_1.default();
|
|
25
|
+
form.append('data', data.toString());
|
|
26
|
+
if (options.metadata) {
|
|
27
|
+
form.append('metadata', JSON.stringify(options.metadata));
|
|
28
|
+
}
|
|
29
|
+
if (options.app) {
|
|
30
|
+
form.append('app', options.app);
|
|
31
|
+
}
|
|
32
|
+
const request = yield (0, src_1.buildRequest)('api/appmaps');
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const req = request.requestFunction(request.url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
headers: Object.assign(Object.assign({}, request.headers), form.getHeaders()),
|
|
37
|
+
}, resolve);
|
|
38
|
+
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
39
|
+
form.pipe(req);
|
|
40
|
+
}).then((0, src_1.retryOn503)(retrier));
|
|
87
41
|
});
|
|
88
42
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
})
|
|
104
|
-
.on('error', reject);
|
|
105
|
-
});
|
|
106
|
-
})];
|
|
43
|
+
return makeRequest()
|
|
44
|
+
.then(src_1.handleError)
|
|
45
|
+
.then((response) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
const responseData = [];
|
|
48
|
+
response
|
|
49
|
+
.on('data', (chunk) => {
|
|
50
|
+
responseData.push(Buffer.from(chunk));
|
|
51
|
+
})
|
|
52
|
+
.on('end', () => {
|
|
53
|
+
resolve(JSON.parse(Buffer.concat(responseData).toString()));
|
|
54
|
+
})
|
|
55
|
+
.on('error', reject);
|
|
56
|
+
});
|
|
107
57
|
});
|
|
108
58
|
});
|
|
109
59
|
}
|
|
110
60
|
exports.create = create;
|
|
111
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -19,89 +8,49 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
19
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
9
|
});
|
|
21
10
|
};
|
|
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 (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
13
|
};
|
|
52
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
15
|
exports.create = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function create(appId, appMapIds, options, retryOptions) {
|
|
58
|
-
|
|
59
|
-
|
|
16
|
+
const src_1 = require("@appland/client/dist/src");
|
|
17
|
+
const util_1 = require("../../../rules/lib/util");
|
|
18
|
+
const retry_1 = __importDefault(require("../retry"));
|
|
19
|
+
function create(appId, appMapIds, options, retryOptions = {}) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
if ((0, util_1.verbose)())
|
|
22
|
+
console.log(`Creating mapset in app ${appId} with ${appMapIds.length} AppMaps`);
|
|
23
|
+
const retrier = (0, retry_1.default)(`Create Mapset`, retryOptions, makeRequest);
|
|
60
24
|
function makeRequest() {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
headers: __assign({ 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, request.headers),
|
|
74
|
-
}, resolve);
|
|
75
|
-
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
76
|
-
req.write(payload);
|
|
77
|
-
req.end();
|
|
78
|
-
}).then((0, src_1.retryOn503)(retrier))];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const payload = JSON.stringify(Object.assign({ app: appId, appmaps: appMapIds }, options));
|
|
27
|
+
const request = yield (0, src_1.buildRequest)('api/mapsets');
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const req = request.requestFunction(request.url, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: Object.assign({ 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, request.headers),
|
|
32
|
+
}, resolve);
|
|
33
|
+
req.on('error', (0, src_1.retryOnError)(retrier, resolve, reject));
|
|
34
|
+
req.write(payload);
|
|
35
|
+
req.end();
|
|
36
|
+
}).then((0, src_1.retryOn503)(retrier));
|
|
81
37
|
});
|
|
82
38
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.on('end', function () {
|
|
98
|
-
resolve(JSON.parse(Buffer.concat(responseData).toString()));
|
|
99
|
-
})
|
|
100
|
-
.on('error', reject);
|
|
101
|
-
});
|
|
102
|
-
})];
|
|
39
|
+
return makeRequest()
|
|
40
|
+
.then(src_1.handleError)
|
|
41
|
+
.then((response) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const responseData = [];
|
|
44
|
+
response
|
|
45
|
+
.on('data', (chunk) => {
|
|
46
|
+
responseData.push(Buffer.from(chunk));
|
|
47
|
+
})
|
|
48
|
+
.on('end', () => {
|
|
49
|
+
resolve(JSON.parse(Buffer.concat(responseData).toString()));
|
|
50
|
+
})
|
|
51
|
+
.on('error', reject);
|
|
52
|
+
});
|
|
103
53
|
});
|
|
104
54
|
});
|
|
105
55
|
}
|
|
106
56
|
exports.create = create;
|
|
107
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const util_1 = require("../../rules/lib/util");
|
|
4
|
+
const RetryDelay = 500;
|
|
5
|
+
const MaxRetries = 3;
|
|
6
6
|
function retry(description, retryOptions, retryFn) {
|
|
7
7
|
var _a, _b;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const maxRetries = (_a = retryOptions.maxRetries) !== null && _a !== void 0 ? _a : MaxRetries;
|
|
9
|
+
const retryDelay = (_b = retryOptions.retryDelay) !== null && _b !== void 0 ? _b : RetryDelay;
|
|
10
|
+
let retryCount = 0;
|
|
11
11
|
function computeDelay() {
|
|
12
12
|
return retryDelay * Math.pow(2, retryCount - 1);
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return (resolve, reject) => {
|
|
15
15
|
retryCount += 1;
|
|
16
16
|
if (retryCount > maxRetries) {
|
|
17
|
-
reject(new Error(
|
|
17
|
+
reject(new Error(`${description} failed: Max retries exceeded.`));
|
|
18
18
|
}
|
|
19
19
|
if ((0, util_1.verbose)()) {
|
|
20
|
-
console.log(
|
|
20
|
+
console.log(`Retrying ${description} in ${computeDelay()}ms`);
|
|
21
21
|
}
|
|
22
|
-
setTimeout(
|
|
22
|
+
setTimeout(() => retryFn().then(resolve).catch(reject), computeDelay());
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
exports.default = retry;
|
|
26
|
-
//# sourceMappingURL=retry.js.map
|