- Fix bulk CSV upload functionality that was returning HTML errors - Implement proper project/organization handling for logged-in vs anonymous users - Update user registration to create unique Default Organization and Default Project - Fix frontend API URL configuration for bulk upload endpoints - Resolve foreign key constraint violations in bulk processing - Update BulkProcessorService to use in-memory processing instead of Redis - Fix redirect-tracker service to handle missing project IDs properly - Update Prisma schema for optional project relationships in bulk jobs - Improve registration form UI with better password validation and alignment
186 lines
5.9 KiB
TypeScript
186 lines
5.9 KiB
TypeScript
import { z } from 'zod';
|
|
export interface BulkTrackingJob {
|
|
id: string;
|
|
userId: string;
|
|
organizationId?: string;
|
|
projectId?: string;
|
|
urls: Array<{
|
|
url: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}>;
|
|
options: {
|
|
method: 'GET' | 'POST' | 'HEAD';
|
|
userAgent?: string;
|
|
maxHops: number;
|
|
timeout: number;
|
|
enableSSLAnalysis: boolean;
|
|
enableSEOAnalysis: boolean;
|
|
enableSecurityAnalysis: boolean;
|
|
headers?: Record<string, string>;
|
|
};
|
|
status: 'PENDING' | 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'ERROR';
|
|
progress: {
|
|
total: number;
|
|
processed: number;
|
|
successful: number;
|
|
failed: number;
|
|
};
|
|
results?: Array<{
|
|
url: string;
|
|
label?: string;
|
|
checkId?: string;
|
|
status: 'success' | 'failed';
|
|
error?: string;
|
|
timing: {
|
|
startedAt: Date;
|
|
finishedAt?: Date;
|
|
durationMs?: number;
|
|
};
|
|
}>;
|
|
createdAt: Date;
|
|
startedAt?: Date;
|
|
finishedAt?: Date;
|
|
estimatedCompletionAt?: Date;
|
|
}
|
|
declare const BulkJobCreateSchema: z.ZodObject<{
|
|
projectId: z.ZodOptional<z.ZodString>;
|
|
urls: z.ZodArray<z.ZodObject<{
|
|
url: z.ZodString;
|
|
label: z.ZodOptional<z.ZodString>;
|
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
}, "strip", z.ZodTypeAny, {
|
|
url?: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}, {
|
|
url?: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}>, "many">;
|
|
options: z.ZodDefault<z.ZodObject<{
|
|
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "HEAD"]>>;
|
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
maxHops: z.ZodDefault<z.ZodNumber>;
|
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
enableSSLAnalysis: z.ZodDefault<z.ZodBoolean>;
|
|
enableSEOAnalysis: z.ZodDefault<z.ZodBoolean>;
|
|
enableSecurityAnalysis: z.ZodDefault<z.ZodBoolean>;
|
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
}, "strip", z.ZodTypeAny, {
|
|
headers?: Record<string, string>;
|
|
timeout?: number;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
userAgent?: string;
|
|
maxHops?: number;
|
|
enableSSLAnalysis?: boolean;
|
|
enableSEOAnalysis?: boolean;
|
|
enableSecurityAnalysis?: boolean;
|
|
}, {
|
|
headers?: Record<string, string>;
|
|
timeout?: number;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
userAgent?: string;
|
|
maxHops?: number;
|
|
enableSSLAnalysis?: boolean;
|
|
enableSEOAnalysis?: boolean;
|
|
enableSecurityAnalysis?: boolean;
|
|
}>>;
|
|
}, "strip", z.ZodTypeAny, {
|
|
options?: {
|
|
headers?: Record<string, string>;
|
|
timeout?: number;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
userAgent?: string;
|
|
maxHops?: number;
|
|
enableSSLAnalysis?: boolean;
|
|
enableSEOAnalysis?: boolean;
|
|
enableSecurityAnalysis?: boolean;
|
|
};
|
|
projectId?: string;
|
|
urls?: {
|
|
url?: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}[];
|
|
}, {
|
|
options?: {
|
|
headers?: Record<string, string>;
|
|
timeout?: number;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
userAgent?: string;
|
|
maxHops?: number;
|
|
enableSSLAnalysis?: boolean;
|
|
enableSEOAnalysis?: boolean;
|
|
enableSecurityAnalysis?: boolean;
|
|
};
|
|
projectId?: string;
|
|
urls?: {
|
|
url?: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}[];
|
|
}>;
|
|
declare const CsvRowSchema: z.ZodObject<{
|
|
url: z.ZodString;
|
|
label: z.ZodOptional<z.ZodString>;
|
|
method: z.ZodOptional<z.ZodEnum<["GET", "POST", "HEAD"]>>;
|
|
user_agent: z.ZodOptional<z.ZodString>;
|
|
max_hops: z.ZodOptional<z.ZodString>;
|
|
timeout: z.ZodOptional<z.ZodString>;
|
|
enable_ssl: z.ZodOptional<z.ZodString>;
|
|
enable_seo: z.ZodOptional<z.ZodString>;
|
|
enable_security: z.ZodOptional<z.ZodString>;
|
|
}, "strip", z.ZodTypeAny, {
|
|
timeout?: string;
|
|
url?: string;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
label?: string;
|
|
user_agent?: string;
|
|
max_hops?: string;
|
|
enable_ssl?: string;
|
|
enable_seo?: string;
|
|
enable_security?: string;
|
|
}, {
|
|
timeout?: string;
|
|
url?: string;
|
|
method?: "GET" | "HEAD" | "POST";
|
|
label?: string;
|
|
user_agent?: string;
|
|
max_hops?: string;
|
|
enable_ssl?: string;
|
|
enable_seo?: string;
|
|
enable_security?: string;
|
|
}>;
|
|
export type BulkJobCreateRequest = z.infer<typeof BulkJobCreateSchema>;
|
|
export type CsvRow = z.infer<typeof CsvRowSchema>;
|
|
export declare class BulkProcessorService {
|
|
private readonly uploadsDir;
|
|
private readonly inMemoryJobs;
|
|
constructor();
|
|
private ensureUploadsDirectory;
|
|
parseCsvFile(filePath: string): Promise<Array<{
|
|
url: string;
|
|
label?: string;
|
|
metadata?: Record<string, any>;
|
|
}>>;
|
|
private parseBoolean;
|
|
createBulkJob(userId: string, organizationId: string | undefined, jobData: BulkJobCreateRequest, filePath?: string): Promise<BulkTrackingJob>;
|
|
createBulkJobFromCsv(userId: string, organizationId: string | undefined, filePath: string, projectId: string, options?: Partial<BulkJobCreateRequest['options']>): Promise<BulkTrackingJob>;
|
|
getBulkJob(jobId: string, userId: string): Promise<BulkTrackingJob | null>;
|
|
private calculateEstimatedCompletion;
|
|
cancelBulkJob(jobId: string, userId: string): Promise<boolean>;
|
|
getUserBulkJobs(userId: string, limit?: number, offset?: number): Promise<BulkTrackingJob[]>;
|
|
exportResultsToCsv(jobId: string, userId: string): Promise<string>;
|
|
cleanupOldJobs(maxAgeHours?: number): Promise<void>;
|
|
getQueueStats(): Promise<{
|
|
waiting: number;
|
|
active: number;
|
|
completed: number;
|
|
failed: number;
|
|
delayed: number;
|
|
}>;
|
|
private processBulkJobInMemory;
|
|
}
|
|
export {};
|
|
//# sourceMappingURL=bulk-processor.service.d.ts.map
|