@appland/scanner 1.81.1 → 1.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/built/appMapIndex.js +12 -5
- package/built/cli/scan/watchScan.js +32 -19
- package/built/telemetry.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# [@appland/scanner-v1.82.1](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.82.0...@appland/scanner-v1.82.1) (2023-08-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* Ensure that AppMaps are un-marked as being scanned ([e051d8d](https://github.com/getappmap/appmap-js/commit/e051d8db4e7d7b6b8ad8420573f0f02939d9e3bc))
|
|
7
|
+
|
|
8
|
+
# [@appland/scanner-v1.82.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.81.1...@appland/scanner-v1.82.0) (2023-08-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Fix caching of unparseable SQL ([e81db08](https://github.com/getappmap/appmap-js/commit/e81db08d6f6a7b661f77aa3aead5e800e15a7358))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* Analyze in worker threads ([612da06](https://github.com/getappmap/appmap-js/commit/612da06532e765469094aaeaaf614a52e75e46d2))
|
|
19
|
+
|
|
1
20
|
# [@appland/scanner-v1.81.1](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.81.0...@appland/scanner-v1.81.1) (2023-08-11)
|
|
2
21
|
|
|
3
22
|
|
package/built/appMapIndex.js
CHANGED
|
@@ -15,12 +15,19 @@ class AppMapIndex {
|
|
|
15
15
|
if (!event.sql)
|
|
16
16
|
throw new Error(`${event.fqid} is not a SQL query`);
|
|
17
17
|
const sql = this.sqlNormalized(event);
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
let result;
|
|
19
|
+
const cachedAST = ASTBySQLString.get(sql);
|
|
20
|
+
if (cachedAST === 'parse-error') {
|
|
21
|
+
result = undefined;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
else if (cachedAST) {
|
|
24
|
+
result = cachedAST;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
result = (0, models_1.parseSQL)(sql);
|
|
28
|
+
ASTBySQLString.set(sql, result ? result : 'parse-error');
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
24
31
|
}
|
|
25
32
|
sqlNormalized(event) {
|
|
26
33
|
if (!event.sql)
|
|
@@ -50,6 +50,7 @@ const events_1 = __importDefault(require("events"));
|
|
|
50
50
|
const watchScanTelemetry_1 = require("./watchScanTelemetry");
|
|
51
51
|
const isAncestorPath_1 = __importDefault(require("../../util/isAncestorPath"));
|
|
52
52
|
const util_1 = require("util");
|
|
53
|
+
const console_1 = require("console");
|
|
53
54
|
const debug = (0, util_1.debuglog)('scanner:watch');
|
|
54
55
|
function isDir(targetPath) {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -176,25 +177,37 @@ class Watcher {
|
|
|
176
177
|
scan(mtimePath) {
|
|
177
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
179
|
(0, assert_1.default)(this.config, `config should always be loaded before appmapWatcher triggers a scan`);
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
180
|
+
const perform = () => __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const appmapFile = [path_1.default.dirname(mtimePath), 'appmap.json'].join('.');
|
|
182
|
+
const reportFile = mtimePath.replace(/mtime$/, 'appmap-findings.json');
|
|
183
|
+
const [appmapStats, reportStats] = yield Promise.all([appmapFile, reportFile].map((f) => (0, promises_1.stat)(f).catch(() => null)));
|
|
184
|
+
if (!appmapStats) {
|
|
185
|
+
(0, console_1.warn)(`[scan] AppMap file ${appmapFile} does not exist`);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const cut = (str) => str.substring(str.length - 8);
|
|
189
|
+
(0, assert_1.default)(this.config);
|
|
190
|
+
debug('%s: %s, findings: %s, config: %s', appmapFile, cut(appmapStats.mtimeMs.toFixed(3)), reportStats && cut(reportStats.mtimeMs.toFixed(3)), cut(this.config.timestampMs.toFixed(3)));
|
|
191
|
+
if (reportStats &&
|
|
192
|
+
reportStats.mtimeMs > appmapStats.mtimeMs - 1000 &&
|
|
193
|
+
reportStats.mtimeMs > this.config.timestampMs - 1000) {
|
|
194
|
+
(0, console_1.warn)(`[scan] Report file ${reportFile} is already up to date`);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const startTime = Date.now();
|
|
198
|
+
const scanner = yield (0, scanner_1.default)(true, this.config, [appmapFile]);
|
|
199
|
+
const rawScanResults = yield scanner.scan();
|
|
200
|
+
const elapsed = Date.now() - startTime;
|
|
201
|
+
this.scanEventEmitter.emit('scan', { scanResults: rawScanResults, elapsed });
|
|
202
|
+
// Always report the raw data
|
|
203
|
+
yield (0, promises_1.writeFile)(reportFile, (0, formatReport_1.formatReport)(rawScanResults));
|
|
204
|
+
});
|
|
205
|
+
try {
|
|
206
|
+
yield perform();
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
this.processing.delete(mtimePath);
|
|
210
|
+
}
|
|
198
211
|
});
|
|
199
212
|
}
|
|
200
213
|
reloadConfig() {
|
package/built/telemetry.js
CHANGED
|
@@ -271,7 +271,7 @@ class GitProperties {
|
|
|
271
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
272
|
return new Promise((resolve) => {
|
|
273
273
|
try {
|
|
274
|
-
const commandProcess = (0, child_process_1.spawn)('git', ['status'], {
|
|
274
|
+
const commandProcess = (0, child_process_1.spawn)('git', ['status', '--porcelain'], {
|
|
275
275
|
shell: true,
|
|
276
276
|
cwd: cwd === null || cwd === void 0 ? void 0 : cwd.toString(),
|
|
277
277
|
stdio: 'ignore',
|