officeparser 7.5.0 → 7.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/OfficeParser.js +54 -6
- package/dist/index.d.ts +2 -2
- package/dist/officeparser.browser.d.ts +34 -1
- package/dist/officeparser.browser.iife.js +153 -153
- package/dist/officeparser.browser.mjs +147 -147
- package/dist/officeparser.browser.slim.d.ts +34 -1
- package/dist/officeparser.browser.slim.iife.js +176 -176
- package/dist/officeparser.browser.slim.mjs +176 -176
- package/dist/parsers/EpubParser.js +2 -2
- package/dist/parsers/ExcelParser.js +11 -7
- package/dist/parsers/OpenOfficeParser.js +17 -3
- package/dist/parsers/PowerPointParser.js +21 -5
- package/dist/parsers/WordParser.js +12 -7
- package/dist/sbom.cdx.json +92 -92
- package/dist/types.d.ts +34 -1
- package/dist/types.js +10 -0
- package/dist/utils/configUtils.d.ts +15 -2
- package/dist/utils/configUtils.js +58 -13
- package/dist/utils/errorUtils.d.ts +8 -2
- package/dist/utils/errorUtils.js +23 -1
- package/dist/utils/zipUtils.d.ts +64 -4
- package/dist/utils/zipUtils.js +188 -4
- package/package.json +1 -1
|
@@ -41,6 +41,12 @@ export declare enum OfficeErrorType {
|
|
|
41
41
|
ZIP_ENTRY_INVALID_SIZE = "ZIP_ENTRY_INVALID_SIZE",
|
|
42
42
|
/** ZIP uncompressed size limit exceeded */
|
|
43
43
|
ZIP_SIZE_LIMIT_EXCEEDED = "ZIP_SIZE_LIMIT_EXCEEDED",
|
|
44
|
+
/** ZIP data yielded no readable entries (corrupt, truncated, or not a ZIP archive) */
|
|
45
|
+
ZIP_NO_ENTRIES_FOUND = "ZIP_NO_ENTRIES_FOUND",
|
|
46
|
+
/** ZIP data is truncated: the End of Central Directory record is absent */
|
|
47
|
+
ZIP_TRUNCATED = "ZIP_TRUNCATED",
|
|
48
|
+
/** A readable ZIP archive is missing the part its document format requires */
|
|
49
|
+
REQUIRED_PART_MISSING = "REQUIRED_PART_MISSING",
|
|
44
50
|
/** Document element/structure nesting exceeded the safe recursion depth */
|
|
45
51
|
MAX_NESTING_DEPTH_EXCEEDED = "MAX_NESTING_DEPTH_EXCEEDED",
|
|
46
52
|
/** Embedding call timed out */
|
|
@@ -90,7 +96,11 @@ export declare enum OfficeWarningType {
|
|
|
90
96
|
/** A metadata override could not be represented in the destination format's vocabulary */
|
|
91
97
|
METADATA_NOT_REPRESENTABLE = "METADATA_NOT_REPRESENTABLE",
|
|
92
98
|
/** A styleMap output.tag was not an allowed element name and was ignored */
|
|
93
|
-
INVALID_STYLE_MAP_TAG = "INVALID_STYLE_MAP_TAG"
|
|
99
|
+
INVALID_STYLE_MAP_TAG = "INVALID_STYLE_MAP_TAG",
|
|
100
|
+
/** A workbook archive contains no worksheet parts (chartsheet-only workbooks are legitimate) */
|
|
101
|
+
NO_WORKSHEETS_FOUND = "NO_WORKSHEETS_FOUND",
|
|
102
|
+
/** A presentation archive contains no slides (a zero-slide presentation is legitimate) */
|
|
103
|
+
NO_SLIDES_FOUND = "NO_SLIDES_FOUND"
|
|
94
104
|
}
|
|
95
105
|
/**
|
|
96
106
|
* Consolidated timeout settings for OCR operations.
|
|
@@ -463,6 +473,29 @@ export interface OfficeIssue {
|
|
|
463
473
|
/** Optional additional context or original error object. */
|
|
464
474
|
details?: any;
|
|
465
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* An Error thrown by OfficeParser, carrying the structured issue that produced it.
|
|
478
|
+
*
|
|
479
|
+
* Catching code can branch on `error.officeIssue.code`, the same stable enum used for warnings,
|
|
480
|
+
* instead of matching against message text. Errors that originate outside the library (and
|
|
481
|
+
* `AbortError`, which is deliberately re-thrown untouched so cancellation stays detectable via
|
|
482
|
+
* `error.name`) do not carry this property, hence the optional marker.
|
|
483
|
+
*
|
|
484
|
+
* @example
|
|
485
|
+
* ```typescript
|
|
486
|
+
* try {
|
|
487
|
+
* await parseOffice(buffer, { fileType: 'docx' });
|
|
488
|
+
* } catch (err) {
|
|
489
|
+
* if ((err as OfficeError).officeIssue?.code === OfficeErrorType.REQUIRED_PART_MISSING) {
|
|
490
|
+
* // the archive is readable, but it is not a docx
|
|
491
|
+
* }
|
|
492
|
+
* }
|
|
493
|
+
* ```
|
|
494
|
+
*/
|
|
495
|
+
export interface OfficeError extends Error {
|
|
496
|
+
/** The structured issue this error was created from. */
|
|
497
|
+
officeIssue?: OfficeIssue;
|
|
498
|
+
}
|
|
466
499
|
/**
|
|
467
500
|
* The result of a document conversion operation.
|
|
468
501
|
*/
|