Skip to main content

TypeScript types

Core imports​

import type {
Entity,
FeedbackCreateRequest,
Job,
JobEvent,
JobStatus,
MatchingAnalysisCreateJobRequest,
MediaFile,
Report,
ReportCreateJobRequest,
ReportJobReceipt,
TargetSelector,
WaitOptions,
} from "@mappa-ai/mappa-node";

Job lifecycle enums​

type JobStatus = "queued" | "running" | "succeeded" | "failed" | "canceled";

type JobStage =
| "uploaded"
| "queued"
| "transcoding"
| "extracting"
| "scoring"
| "rendering"
| "finalizing";

Report request/response shapes​

type ReportCreateJobRequest = {
media: { mediaId: string };
output: { template: "sales_playbook" | "general_report" | "hiring_report" | "profile_alignment"; templateParams?: Record<string, unknown> };
target: TargetSelector;
label?: string;
entityLabel?: string;
webhook?: { url: string; headers?: Record<string, string> };
};

type Report = {
id: string;
output: { template: "sales_playbook" | "general_report" | "hiring_report" | "profile_alignment" };
markdown?: string | null;
sections?: Array<{ section_title: string; section_content: unknown }> | null;
pdfUrl?: string;
reportUrl?: string;
};

Handle + wait types​

type WaitOptions = {
timeoutMs?: number;
onEvent?: (event: JobEvent) => void;
signal?: AbortSignal;
};

type ReportJobReceipt = {
jobId: string;
status: "queued" | "running";
handle?: {
wait(opts?: WaitOptions): Promise<Report>;
stream(): AsyncIterable<JobEvent>;
};
};

File + entity types​

type MediaFile = {
mediaId: string;
processingStatus: "PENDING" | "PROCESSING" | "COMPLETED" | "FAILED";
};

type Entity = {
id: string;
label: string | null;
mediaCount: number;
};