Shared Types and Utilities

This directory contains TypeScript types and utilities shared between the frontend and backend.

types.ts

PDFOperation

Defines the structure for PDF tool operations:

  • type: Operation identifier
  • name: Display name
  • description: Tool description
  • icon: Emoji icon

FileUploadState

Manages file upload state:

  • files: Array of selected files
  • isUploading: Upload status
  • error: Error message if any

PDFInfo

PDF metadata structure:

  • pageCount: Number of pages
  • title, author, subject: PDF metadata
  • creationDate, modificationDate: Timestamps
  • isEncrypted: Encryption status
  • fileSize: File size in bytes

Operation Options

Type definitions for tool-specific options:

  • SplitOptions: Page selection modes
  • RotateOptions: Rotation angle and pages
  • ProtectOptions: Password and permissions
  • ConversionOptions: Image format and quality

ProcessingResult

Standard response format:

  • success: Operation success status
  • message: Status or error message
  • downloadUrl: File download URL
  • filename: Suggested filename
  • info: PDF information (for info operations)

Usage

These types ensure type safety across the frontend and backend, providing a consistent interface for PDF operations and data structures.