@kreuzberg/node 4.0.0-rc.6 → 4.0.0-rc.8

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.
@@ -0,0 +1,358 @@
1
+ /**
2
+ * Error types for Kreuzberg document intelligence framework.
3
+ *
4
+ * These error classes mirror the Rust core error types and provide
5
+ * type-safe error handling for TypeScript consumers.
6
+ *
7
+ * ## Error Hierarchy
8
+ *
9
+ * ```
10
+ * Error (JavaScript built-in)
11
+ * └── KreuzbergError (base class)
12
+ * ├── ValidationError
13
+ * ├── ParsingError
14
+ * ├── OcrError
15
+ * ├── CacheError
16
+ * ├── ImageProcessingError
17
+ * ├── PluginError
18
+ * ├── MissingDependencyError
19
+ * └── ... (other error types)
20
+ * ```
21
+ *
22
+ * @module errors
23
+ */
24
+ /**
25
+ * FFI error codes matching kreuzberg-ffi C library error types.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * import { ErrorCode, getLastErrorCode } from '@kreuzberg/node';
30
+ *
31
+ * try {
32
+ * const result = await extractFile('document.pdf');
33
+ * } catch (error) {
34
+ * const code = getLastErrorCode();
35
+ * if (code === ErrorCode.Panic) {
36
+ * console.error('A panic occurred in the native library');
37
+ * }
38
+ * }
39
+ * ```
40
+ */
41
+ declare enum ErrorCode {
42
+ /**
43
+ * No error (success)
44
+ */
45
+ Success = 0,
46
+ /**
47
+ * Generic error
48
+ */
49
+ GenericError = 1,
50
+ /**
51
+ * Panic occurred in native code
52
+ */
53
+ Panic = 2,
54
+ /**
55
+ * Invalid argument provided
56
+ */
57
+ InvalidArgument = 3,
58
+ /**
59
+ * I/O error (file system, network, etc.)
60
+ */
61
+ IoError = 4,
62
+ /**
63
+ * Error parsing document content
64
+ */
65
+ ParsingError = 5,
66
+ /**
67
+ * Error in OCR processing
68
+ */
69
+ OcrError = 6,
70
+ /**
71
+ * Required system dependency is missing
72
+ */
73
+ MissingDependency = 7
74
+ }
75
+ /**
76
+ * Context information for panics in native code.
77
+ *
78
+ * Contains file location, line number, function name, panic message,
79
+ * and timestamp for debugging native library issues.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * import { KreuzbergError } from '@kreuzberg/node';
84
+ *
85
+ * try {
86
+ * const result = await extractFile('document.pdf');
87
+ * } catch (error) {
88
+ * if (error instanceof KreuzbergError && error.panicContext) {
89
+ * console.error('Panic occurred:');
90
+ * console.error(`File: ${error.panicContext.file}`);
91
+ * console.error(`Line: ${error.panicContext.line}`);
92
+ * console.error(`Function: ${error.panicContext.function}`);
93
+ * console.error(`Message: ${error.panicContext.message}`);
94
+ * }
95
+ * }
96
+ * ```
97
+ */
98
+ interface PanicContext {
99
+ /**
100
+ * Source file where panic occurred
101
+ */
102
+ file: string;
103
+ /**
104
+ * Line number in source file
105
+ */
106
+ line: number;
107
+ /**
108
+ * Function name where panic occurred
109
+ */
110
+ function: string;
111
+ /**
112
+ * Panic message
113
+ */
114
+ message: string;
115
+ /**
116
+ * Unix timestamp (seconds since epoch)
117
+ */
118
+ timestamp_secs: number;
119
+ }
120
+ /**
121
+ * Base error class for all Kreuzberg errors.
122
+ *
123
+ * All error types thrown by Kreuzberg extend this class, allowing
124
+ * consumers to catch all Kreuzberg-specific errors with a single catch block.
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * import { extractFile, KreuzbergError } from '@kreuzberg/node';
129
+ *
130
+ * try {
131
+ * const result = await extractFile('document.pdf');
132
+ * } catch (error) {
133
+ * if (error instanceof KreuzbergError) {
134
+ * console.error('Kreuzberg error:', error.message);
135
+ * if (error.panicContext) {
136
+ * console.error('Panic at:', error.panicContext.file + ':' + error.panicContext.line);
137
+ * }
138
+ * } else {
139
+ * throw error; // Re-throw non-Kreuzberg errors
140
+ * }
141
+ * }
142
+ * ```
143
+ */
144
+ declare class KreuzbergError extends Error {
145
+ /**
146
+ * Panic context if error was caused by a panic in native code.
147
+ * Will be null for non-panic errors.
148
+ */
149
+ readonly panicContext: PanicContext | null;
150
+ constructor(message: string, panicContext?: PanicContext | null);
151
+ toJSON(): {
152
+ name: string;
153
+ message: string;
154
+ panicContext: PanicContext | null;
155
+ stack: string | undefined;
156
+ };
157
+ }
158
+ /**
159
+ * Error thrown when document validation fails.
160
+ *
161
+ * Validation errors occur when a document doesn't meet specified criteria,
162
+ * such as minimum content length, required metadata fields, or quality thresholds.
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * import { extractFile, ValidationError } from '@kreuzberg/node';
167
+ *
168
+ * try {
169
+ * const result = await extractFile('document.pdf');
170
+ * } catch (error) {
171
+ * if (error instanceof ValidationError) {
172
+ * console.error('Document validation failed:', error.message);
173
+ * }
174
+ * }
175
+ * ```
176
+ */
177
+ declare class ValidationError extends KreuzbergError {
178
+ constructor(message: string, panicContext?: PanicContext | null);
179
+ }
180
+ /**
181
+ * Error thrown when document parsing fails.
182
+ *
183
+ * Parsing errors occur when a document is corrupted, malformed, or cannot
184
+ * be processed by the extraction engine. This includes issues like:
185
+ * - Corrupted PDF files
186
+ * - Invalid XML/JSON syntax
187
+ * - Unsupported file format versions
188
+ * - Encrypted documents without valid passwords
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * import { extractFile, ParsingError } from '@kreuzberg/node';
193
+ *
194
+ * try {
195
+ * const result = await extractFile('corrupted.pdf');
196
+ * } catch (error) {
197
+ * if (error instanceof ParsingError) {
198
+ * console.error('Failed to parse document:', error.message);
199
+ * }
200
+ * }
201
+ * ```
202
+ */
203
+ declare class ParsingError extends KreuzbergError {
204
+ constructor(message: string, panicContext?: PanicContext | null);
205
+ }
206
+ /**
207
+ * Error thrown when OCR processing fails.
208
+ *
209
+ * OCR errors occur during optical character recognition, such as:
210
+ * - OCR backend initialization failures
211
+ * - Image preprocessing errors
212
+ * - Language model loading issues
213
+ * - OCR engine crashes
214
+ *
215
+ * @example
216
+ * ```typescript
217
+ * import { extractFile, OcrError } from '@kreuzberg/node';
218
+ *
219
+ * try {
220
+ * const result = await extractFile('scanned.pdf', null, {
221
+ * ocr: { backend: 'tesseract', language: 'eng' }
222
+ * });
223
+ * } catch (error) {
224
+ * if (error instanceof OcrError) {
225
+ * console.error('OCR processing failed:', error.message);
226
+ * }
227
+ * }
228
+ * ```
229
+ */
230
+ declare class OcrError extends KreuzbergError {
231
+ constructor(message: string, panicContext?: PanicContext | null);
232
+ }
233
+ /**
234
+ * Error thrown when cache operations fail.
235
+ *
236
+ * Cache errors are typically non-fatal and occur during caching operations, such as:
237
+ * - Cache directory creation failures
238
+ * - Disk write errors
239
+ * - Cache entry corruption
240
+ * - Insufficient disk space
241
+ *
242
+ * These errors are usually logged but don't prevent extraction from completing.
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * import { extractFile, CacheError } from '@kreuzberg/node';
247
+ *
248
+ * try {
249
+ * const result = await extractFile('document.pdf', null, {
250
+ * useCache: true
251
+ * });
252
+ * } catch (error) {
253
+ * if (error instanceof CacheError) {
254
+ * console.warn('Cache operation failed, continuing without cache:', error.message);
255
+ * }
256
+ * }
257
+ * ```
258
+ */
259
+ declare class CacheError extends KreuzbergError {
260
+ constructor(message: string, panicContext?: PanicContext | null);
261
+ }
262
+ /**
263
+ * Error thrown when image processing operations fail.
264
+ *
265
+ * Image processing errors occur during image manipulation, such as:
266
+ * - Image decoding failures
267
+ * - Unsupported image formats
268
+ * - Image resizing/scaling errors
269
+ * - DPI adjustment failures
270
+ * - Color space conversion issues
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * import { extractFile, ImageProcessingError } from '@kreuzberg/node';
275
+ *
276
+ * try {
277
+ * const result = await extractFile('document.pdf', null, {
278
+ * images: {
279
+ * extractImages: true,
280
+ * targetDpi: 300
281
+ * }
282
+ * });
283
+ * } catch (error) {
284
+ * if (error instanceof ImageProcessingError) {
285
+ * console.error('Image processing failed:', error.message);
286
+ * }
287
+ * }
288
+ * ```
289
+ */
290
+ declare class ImageProcessingError extends KreuzbergError {
291
+ constructor(message: string, panicContext?: PanicContext | null);
292
+ }
293
+ /**
294
+ * Error thrown when a plugin operation fails.
295
+ *
296
+ * Plugin errors occur in custom plugins (postprocessors, validators, OCR backends), such as:
297
+ * - Plugin initialization failures
298
+ * - Plugin processing errors
299
+ * - Plugin crashes or timeouts
300
+ * - Invalid plugin configuration
301
+ *
302
+ * The error message includes the plugin name to help identify which plugin failed.
303
+ *
304
+ * @example
305
+ * ```typescript
306
+ * import { extractFile, PluginError } from '@kreuzberg/node';
307
+ *
308
+ * try {
309
+ * const result = await extractFile('document.pdf');
310
+ * } catch (error) {
311
+ * if (error instanceof PluginError) {
312
+ * console.error(`Plugin '${error.pluginName}' failed:`, error.message);
313
+ * }
314
+ * }
315
+ * ```
316
+ */
317
+ declare class PluginError extends KreuzbergError {
318
+ /**
319
+ * Name of the plugin that threw the error.
320
+ */
321
+ readonly pluginName: string;
322
+ constructor(message: string, pluginName: string, panicContext?: PanicContext | null);
323
+ toJSON(): {
324
+ name: string;
325
+ message: string;
326
+ pluginName: string;
327
+ panicContext: PanicContext | null;
328
+ stack: string | undefined;
329
+ };
330
+ }
331
+ /**
332
+ * Error thrown when a required system dependency is missing.
333
+ *
334
+ * Missing dependency errors occur when external tools or libraries are not available, such as:
335
+ * - LibreOffice (for DOC/PPT/XLS files)
336
+ * - Tesseract OCR (for OCR processing)
337
+ * - ImageMagick (for image processing)
338
+ * - Poppler (for PDF rendering)
339
+ *
340
+ * @example
341
+ * ```typescript
342
+ * import { extractFile, MissingDependencyError } from '@kreuzberg/node';
343
+ *
344
+ * try {
345
+ * const result = await extractFile('document.doc');
346
+ * } catch (error) {
347
+ * if (error instanceof MissingDependencyError) {
348
+ * console.error('Missing dependency:', error.message);
349
+ * console.log('Please install LibreOffice to process DOC files');
350
+ * }
351
+ * }
352
+ * ```
353
+ */
354
+ declare class MissingDependencyError extends KreuzbergError {
355
+ constructor(message: string, panicContext?: PanicContext | null);
356
+ }
357
+
358
+ export { CacheError, ErrorCode, ImageProcessingError, KreuzbergError, MissingDependencyError, OcrError, type PanicContext, ParsingError, PluginError, ValidationError };
package/dist/errors.js ADDED
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var errors_exports = {};
20
+ __export(errors_exports, {
21
+ CacheError: () => CacheError,
22
+ ErrorCode: () => ErrorCode,
23
+ ImageProcessingError: () => ImageProcessingError,
24
+ KreuzbergError: () => KreuzbergError,
25
+ MissingDependencyError: () => MissingDependencyError,
26
+ OcrError: () => OcrError,
27
+ ParsingError: () => ParsingError,
28
+ PluginError: () => PluginError,
29
+ ValidationError: () => ValidationError
30
+ });
31
+ module.exports = __toCommonJS(errors_exports);
32
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
33
+ ErrorCode2[ErrorCode2["Success"] = 0] = "Success";
34
+ ErrorCode2[ErrorCode2["GenericError"] = 1] = "GenericError";
35
+ ErrorCode2[ErrorCode2["Panic"] = 2] = "Panic";
36
+ ErrorCode2[ErrorCode2["InvalidArgument"] = 3] = "InvalidArgument";
37
+ ErrorCode2[ErrorCode2["IoError"] = 4] = "IoError";
38
+ ErrorCode2[ErrorCode2["ParsingError"] = 5] = "ParsingError";
39
+ ErrorCode2[ErrorCode2["OcrError"] = 6] = "OcrError";
40
+ ErrorCode2[ErrorCode2["MissingDependency"] = 7] = "MissingDependency";
41
+ return ErrorCode2;
42
+ })(ErrorCode || {});
43
+ class KreuzbergError extends Error {
44
+ /**
45
+ * Panic context if error was caused by a panic in native code.
46
+ * Will be null for non-panic errors.
47
+ */
48
+ panicContext;
49
+ constructor(message, panicContext) {
50
+ super(message);
51
+ this.name = "KreuzbergError";
52
+ this.panicContext = panicContext ?? null;
53
+ Object.setPrototypeOf(this, KreuzbergError.prototype);
54
+ }
55
+ toJSON() {
56
+ return {
57
+ name: this.name,
58
+ message: this.message,
59
+ panicContext: this.panicContext,
60
+ stack: this.stack
61
+ };
62
+ }
63
+ }
64
+ class ValidationError extends KreuzbergError {
65
+ constructor(message, panicContext) {
66
+ super(message, panicContext);
67
+ this.name = "ValidationError";
68
+ Object.setPrototypeOf(this, ValidationError.prototype);
69
+ }
70
+ }
71
+ class ParsingError extends KreuzbergError {
72
+ constructor(message, panicContext) {
73
+ super(message, panicContext);
74
+ this.name = "ParsingError";
75
+ Object.setPrototypeOf(this, ParsingError.prototype);
76
+ }
77
+ }
78
+ class OcrError extends KreuzbergError {
79
+ constructor(message, panicContext) {
80
+ super(message, panicContext);
81
+ this.name = "OcrError";
82
+ Object.setPrototypeOf(this, OcrError.prototype);
83
+ }
84
+ }
85
+ class CacheError extends KreuzbergError {
86
+ constructor(message, panicContext) {
87
+ super(message, panicContext);
88
+ this.name = "CacheError";
89
+ Object.setPrototypeOf(this, CacheError.prototype);
90
+ }
91
+ }
92
+ class ImageProcessingError extends KreuzbergError {
93
+ constructor(message, panicContext) {
94
+ super(message, panicContext);
95
+ this.name = "ImageProcessingError";
96
+ Object.setPrototypeOf(this, ImageProcessingError.prototype);
97
+ }
98
+ }
99
+ class PluginError extends KreuzbergError {
100
+ /**
101
+ * Name of the plugin that threw the error.
102
+ */
103
+ pluginName;
104
+ constructor(message, pluginName, panicContext) {
105
+ super(`Plugin error in '${pluginName}': ${message}`, panicContext);
106
+ this.name = "PluginError";
107
+ this.pluginName = pluginName;
108
+ Object.setPrototypeOf(this, PluginError.prototype);
109
+ }
110
+ toJSON() {
111
+ return {
112
+ name: this.name,
113
+ message: this.message,
114
+ pluginName: this.pluginName,
115
+ panicContext: this.panicContext,
116
+ stack: this.stack
117
+ };
118
+ }
119
+ }
120
+ class MissingDependencyError extends KreuzbergError {
121
+ constructor(message, panicContext) {
122
+ super(message, panicContext);
123
+ this.name = "MissingDependencyError";
124
+ Object.setPrototypeOf(this, MissingDependencyError.prototype);
125
+ }
126
+ }
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ CacheError,
130
+ ErrorCode,
131
+ ImageProcessingError,
132
+ KreuzbergError,
133
+ MissingDependencyError,
134
+ OcrError,
135
+ ParsingError,
136
+ PluginError,
137
+ ValidationError
138
+ });
139
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../typescript/errors.ts"],"sourcesContent":["/**\n * Error types for Kreuzberg document intelligence framework.\n *\n * These error classes mirror the Rust core error types and provide\n * type-safe error handling for TypeScript consumers.\n *\n * ## Error Hierarchy\n *\n * ```\n * Error (JavaScript built-in)\n * └── KreuzbergError (base class)\n * ├── ValidationError\n * ├── ParsingError\n * ├── OcrError\n * ├── CacheError\n * ├── ImageProcessingError\n * ├── PluginError\n * ├── MissingDependencyError\n * └── ... (other error types)\n * ```\n *\n * @module errors\n */\n\n/**\n * FFI error codes matching kreuzberg-ffi C library error types.\n *\n * @example\n * ```typescript\n * import { ErrorCode, getLastErrorCode } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * const code = getLastErrorCode();\n * if (code === ErrorCode.Panic) {\n * console.error('A panic occurred in the native library');\n * }\n * }\n * ```\n */\nexport enum ErrorCode {\n\t/**\n\t * No error (success)\n\t */\n\tSuccess = 0,\n\t/**\n\t * Generic error\n\t */\n\tGenericError = 1,\n\t/**\n\t * Panic occurred in native code\n\t */\n\tPanic = 2,\n\t/**\n\t * Invalid argument provided\n\t */\n\tInvalidArgument = 3,\n\t/**\n\t * I/O error (file system, network, etc.)\n\t */\n\tIoError = 4,\n\t/**\n\t * Error parsing document content\n\t */\n\tParsingError = 5,\n\t/**\n\t * Error in OCR processing\n\t */\n\tOcrError = 6,\n\t/**\n\t * Required system dependency is missing\n\t */\n\tMissingDependency = 7,\n}\n\n/**\n * Context information for panics in native code.\n *\n * Contains file location, line number, function name, panic message,\n * and timestamp for debugging native library issues.\n *\n * @example\n * ```typescript\n * import { KreuzbergError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof KreuzbergError && error.panicContext) {\n * console.error('Panic occurred:');\n * console.error(`File: ${error.panicContext.file}`);\n * console.error(`Line: ${error.panicContext.line}`);\n * console.error(`Function: ${error.panicContext.function}`);\n * console.error(`Message: ${error.panicContext.message}`);\n * }\n * }\n * ```\n */\nexport interface PanicContext {\n\t/**\n\t * Source file where panic occurred\n\t */\n\tfile: string;\n\t/**\n\t * Line number in source file\n\t */\n\tline: number;\n\t/**\n\t * Function name where panic occurred\n\t */\n\tfunction: string;\n\t/**\n\t * Panic message\n\t */\n\tmessage: string;\n\t/**\n\t * Unix timestamp (seconds since epoch)\n\t */\n\ttimestamp_secs: number;\n}\n\n/**\n * Base error class for all Kreuzberg errors.\n *\n * All error types thrown by Kreuzberg extend this class, allowing\n * consumers to catch all Kreuzberg-specific errors with a single catch block.\n *\n * @example\n * ```typescript\n * import { extractFile, KreuzbergError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof KreuzbergError) {\n * console.error('Kreuzberg error:', error.message);\n * if (error.panicContext) {\n * console.error('Panic at:', error.panicContext.file + ':' + error.panicContext.line);\n * }\n * } else {\n * throw error; // Re-throw non-Kreuzberg errors\n * }\n * }\n * ```\n */\nexport class KreuzbergError extends Error {\n\t/**\n\t * Panic context if error was caused by a panic in native code.\n\t * Will be null for non-panic errors.\n\t */\n\tpublic readonly panicContext: PanicContext | null;\n\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message);\n\t\tthis.name = \"KreuzbergError\";\n\t\tthis.panicContext = panicContext ?? null;\n\t\tObject.setPrototypeOf(this, KreuzbergError.prototype);\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tpanicContext: this.panicContext,\n\t\t\tstack: this.stack,\n\t\t};\n\t}\n}\n\n/**\n * Error thrown when document validation fails.\n *\n * Validation errors occur when a document doesn't meet specified criteria,\n * such as minimum content length, required metadata fields, or quality thresholds.\n *\n * @example\n * ```typescript\n * import { extractFile, ValidationError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof ValidationError) {\n * console.error('Document validation failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ValidationError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ValidationError\";\n\t\tObject.setPrototypeOf(this, ValidationError.prototype);\n\t}\n}\n\n/**\n * Error thrown when document parsing fails.\n *\n * Parsing errors occur when a document is corrupted, malformed, or cannot\n * be processed by the extraction engine. This includes issues like:\n * - Corrupted PDF files\n * - Invalid XML/JSON syntax\n * - Unsupported file format versions\n * - Encrypted documents without valid passwords\n *\n * @example\n * ```typescript\n * import { extractFile, ParsingError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('corrupted.pdf');\n * } catch (error) {\n * if (error instanceof ParsingError) {\n * console.error('Failed to parse document:', error.message);\n * }\n * }\n * ```\n */\nexport class ParsingError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ParsingError\";\n\t\tObject.setPrototypeOf(this, ParsingError.prototype);\n\t}\n}\n\n/**\n * Error thrown when OCR processing fails.\n *\n * OCR errors occur during optical character recognition, such as:\n * - OCR backend initialization failures\n * - Image preprocessing errors\n * - Language model loading issues\n * - OCR engine crashes\n *\n * @example\n * ```typescript\n * import { extractFile, OcrError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('scanned.pdf', null, {\n * ocr: { backend: 'tesseract', language: 'eng' }\n * });\n * } catch (error) {\n * if (error instanceof OcrError) {\n * console.error('OCR processing failed:', error.message);\n * }\n * }\n * ```\n */\nexport class OcrError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"OcrError\";\n\t\tObject.setPrototypeOf(this, OcrError.prototype);\n\t}\n}\n\n/**\n * Error thrown when cache operations fail.\n *\n * Cache errors are typically non-fatal and occur during caching operations, such as:\n * - Cache directory creation failures\n * - Disk write errors\n * - Cache entry corruption\n * - Insufficient disk space\n *\n * These errors are usually logged but don't prevent extraction from completing.\n *\n * @example\n * ```typescript\n * import { extractFile, CacheError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf', null, {\n * useCache: true\n * });\n * } catch (error) {\n * if (error instanceof CacheError) {\n * console.warn('Cache operation failed, continuing without cache:', error.message);\n * }\n * }\n * ```\n */\nexport class CacheError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"CacheError\";\n\t\tObject.setPrototypeOf(this, CacheError.prototype);\n\t}\n}\n\n/**\n * Error thrown when image processing operations fail.\n *\n * Image processing errors occur during image manipulation, such as:\n * - Image decoding failures\n * - Unsupported image formats\n * - Image resizing/scaling errors\n * - DPI adjustment failures\n * - Color space conversion issues\n *\n * @example\n * ```typescript\n * import { extractFile, ImageProcessingError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf', null, {\n * images: {\n * extractImages: true,\n * targetDpi: 300\n * }\n * });\n * } catch (error) {\n * if (error instanceof ImageProcessingError) {\n * console.error('Image processing failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ImageProcessingError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ImageProcessingError\";\n\t\tObject.setPrototypeOf(this, ImageProcessingError.prototype);\n\t}\n}\n\n/**\n * Error thrown when a plugin operation fails.\n *\n * Plugin errors occur in custom plugins (postprocessors, validators, OCR backends), such as:\n * - Plugin initialization failures\n * - Plugin processing errors\n * - Plugin crashes or timeouts\n * - Invalid plugin configuration\n *\n * The error message includes the plugin name to help identify which plugin failed.\n *\n * @example\n * ```typescript\n * import { extractFile, PluginError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof PluginError) {\n * console.error(`Plugin '${error.pluginName}' failed:`, error.message);\n * }\n * }\n * ```\n */\nexport class PluginError extends KreuzbergError {\n\t/**\n\t * Name of the plugin that threw the error.\n\t */\n\tpublic readonly pluginName: string;\n\n\tconstructor(message: string, pluginName: string, panicContext?: PanicContext | null) {\n\t\tsuper(`Plugin error in '${pluginName}': ${message}`, panicContext);\n\t\tthis.name = \"PluginError\";\n\t\tthis.pluginName = pluginName;\n\t\tObject.setPrototypeOf(this, PluginError.prototype);\n\t}\n\n\toverride toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tpluginName: this.pluginName,\n\t\t\tpanicContext: this.panicContext,\n\t\t\tstack: this.stack,\n\t\t};\n\t}\n}\n\n/**\n * Error thrown when a required system dependency is missing.\n *\n * Missing dependency errors occur when external tools or libraries are not available, such as:\n * - LibreOffice (for DOC/PPT/XLS files)\n * - Tesseract OCR (for OCR processing)\n * - ImageMagick (for image processing)\n * - Poppler (for PDF rendering)\n *\n * @example\n * ```typescript\n * import { extractFile, MissingDependencyError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.doc');\n * } catch (error) {\n * if (error instanceof MissingDependencyError) {\n * console.error('Missing dependency:', error.message);\n * console.log('Please install LibreOffice to process DOC files');\n * }\n * }\n * ```\n */\nexport class MissingDependencyError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"MissingDependencyError\";\n\t\tObject.setPrototypeOf(this, MissingDependencyError.prototype);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCO,IAAK,YAAL,kBAAKA,eAAL;AAIN,EAAAA,sBAAA,aAAU,KAAV;AAIA,EAAAA,sBAAA,kBAAe,KAAf;AAIA,EAAAA,sBAAA,WAAQ,KAAR;AAIA,EAAAA,sBAAA,qBAAkB,KAAlB;AAIA,EAAAA,sBAAA,aAAU,KAAV;AAIA,EAAAA,sBAAA,kBAAe,KAAf;AAIA,EAAAA,sBAAA,cAAW,KAAX;AAIA,EAAAA,sBAAA,uBAAoB,KAApB;AAhCW,SAAAA;AAAA,GAAA;AAyGL,MAAM,uBAAuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB;AAAA,EAEhB,YAAY,SAAiB,cAAoC;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,eAAe,gBAAgB;AACpC,WAAO,eAAe,MAAM,eAAe,SAAS;AAAA,EACrD;AAAA,EAEA,SAAS;AACR,WAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,cAAc,KAAK;AAAA,MACnB,OAAO,KAAK;AAAA,IACb;AAAA,EACD;AACD;AAqBO,MAAM,wBAAwB,eAAe;AAAA,EACnD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,gBAAgB,SAAS;AAAA,EACtD;AACD;AAyBO,MAAM,qBAAqB,eAAe;AAAA,EAChD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,aAAa,SAAS;AAAA,EACnD;AACD;AA0BO,MAAM,iBAAiB,eAAe;AAAA,EAC5C,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,SAAS,SAAS;AAAA,EAC/C;AACD;AA4BO,MAAM,mBAAmB,eAAe;AAAA,EAC9C,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EACjD;AACD;AA8BO,MAAM,6BAA6B,eAAe;AAAA,EACxD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,qBAAqB,SAAS;AAAA,EAC3D;AACD;AA0BO,MAAM,oBAAoB,eAAe;AAAA;AAAA;AAAA;AAAA,EAI/B;AAAA,EAEhB,YAAY,SAAiB,YAAoB,cAAoC;AACpF,UAAM,oBAAoB,UAAU,MAAM,OAAO,IAAI,YAAY;AACjE,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,WAAO,eAAe,MAAM,YAAY,SAAS;AAAA,EAClD;AAAA,EAES,SAAS;AACjB,WAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,YAAY,KAAK;AAAA,MACjB,cAAc,KAAK;AAAA,MACnB,OAAO,KAAK;AAAA,IACb;AAAA,EACD;AACD;AAyBO,MAAM,+BAA+B,eAAe;AAAA,EAC1D,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,uBAAuB,SAAS;AAAA,EAC7D;AACD;","names":["ErrorCode"]}
@@ -0,0 +1,107 @@
1
+ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
2
+ ErrorCode2[ErrorCode2["Success"] = 0] = "Success";
3
+ ErrorCode2[ErrorCode2["GenericError"] = 1] = "GenericError";
4
+ ErrorCode2[ErrorCode2["Panic"] = 2] = "Panic";
5
+ ErrorCode2[ErrorCode2["InvalidArgument"] = 3] = "InvalidArgument";
6
+ ErrorCode2[ErrorCode2["IoError"] = 4] = "IoError";
7
+ ErrorCode2[ErrorCode2["ParsingError"] = 5] = "ParsingError";
8
+ ErrorCode2[ErrorCode2["OcrError"] = 6] = "OcrError";
9
+ ErrorCode2[ErrorCode2["MissingDependency"] = 7] = "MissingDependency";
10
+ return ErrorCode2;
11
+ })(ErrorCode || {});
12
+ class KreuzbergError extends Error {
13
+ /**
14
+ * Panic context if error was caused by a panic in native code.
15
+ * Will be null for non-panic errors.
16
+ */
17
+ panicContext;
18
+ constructor(message, panicContext) {
19
+ super(message);
20
+ this.name = "KreuzbergError";
21
+ this.panicContext = panicContext ?? null;
22
+ Object.setPrototypeOf(this, KreuzbergError.prototype);
23
+ }
24
+ toJSON() {
25
+ return {
26
+ name: this.name,
27
+ message: this.message,
28
+ panicContext: this.panicContext,
29
+ stack: this.stack
30
+ };
31
+ }
32
+ }
33
+ class ValidationError extends KreuzbergError {
34
+ constructor(message, panicContext) {
35
+ super(message, panicContext);
36
+ this.name = "ValidationError";
37
+ Object.setPrototypeOf(this, ValidationError.prototype);
38
+ }
39
+ }
40
+ class ParsingError extends KreuzbergError {
41
+ constructor(message, panicContext) {
42
+ super(message, panicContext);
43
+ this.name = "ParsingError";
44
+ Object.setPrototypeOf(this, ParsingError.prototype);
45
+ }
46
+ }
47
+ class OcrError extends KreuzbergError {
48
+ constructor(message, panicContext) {
49
+ super(message, panicContext);
50
+ this.name = "OcrError";
51
+ Object.setPrototypeOf(this, OcrError.prototype);
52
+ }
53
+ }
54
+ class CacheError extends KreuzbergError {
55
+ constructor(message, panicContext) {
56
+ super(message, panicContext);
57
+ this.name = "CacheError";
58
+ Object.setPrototypeOf(this, CacheError.prototype);
59
+ }
60
+ }
61
+ class ImageProcessingError extends KreuzbergError {
62
+ constructor(message, panicContext) {
63
+ super(message, panicContext);
64
+ this.name = "ImageProcessingError";
65
+ Object.setPrototypeOf(this, ImageProcessingError.prototype);
66
+ }
67
+ }
68
+ class PluginError extends KreuzbergError {
69
+ /**
70
+ * Name of the plugin that threw the error.
71
+ */
72
+ pluginName;
73
+ constructor(message, pluginName, panicContext) {
74
+ super(`Plugin error in '${pluginName}': ${message}`, panicContext);
75
+ this.name = "PluginError";
76
+ this.pluginName = pluginName;
77
+ Object.setPrototypeOf(this, PluginError.prototype);
78
+ }
79
+ toJSON() {
80
+ return {
81
+ name: this.name,
82
+ message: this.message,
83
+ pluginName: this.pluginName,
84
+ panicContext: this.panicContext,
85
+ stack: this.stack
86
+ };
87
+ }
88
+ }
89
+ class MissingDependencyError extends KreuzbergError {
90
+ constructor(message, panicContext) {
91
+ super(message, panicContext);
92
+ this.name = "MissingDependencyError";
93
+ Object.setPrototypeOf(this, MissingDependencyError.prototype);
94
+ }
95
+ }
96
+ export {
97
+ CacheError,
98
+ ErrorCode,
99
+ ImageProcessingError,
100
+ KreuzbergError,
101
+ MissingDependencyError,
102
+ OcrError,
103
+ ParsingError,
104
+ PluginError,
105
+ ValidationError
106
+ };
107
+ //# sourceMappingURL=errors.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../typescript/errors.ts"],"sourcesContent":["/**\n * Error types for Kreuzberg document intelligence framework.\n *\n * These error classes mirror the Rust core error types and provide\n * type-safe error handling for TypeScript consumers.\n *\n * ## Error Hierarchy\n *\n * ```\n * Error (JavaScript built-in)\n * └── KreuzbergError (base class)\n * ├── ValidationError\n * ├── ParsingError\n * ├── OcrError\n * ├── CacheError\n * ├── ImageProcessingError\n * ├── PluginError\n * ├── MissingDependencyError\n * └── ... (other error types)\n * ```\n *\n * @module errors\n */\n\n/**\n * FFI error codes matching kreuzberg-ffi C library error types.\n *\n * @example\n * ```typescript\n * import { ErrorCode, getLastErrorCode } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * const code = getLastErrorCode();\n * if (code === ErrorCode.Panic) {\n * console.error('A panic occurred in the native library');\n * }\n * }\n * ```\n */\nexport enum ErrorCode {\n\t/**\n\t * No error (success)\n\t */\n\tSuccess = 0,\n\t/**\n\t * Generic error\n\t */\n\tGenericError = 1,\n\t/**\n\t * Panic occurred in native code\n\t */\n\tPanic = 2,\n\t/**\n\t * Invalid argument provided\n\t */\n\tInvalidArgument = 3,\n\t/**\n\t * I/O error (file system, network, etc.)\n\t */\n\tIoError = 4,\n\t/**\n\t * Error parsing document content\n\t */\n\tParsingError = 5,\n\t/**\n\t * Error in OCR processing\n\t */\n\tOcrError = 6,\n\t/**\n\t * Required system dependency is missing\n\t */\n\tMissingDependency = 7,\n}\n\n/**\n * Context information for panics in native code.\n *\n * Contains file location, line number, function name, panic message,\n * and timestamp for debugging native library issues.\n *\n * @example\n * ```typescript\n * import { KreuzbergError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof KreuzbergError && error.panicContext) {\n * console.error('Panic occurred:');\n * console.error(`File: ${error.panicContext.file}`);\n * console.error(`Line: ${error.panicContext.line}`);\n * console.error(`Function: ${error.panicContext.function}`);\n * console.error(`Message: ${error.panicContext.message}`);\n * }\n * }\n * ```\n */\nexport interface PanicContext {\n\t/**\n\t * Source file where panic occurred\n\t */\n\tfile: string;\n\t/**\n\t * Line number in source file\n\t */\n\tline: number;\n\t/**\n\t * Function name where panic occurred\n\t */\n\tfunction: string;\n\t/**\n\t * Panic message\n\t */\n\tmessage: string;\n\t/**\n\t * Unix timestamp (seconds since epoch)\n\t */\n\ttimestamp_secs: number;\n}\n\n/**\n * Base error class for all Kreuzberg errors.\n *\n * All error types thrown by Kreuzberg extend this class, allowing\n * consumers to catch all Kreuzberg-specific errors with a single catch block.\n *\n * @example\n * ```typescript\n * import { extractFile, KreuzbergError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof KreuzbergError) {\n * console.error('Kreuzberg error:', error.message);\n * if (error.panicContext) {\n * console.error('Panic at:', error.panicContext.file + ':' + error.panicContext.line);\n * }\n * } else {\n * throw error; // Re-throw non-Kreuzberg errors\n * }\n * }\n * ```\n */\nexport class KreuzbergError extends Error {\n\t/**\n\t * Panic context if error was caused by a panic in native code.\n\t * Will be null for non-panic errors.\n\t */\n\tpublic readonly panicContext: PanicContext | null;\n\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message);\n\t\tthis.name = \"KreuzbergError\";\n\t\tthis.panicContext = panicContext ?? null;\n\t\tObject.setPrototypeOf(this, KreuzbergError.prototype);\n\t}\n\n\ttoJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tpanicContext: this.panicContext,\n\t\t\tstack: this.stack,\n\t\t};\n\t}\n}\n\n/**\n * Error thrown when document validation fails.\n *\n * Validation errors occur when a document doesn't meet specified criteria,\n * such as minimum content length, required metadata fields, or quality thresholds.\n *\n * @example\n * ```typescript\n * import { extractFile, ValidationError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof ValidationError) {\n * console.error('Document validation failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ValidationError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ValidationError\";\n\t\tObject.setPrototypeOf(this, ValidationError.prototype);\n\t}\n}\n\n/**\n * Error thrown when document parsing fails.\n *\n * Parsing errors occur when a document is corrupted, malformed, or cannot\n * be processed by the extraction engine. This includes issues like:\n * - Corrupted PDF files\n * - Invalid XML/JSON syntax\n * - Unsupported file format versions\n * - Encrypted documents without valid passwords\n *\n * @example\n * ```typescript\n * import { extractFile, ParsingError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('corrupted.pdf');\n * } catch (error) {\n * if (error instanceof ParsingError) {\n * console.error('Failed to parse document:', error.message);\n * }\n * }\n * ```\n */\nexport class ParsingError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ParsingError\";\n\t\tObject.setPrototypeOf(this, ParsingError.prototype);\n\t}\n}\n\n/**\n * Error thrown when OCR processing fails.\n *\n * OCR errors occur during optical character recognition, such as:\n * - OCR backend initialization failures\n * - Image preprocessing errors\n * - Language model loading issues\n * - OCR engine crashes\n *\n * @example\n * ```typescript\n * import { extractFile, OcrError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('scanned.pdf', null, {\n * ocr: { backend: 'tesseract', language: 'eng' }\n * });\n * } catch (error) {\n * if (error instanceof OcrError) {\n * console.error('OCR processing failed:', error.message);\n * }\n * }\n * ```\n */\nexport class OcrError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"OcrError\";\n\t\tObject.setPrototypeOf(this, OcrError.prototype);\n\t}\n}\n\n/**\n * Error thrown when cache operations fail.\n *\n * Cache errors are typically non-fatal and occur during caching operations, such as:\n * - Cache directory creation failures\n * - Disk write errors\n * - Cache entry corruption\n * - Insufficient disk space\n *\n * These errors are usually logged but don't prevent extraction from completing.\n *\n * @example\n * ```typescript\n * import { extractFile, CacheError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf', null, {\n * useCache: true\n * });\n * } catch (error) {\n * if (error instanceof CacheError) {\n * console.warn('Cache operation failed, continuing without cache:', error.message);\n * }\n * }\n * ```\n */\nexport class CacheError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"CacheError\";\n\t\tObject.setPrototypeOf(this, CacheError.prototype);\n\t}\n}\n\n/**\n * Error thrown when image processing operations fail.\n *\n * Image processing errors occur during image manipulation, such as:\n * - Image decoding failures\n * - Unsupported image formats\n * - Image resizing/scaling errors\n * - DPI adjustment failures\n * - Color space conversion issues\n *\n * @example\n * ```typescript\n * import { extractFile, ImageProcessingError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf', null, {\n * images: {\n * extractImages: true,\n * targetDpi: 300\n * }\n * });\n * } catch (error) {\n * if (error instanceof ImageProcessingError) {\n * console.error('Image processing failed:', error.message);\n * }\n * }\n * ```\n */\nexport class ImageProcessingError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"ImageProcessingError\";\n\t\tObject.setPrototypeOf(this, ImageProcessingError.prototype);\n\t}\n}\n\n/**\n * Error thrown when a plugin operation fails.\n *\n * Plugin errors occur in custom plugins (postprocessors, validators, OCR backends), such as:\n * - Plugin initialization failures\n * - Plugin processing errors\n * - Plugin crashes or timeouts\n * - Invalid plugin configuration\n *\n * The error message includes the plugin name to help identify which plugin failed.\n *\n * @example\n * ```typescript\n * import { extractFile, PluginError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.pdf');\n * } catch (error) {\n * if (error instanceof PluginError) {\n * console.error(`Plugin '${error.pluginName}' failed:`, error.message);\n * }\n * }\n * ```\n */\nexport class PluginError extends KreuzbergError {\n\t/**\n\t * Name of the plugin that threw the error.\n\t */\n\tpublic readonly pluginName: string;\n\n\tconstructor(message: string, pluginName: string, panicContext?: PanicContext | null) {\n\t\tsuper(`Plugin error in '${pluginName}': ${message}`, panicContext);\n\t\tthis.name = \"PluginError\";\n\t\tthis.pluginName = pluginName;\n\t\tObject.setPrototypeOf(this, PluginError.prototype);\n\t}\n\n\toverride toJSON() {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.message,\n\t\t\tpluginName: this.pluginName,\n\t\t\tpanicContext: this.panicContext,\n\t\t\tstack: this.stack,\n\t\t};\n\t}\n}\n\n/**\n * Error thrown when a required system dependency is missing.\n *\n * Missing dependency errors occur when external tools or libraries are not available, such as:\n * - LibreOffice (for DOC/PPT/XLS files)\n * - Tesseract OCR (for OCR processing)\n * - ImageMagick (for image processing)\n * - Poppler (for PDF rendering)\n *\n * @example\n * ```typescript\n * import { extractFile, MissingDependencyError } from '@kreuzberg/node';\n *\n * try {\n * const result = await extractFile('document.doc');\n * } catch (error) {\n * if (error instanceof MissingDependencyError) {\n * console.error('Missing dependency:', error.message);\n * console.log('Please install LibreOffice to process DOC files');\n * }\n * }\n * ```\n */\nexport class MissingDependencyError extends KreuzbergError {\n\tconstructor(message: string, panicContext?: PanicContext | null) {\n\t\tsuper(message, panicContext);\n\t\tthis.name = \"MissingDependencyError\";\n\t\tObject.setPrototypeOf(this, MissingDependencyError.prototype);\n\t}\n}\n"],"mappings":"AAyCO,IAAK,YAAL,kBAAKA,eAAL;AAIN,EAAAA,sBAAA,aAAU,KAAV;AAIA,EAAAA,sBAAA,kBAAe,KAAf;AAIA,EAAAA,sBAAA,WAAQ,KAAR;AAIA,EAAAA,sBAAA,qBAAkB,KAAlB;AAIA,EAAAA,sBAAA,aAAU,KAAV;AAIA,EAAAA,sBAAA,kBAAe,KAAf;AAIA,EAAAA,sBAAA,cAAW,KAAX;AAIA,EAAAA,sBAAA,uBAAoB,KAApB;AAhCW,SAAAA;AAAA,GAAA;AAyGL,MAAM,uBAAuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB;AAAA,EAEhB,YAAY,SAAiB,cAAoC;AAChE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,eAAe,gBAAgB;AACpC,WAAO,eAAe,MAAM,eAAe,SAAS;AAAA,EACrD;AAAA,EAEA,SAAS;AACR,WAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,cAAc,KAAK;AAAA,MACnB,OAAO,KAAK;AAAA,IACb;AAAA,EACD;AACD;AAqBO,MAAM,wBAAwB,eAAe;AAAA,EACnD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,gBAAgB,SAAS;AAAA,EACtD;AACD;AAyBO,MAAM,qBAAqB,eAAe;AAAA,EAChD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,aAAa,SAAS;AAAA,EACnD;AACD;AA0BO,MAAM,iBAAiB,eAAe;AAAA,EAC5C,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,SAAS,SAAS;AAAA,EAC/C;AACD;AA4BO,MAAM,mBAAmB,eAAe;AAAA,EAC9C,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EACjD;AACD;AA8BO,MAAM,6BAA6B,eAAe;AAAA,EACxD,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,qBAAqB,SAAS;AAAA,EAC3D;AACD;AA0BO,MAAM,oBAAoB,eAAe;AAAA;AAAA;AAAA;AAAA,EAI/B;AAAA,EAEhB,YAAY,SAAiB,YAAoB,cAAoC;AACpF,UAAM,oBAAoB,UAAU,MAAM,OAAO,IAAI,YAAY;AACjE,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,WAAO,eAAe,MAAM,YAAY,SAAS;AAAA,EAClD;AAAA,EAES,SAAS;AACjB,WAAO;AAAA,MACN,MAAM,KAAK;AAAA,MACX,SAAS,KAAK;AAAA,MACd,YAAY,KAAK;AAAA,MACjB,cAAc,KAAK;AAAA,MACnB,OAAO,KAAK;AAAA,IACb;AAAA,EACD;AACD;AAyBO,MAAM,+BAA+B,eAAe;AAAA,EAC1D,YAAY,SAAiB,cAAoC;AAChE,UAAM,SAAS,YAAY;AAC3B,SAAK,OAAO;AACZ,WAAO,eAAe,MAAM,uBAAuB,SAAS;AAAA,EAC7D;AACD;","names":["ErrorCode"]}