118 lines
2.3 KiB
TypeScript
118 lines
2.3 KiB
TypeScript
export type DoResumableDownloadParams = {
|
|
url: string
|
|
filepath: string
|
|
timeout: number
|
|
allowedMimeTypes: string[]
|
|
signal?: AbortSignal
|
|
onProgress?: (progress: DoResumableDownloadProgress) => void
|
|
onComplete?: (url: string, path: string) => void | Promise<void>
|
|
forceNew?: boolean
|
|
}
|
|
|
|
export type DoResumableDownloadWithRetryParams = DoResumableDownloadParams & {
|
|
max_retries?: number
|
|
retry_delay?: number
|
|
onAttemptError?: (error: Error, attempt: number) => void
|
|
}
|
|
|
|
export type DoResumableDownloadProgress = {
|
|
downloadedBytes: number
|
|
totalBytes: number
|
|
lastProgressTime: number
|
|
lastDownloadedBytes: number
|
|
url: string
|
|
}
|
|
|
|
export type CuratedCollection = {
|
|
name: string
|
|
slug: string
|
|
description: string
|
|
icon: string
|
|
language: string
|
|
resources: {
|
|
title: string
|
|
description: string
|
|
size_mb: number
|
|
url: string
|
|
}[]
|
|
}
|
|
|
|
export type CuratedCollectionWithStatus = CuratedCollection & {
|
|
all_downloaded: boolean
|
|
}
|
|
|
|
export type CuratedCollectionsFile = {
|
|
collections: CuratedCollection[]
|
|
}
|
|
|
|
export type RunDownloadJobParams = Omit<
|
|
DoResumableDownloadParams,
|
|
'onProgress' | 'onComplete' | 'signal'
|
|
> & {
|
|
filetype: string
|
|
}
|
|
|
|
export type DownloadJobWithProgress = {
|
|
jobId: string
|
|
url: string
|
|
progress: number
|
|
filepath: string
|
|
filetype: string
|
|
}
|
|
|
|
// Tiered category types for curated collections UI
|
|
export type CategoryResource = {
|
|
title: string
|
|
description: string
|
|
size_mb?: number
|
|
url: string
|
|
}
|
|
|
|
export type CategoryTier = {
|
|
name: string
|
|
slug: string
|
|
description: string
|
|
recommended?: boolean
|
|
includesTier?: string
|
|
resources: CategoryResource[]
|
|
}
|
|
|
|
export type CuratedCategory = {
|
|
name: string
|
|
slug: string
|
|
icon: string
|
|
description: string
|
|
language: string
|
|
tiers: CategoryTier[]
|
|
installedTierSlug?: string
|
|
}
|
|
|
|
export type CuratedCategoriesFile = {
|
|
categories: CuratedCategory[]
|
|
}
|
|
|
|
// Wikipedia selector types
|
|
export type WikipediaOption = {
|
|
id: string
|
|
name: string
|
|
description: string
|
|
size_mb: number
|
|
url: string | null
|
|
}
|
|
|
|
export type WikipediaOptionsFile = {
|
|
options: WikipediaOption[]
|
|
}
|
|
|
|
export type WikipediaCurrentSelection = {
|
|
optionId: string
|
|
status: 'none' | 'downloading' | 'installed' | 'failed'
|
|
filename: string | null
|
|
url: string | null
|
|
}
|
|
|
|
export type WikipediaState = {
|
|
options: WikipediaOption[]
|
|
currentSelection: WikipediaCurrentSelection | null
|
|
}
|