Skip to main content

Types

Types are shared between @syncsnap/react and syncsnap where applicable. Import from the package you use.

JobStatus

type JobStatus = "pending" | "in_progress" | "completed" | "failed";

Job

interface Job {
  id: string;
  projectId: string;
  status: JobStatus;
  fileName?: string | null;
  createdAt: string;
  updatedAt: string;
}

CreateJobResponse

Returned when creating a job (POST job).
interface CreateJobResponse {
  id: string;
  projectId: string;
  status: JobStatus;
  createdAt: string;
  updatedAt: string;
}

PresignedUrlResponse

Returned when requesting a presigned upload or download URL.
interface PresignedUrlResponse {
  url: string;
  fileName: string;
  expiration: string;
}

CompletedJobResponse (React)

When the server is configured with onCompleted, the download response can include a custom payload.
interface CompletedJobResponse<T = unknown> extends PresignedUrlResponse {
  completedPayload?: T;
}

UseSyncsnapJobOptions (React)

Options for useSyncsnapJob. See useSyncsnapJob API.

UseSyncsnapJobResult (React)

Return value of useSyncsnapJob.

WaitForJobOptions (Server)

Options for SyncsnapServer.waitForJobCompletion:
interface WaitForJobOptions {
  intervalMs?: number;
  timeoutMs?: number;
  onPoll?: (job: Job) => void;
  signal?: AbortSignal;
}