Externalize audit pipeline services
This commit is contained in:
@@ -89,6 +89,7 @@ type AuditGenerationEvidence = {
|
||||
technicalChecks: AuditGenerationEvidenceTechnicalCheck[];
|
||||
screenshots: AuditGenerationEvidenceScreenshot[];
|
||||
pageSpeedInputs: PageSpeedMinimalAuditResult[];
|
||||
externalMarkdown?: string;
|
||||
};
|
||||
|
||||
function byteLength(value: string) {
|
||||
@@ -199,6 +200,8 @@ const secretHints = [
|
||||
"SMTP_USER",
|
||||
"BETTER_AUTH_SECRET",
|
||||
"RYBBIT_API_KEY",
|
||||
"SCREENSHOTONE_API_KEY",
|
||||
"JINA_API_KEY",
|
||||
];
|
||||
|
||||
function sanitizeSecretCandidates(value: string | undefined): string | undefined {
|
||||
@@ -226,7 +229,7 @@ function sanitizeSecretCandidates(value: string | undefined): string | undefined
|
||||
}
|
||||
|
||||
function escapeRegExp(value: string) {
|
||||
return value.replace(/[.*+?^${}()|[\\]\\]/g, "\\$&");
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
type StartLeadSnapshot = Pick<
|
||||
@@ -549,6 +552,35 @@ export const persistAuditGenerationResult = internalMutation({
|
||||
},
|
||||
});
|
||||
|
||||
export const persistExternalCaptureScreenshot = internalMutation({
|
||||
args: {
|
||||
leadId: v.id("leads"),
|
||||
runId: v.id("agentRuns"),
|
||||
storageId: v.id("_storage"),
|
||||
viewport: v.union(v.literal("desktop"), v.literal("mobile")),
|
||||
sourceUrl: v.string(),
|
||||
capturedAt: v.number(),
|
||||
width: v.number(),
|
||||
height: v.number(),
|
||||
mimeType: v.string(),
|
||||
},
|
||||
returns: v.id("websiteCrawlScreenshots"),
|
||||
handler: async (ctx, args): Promise<Id<"websiteCrawlScreenshots">> => {
|
||||
return await ctx.db.insert("websiteCrawlScreenshots", {
|
||||
leadId: args.leadId,
|
||||
runId: args.runId,
|
||||
storageId: args.storageId,
|
||||
viewport: args.viewport,
|
||||
sourceUrl: args.sourceUrl,
|
||||
capturedAt: args.capturedAt,
|
||||
width: args.width,
|
||||
height: args.height,
|
||||
mimeType: args.mimeType,
|
||||
createdAt: Date.now(),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
export const finishAuditGenerationRun = internalMutation({
|
||||
args: {
|
||||
runId: v.id("agentRuns"),
|
||||
|
||||
Reference in New Issue
Block a user