Integrate PageSpeed Insights audits
This commit is contained in:
@@ -95,6 +95,22 @@ const runEventLevel = v.union(
|
||||
...RUN_EVENT_LEVELS.map((level) => v.literal(level)),
|
||||
);
|
||||
const screenshotViewport = v.union(v.literal("desktop"), v.literal("mobile"));
|
||||
const pageSpeedStrategy = v.union(
|
||||
v.literal("mobile"),
|
||||
v.literal("desktop"),
|
||||
);
|
||||
const pageSpeedResultStatus = v.union(
|
||||
v.literal("succeeded"),
|
||||
v.literal("failed"),
|
||||
);
|
||||
const pageSpeedErrorType = v.union(
|
||||
v.literal("quota"),
|
||||
v.literal("timeout"),
|
||||
v.literal("unavailable"),
|
||||
v.literal("invalid_url"),
|
||||
v.literal("api_error"),
|
||||
v.literal("unknown"),
|
||||
);
|
||||
const settingsValue = v.union(v.string(), v.number(), v.boolean(), v.null());
|
||||
const auditMetricSummary = v.object({
|
||||
performanceScore: v.optional(v.number()),
|
||||
@@ -255,6 +271,48 @@ export default defineSchema({
|
||||
.index("by_auditId_and_viewport", ["auditId", "viewport"])
|
||||
.index("by_storageId", ["storageId"]),
|
||||
|
||||
pageSpeedResults: defineTable({
|
||||
leadId: v.id("leads"),
|
||||
auditId: v.optional(v.id("audits")),
|
||||
runId: v.optional(v.id("agentRuns")),
|
||||
strategy: pageSpeedStrategy,
|
||||
status: pageSpeedResultStatus,
|
||||
sourceUrl: v.string(),
|
||||
finalUrl: v.optional(v.string()),
|
||||
rawStorageId: v.optional(v.id("_storage")),
|
||||
errorType: v.optional(pageSpeedErrorType),
|
||||
errorSummary: v.optional(v.string()),
|
||||
fetchedAt: v.number(),
|
||||
createdAt: v.number(),
|
||||
normalized: v.optional(
|
||||
v.object({
|
||||
scores: v.optional(
|
||||
v.object({
|
||||
performance: v.optional(v.number()),
|
||||
accessibility: v.optional(v.number()),
|
||||
bestPractices: v.optional(v.number()),
|
||||
seo: v.optional(v.number()),
|
||||
}),
|
||||
),
|
||||
metrics: v.optional(
|
||||
v.object({
|
||||
firstContentfulPaintMs: v.optional(v.number()),
|
||||
largestContentfulPaintMs: v.optional(v.number()),
|
||||
cumulativeLayoutShift: v.optional(v.number()),
|
||||
totalBlockingTimeMs: v.optional(v.number()),
|
||||
speedIndexMs: v.optional(v.number()),
|
||||
}),
|
||||
),
|
||||
opportunities: v.optional(v.array(v.string())),
|
||||
implications: v.optional(v.array(v.string())),
|
||||
}),
|
||||
),
|
||||
})
|
||||
.index("by_leadId", ["leadId"])
|
||||
.index("by_runId", ["runId"])
|
||||
.index("by_auditId", ["auditId"])
|
||||
.index("by_leadId_and_strategy", ["leadId", "strategy"]),
|
||||
|
||||
websiteCrawlPages: defineTable({
|
||||
leadId: v.id("leads"),
|
||||
runId: v.optional(v.id("agentRuns")),
|
||||
|
||||
Reference in New Issue
Block a user