codeflash-internal/js/cf-api/types.ts
Kevin Turcios d7a8b8f227
perf: fix CI build + lazy-load heavy libs + parallelize DB queries (#2601)
## Summary
- **Fix CI build failure**: Auth0Client crashes during Next.js
prerendering when env vars aren't set. Returns a no-op stub (`getSession
→ null`) when domain is missing — semantically correct for static
generation
- **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and
react-syntax-highlighter were eagerly imported in monaco-diff-viewer but
only rendered when user expands "Generated Tests". Extracted into a
dynamic component
- **Parallelize repo detail query**: `getRepositoryById` ran the
activity count sequentially after the repo lookup. Since `repoId` is
already available, all three queries now run in parallel

## Test plan
- [ ] CI `build` check passes (was failing since #2598)
- [ ] Trace page still renders generated tests correctly when expanded
- [ ] Repository detail page loads correctly with activity status
2026-04-13 11:03:05 -05:00

54 lines
1.7 KiB
TypeScript

import { Request } from "express"
// Permissive Octokit type
export type AnyOctokit = any
// PR response type
export type PullRequestCreationResponse = any
// Subscription info attached by track-usage middleware
export interface SubscriptionInfo {
userId: string
tier: string
used: number
limit: number
}
// Extended Request with userId and organizationId
export interface AuthorizedUserReq extends Request {
userId?: string
organizationId?: string | null
user?: {
id: string
email?: string
}
subscriptionInfo?: SubscriptionInfo
}
// PR database interface
export interface PullRequestDB {
pull_request: {
dependent_pr_url?: string
review_suggestion_pr_url?: string
[key: string]: any
}
}
// Complete AsyncExpressApp interface
export interface AsyncExpressApp {
post: ((path: string, handler: any) => AsyncExpressApp) &
((path: string, middleware: any, handler: any) => AsyncExpressApp) &
((path: string, ...handlers: any[]) => AsyncExpressApp)
// Async methods
postAsync: (path: string, handler: (req: any, res: any, next?: any) => Promise<any>) => void
getAsync: (path: string, handler: (req: any, res: any, next?: any) => Promise<any>) => void
// Standard Express methods
use: (pathOrMiddleware: any, middleware?: any) => AsyncExpressApp
get: (path: string, handler: (req: any, res: any, next?: any) => any) => AsyncExpressApp
put: (path: string, handler: (req: any, res: any, next?: any) => any) => AsyncExpressApp
delete: (path: string, handler: (req: any, res: any, next?: any) => any) => AsyncExpressApp
patch: (path: string, handler: (req: any, res: any, next?: any) => any) => AsyncExpressApp
listen: (port: number, callback?: () => void) => any
}