mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #27928 from overleaf/dp-pdf-caching-typescript-2
Convert pdf-caching file to typescript GitOrigin-RevId: 9acd2fc0697490008d82abfad0994df362814bad
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
export type PDFRange = {
|
||||
objectId: Uint8Array
|
||||
export type Chunk = {
|
||||
start: number
|
||||
end: number
|
||||
}
|
||||
|
||||
export type PrefetchedChunk<ChunkType extends Chunk> = ChunkType & {
|
||||
buffer: Uint8Array
|
||||
}
|
||||
|
||||
export type PDFRange<ObjectIdType = Uint8Array | string> = Chunk & {
|
||||
objectId: ObjectIdType
|
||||
hash: string
|
||||
size: number
|
||||
start: number
|
||||
totalUsage: number
|
||||
}
|
||||
|
||||
@@ -18,17 +25,36 @@ type OutputFileBase = {
|
||||
main?: boolean
|
||||
}
|
||||
|
||||
export type PDFFile = OutputFileBase & {
|
||||
type PDFFileBase = OutputFileBase & {
|
||||
clsiCacheShard: string
|
||||
contentId: string
|
||||
createdAt: Date
|
||||
editorId: string
|
||||
pdfDownloadURL: string
|
||||
pdfURL: string
|
||||
prefetched: any[]
|
||||
preprocessed: boolean
|
||||
ranges: PDFRange[]
|
||||
pdfDownloadUrl: string
|
||||
pdfUrl: string
|
||||
size: number
|
||||
startXRefTable?: number
|
||||
}
|
||||
|
||||
export type PDFFile = PDFFileBase & {
|
||||
createdAt?: string
|
||||
ranges: PDFRange<string>[]
|
||||
prefetched?: PrefetchedChunk<PDFRange<Uint8Array>>[]
|
||||
}
|
||||
|
||||
export type ProcessedPDFFile = PDFFileBase & {
|
||||
preprocessed: true
|
||||
createdAt: Date
|
||||
prefetched: PrefetchedChunk<PDFRange<Uint8Array>>[]
|
||||
ranges: PDFRange<Uint8Array>[]
|
||||
}
|
||||
|
||||
// This type is a little bit of a hack to work around the fact that we mutate
|
||||
// the PDFFile object directly when processed into a ProcessedPDFFile
|
||||
export type PartiallyProcessedPDFFile = PDFFileBase & {
|
||||
preprocessed?: boolean
|
||||
createdAt?: Date | string
|
||||
prefetched?: PrefetchedChunk<PDFRange<Uint8Array>>[]
|
||||
ranges: PDFRange<Uint8Array>[] | PDFRange<string>[]
|
||||
}
|
||||
|
||||
export type CompileOutputFile = OutputFileBase | PDFFile
|
||||
|
||||
Reference in New Issue
Block a user