@taskbotjs/webapi
Advanced tools
Comparing version 0.1.0-alpha.5 to 0.9.0
@@ -212,33 +212,2 @@ "use strict"; | ||
})); | ||
app.get("/done", express_async_handler_1.default(async (req, res) => { | ||
const resp = await this.clientPool.use((taskbot) => taskbot.doneSet.peek(req.query.limit, req.query.offset)); | ||
res.json(resp); | ||
})); | ||
app.post("/done/clean", express_async_handler_1.default(async (req, res) => { | ||
const count = await this.clientPool.use((taskbot) => taskbot.doneSet.cleanAll()); | ||
res.json({ ok: true, count }); | ||
})); | ||
app.get("/done/:jobId", express_async_handler_1.default(async (req, res) => { | ||
const jobId = req.params.jobId; | ||
const resp = await this.clientPool.use(async (taskbot) => { | ||
if (await taskbot.doneSet.contains(jobId)) { | ||
return taskbot.readJob(jobId); | ||
} | ||
return null; | ||
}); | ||
if (!resp) { | ||
throw new APIError_1.NotFoundError(`Job '${jobId}' not found.`); | ||
} | ||
else { | ||
res.json(resp); | ||
} | ||
})); | ||
app.delete("/done/:jobId", express_async_handler_1.default(async (req, res) => { | ||
const jobId = req.params.jobId; | ||
await this.clientPool.use(async (taskbot) => { | ||
await taskbot.doneSet.remove(jobId); | ||
await taskbot.unsafeDeleteJob(jobId); | ||
}); | ||
res.json({ ok: true }); | ||
})); | ||
if (logRequests) { | ||
@@ -245,0 +214,0 @@ app.use(Middleware.buildErrorLoggingMiddleware(logger)); |
@@ -6,3 +6,3 @@ { | ||
"repository": "github:eropple/taskbotjs", | ||
"version": "0.1.0-alpha.5", | ||
"version": "0.9.0", | ||
"main": "dist", | ||
@@ -21,3 +21,3 @@ "files": [ | ||
"dependencies": { | ||
"@taskbotjs/client": "0.1.0-alpha.5", | ||
"@taskbotjs/client": "0.9.0", | ||
"async-lock": "1.1.3", | ||
@@ -24,0 +24,0 @@ "bunyan": "1.8.12", |
@@ -313,46 +313,2 @@ import { Server as HttpServer } from "http"; | ||
app.get("/done", asyncHandler(async (req, res) => { | ||
const resp: Array<JobDescriptor> = | ||
await this.clientPool.use( | ||
(taskbot) => taskbot.doneSet.peek(req.query.limit, req.query.offset)); | ||
res.json(resp); | ||
})); | ||
app.post("/done/clean", asyncHandler(async (req, res) => { | ||
const count = await this.clientPool.use((taskbot) => taskbot.doneSet.cleanAll()); | ||
res.json({ ok: true, count }); | ||
})); | ||
app.get("/done/:jobId", asyncHandler(async (req, res) => { | ||
const jobId = req.params.jobId; | ||
const resp: JobDescriptor | null = | ||
await this.clientPool.use( | ||
async (taskbot) => { | ||
if (await taskbot.doneSet.contains(jobId)) { | ||
return taskbot.readJob(jobId); | ||
} | ||
return null; | ||
}); | ||
if (!resp) { | ||
throw new NotFoundError(`Job '${jobId}' not found.`); | ||
} else { | ||
res.json(resp); | ||
} | ||
})); | ||
app.delete("/done/:jobId", asyncHandler(async (req, res) => { | ||
const jobId = req.params.jobId; | ||
await this.clientPool.use( | ||
async (taskbot) => { | ||
await taskbot.doneSet.remove(jobId); | ||
await taskbot.unsafeDeleteJob(jobId); | ||
}); | ||
res.json({ ok: true }); | ||
})); | ||
if (logRequests) { | ||
@@ -359,0 +315,0 @@ app.use(Middleware.buildErrorLoggingMiddleware(logger)); |
42513
670
+ Added@taskbotjs/client@0.9.0(transitive)
- Removed@taskbotjs/client@0.1.0-alpha.5(transitive)
Updated@taskbotjs/client@0.9.0