@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
|
@@ -8,85 +8,47 @@ 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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
const openapi_1 = require("../openapi");
|
|
16
|
+
const parseRuleDescription_1 = __importDefault(require("./lib/parseRuleDescription"));
|
|
17
|
+
class Options {
|
|
18
|
+
constructor() {
|
|
46
19
|
this.schemata = {};
|
|
47
20
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return "HTTP client request is incompatible with OpenAPI schema. Change details: ".concat(change.action, " ").concat(change.sourceSpecEntityDetails
|
|
21
|
+
}
|
|
22
|
+
const changeMessage = (change) => {
|
|
23
|
+
return `HTTP client request is incompatible with OpenAPI schema. Change details: ${change.action} ${change.sourceSpecEntityDetails
|
|
52
24
|
.concat(change.destinationSpecEntityDetails)
|
|
53
|
-
.map(
|
|
54
|
-
.join(', ')
|
|
25
|
+
.map((detail) => detail.location)
|
|
26
|
+
.join(', ')}`;
|
|
55
27
|
};
|
|
56
28
|
function build(options) {
|
|
57
29
|
function matcher(event) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
};
|
|
76
|
-
return [4 /*yield*/, (0, openapi_1.breakingChanges)(clientSchema, serverSchema)];
|
|
77
|
-
case 2:
|
|
78
|
-
changes = _a.sent();
|
|
79
|
-
return [2 /*return*/, changes.map(function (change) { return ({
|
|
80
|
-
event: event,
|
|
81
|
-
message: changeMessage(change),
|
|
82
|
-
}); })];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const clientFragment = (0, openapi_1.forClientRequest)(event);
|
|
32
|
+
const serverSchema = yield (0, openapi_1.forURL)(event.httpClientRequest.url, options.schemata);
|
|
33
|
+
const clientSchema = {
|
|
34
|
+
openapi: '3.0.0',
|
|
35
|
+
info: {
|
|
36
|
+
title: 'Schema derived from client request',
|
|
37
|
+
version: serverSchema.info.version, // Indicate that it *should* be compatible.
|
|
38
|
+
},
|
|
39
|
+
paths: clientFragment.paths,
|
|
40
|
+
components: { securitySchemes: clientFragment.securitySchemes },
|
|
41
|
+
};
|
|
42
|
+
const changes = yield (0, openapi_1.breakingChanges)(clientSchema, serverSchema);
|
|
43
|
+
return changes.map((change) => ({
|
|
44
|
+
event,
|
|
45
|
+
message: changeMessage(change),
|
|
46
|
+
}));
|
|
85
47
|
});
|
|
86
48
|
}
|
|
87
49
|
return {
|
|
88
|
-
matcher
|
|
89
|
-
where:
|
|
50
|
+
matcher,
|
|
51
|
+
where: (e) => !!e.httpClientRequest && !!e.httpClientRequest.url,
|
|
90
52
|
};
|
|
91
53
|
}
|
|
92
54
|
exports.default = {
|
|
@@ -98,7 +60,6 @@ exports.default = {
|
|
|
98
60
|
impactDomain: 'Stability',
|
|
99
61
|
description: (0, parseRuleDescription_1.default)('incompatibleHttpClientRequest'),
|
|
100
62
|
url: 'https://appland.com/docs/analysis/rules-reference.html#incompatible-http-client-request',
|
|
101
|
-
Options
|
|
102
|
-
build
|
|
63
|
+
Options,
|
|
64
|
+
build,
|
|
103
65
|
};
|
|
104
|
-
//# sourceMappingURL=incompatibleHttpClientRequest.js.map
|
|
@@ -3,17 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const url_1 = require("url");
|
|
7
|
+
const recordSecrets_1 = __importDefault(require("../analyzer/recordSecrets"));
|
|
8
|
+
const secretsRegexes_1 = require("../analyzer/secretsRegexes");
|
|
9
|
+
const parseRuleDescription_1 = __importDefault(require("./lib/parseRuleDescription"));
|
|
10
|
+
const BCRYPT_REGEXP = /^[$]2[abxy]?[$](?:0[4-9]|[12][0-9]|3[01])[$][./0-9a-zA-Z]{53}$/;
|
|
11
|
+
const secrets = new Set();
|
|
12
12
|
function stringEquals(e) {
|
|
13
13
|
if (!e.parameters || !e.receiver || e.parameters.length !== 1) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const args = [e.receiver.value, e.parameters[0].value];
|
|
17
17
|
function isBcrypt(str) {
|
|
18
18
|
return BCRYPT_REGEXP.test(str);
|
|
19
19
|
}
|
|
@@ -36,12 +36,12 @@ function build() {
|
|
|
36
36
|
return (e.isFunction && (e.codeObject.labels.has(StringEquals) || e.codeObject.labels.has(Secret)));
|
|
37
37
|
}
|
|
38
38
|
return {
|
|
39
|
-
matcher
|
|
40
|
-
where
|
|
39
|
+
matcher,
|
|
40
|
+
where,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const Secret = 'secret';
|
|
44
|
+
const StringEquals = 'string.equals';
|
|
45
45
|
exports.default = {
|
|
46
46
|
id: 'insecure-compare',
|
|
47
47
|
title: 'Insecure comparison of secrets',
|
|
@@ -53,6 +53,5 @@ exports.default = {
|
|
|
53
53
|
},
|
|
54
54
|
description: (0, parseRuleDescription_1.default)('insecureCompare'),
|
|
55
55
|
url: 'https://appland.com/docs/analysis/rules-reference.html#insecure-compare',
|
|
56
|
-
build
|
|
56
|
+
build,
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=insecureCompare.js.map
|
|
@@ -1,65 +1,34 @@
|
|
|
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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
4
|
};
|
|
30
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
6
|
+
const wellKnownLabels_1 = __importDefault(require("../wellKnownLabels"));
|
|
7
|
+
const sqlTransactionScope_1 = require("../scope/sqlTransactionScope");
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
const parseRuleDescription_1 = __importDefault(require("./lib/parseRuleDescription"));
|
|
35
10
|
function build() {
|
|
36
11
|
function matcher(event) {
|
|
37
12
|
if (!(0, sqlTransactionScope_1.hasTransactionDetails)(event))
|
|
38
|
-
throw new Error(
|
|
13
|
+
throw new Error(`expected event ${event.id} to be a transaction`);
|
|
39
14
|
if (event.transaction.status === 'commit')
|
|
40
15
|
return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
var cancellationEvents = event.transaction.events.filter(function (_a) {
|
|
46
|
-
var labels = _a.labels;
|
|
47
|
-
return labels.has(wellKnownLabels_1.default.JobCancel);
|
|
48
|
-
});
|
|
49
|
-
var missing = creationEvents.length - cancellationEvents.length;
|
|
16
|
+
const creationEvents = event.transaction.events.filter(({ labels }) => labels.has(wellKnownLabels_1.default.JobCreate));
|
|
17
|
+
const cancellationEvents = event.transaction.events.filter(({ labels }) => labels.has(wellKnownLabels_1.default.JobCancel));
|
|
18
|
+
const missing = creationEvents.length - cancellationEvents.length;
|
|
50
19
|
if (missing === 0)
|
|
51
20
|
return;
|
|
52
|
-
|
|
21
|
+
const result = {
|
|
53
22
|
event: event,
|
|
54
|
-
message:
|
|
23
|
+
message: `${missing} jobs created but not cancelled in this rolled back transaction`,
|
|
55
24
|
// if there's a mismatch and there are cancellations we can't tell
|
|
56
25
|
// for sure which creations they match, so return everything
|
|
57
|
-
relatedEvents:
|
|
26
|
+
relatedEvents: [...creationEvents, ...cancellationEvents],
|
|
58
27
|
};
|
|
59
28
|
return [result];
|
|
60
29
|
}
|
|
61
30
|
return {
|
|
62
|
-
matcher
|
|
31
|
+
matcher,
|
|
63
32
|
};
|
|
64
33
|
}
|
|
65
34
|
exports.default = {
|
|
@@ -74,6 +43,5 @@ exports.default = {
|
|
|
74
43
|
},
|
|
75
44
|
description: (0, parseRuleDescription_1.default)('jobNotCancelled'),
|
|
76
45
|
url: 'https://appland.com/docs/analysis/rules-reference.html#job-not-cancelled',
|
|
77
|
-
build
|
|
46
|
+
build,
|
|
78
47
|
};
|
|
79
|
-
//# sourceMappingURL=jobNotCancelled.js.map
|
|
@@ -2,10 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// Builds a function that returns true if the provided event argument has the specified
|
|
4
4
|
// objectId as the receiver or as a parameter value.
|
|
5
|
-
exports.default = (
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
});
|
|
11
|
-
//# sourceMappingURL=hasParameterOrReceiver.js.map
|
|
5
|
+
exports.default = (objectId) => {
|
|
6
|
+
return (event) => (!!event.receiver && event.receiver.object_id === objectId) ||
|
|
7
|
+
(!!event.parameters && event.parameters.some((param) => param.object_id === objectId));
|
|
8
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildFilters = exports.buildFilter = void 0;
|
|
4
|
-
|
|
4
|
+
const matchPattern_1 = require("./matchPattern");
|
|
5
5
|
function buildFilter(pattern) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
id:
|
|
9
|
-
type:
|
|
10
|
-
fqid:
|
|
11
|
-
query:
|
|
12
|
-
route:
|
|
6
|
+
const testFn = (0, matchPattern_1.buildFilter)(pattern.test);
|
|
7
|
+
const propertyFn = {
|
|
8
|
+
id: (e) => e.codeObject.id,
|
|
9
|
+
type: (e) => e.codeObject.type,
|
|
10
|
+
fqid: (e) => e.codeObject.fqid,
|
|
11
|
+
query: (e, appMapIndex) => (e.sql ? appMapIndex.sqlNormalized(e) : null),
|
|
12
|
+
route: (e) => e.route,
|
|
13
13
|
};
|
|
14
|
-
return
|
|
15
|
-
|
|
14
|
+
return (event, appMapIndex) => {
|
|
15
|
+
const fn = propertyFn[pattern.property];
|
|
16
16
|
if (!fn) {
|
|
17
|
-
throw new Error(
|
|
17
|
+
throw new Error(`Unrecognized Event filter property: ${pattern.property}`);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const value = fn(event, appMapIndex);
|
|
20
20
|
if (!value) {
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
@@ -28,4 +28,3 @@ function buildFilters(patterns) {
|
|
|
28
28
|
return patterns.map(buildFilter);
|
|
29
29
|
}
|
|
30
30
|
exports.buildFilters = buildFilters;
|
|
31
|
-
//# sourceMappingURL=matchEvent.js.map
|
|
@@ -6,18 +6,18 @@ function buildFilter(pattern) {
|
|
|
6
6
|
return pattern.ignoreCase ? value.toLocaleLowerCase() : value;
|
|
7
7
|
}
|
|
8
8
|
if (pattern.equal) {
|
|
9
|
-
|
|
10
|
-
return
|
|
9
|
+
const testStr = respectIgnoreCaseFlag(pattern.equal);
|
|
10
|
+
return (value) => respectIgnoreCaseFlag(value) === testStr;
|
|
11
11
|
}
|
|
12
12
|
else if (pattern.include) {
|
|
13
|
-
|
|
14
|
-
return
|
|
13
|
+
const testStr = respectIgnoreCaseFlag(pattern.include);
|
|
14
|
+
return (value) => respectIgnoreCaseFlag(value).includes(testStr);
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
|
-
|
|
17
|
+
const regexp = pattern.match instanceof RegExp
|
|
18
18
|
? pattern.match
|
|
19
19
|
: new RegExp(pattern.match, pattern.ignoreCase ? 'i' : undefined);
|
|
20
|
-
return
|
|
20
|
+
return (value) => regexp.test(value);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.buildFilter = buildFilter;
|
|
@@ -25,4 +25,3 @@ function buildFilters(patterns) {
|
|
|
25
25
|
return patterns.map(buildFilter);
|
|
26
26
|
}
|
|
27
27
|
exports.buildFilters = buildFilters;
|
|
28
|
-
//# sourceMappingURL=matchPattern.js.map
|
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const util_1 = require("./util");
|
|
9
9
|
function parseRuleDescription(id) {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const content = fs_1.default.readFileSync((0, path_1.join)(__dirname, `../../../doc/rules/${(0, util_1.dasherize)(id)}.md`), 'utf-8');
|
|
11
|
+
const propertiesContent = content.match(/---\n((?:.*\n)+)---\n((?:.*\n)+?)##?#?/);
|
|
12
12
|
if (!propertiesContent) {
|
|
13
13
|
// This is probably a new doc that doesn't have front matter yet.
|
|
14
14
|
// It's all description.
|
|
@@ -17,4 +17,3 @@ function parseRuleDescription(id) {
|
|
|
17
17
|
return propertiesContent[2].replace(/\n/g, ' ').trim();
|
|
18
18
|
}
|
|
19
19
|
exports.default = parseRuleDescription;
|
|
20
|
-
//# sourceMappingURL=parseRuleDescription.js.map
|
|
@@ -1,80 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
3
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
4
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
5
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6
|
-
function step(op) {
|
|
7
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
8
|
-
while (_) try {
|
|
9
|
-
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;
|
|
10
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
11
|
-
switch (op[0]) {
|
|
12
|
-
case 0: case 1: t = op; break;
|
|
13
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
14
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
15
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
16
|
-
default:
|
|
17
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
18
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
19
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
20
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
21
|
-
if (t[2]) _.ops.pop();
|
|
22
|
-
_.trys.pop(); continue;
|
|
23
|
-
}
|
|
24
|
-
op = body.call(thisArg, _);
|
|
25
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
26
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var __values = (this && this.__values) || function(o) {
|
|
30
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
31
|
-
if (m) return m.call(o);
|
|
32
|
-
if (o && typeof o.length === "number") return {
|
|
33
|
-
next: function () {
|
|
34
|
-
if (o && i >= o.length) o = void 0;
|
|
35
|
-
return { value: o && o[i++], done: !o };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
39
|
-
};
|
|
40
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
|
|
42
|
-
function precedingEvents(rootEvent, target) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
switch (_d.label) {
|
|
47
|
-
case 0:
|
|
48
|
-
_d.trys.push([0, 5, 6, 7]);
|
|
49
|
-
_a = __values(new models_1.EventNavigator(rootEvent).descendants()), _b = _a.next();
|
|
50
|
-
_d.label = 1;
|
|
51
|
-
case 1:
|
|
52
|
-
if (!!_b.done) return [3 /*break*/, 4];
|
|
53
|
-
event = _b.value;
|
|
54
|
-
if (event.event === target) {
|
|
55
|
-
return [3 /*break*/, 4];
|
|
56
|
-
}
|
|
57
|
-
return [4 /*yield*/, event];
|
|
58
|
-
case 2:
|
|
59
|
-
_d.sent();
|
|
60
|
-
_d.label = 3;
|
|
61
|
-
case 3:
|
|
62
|
-
_b = _a.next();
|
|
63
|
-
return [3 /*break*/, 1];
|
|
64
|
-
case 4: return [3 /*break*/, 7];
|
|
65
|
-
case 5:
|
|
66
|
-
e_1_1 = _d.sent();
|
|
67
|
-
e_1 = { error: e_1_1 };
|
|
68
|
-
return [3 /*break*/, 7];
|
|
69
|
-
case 6:
|
|
70
|
-
try {
|
|
71
|
-
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
72
|
-
}
|
|
73
|
-
finally { if (e_1) throw e_1.error; }
|
|
74
|
-
return [7 /*endfinally*/];
|
|
75
|
-
case 7: return [2 /*return*/];
|
|
3
|
+
const models_1 = require("@appland/models");
|
|
4
|
+
function* precedingEvents(rootEvent, target) {
|
|
5
|
+
for (const event of new models_1.EventNavigator(rootEvent).descendants()) {
|
|
6
|
+
if (event.event === target) {
|
|
7
|
+
break;
|
|
76
8
|
}
|
|
77
|
-
|
|
9
|
+
yield event;
|
|
10
|
+
}
|
|
78
11
|
}
|
|
79
12
|
exports.default = precedingEvents;
|
|
80
|
-
//# sourceMappingURL=precedingEvents.js.map
|
|
@@ -1,40 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __values = (this && this.__values) || function(o) {
|
|
3
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
-
if (m) return m.call(o);
|
|
5
|
-
if (o && typeof o.length === "number") return {
|
|
6
|
-
next: function () {
|
|
7
|
-
if (o && i >= o.length) o = void 0;
|
|
8
|
-
return { value: o && o[i++], done: !o };
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.rpcWithoutProtection = void 0;
|
|
15
4
|
function rpcWithoutProtection(candidateGenerator, options) {
|
|
16
5
|
return {
|
|
17
|
-
matcher:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var candidate = _c.value;
|
|
22
|
-
if (candidate.codeObject.labels.has(options.expectedLabel)) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
28
|
-
finally {
|
|
29
|
-
try {
|
|
30
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
6
|
+
matcher: (httpClientRequest) => {
|
|
7
|
+
for (const candidate of candidateGenerator(httpClientRequest)) {
|
|
8
|
+
if (candidate.codeObject.labels.has(options.expectedLabel)) {
|
|
9
|
+
return false;
|
|
31
10
|
}
|
|
32
|
-
finally { if (e_1) throw e_1.error; }
|
|
33
11
|
}
|
|
34
12
|
return true;
|
|
35
13
|
},
|
|
36
|
-
where:
|
|
14
|
+
where: (e) => !!e.httpClientRequest,
|
|
37
15
|
};
|
|
38
16
|
}
|
|
39
17
|
exports.rpcWithoutProtection = rpcWithoutProtection;
|
|
40
|
-
//# sourceMappingURL=rpcWithoutProtection.js.map
|
package/built/rules/lib/util.js
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verbose = exports.toRegExpArray = exports.responseContentType = exports.toRegExp = exports.providesAuthentication = exports.pluralize = exports.dasherize = exports.camelize = exports.parseValue = exports.isRoot = exports.ideLink = exports.isTruthy = exports.isFalsey = exports.emptyValue = exports.capitalize = exports.appMapDir = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
exports.verbose = exports.toRegExpArray = exports.responseContentType = exports.toRegExp = exports.providesAuthentication = exports.pluralize = exports.dasherize = exports.camelize = exports.parseValue = exports.isRoot = exports.ideLink = exports.isTruthy = exports.isFalsey = exports.emptyValue = exports.capitalize = exports.appMapDir = exports.appmapDirFromConfig = void 0;
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const promises_1 = require("fs/promises");
|
|
15
|
+
const js_yaml_1 = require("js-yaml");
|
|
16
|
+
const path_1 = require("path");
|
|
17
|
+
const util_1 = require("util");
|
|
18
|
+
function appmapDirFromConfig() {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const appMapConfigExists = yield (0, util_1.promisify)(fs_1.exists)('appmap.yml');
|
|
21
|
+
if (appMapConfigExists) {
|
|
22
|
+
const appMapConfigData = (0, js_yaml_1.load)((yield (0, promises_1.readFile)('appmap.yml')).toString());
|
|
23
|
+
if (appMapConfigData && typeof appMapConfigData === 'object') {
|
|
24
|
+
return appMapConfigData['appmap_dir'];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.appmapDirFromConfig = appmapDirFromConfig;
|
|
30
|
+
let isVerbose = false;
|
|
31
|
+
function verbose(v = null) {
|
|
8
32
|
if (v === true || v === false) {
|
|
9
33
|
isVerbose = v;
|
|
10
34
|
}
|
|
@@ -64,55 +88,55 @@ function parseValue(valueObj) {
|
|
|
64
88
|
return valueObj.value
|
|
65
89
|
.slice(1, valueObj.value.length - 1)
|
|
66
90
|
.split(',')
|
|
67
|
-
.map(
|
|
91
|
+
.map((v) => v.trim());
|
|
68
92
|
}
|
|
69
93
|
return [valueObj.value];
|
|
70
94
|
}
|
|
71
95
|
exports.parseValue = parseValue;
|
|
72
|
-
|
|
96
|
+
const isTruthy = (valueObj) => !isFalsey(valueObj);
|
|
73
97
|
exports.isTruthy = isTruthy;
|
|
74
98
|
function providesAuthentication(event, label) {
|
|
75
99
|
return event.returnValue && event.labels.has(label) && isTruthy(event.returnValue);
|
|
76
100
|
}
|
|
77
101
|
exports.providesAuthentication = providesAuthentication;
|
|
78
102
|
function ideLink(filePath, ide, eventId) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
const OSC = '\u001B]';
|
|
104
|
+
const BEL = '\u0007';
|
|
105
|
+
const SEP = ';';
|
|
82
106
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
83
|
-
|
|
107
|
+
const supportsHyperlinks = require('supports-hyperlinks');
|
|
84
108
|
if (!supportsHyperlinks.stdout) {
|
|
85
109
|
return filePath;
|
|
86
110
|
}
|
|
87
|
-
|
|
111
|
+
let path;
|
|
88
112
|
if (!(0, path_1.isAbsolute)(filePath)) {
|
|
89
|
-
path =
|
|
113
|
+
path = `${__dirname}/../../../../../${filePath}`;
|
|
90
114
|
}
|
|
91
115
|
else {
|
|
92
116
|
path = filePath;
|
|
93
117
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
?
|
|
98
|
-
:
|
|
118
|
+
const state = { currentView: 'viewFlow', selectedObject: `event:${eventId}` };
|
|
119
|
+
const encodedState = encodeURIComponent(JSON.stringify(state));
|
|
120
|
+
const link = ide == 'vscode'
|
|
121
|
+
? `vscode://appland.appmap/open?uri=${path}&state=${encodedState}`
|
|
122
|
+
: `${ide}://open?file=${path}`;
|
|
99
123
|
return [OSC, '8', SEP, SEP, link, BEL, filePath, OSC, '8', SEP, SEP, BEL].join('');
|
|
100
124
|
}
|
|
101
125
|
exports.ideLink = ideLink;
|
|
102
|
-
|
|
126
|
+
const toRegExp = (value) => {
|
|
103
127
|
return typeof value === 'string' ? new RegExp(value) : value;
|
|
104
128
|
};
|
|
105
129
|
exports.toRegExp = toRegExp;
|
|
106
|
-
|
|
130
|
+
const toRegExpArray = (value) => {
|
|
107
131
|
return value.map(toRegExp);
|
|
108
132
|
};
|
|
109
133
|
exports.toRegExpArray = toRegExpArray;
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
const RootLabels = ['command', 'job'];
|
|
135
|
+
const isRoot = (event) => {
|
|
112
136
|
if (!event) {
|
|
113
137
|
return true;
|
|
114
138
|
}
|
|
115
|
-
return (!!event.httpServerRequest || RootLabels.some(
|
|
139
|
+
return (!!event.httpServerRequest || RootLabels.some((label) => event.codeObject.labels.has(label)));
|
|
116
140
|
};
|
|
117
141
|
exports.isRoot = isRoot;
|
|
118
142
|
// Attribution: https://github.com/shahata/dasherize
|
|
@@ -127,7 +151,7 @@ function dasherize(str) {
|
|
|
127
151
|
exports.dasherize = dasherize;
|
|
128
152
|
// Literally StackOverflow
|
|
129
153
|
function camelize(text) {
|
|
130
|
-
text = text.replace(/[-_\s.]+(.)?/g,
|
|
154
|
+
text = text.replace(/[-_\s.]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''));
|
|
131
155
|
return text.slice(0, 1).toLowerCase() + text.slice(1);
|
|
132
156
|
}
|
|
133
157
|
exports.camelize = camelize;
|
|
@@ -135,4 +159,3 @@ function pluralize(word, count) {
|
|
|
135
159
|
return count === 1 ? word : [word, 's'].join('');
|
|
136
160
|
}
|
|
137
161
|
exports.pluralize = pluralize;
|
|
138
|
-
//# sourceMappingURL=util.js.map
|