chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -69,13 +69,14 @@ export class ExcelHandler extends BaseFormatHandler {
|
|||
const sheet = workbook.Sheets[sheetName]
|
||||
if (!sheet) continue
|
||||
|
||||
// Convert sheet to JSON with headers
|
||||
const sheetData = XLSX.utils.sheet_to_json(sheet, {
|
||||
// Convert sheet to JSON with headers. `header: 1` makes xlsx return
|
||||
// rows as arrays of raw cell values, typed via the generic overload.
|
||||
const sheetData = XLSX.utils.sheet_to_json<unknown[]>(sheet, {
|
||||
header: 1, // Get as array of arrays first
|
||||
defval: null,
|
||||
blankrows: false,
|
||||
raw: false // Convert to formatted strings
|
||||
}) as any[][]
|
||||
})
|
||||
|
||||
if (sheetData.length === 0) continue
|
||||
|
||||
|
|
|
|||
|
|
@ -70,8 +70,20 @@ export class PDFHandler extends BaseFormatHandler {
|
|||
|
||||
const pdfDoc = await loadingTask.promise
|
||||
|
||||
// Extract metadata
|
||||
// Extract metadata. pdfjs-dist types getMetadata().info as the bare
|
||||
// `Object` type, so the well-known PDF document-information dictionary
|
||||
// keys (PDF 32000-1:2008 §14.3.3) are surfaced via a structural type at
|
||||
// this library boundary.
|
||||
const metadata = await pdfDoc.getMetadata()
|
||||
const documentInfo = metadata.info as {
|
||||
Title?: string
|
||||
Author?: string
|
||||
Subject?: string
|
||||
Creator?: string
|
||||
Producer?: string
|
||||
CreationDate?: string
|
||||
ModDate?: string
|
||||
} | undefined
|
||||
const numPages = pdfDoc.numPages
|
||||
|
||||
// Report document loaded
|
||||
|
|
@ -177,13 +189,13 @@ export class PDFHandler extends BaseFormatHandler {
|
|||
textLength: totalTextLength,
|
||||
tableCount: detectedTables,
|
||||
pdfMetadata: {
|
||||
title: (metadata.info as any)?.Title || null,
|
||||
author: (metadata.info as any)?.Author || null,
|
||||
subject: (metadata.info as any)?.Subject || null,
|
||||
creator: (metadata.info as any)?.Creator || null,
|
||||
producer: (metadata.info as any)?.Producer || null,
|
||||
creationDate: (metadata.info as any)?.CreationDate || null,
|
||||
modificationDate: (metadata.info as any)?.ModDate || null
|
||||
title: documentInfo?.Title || null,
|
||||
author: documentInfo?.Author || null,
|
||||
subject: documentInfo?.Subject || null,
|
||||
creator: documentInfo?.Creator || null,
|
||||
producer: documentInfo?.Producer || null,
|
||||
creationDate: documentInfo?.CreationDate || null,
|
||||
modificationDate: documentInfo?.ModDate || null
|
||||
}
|
||||
}
|
||||
),
|
||||
|
|
|
|||
Reference in a new issue