@lovelybunch/api 1.0.69-alpha.18 → 1.0.69-alpha.19
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/dist/routes/api/v1/events/purge/route.d.ts +0 -2
- package/dist/routes/api/v1/events/purge/route.js +2 -14
- package/dist/routes/api/v1/events/route.d.ts +0 -2
- package/dist/routes/api/v1/events/route.js +2 -14
- package/dist/routes/api/v1/events/stream/route.js +2 -14
- package/package.json +4 -4
- package/static/assets/{index-B8R7MEZ5.js → index-BGfUbDUx.js} +3 -3
- package/static/index.html +1 -1
|
@@ -9,8 +9,6 @@ import { Context } from "hono";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function POST(c: Context): Promise<(Response & import("hono").TypedResponse<{
|
|
11
11
|
error: string;
|
|
12
|
-
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
13
|
-
error: string;
|
|
14
12
|
}, 400, "json">) | (Response & import("hono").TypedResponse<{
|
|
15
13
|
deleted: number;
|
|
16
14
|
}, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Events purge endpoint
|
|
3
3
|
*/
|
|
4
|
+
import { getLogsDir } from "@lovelybunch/core";
|
|
4
5
|
import { promises as fs } from "fs";
|
|
5
6
|
import path from "path";
|
|
6
|
-
import { findGaitDirectory } from "../../../../../lib/gait-path.js";
|
|
7
|
-
/**
|
|
8
|
-
* Get the events directory path
|
|
9
|
-
*/
|
|
10
|
-
async function getEventsDir() {
|
|
11
|
-
const gaitDir = await findGaitDirectory();
|
|
12
|
-
if (!gaitDir)
|
|
13
|
-
return null;
|
|
14
|
-
return path.join(gaitDir, "logs");
|
|
15
|
-
}
|
|
16
7
|
/**
|
|
17
8
|
* POST /api/v1/events/purge
|
|
18
9
|
* Delete rotated files older than a timestamp
|
|
@@ -20,10 +11,7 @@ async function getEventsDir() {
|
|
|
20
11
|
*/
|
|
21
12
|
export async function POST(c) {
|
|
22
13
|
try {
|
|
23
|
-
const eventsDir =
|
|
24
|
-
if (!eventsDir) {
|
|
25
|
-
return c.json({ error: "Events directory not found" }, 404);
|
|
26
|
-
}
|
|
14
|
+
const eventsDir = getLogsDir();
|
|
27
15
|
const body = await c.req.json();
|
|
28
16
|
const beforeIso = body.beforeIso;
|
|
29
17
|
if (!beforeIso) {
|
|
@@ -19,8 +19,6 @@ export declare function POST(c: Context): Promise<(Response & import("hono").Typ
|
|
|
19
19
|
* Fetch a page of events from the current file
|
|
20
20
|
*/
|
|
21
21
|
export declare function GET(c: Context): Promise<(Response & import("hono").TypedResponse<{
|
|
22
|
-
error: string;
|
|
23
|
-
}, 404, "json">) | (Response & import("hono").TypedResponse<{
|
|
24
22
|
items: any[];
|
|
25
23
|
next_since_seq: number;
|
|
26
24
|
eof: boolean;
|
|
@@ -3,20 +3,11 @@
|
|
|
3
3
|
* Provides endpoints for logging, querying, and streaming events
|
|
4
4
|
*/
|
|
5
5
|
import { getLogger } from "@lovelybunch/core/logging";
|
|
6
|
+
import { getLogsDir } from "@lovelybunch/core";
|
|
6
7
|
import { promises as fs } from "fs";
|
|
7
8
|
import * as fsSync from "fs";
|
|
8
9
|
import path from "path";
|
|
9
|
-
import { findGaitDirectory } from "../../../../lib/gait-path.js";
|
|
10
10
|
import readline from "readline";
|
|
11
|
-
/**
|
|
12
|
-
* Get the events directory path
|
|
13
|
-
*/
|
|
14
|
-
async function getEventsDir() {
|
|
15
|
-
const gaitDir = await findGaitDirectory();
|
|
16
|
-
if (!gaitDir)
|
|
17
|
-
return null;
|
|
18
|
-
return path.join(gaitDir, "logs");
|
|
19
|
-
}
|
|
20
11
|
/**
|
|
21
12
|
* POST /api/v1/events
|
|
22
13
|
* Enqueue one or many events
|
|
@@ -50,10 +41,7 @@ export async function POST(c) {
|
|
|
50
41
|
*/
|
|
51
42
|
export async function GET(c) {
|
|
52
43
|
try {
|
|
53
|
-
const eventsDir =
|
|
54
|
-
if (!eventsDir) {
|
|
55
|
-
return c.json({ error: "Events directory not found" }, 404);
|
|
56
|
-
}
|
|
44
|
+
const eventsDir = getLogsDir();
|
|
57
45
|
const url = new URL(c.req.url);
|
|
58
46
|
const sinceSeq = parseInt(url.searchParams.get("since_seq") || "0", 10);
|
|
59
47
|
const limit = Math.min(parseInt(url.searchParams.get("limit") || "1000", 10), 5000);
|
|
@@ -2,29 +2,17 @@
|
|
|
2
2
|
* Events streaming endpoint for real-time tailing
|
|
3
3
|
*/
|
|
4
4
|
import { streamSSE } from "hono/streaming";
|
|
5
|
+
import { getLogsDir } from "@lovelybunch/core";
|
|
5
6
|
import { promises as fs } from "fs";
|
|
6
7
|
import * as fsSync from "fs";
|
|
7
8
|
import path from "path";
|
|
8
|
-
import { findGaitDirectory } from "../../../../../lib/gait-path.js";
|
|
9
9
|
import readline from "readline";
|
|
10
|
-
/**
|
|
11
|
-
* Get the events directory path
|
|
12
|
-
*/
|
|
13
|
-
async function getEventsDir() {
|
|
14
|
-
const gaitDir = await findGaitDirectory();
|
|
15
|
-
if (!gaitDir)
|
|
16
|
-
return null;
|
|
17
|
-
return path.join(gaitDir, "logs");
|
|
18
|
-
}
|
|
19
10
|
/**
|
|
20
11
|
* GET /api/v1/events/stream?since_seq=
|
|
21
12
|
* Server-Sent Events stream for near real-time tails
|
|
22
13
|
*/
|
|
23
14
|
export async function GET(c) {
|
|
24
|
-
const eventsDir =
|
|
25
|
-
if (!eventsDir) {
|
|
26
|
-
return c.json({ error: "Events directory not found" }, 404);
|
|
27
|
-
}
|
|
15
|
+
const eventsDir = getLogsDir();
|
|
28
16
|
const url = new URL(c.req.url);
|
|
29
17
|
const sinceSeq = parseInt(url.searchParams.get("since_seq") || "0", 10);
|
|
30
18
|
const currentFile = path.join(eventsDir, "events-current.jsonl");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovelybunch/api",
|
|
3
|
-
"version": "1.0.69-alpha.
|
|
3
|
+
"version": "1.0.69-alpha.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/server-with-static.js",
|
|
6
6
|
"exports": {
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@hono/node-server": "^1.13.7",
|
|
38
38
|
"@hono/node-ws": "^1.0.6",
|
|
39
|
-
"@lovelybunch/core": "^1.0.69-alpha.
|
|
40
|
-
"@lovelybunch/mcp": "^1.0.69-alpha.
|
|
41
|
-
"@lovelybunch/types": "^1.0.69-alpha.
|
|
39
|
+
"@lovelybunch/core": "^1.0.69-alpha.19",
|
|
40
|
+
"@lovelybunch/mcp": "^1.0.69-alpha.19",
|
|
41
|
+
"@lovelybunch/types": "^1.0.69-alpha.19",
|
|
42
42
|
"arctic": "^1.9.2",
|
|
43
43
|
"bcrypt": "^5.1.1",
|
|
44
44
|
"cookie": "^0.6.0",
|