log-search 1.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/LICENSE +21 -0
- package/README.md +226 -0
- package/bin/log-search.js +45 -0
- package/dist/cli/commands/clear.d.ts +9 -0
- package/dist/cli/commands/clear.d.ts.map +1 -0
- package/dist/cli/commands/clear.js +116 -0
- package/dist/cli/commands/clear.js.map +1 -0
- package/dist/cli/commands/index.d.ts +8 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +118 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/info.d.ts +8 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +96 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/search.d.ts +9 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +178 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/watch.d.ts +8 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/commands/watch.js +141 -0
- package/dist/cli/commands/watch.js.map +1 -0
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +57 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/output/colorizer.d.ts +36 -0
- package/dist/cli/output/colorizer.d.ts.map +1 -0
- package/dist/cli/output/colorizer.js +101 -0
- package/dist/cli/output/colorizer.js.map +1 -0
- package/dist/cli/output/formatter.d.ts +31 -0
- package/dist/cli/output/formatter.d.ts.map +1 -0
- package/dist/cli/output/formatter.js +146 -0
- package/dist/cli/output/formatter.js.map +1 -0
- package/dist/cli/output/table.d.ts +12 -0
- package/dist/cli/output/table.d.ts.map +1 -0
- package/dist/cli/output/table.js +48 -0
- package/dist/cli/output/table.js.map +1 -0
- package/dist/core/indexer/ChunkProcessor.d.ts +21 -0
- package/dist/core/indexer/ChunkProcessor.d.ts.map +1 -0
- package/dist/core/indexer/ChunkProcessor.js +105 -0
- package/dist/core/indexer/ChunkProcessor.js.map +1 -0
- package/dist/core/indexer/IndexBuilder.d.ts +47 -0
- package/dist/core/indexer/IndexBuilder.d.ts.map +1 -0
- package/dist/core/indexer/IndexBuilder.js +274 -0
- package/dist/core/indexer/IndexBuilder.js.map +1 -0
- package/dist/core/indexer/IndexSerializer.d.ts +30 -0
- package/dist/core/indexer/IndexSerializer.d.ts.map +1 -0
- package/dist/core/indexer/IndexSerializer.js +142 -0
- package/dist/core/indexer/IndexSerializer.js.map +1 -0
- package/dist/core/indexer/OffsetMapper.d.ts +55 -0
- package/dist/core/indexer/OffsetMapper.d.ts.map +1 -0
- package/dist/core/indexer/OffsetMapper.js +94 -0
- package/dist/core/indexer/OffsetMapper.js.map +1 -0
- package/dist/core/indexer/TokenExtractor.d.ts +27 -0
- package/dist/core/indexer/TokenExtractor.d.ts.map +1 -0
- package/dist/core/indexer/TokenExtractor.js +92 -0
- package/dist/core/indexer/TokenExtractor.js.map +1 -0
- package/dist/core/searcher/IndexSearcher.d.ts +37 -0
- package/dist/core/searcher/IndexSearcher.d.ts.map +1 -0
- package/dist/core/searcher/IndexSearcher.js +360 -0
- package/dist/core/searcher/IndexSearcher.js.map +1 -0
- package/dist/core/searcher/RankEngine.d.ts +29 -0
- package/dist/core/searcher/RankEngine.d.ts.map +1 -0
- package/dist/core/searcher/RankEngine.js +90 -0
- package/dist/core/searcher/RankEngine.js.map +1 -0
- package/dist/core/searcher/ResultFetcher.d.ts +37 -0
- package/dist/core/searcher/ResultFetcher.d.ts.map +1 -0
- package/dist/core/searcher/ResultFetcher.js +118 -0
- package/dist/core/searcher/ResultFetcher.js.map +1 -0
- package/dist/core/streaming/ChunkSplitter.d.ts +25 -0
- package/dist/core/streaming/ChunkSplitter.d.ts.map +1 -0
- package/dist/core/streaming/ChunkSplitter.js +71 -0
- package/dist/core/streaming/ChunkSplitter.js.map +1 -0
- package/dist/core/streaming/FileStreamer.d.ts +39 -0
- package/dist/core/streaming/FileStreamer.d.ts.map +1 -0
- package/dist/core/streaming/FileStreamer.js +138 -0
- package/dist/core/streaming/FileStreamer.js.map +1 -0
- package/dist/core/streaming/LineBuffer.d.ts +26 -0
- package/dist/core/streaming/LineBuffer.d.ts.map +1 -0
- package/dist/core/streaming/LineBuffer.js +52 -0
- package/dist/core/streaming/LineBuffer.js.map +1 -0
- package/dist/core/workers/IndexWorker.d.ts +8 -0
- package/dist/core/workers/IndexWorker.d.ts.map +1 -0
- package/dist/core/workers/IndexWorker.js +41 -0
- package/dist/core/workers/IndexWorker.js.map +1 -0
- package/dist/core/workers/SearchWorker.d.ts +7 -0
- package/dist/core/workers/SearchWorker.d.ts.map +1 -0
- package/dist/core/workers/SearchWorker.js +63 -0
- package/dist/core/workers/SearchWorker.js.map +1 -0
- package/dist/core/workers/WorkerPool.d.ts +30 -0
- package/dist/core/workers/WorkerPool.d.ts.map +1 -0
- package/dist/core/workers/WorkerPool.js +132 -0
- package/dist/core/workers/WorkerPool.js.map +1 -0
- package/dist/formats/LogFormatDetector.d.ts +22 -0
- package/dist/formats/LogFormatDetector.d.ts.map +1 -0
- package/dist/formats/LogFormatDetector.js +123 -0
- package/dist/formats/LogFormatDetector.js.map +1 -0
- package/dist/formats/parsers/ApacheParser.d.ts +10 -0
- package/dist/formats/parsers/ApacheParser.d.ts.map +1 -0
- package/dist/formats/parsers/ApacheParser.js +54 -0
- package/dist/formats/parsers/ApacheParser.js.map +1 -0
- package/dist/formats/parsers/GenericParser.d.ts +11 -0
- package/dist/formats/parsers/GenericParser.d.ts.map +1 -0
- package/dist/formats/parsers/GenericParser.js +61 -0
- package/dist/formats/parsers/GenericParser.js.map +1 -0
- package/dist/formats/parsers/JsonParser.d.ts +12 -0
- package/dist/formats/parsers/JsonParser.d.ts.map +1 -0
- package/dist/formats/parsers/JsonParser.js +92 -0
- package/dist/formats/parsers/JsonParser.js.map +1 -0
- package/dist/formats/parsers/NginxParser.d.ts +15 -0
- package/dist/formats/parsers/NginxParser.d.ts.map +1 -0
- package/dist/formats/parsers/NginxParser.js +78 -0
- package/dist/formats/parsers/NginxParser.js.map +1 -0
- package/dist/formats/parsers/SyslogParser.d.ts +10 -0
- package/dist/formats/parsers/SyslogParser.d.ts.map +1 -0
- package/dist/formats/parsers/SyslogParser.js +73 -0
- package/dist/formats/parsers/SyslogParser.js.map +1 -0
- package/dist/formats/schemas/LogSchema.d.ts +70 -0
- package/dist/formats/schemas/LogSchema.d.ts.map +1 -0
- package/dist/formats/schemas/LogSchema.js +7 -0
- package/dist/formats/schemas/LogSchema.js.map +1 -0
- package/dist/index-store/CacheManager.d.ts +45 -0
- package/dist/index-store/CacheManager.d.ts.map +1 -0
- package/dist/index-store/CacheManager.js +84 -0
- package/dist/index-store/CacheManager.js.map +1 -0
- package/dist/index-store/FileWatcher.d.ts +39 -0
- package/dist/index-store/FileWatcher.d.ts.map +1 -0
- package/dist/index-store/FileWatcher.js +121 -0
- package/dist/index-store/FileWatcher.js.map +1 -0
- package/dist/index-store/IncrementalUpdater.d.ts +19 -0
- package/dist/index-store/IncrementalUpdater.d.ts.map +1 -0
- package/dist/index-store/IncrementalUpdater.js +62 -0
- package/dist/index-store/IncrementalUpdater.js.map +1 -0
- package/dist/index-store/IndexStore.d.ts +66 -0
- package/dist/index-store/IndexStore.d.ts.map +1 -0
- package/dist/index-store/IndexStore.js +183 -0
- package/dist/index-store/IndexStore.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/pro/alerts/AlertEngine.d.ts +35 -0
- package/dist/pro/alerts/AlertEngine.d.ts.map +1 -0
- package/dist/pro/alerts/AlertEngine.js +162 -0
- package/dist/pro/alerts/AlertEngine.js.map +1 -0
- package/dist/pro/alerts/Notifier.d.ts +23 -0
- package/dist/pro/alerts/Notifier.d.ts.map +1 -0
- package/dist/pro/alerts/Notifier.js +173 -0
- package/dist/pro/alerts/Notifier.js.map +1 -0
- package/dist/pro/alerts/RuleParser.d.ts +32 -0
- package/dist/pro/alerts/RuleParser.d.ts.map +1 -0
- package/dist/pro/alerts/RuleParser.js +86 -0
- package/dist/pro/alerts/RuleParser.js.map +1 -0
- package/dist/pro/auth/LicenseValidator.d.ts +29 -0
- package/dist/pro/auth/LicenseValidator.d.ts.map +1 -0
- package/dist/pro/auth/LicenseValidator.js +122 -0
- package/dist/pro/auth/LicenseValidator.js.map +1 -0
- package/dist/pro/auth/TokenManager.d.ts +27 -0
- package/dist/pro/auth/TokenManager.d.ts.map +1 -0
- package/dist/pro/auth/TokenManager.js +98 -0
- package/dist/pro/auth/TokenManager.js.map +1 -0
- package/dist/pro/webui/UIServer.d.ts +34 -0
- package/dist/pro/webui/UIServer.d.ts.map +1 -0
- package/dist/pro/webui/UIServer.js +353 -0
- package/dist/pro/webui/UIServer.js.map +1 -0
- package/dist/query/QueryEngine.d.ts +34 -0
- package/dist/query/QueryEngine.d.ts.map +1 -0
- package/dist/query/QueryEngine.js +187 -0
- package/dist/query/QueryEngine.js.map +1 -0
- package/dist/query/operators/AndOperator.d.ts +18 -0
- package/dist/query/operators/AndOperator.d.ts.map +1 -0
- package/dist/query/operators/AndOperator.js +55 -0
- package/dist/query/operators/AndOperator.js.map +1 -0
- package/dist/query/operators/NotOperator.d.ts +19 -0
- package/dist/query/operators/NotOperator.d.ts.map +1 -0
- package/dist/query/operators/NotOperator.js +43 -0
- package/dist/query/operators/NotOperator.js.map +1 -0
- package/dist/query/operators/OrOperator.d.ts +17 -0
- package/dist/query/operators/OrOperator.d.ts.map +1 -0
- package/dist/query/operators/OrOperator.js +54 -0
- package/dist/query/operators/OrOperator.js.map +1 -0
- package/dist/query/operators/RangeOperator.d.ts +23 -0
- package/dist/query/operators/RangeOperator.d.ts.map +1 -0
- package/dist/query/operators/RangeOperator.js +63 -0
- package/dist/query/operators/RangeOperator.js.map +1 -0
- package/dist/query/regex/FuzzyMatcher.d.ts +29 -0
- package/dist/query/regex/FuzzyMatcher.d.ts.map +1 -0
- package/dist/query/regex/FuzzyMatcher.js +89 -0
- package/dist/query/regex/FuzzyMatcher.js.map +1 -0
- package/dist/query/regex/RegexMatcher.d.ts +31 -0
- package/dist/query/regex/RegexMatcher.d.ts.map +1 -0
- package/dist/query/regex/RegexMatcher.js +73 -0
- package/dist/query/regex/RegexMatcher.js.map +1 -0
- package/dist/types/ConfigTypes.d.ts +78 -0
- package/dist/types/ConfigTypes.d.ts.map +1 -0
- package/dist/types/ConfigTypes.js +7 -0
- package/dist/types/ConfigTypes.js.map +1 -0
- package/dist/types/IndexTypes.d.ts +86 -0
- package/dist/types/IndexTypes.d.ts.map +1 -0
- package/dist/types/IndexTypes.js +7 -0
- package/dist/types/IndexTypes.js.map +1 -0
- package/dist/types/SearchTypes.d.ts +102 -0
- package/dist/types/SearchTypes.d.ts.map +1 -0
- package/dist/types/SearchTypes.js +7 -0
- package/dist/types/SearchTypes.js.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/fs-helpers.d.ts +9 -0
- package/dist/utils/fs-helpers.d.ts.map +1 -0
- package/dist/utils/fs-helpers.js +76 -0
- package/dist/utils/fs-helpers.js.map +1 -0
- package/dist/utils/hash.d.ts +7 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +49 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +41 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/performance.d.ts +14 -0
- package/dist/utils/performance.d.ts.map +1 -0
- package/dist/utils/performance.js +32 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/progress.d.ts +7 -0
- package/dist/utils/progress.d.ts.map +1 -0
- package/dist/utils/progress.js +22 -0
- package/dist/utils/progress.js.map +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* FuzzyMatcher.ts
|
|
4
|
+
* Performs approximate string matching using Jaro-Winkler similarity.
|
|
5
|
+
* Used for fuzzy search queries (e.g., ~"eror" finds "error").
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.FuzzyMatcher = void 0;
|
|
9
|
+
class FuzzyMatcher {
|
|
10
|
+
term;
|
|
11
|
+
threshold;
|
|
12
|
+
constructor(term, threshold = 0.85) {
|
|
13
|
+
this.term = term.toLowerCase();
|
|
14
|
+
this.threshold = threshold;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if a line contains a token similar to the search term.
|
|
18
|
+
*/
|
|
19
|
+
test(line) {
|
|
20
|
+
const tokens = line.toLowerCase().split(/\s+/);
|
|
21
|
+
return tokens.some((token) => this.similarity(this.term, token) >= this.threshold);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Find approximate matches in a line and return their positions.
|
|
25
|
+
*/
|
|
26
|
+
findMatches(line) {
|
|
27
|
+
const results = [];
|
|
28
|
+
const lower = line.toLowerCase();
|
|
29
|
+
let idx = 0;
|
|
30
|
+
for (const token of line.split(/(\s+)/)) {
|
|
31
|
+
const score = this.similarity(this.term, token.toLowerCase().replace(/\W/g, ''));
|
|
32
|
+
if (score >= this.threshold) {
|
|
33
|
+
results.push({ token, score, start: idx, end: idx + token.length });
|
|
34
|
+
}
|
|
35
|
+
idx += token.length;
|
|
36
|
+
}
|
|
37
|
+
return results;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Jaro-Winkler similarity between two strings.
|
|
41
|
+
* Returns a value in [0, 1].
|
|
42
|
+
*/
|
|
43
|
+
similarity(s1, s2) {
|
|
44
|
+
if (s1 === s2)
|
|
45
|
+
return 1;
|
|
46
|
+
if (!s1 || !s2)
|
|
47
|
+
return 0;
|
|
48
|
+
const len1 = s1.length;
|
|
49
|
+
const len2 = s2.length;
|
|
50
|
+
const matchDist = Math.max(Math.floor(Math.max(len1, len2) / 2) - 1, 0);
|
|
51
|
+
const s1Matched = new Array(len1).fill(false);
|
|
52
|
+
const s2Matched = new Array(len2).fill(false);
|
|
53
|
+
let matches = 0;
|
|
54
|
+
let transpositions = 0;
|
|
55
|
+
for (let i = 0; i < len1; i++) {
|
|
56
|
+
const start = Math.max(0, i - matchDist);
|
|
57
|
+
const end = Math.min(i + matchDist + 1, len2);
|
|
58
|
+
for (let j = start; j < end; j++) {
|
|
59
|
+
if (s2Matched[j] || s1[i] !== s2[j])
|
|
60
|
+
continue;
|
|
61
|
+
s1Matched[i] = true;
|
|
62
|
+
s2Matched[j] = true;
|
|
63
|
+
matches++;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (matches === 0)
|
|
68
|
+
return 0;
|
|
69
|
+
let k = 0;
|
|
70
|
+
for (let i = 0; i < len1; i++) {
|
|
71
|
+
if (!s1Matched[i])
|
|
72
|
+
continue;
|
|
73
|
+
while (!s2Matched[k])
|
|
74
|
+
k++;
|
|
75
|
+
if (s1[i] !== s2[k])
|
|
76
|
+
transpositions++;
|
|
77
|
+
k++;
|
|
78
|
+
}
|
|
79
|
+
const jaro = (matches / len1 + matches / len2 + (matches - transpositions / 2) / matches) / 3;
|
|
80
|
+
// Winkler prefix bonus (max 4 chars, 0.1 scale)
|
|
81
|
+
let prefix = 0;
|
|
82
|
+
const maxPrefix = Math.min(4, Math.min(len1, len2));
|
|
83
|
+
for (let i = 0; i < maxPrefix && s1[i] === s2[i]; i++)
|
|
84
|
+
prefix++;
|
|
85
|
+
return jaro + prefix * 0.1 * (1 - jaro);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.FuzzyMatcher = FuzzyMatcher;
|
|
89
|
+
//# sourceMappingURL=FuzzyMatcher.js.map
|
|
@@ -0,0 +1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
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RegexMatcher.ts
|
|
3
|
+
* Applies a compiled regex against a collection of lines.
|
|
4
|
+
* Used as a post-filter after index lookup or for full regex scans.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RegexMatcher {
|
|
7
|
+
private regex;
|
|
8
|
+
constructor(pattern: string | RegExp, ignoreCase?: boolean);
|
|
9
|
+
/**
|
|
10
|
+
* Test if a single line matches.
|
|
11
|
+
*/
|
|
12
|
+
test(line: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Find all match positions in a line.
|
|
15
|
+
* Returns array of [start, end] pairs.
|
|
16
|
+
*/
|
|
17
|
+
findAll(line: string): Array<[number, number]>;
|
|
18
|
+
/**
|
|
19
|
+
* Filter a list of lines, returning indices (into `lines`) that match.
|
|
20
|
+
*/
|
|
21
|
+
filterLines(lines: string[]): number[];
|
|
22
|
+
/**
|
|
23
|
+
* Filter offsets based on corresponding line content.
|
|
24
|
+
*/
|
|
25
|
+
filterOffsets(offsets: number[], lines: string[]): number[];
|
|
26
|
+
/**
|
|
27
|
+
* Validate a regex pattern string without throwing.
|
|
28
|
+
*/
|
|
29
|
+
static isValid(pattern: string): boolean;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=RegexMatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegexMatcher.d.ts","sourceRoot":"","sources":["../../../src/query/regex/RegexMatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,UAAU,GAAE,OAAc;IAShE;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK3B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAa9C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAQtC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAI3D;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAQzC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RegexMatcher.ts
|
|
4
|
+
* Applies a compiled regex against a collection of lines.
|
|
5
|
+
* Used as a post-filter after index lookup or for full regex scans.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.RegexMatcher = void 0;
|
|
9
|
+
class RegexMatcher {
|
|
10
|
+
regex;
|
|
11
|
+
constructor(pattern, ignoreCase = true) {
|
|
12
|
+
if (pattern instanceof RegExp) {
|
|
13
|
+
this.regex = pattern;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
const flags = ignoreCase ? 'gi' : 'g';
|
|
17
|
+
this.regex = new RegExp(pattern, flags);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Test if a single line matches.
|
|
22
|
+
*/
|
|
23
|
+
test(line) {
|
|
24
|
+
this.regex.lastIndex = 0;
|
|
25
|
+
return this.regex.test(line);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Find all match positions in a line.
|
|
29
|
+
* Returns array of [start, end] pairs.
|
|
30
|
+
*/
|
|
31
|
+
findAll(line) {
|
|
32
|
+
this.regex.lastIndex = 0;
|
|
33
|
+
const positions = [];
|
|
34
|
+
let match;
|
|
35
|
+
while ((match = this.regex.exec(line)) !== null) {
|
|
36
|
+
positions.push([match.index, match.index + match[0].length]);
|
|
37
|
+
if (!this.regex.global)
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return positions;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Filter a list of lines, returning indices (into `lines`) that match.
|
|
44
|
+
*/
|
|
45
|
+
filterLines(lines) {
|
|
46
|
+
const indices = [];
|
|
47
|
+
for (let i = 0; i < lines.length; i++) {
|
|
48
|
+
if (this.test(lines[i]))
|
|
49
|
+
indices.push(i);
|
|
50
|
+
}
|
|
51
|
+
return indices;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Filter offsets based on corresponding line content.
|
|
55
|
+
*/
|
|
56
|
+
filterOffsets(offsets, lines) {
|
|
57
|
+
return offsets.filter((_, i) => this.test(lines[i]));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Validate a regex pattern string without throwing.
|
|
61
|
+
*/
|
|
62
|
+
static isValid(pattern) {
|
|
63
|
+
try {
|
|
64
|
+
new RegExp(pattern);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.RegexMatcher = RegexMatcher;
|
|
73
|
+
//# sourceMappingURL=RegexMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegexMatcher.js","sourceRoot":"","sources":["../../../src/query/regex/RegexMatcher.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,MAAa,YAAY;IACf,KAAK,CAAS;IAEtB,YAAY,OAAwB,EAAE,aAAsB,IAAI;QAC9D,IAAI,OAAO,YAAY,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;YACtC,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1C,C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AAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC;YACH,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAlED,oCAkEC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfigTypes.ts
|
|
3
|
+
* Configuration types for log-search global settings.
|
|
4
|
+
*/
|
|
5
|
+
export type LogFormat = 'nginx' | 'apache' | 'json' | 'syslog' | 'kubernetes' | 'docker' | 'generic';
|
|
6
|
+
export interface GlobalConfig {
|
|
7
|
+
/** Directory to store index files. Default: ~/.log-search/indexes */
|
|
8
|
+
indexDir?: string;
|
|
9
|
+
/** Maximum size of the LRU cache for loaded indexes (number of indexes). Default: 10 */
|
|
10
|
+
maxCacheSize?: number;
|
|
11
|
+
/** Watch mode polling interval (ms). Default: 500 */
|
|
12
|
+
watchInterval?: number;
|
|
13
|
+
/** Enable debug logging. Default: false */
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
/** Pro license key */
|
|
16
|
+
licenseKey?: string;
|
|
17
|
+
/** Default output format */
|
|
18
|
+
defaultOutput?: 'text' | 'json' | 'table';
|
|
19
|
+
/** Color output in terminal. Default: true */
|
|
20
|
+
color?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ProConfig {
|
|
23
|
+
/** Pro license key */
|
|
24
|
+
licenseKey: string;
|
|
25
|
+
/** Activation token from Pro server */
|
|
26
|
+
activationToken?: string;
|
|
27
|
+
/** License expiry date */
|
|
28
|
+
expiresAt?: string;
|
|
29
|
+
/** Allowed features */
|
|
30
|
+
features: ProFeature[];
|
|
31
|
+
}
|
|
32
|
+
export type ProFeature = 'web-ui' | 'alerts' | 'multi-file' | 'api-server' | 'reports' | 'team-sharing';
|
|
33
|
+
export interface AlertRule {
|
|
34
|
+
name: string;
|
|
35
|
+
/** String pattern or RegExp to match */
|
|
36
|
+
pattern: string | RegExp;
|
|
37
|
+
severity: 'info' | 'warning' | 'critical';
|
|
38
|
+
/** Notification channel */
|
|
39
|
+
channel?: AlertChannel;
|
|
40
|
+
/** Cooldown in seconds before re-alerting on same rule. Default: 60 */
|
|
41
|
+
cooldownSeconds?: number;
|
|
42
|
+
}
|
|
43
|
+
export type AlertChannel = SlackChannel | DiscordChannel | EmailChannel | WebhookChannel | PagerDutyChannel;
|
|
44
|
+
export interface SlackChannel {
|
|
45
|
+
type: 'slack';
|
|
46
|
+
webhookUrl: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DiscordChannel {
|
|
49
|
+
type: 'discord';
|
|
50
|
+
webhookUrl: string;
|
|
51
|
+
}
|
|
52
|
+
export interface EmailChannel {
|
|
53
|
+
type: 'email';
|
|
54
|
+
to: string[];
|
|
55
|
+
smtpConfig?: {
|
|
56
|
+
host: string;
|
|
57
|
+
port: number;
|
|
58
|
+
user: string;
|
|
59
|
+
pass: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface WebhookChannel {
|
|
63
|
+
type: 'webhook';
|
|
64
|
+
url: string;
|
|
65
|
+
headers?: Record<string, string>;
|
|
66
|
+
}
|
|
67
|
+
export interface PagerDutyChannel {
|
|
68
|
+
type: 'pagerduty';
|
|
69
|
+
integrationKey: string;
|
|
70
|
+
}
|
|
71
|
+
export interface AlertMatch {
|
|
72
|
+
rule: string;
|
|
73
|
+
line: string;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
severity: 'info' | 'warning' | 'critical';
|
|
76
|
+
filePath?: string;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=ConfigTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigTypes.d.ts","sourceRoot":"","sources":["../../src/types/ConfigTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG,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AAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigTypes.js","sourceRoot":"","sources":["../../src/types/ConfigTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexTypes.ts
|
|
3
|
+
* All TypeScript types and interfaces related to index building and storage.
|
|
4
|
+
*/
|
|
5
|
+
export type CompressionAlgorithm = 'none' | 'gzip' | 'zstd';
|
|
6
|
+
export interface IndexConfig {
|
|
7
|
+
/** Size of each chunk processed in parallel (bytes). Default: 64MB */
|
|
8
|
+
chunkSize?: number;
|
|
9
|
+
/** Max number of worker threads. Default: CPU cores - 1 */
|
|
10
|
+
maxWorkers?: number;
|
|
11
|
+
/** Compression algorithm for the index file. Default: 'gzip' */
|
|
12
|
+
compression?: CompressionAlgorithm;
|
|
13
|
+
/** Minimum token length to index. Default: 2 */
|
|
14
|
+
tokenMinLength?: number;
|
|
15
|
+
/** Include line numbers in the index. Default: true */
|
|
16
|
+
includeLineNumbers?: boolean;
|
|
17
|
+
/** Index timestamp tokens. Default: true */
|
|
18
|
+
includeTimestamps?: boolean;
|
|
19
|
+
/** Custom stop words to exclude from index */
|
|
20
|
+
stopWords?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface ChunkBoundary {
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
chunkId: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ChunkResult {
|
|
28
|
+
chunkId: number;
|
|
29
|
+
lineCount: number;
|
|
30
|
+
bytesProcessed: number;
|
|
31
|
+
/** Map of term → array of byte offsets in the file */
|
|
32
|
+
termOffsets: Record<string, number[]>;
|
|
33
|
+
/** Byte offset of each line start */
|
|
34
|
+
lineOffsets: number[];
|
|
35
|
+
}
|
|
36
|
+
export interface IndexMetadata {
|
|
37
|
+
totalLines: number;
|
|
38
|
+
uniqueTerms: number;
|
|
39
|
+
fileSize: number;
|
|
40
|
+
filePath: string;
|
|
41
|
+
fileHash: string;
|
|
42
|
+
builtAt: string;
|
|
43
|
+
buildTimeMs: number;
|
|
44
|
+
compressionRatio: number;
|
|
45
|
+
version: string;
|
|
46
|
+
}
|
|
47
|
+
export interface InvertedIndex {
|
|
48
|
+
/** term → sorted array of byte offsets (line starts) */
|
|
49
|
+
invertedIndex: Record<string, number[]>;
|
|
50
|
+
/** Sorted array of all line start byte offsets */
|
|
51
|
+
lineOffsets: number[];
|
|
52
|
+
metadata: IndexMetadata;
|
|
53
|
+
}
|
|
54
|
+
export interface BuildResult {
|
|
55
|
+
indexPath: string;
|
|
56
|
+
fileSize: number;
|
|
57
|
+
totalLines: number;
|
|
58
|
+
uniqueTerms: number;
|
|
59
|
+
buildTimeMs: number;
|
|
60
|
+
compressionRatio: number;
|
|
61
|
+
}
|
|
62
|
+
export interface IndexInfo {
|
|
63
|
+
indexPath: string;
|
|
64
|
+
filePath: string;
|
|
65
|
+
fileSize: number;
|
|
66
|
+
indexSize: number;
|
|
67
|
+
totalLines: number;
|
|
68
|
+
uniqueTerms: number;
|
|
69
|
+
builtAt: string;
|
|
70
|
+
compressionRatio: number;
|
|
71
|
+
isStale: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface WorkerTask {
|
|
74
|
+
task: 'processChunk';
|
|
75
|
+
filePath: string;
|
|
76
|
+
startByte: number;
|
|
77
|
+
endByte: number;
|
|
78
|
+
chunkId: number;
|
|
79
|
+
config: IndexConfig;
|
|
80
|
+
}
|
|
81
|
+
export interface WorkerResult {
|
|
82
|
+
chunkId: number;
|
|
83
|
+
result: ChunkResult;
|
|
84
|
+
error?: string;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=IndexTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexTypes.d.ts","sourceRoot":"","sources":["../../src/types/IndexTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,4CAA4C;IAC5C,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8C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AAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IndexTypes.js","sourceRoot":"","sources":["../../src/types/IndexTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SearchTypes.ts
|
|
3
|
+
* All TypeScript types and interfaces related to search queries and results.
|
|
4
|
+
*/
|
|
5
|
+
export type LogLevel = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'WARNING' | 'ERROR' | 'FATAL' | 'CRITICAL';
|
|
6
|
+
export interface SearchOptions {
|
|
7
|
+
/** Maximum number of results to return. Default: 1000 */
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Skip N results (for pagination). Default: 0 */
|
|
10
|
+
offset?: number;
|
|
11
|
+
/** Case-insensitive search. Default: true */
|
|
12
|
+
ignoreCase?: boolean;
|
|
13
|
+
/** Treat query as regex pattern. Default: false */
|
|
14
|
+
isRegex?: boolean;
|
|
15
|
+
/** Number of context lines around each match. Default: 0 */
|
|
16
|
+
context?: number;
|
|
17
|
+
/** Filter results after this ISO datetime */
|
|
18
|
+
since?: string;
|
|
19
|
+
/** Filter results before this ISO datetime */
|
|
20
|
+
until?: string;
|
|
21
|
+
/** Filter by log level */
|
|
22
|
+
level?: LogLevel;
|
|
23
|
+
/** Sort order for results. Default: 'line' */
|
|
24
|
+
sortBy?: 'line' | 'score' | 'timestamp';
|
|
25
|
+
/** Sort direction. Default: 'asc' */
|
|
26
|
+
sortDir?: 'asc' | 'desc';
|
|
27
|
+
}
|
|
28
|
+
export interface SearchResult {
|
|
29
|
+
/** 1-based line number in the original file */
|
|
30
|
+
lineNumber: number;
|
|
31
|
+
/** Byte offset in the file */
|
|
32
|
+
offset: number;
|
|
33
|
+
/** The raw line content */
|
|
34
|
+
content: string;
|
|
35
|
+
/** Array of [start, end] positions of matches within content */
|
|
36
|
+
highlights: Array<[number, number]>;
|
|
37
|
+
/** Relevance score (BM25-simplified) */
|
|
38
|
+
matchScore: number;
|
|
39
|
+
/** Context lines before the match */
|
|
40
|
+
contextBefore?: string[];
|
|
41
|
+
/** Context lines after the match */
|
|
42
|
+
contextAfter?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface SearchStats {
|
|
45
|
+
query: string;
|
|
46
|
+
filePath: string;
|
|
47
|
+
totalMatches: number;
|
|
48
|
+
searchTimeMs: number;
|
|
49
|
+
indexLoaded: boolean;
|
|
50
|
+
}
|
|
51
|
+
export type QueryType = 'simple' | 'phrase' | 'and' | 'or' | 'not' | 'regex' | 'fuzzy' | 'range' | 'level' | 'field';
|
|
52
|
+
export interface BaseQuery {
|
|
53
|
+
type: QueryType;
|
|
54
|
+
raw: string;
|
|
55
|
+
}
|
|
56
|
+
export interface SimpleQuery extends BaseQuery {
|
|
57
|
+
type: 'simple';
|
|
58
|
+
term: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PhraseQuery extends BaseQuery {
|
|
61
|
+
type: 'phrase';
|
|
62
|
+
terms: string[];
|
|
63
|
+
phrase: string;
|
|
64
|
+
}
|
|
65
|
+
export interface AndQuery extends BaseQuery {
|
|
66
|
+
type: 'and';
|
|
67
|
+
operands: ParsedQuery[];
|
|
68
|
+
}
|
|
69
|
+
export interface OrQuery extends BaseQuery {
|
|
70
|
+
type: 'or';
|
|
71
|
+
operands: ParsedQuery[];
|
|
72
|
+
}
|
|
73
|
+
export interface NotQuery extends BaseQuery {
|
|
74
|
+
type: 'not';
|
|
75
|
+
operand: ParsedQuery;
|
|
76
|
+
}
|
|
77
|
+
export interface RegexQuery extends BaseQuery {
|
|
78
|
+
type: 'regex';
|
|
79
|
+
pattern: RegExp;
|
|
80
|
+
}
|
|
81
|
+
export interface FuzzyQuery extends BaseQuery {
|
|
82
|
+
type: 'fuzzy';
|
|
83
|
+
term: string;
|
|
84
|
+
threshold: number;
|
|
85
|
+
}
|
|
86
|
+
export interface RangeQuery extends BaseQuery {
|
|
87
|
+
type: 'range';
|
|
88
|
+
field: string;
|
|
89
|
+
from?: string;
|
|
90
|
+
to?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface LevelQuery extends BaseQuery {
|
|
93
|
+
type: 'level';
|
|
94
|
+
level: LogLevel;
|
|
95
|
+
}
|
|
96
|
+
export interface FieldQuery extends BaseQuery {
|
|
97
|
+
type: 'field';
|
|
98
|
+
field: string;
|
|
99
|
+
value: string;
|
|
100
|
+
}
|
|
101
|
+
export type ParsedQuery = SimpleQuery | PhraseQuery | AndQuery | OrQuery | NotQuery | RegexQuery | FuzzyQuery | RangeQuery | LevelQuery | FieldQuery;
|
|
102
|
+
//# sourceMappingURL=SearchTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchTypes.d.ts","sourceRoot":"","sources":["../../src/types/SearchTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;AAExG,MAAM,WAAW,aA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AAW,UAAW,SAAQ,SAAS;IAC3C,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,WAAW,GACX,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchTypes.js","sourceRoot":"","sources":["../../src/types/SearchTypes.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* types/index.ts
|
|
4
|
+
* Central export for all type definitions.
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./IndexTypes"), exports);
|
|
22
|
+
__exportStar(require("./SearchTypes"), exports);
|
|
23
|
+
__exportStar(require("./ConfigTypes"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,gDAA8B;AAC9B,gDAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fs-helpers.ts
|
|
3
|
+
* File system utility functions.
|
|
4
|
+
*/
|
|
5
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
6
|
+
export declare function getFileSize(filePath: string): Promise<number>;
|
|
7
|
+
export declare function getLogSearchDir(): string;
|
|
8
|
+
export declare function formatBytes(bytes: number): string;
|
|
9
|
+
//# sourceMappingURL=fs-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/fs-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEnE;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKjD"}
|