@loghead/core 0.1.13 → 0.1.15

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.
@@ -113,9 +113,14 @@ async function startApiServer(db) {
113
113
  if (!streamId) {
114
114
  return res.status(400).send("Missing streamId");
115
115
  }
116
- const page = parseInt(req.query.page || "1");
117
- const pageSize = parseInt(req.query.pageSize || "100");
118
- const limit = req.query.limit ? parseInt(req.query.limit) : pageSize;
116
+ let page = parseInt(req.query.page || "1");
117
+ if (page < 1)
118
+ page = 1;
119
+ let pageSize = parseInt(req.query.pageSize || "100");
120
+ let limit = req.query.limit ? parseInt(req.query.limit) : pageSize;
121
+ // Enforce max limit
122
+ if (limit > 1000)
123
+ limit = 1000;
119
124
  const offset = (page - 1) * limit;
120
125
  const query = req.query.q;
121
126
  let logs;
package/dist/cli_main.js CHANGED
@@ -20,7 +20,7 @@ async function main() {
20
20
  console.log("Initializing database...");
21
21
  await (0, migrate_1.migrate)();
22
22
  })
23
- .command("start", "Start API Server", {}, async () => {
23
+ .command(["start", "$0"], "Start API Server", {}, async () => {
24
24
  console.log("Ensuring database is initialized...");
25
25
  await (0, migrate_1.migrate)(false); // Run migrations silently
26
26
  const token = await auth.getOrCreateMcpToken();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loghead/core",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Core API and Database for Loghead",
5
5
  "repository": {
6
6
  "type": "git",
package/src/api/server.ts CHANGED
@@ -126,9 +126,15 @@ export async function startApiServer(db: DbService) {
126
126
  return res.status(400).send("Missing streamId");
127
127
  }
128
128
 
129
- const page = parseInt((req.query.page as string) || "1");
130
- const pageSize = parseInt((req.query.pageSize as string) || "100");
131
- const limit = req.query.limit ? parseInt(req.query.limit as string) : pageSize;
129
+ let page = parseInt((req.query.page as string) || "1");
130
+ if (page < 1) page = 1;
131
+
132
+ let pageSize = parseInt((req.query.pageSize as string) || "100");
133
+ let limit = req.query.limit ? parseInt(req.query.limit as string) : pageSize;
134
+
135
+ // Enforce max limit
136
+ if (limit > 1000) limit = 1000;
137
+
132
138
  const offset = (page - 1) * limit;
133
139
 
134
140
  const query = req.query.q as string;
package/src/cli_main.ts CHANGED
@@ -18,7 +18,7 @@ async function main() {
18
18
  console.log("Initializing database...");
19
19
  await migrate();
20
20
  })
21
- .command("start", "Start API Server", {}, async () => {
21
+ .command(["start", "$0"], "Start API Server", {}, async () => {
22
22
  console.log("Ensuring database is initialized...");
23
23
  await migrate(false); // Run migrations silently
24
24