feat: add website enrichment crawler
This commit is contained in:
@@ -1,26 +1,17 @@
|
||||
import { v } from "convex/values";
|
||||
|
||||
import { normalizeListLimit } from "./domain";
|
||||
import {
|
||||
RUN_EVENT_LEVELS,
|
||||
RUN_STATUSES,
|
||||
RUN_TYPES,
|
||||
normalizeListLimit,
|
||||
} from "./domain";
|
||||
import { mutation, query } from "./_generated/server";
|
||||
|
||||
const runType = v.union(
|
||||
v.literal("campaign"),
|
||||
v.literal("lead_discovery"),
|
||||
v.literal("audit"),
|
||||
v.literal("outreach"),
|
||||
v.literal("lifecycle"),
|
||||
);
|
||||
const runStatus = v.union(
|
||||
v.literal("pending"),
|
||||
v.literal("running"),
|
||||
v.literal("succeeded"),
|
||||
v.literal("failed"),
|
||||
v.literal("canceled"),
|
||||
);
|
||||
const runType = v.union(...RUN_TYPES.map((type) => v.literal(type)));
|
||||
const runStatus = v.union(...RUN_STATUSES.map((status) => v.literal(status)));
|
||||
const eventLevel = v.union(
|
||||
v.literal("info"),
|
||||
v.literal("warning"),
|
||||
v.literal("error"),
|
||||
...RUN_EVENT_LEVELS.map((level) => v.literal(level)),
|
||||
);
|
||||
|
||||
export const create = mutation({
|
||||
@@ -116,6 +107,16 @@ export const list = query({
|
||||
.take(limit);
|
||||
}
|
||||
|
||||
if (args.type) {
|
||||
const type = args.type;
|
||||
|
||||
return await ctx.db
|
||||
.query("agentRuns")
|
||||
.withIndex("by_type", (q) => q.eq("type", type))
|
||||
.order("desc")
|
||||
.take(limit);
|
||||
}
|
||||
|
||||
if (args.status) {
|
||||
const status = args.status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user