Skip to content

Function: pollDocument() ​

ts
function pollDocument(
   client, 
   id, 
   opts?
): Promise<{
  caseId?: string | null;
  contentType: string;
  createdAt: Date;
  fieldKey?: string | null;
  fileName: string;
  id: string;
  rejectionCode?:   | "empty"
     | "too_large"
     | "size_mismatch"
     | "type_mismatch"
     | "unsupported_type"
     | "undecodable_image"
     | "pdf_active_content"
     | "object_missing"
     | null;
  rejectionReason?: string | null;
  scan?:   | {
     engine: string;
     scannedAt: Date;
     signature?: string;
   }
     | null;
  sha256?: string | null;
  sizeBytes: number;
  status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected";
  storageKey: string;
  subjectId: string;
  submissionId?: string | null;
  tenantId: string;
  thumbnailKey?: string | null;
  updatedAt: Date;
  uploadedBy: string;
}>;

Reads the document until its status is terminal (clean, infected or rejected). The first read is immediate; later ones every intervalMs (750 ms) until timeoutMs (60 s).

Parameters ​

client ​

documents ​

Pick<DocumentsClient, "get">

id ​

string

opts? ​

PollOptions = {}

Returns ​

Promise<{ caseId?: string | null; contentType: string; createdAt: Date; fieldKey?: string | null; fileName: string; id: string; rejectionCode?: | "empty" | "too_large" | "size_mismatch" | "type_mismatch" | "unsupported_type" | "undecodable_image" | "pdf_active_content" | "object_missing" | null; rejectionReason?: string | null; scan?: | { engine: string; scannedAt: Date; signature?: string; } | null; sha256?: string | null; sizeBytes: number; status: "pending" | "uploaded" | "rejected" | "scanning" | "clean" | "infected"; storageKey: string; subjectId: string; submissionId?: string | null; tenantId: string; thumbnailKey?: string | null; updatedAt: Date; uploadedBy: string; }>

Released under the Apache-2.0 License.