@hasna/logs 0.3.0 → 0.3.2
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/bun.lock +336 -0
- package/dist/cli/index.js +8 -8
- package/dist/export-yjaar93b.js +10 -0
- package/dist/health-egdb00st.js +8 -0
- package/dist/index-3dr7d80h.js +57 -0
- package/dist/index-5tvnhvgr.js +536 -0
- package/dist/index-6y8pmes4.js +45 -0
- package/dist/index-eh9bkbpa.js +70 -0
- package/dist/index-g8dczzvv.js +30 -0
- package/dist/index-rbrsvsyh.js +88 -0
- package/dist/index-wbsq8qjd.js +1241 -0
- package/dist/index-yb8yd4j6.js +39 -0
- package/dist/jobs-02z4fzsn.js +22 -0
- package/dist/mcp/index.js +6 -6
- package/dist/query-tcg3bm9s.js +14 -0
- package/dist/server/index.js +8 -8
- package/package.json +5 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
__require
|
|
4
|
+
} from "./index-g8dczzvv.js";
|
|
5
|
+
|
|
6
|
+
// src/lib/health.ts
|
|
7
|
+
var startTime = Date.now();
|
|
8
|
+
function getHealth(db) {
|
|
9
|
+
const projects = db.prepare("SELECT COUNT(*) as c FROM projects").get().c;
|
|
10
|
+
const total_logs = db.prepare("SELECT COUNT(*) as c FROM logs").get().c;
|
|
11
|
+
const scheduler_jobs = db.prepare("SELECT COUNT(*) as c FROM scan_jobs WHERE enabled = 1").get().c;
|
|
12
|
+
const open_issues = db.prepare("SELECT COUNT(*) as c FROM issues WHERE status = 'open'").get().c;
|
|
13
|
+
const levelRows = db.prepare("SELECT level, COUNT(*) as c FROM logs GROUP BY level").all();
|
|
14
|
+
const logs_by_level = Object.fromEntries(levelRows.map((r) => [r.level, r.c]));
|
|
15
|
+
const oldest = db.prepare("SELECT MIN(timestamp) as t FROM logs").get();
|
|
16
|
+
const newest = db.prepare("SELECT MAX(timestamp) as t FROM logs").get();
|
|
17
|
+
let db_size_bytes = null;
|
|
18
|
+
try {
|
|
19
|
+
const dbPath = process.env.LOGS_DB_PATH;
|
|
20
|
+
if (dbPath) {
|
|
21
|
+
const { statSync } = __require("fs");
|
|
22
|
+
db_size_bytes = statSync(dbPath).size;
|
|
23
|
+
}
|
|
24
|
+
} catch {}
|
|
25
|
+
return {
|
|
26
|
+
status: "ok",
|
|
27
|
+
uptime_seconds: Math.floor((Date.now() - startTime) / 1000),
|
|
28
|
+
db_size_bytes,
|
|
29
|
+
projects,
|
|
30
|
+
total_logs,
|
|
31
|
+
logs_by_level,
|
|
32
|
+
oldest_log: oldest.t,
|
|
33
|
+
newest_log: newest.t,
|
|
34
|
+
scheduler_jobs,
|
|
35
|
+
open_issues
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { getHealth };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
createJob,
|
|
4
|
+
createScanRun,
|
|
5
|
+
deleteJob,
|
|
6
|
+
finishScanRun,
|
|
7
|
+
getJob,
|
|
8
|
+
listJobs,
|
|
9
|
+
listScanRuns,
|
|
10
|
+
updateJob
|
|
11
|
+
} from "./index-3dr7d80h.js";
|
|
12
|
+
import"./index-g8dczzvv.js";
|
|
13
|
+
export {
|
|
14
|
+
updateJob,
|
|
15
|
+
listScanRuns,
|
|
16
|
+
listJobs,
|
|
17
|
+
getJob,
|
|
18
|
+
finishScanRun,
|
|
19
|
+
deleteJob,
|
|
20
|
+
createScanRun,
|
|
21
|
+
createJob
|
|
22
|
+
};
|
package/dist/mcp/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
import {
|
|
4
4
|
countLogs
|
|
5
|
-
} from "../index-
|
|
5
|
+
} from "../index-6y8pmes4.js";
|
|
6
6
|
import {
|
|
7
7
|
createAlertRule,
|
|
8
8
|
createPage,
|
|
@@ -21,21 +21,21 @@ import {
|
|
|
21
21
|
scoreLabel,
|
|
22
22
|
summarizeLogs,
|
|
23
23
|
updateIssueStatus
|
|
24
|
-
} from "../index-
|
|
24
|
+
} from "../index-5tvnhvgr.js";
|
|
25
25
|
import {
|
|
26
26
|
createJob,
|
|
27
27
|
listJobs
|
|
28
|
-
} from "../
|
|
28
|
+
} from "../index-3dr7d80h.js";
|
|
29
29
|
import {
|
|
30
30
|
getLogContext,
|
|
31
31
|
getLogContextFromId,
|
|
32
32
|
parseTime,
|
|
33
33
|
searchLogs,
|
|
34
34
|
tailLogs
|
|
35
|
-
} from "../
|
|
35
|
+
} from "../index-rbrsvsyh.js";
|
|
36
36
|
import {
|
|
37
37
|
getHealth
|
|
38
|
-
} from "../
|
|
38
|
+
} from "../index-yb8yd4j6.js";
|
|
39
39
|
import {
|
|
40
40
|
__commonJS,
|
|
41
41
|
__export,
|
|
@@ -6301,7 +6301,7 @@ var require_formats = __commonJS((exports) => {
|
|
|
6301
6301
|
}
|
|
6302
6302
|
var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;
|
|
6303
6303
|
function getTime(strictTimeZone) {
|
|
6304
|
-
return function
|
|
6304
|
+
return function time3(str) {
|
|
6305
6305
|
const matches = TIME.exec(str);
|
|
6306
6306
|
if (!matches)
|
|
6307
6307
|
return false;
|
package/dist/server/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
setPageAuth,
|
|
7
7
|
setRetentionPolicy,
|
|
8
8
|
startScheduler
|
|
9
|
-
} from "../index-
|
|
9
|
+
} from "../index-wbsq8qjd.js";
|
|
10
10
|
import {
|
|
11
11
|
countLogs
|
|
12
|
-
} from "../index-
|
|
12
|
+
} from "../index-6y8pmes4.js";
|
|
13
13
|
import {
|
|
14
14
|
createAlertRule,
|
|
15
15
|
createPage,
|
|
@@ -31,26 +31,26 @@ import {
|
|
|
31
31
|
updateAlertRule,
|
|
32
32
|
updateIssueStatus,
|
|
33
33
|
updateProject
|
|
34
|
-
} from "../index-
|
|
34
|
+
} from "../index-5tvnhvgr.js";
|
|
35
35
|
import {
|
|
36
36
|
createJob,
|
|
37
37
|
deleteJob,
|
|
38
38
|
listJobs,
|
|
39
39
|
updateJob
|
|
40
|
-
} from "../
|
|
40
|
+
} from "../index-3dr7d80h.js";
|
|
41
41
|
import {
|
|
42
42
|
getLogContext,
|
|
43
43
|
parseTime,
|
|
44
44
|
searchLogs,
|
|
45
45
|
tailLogs
|
|
46
|
-
} from "../
|
|
46
|
+
} from "../index-rbrsvsyh.js";
|
|
47
47
|
import {
|
|
48
48
|
exportToCsv,
|
|
49
49
|
exportToJson
|
|
50
|
-
} from "../
|
|
50
|
+
} from "../index-eh9bkbpa.js";
|
|
51
51
|
import {
|
|
52
52
|
getHealth
|
|
53
|
-
} from "../
|
|
53
|
+
} from "../index-yb8yd4j6.js";
|
|
54
54
|
import"../index-g8dczzvv.js";
|
|
55
55
|
|
|
56
56
|
// node_modules/hono/dist/compose.js
|
|
@@ -1840,7 +1840,7 @@ var serveStatic = (options) => {
|
|
|
1840
1840
|
|
|
1841
1841
|
// node_modules/hono/dist/adapter/bun/serve-static.js
|
|
1842
1842
|
var serveStatic2 = (options) => {
|
|
1843
|
-
return async function
|
|
1843
|
+
return async function serveStatic22(c, next) {
|
|
1844
1844
|
const getContent = async (path) => {
|
|
1845
1845
|
const file = Bun.file(path);
|
|
1846
1846
|
return await file.exists() ? file : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/logs",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Log aggregation + browser script + headless page scanner + performance monitoring for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"test:coverage": "bun test --coverage",
|
|
20
20
|
"lint": "biome check src/"
|
|
21
21
|
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/hasna/logs.git"
|
|
25
|
+
},
|
|
22
26
|
"publishConfig": {
|
|
23
27
|
"access": "restricted",
|
|
24
28
|
"registry": "https://registry.npmjs.org/"
|