@veryfront/ext-document-kreuzberg 0.1.993 → 0.1.994

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.
@@ -1,2 +1,2 @@
1
- export declare function extractionConfigForMimeType(mimeType: string): Record<string, unknown> | undefined;
1
+ export declare function extractionConfigForMimeType(mimeType: string): Record<string, unknown>;
2
2
  //# sourceMappingURL=extraction-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extraction-config.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-document-kreuzberg/src/extraction-config.ts"],"names":[],"mappings":"AAcA,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAIjG"}
1
+ {"version":3,"file":"extraction-config.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-document-kreuzberg/src/extraction-config.ts"],"names":[],"mappings":"AAmBA,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIrF"}
@@ -1,4 +1,8 @@
1
- const PDF_TEXT_ONLY_EXTRACTION_CONFIG = {
1
+ const MARKDOWN_EXTRACTION_CONFIG = {
2
+ outputFormat: "markdown",
3
+ };
4
+ const PDF_MARKDOWN_EXTRACTION_CONFIG = {
5
+ ...MARKDOWN_EXTRACTION_CONFIG,
2
6
  images: { extractImages: false },
3
7
  pdfOptions: {
4
8
  extractImages: false,
@@ -12,6 +16,6 @@ function normalizeMimeType(mimeType) {
12
16
  }
13
17
  export function extractionConfigForMimeType(mimeType) {
14
18
  return normalizeMimeType(mimeType) === "application/pdf"
15
- ? PDF_TEXT_ONLY_EXTRACTION_CONFIG
16
- : undefined;
19
+ ? PDF_MARKDOWN_EXTRACTION_CONFIG
20
+ : MARKDOWN_EXTRACTION_CONFIG;
17
21
  }
@@ -121,7 +121,11 @@ async function extractPptxBySlide(buffer, mimeType) {
121
121
  const slidePaths = await pptxSlidePaths(zip);
122
122
  if (!slidePaths.length) {
123
123
  const { extractBytes } = await loadKreuzbergNative();
124
- const result = await extractBytes(new Uint8Array(buffer), mimeType);
124
+ const result = await extractBytes(
125
+ new Uint8Array(buffer),
126
+ mimeType,
127
+ extractionConfigForMimeType(mimeType)
128
+ );
125
129
  postProgress({ unit: "file", current: 1, total: 1, characters: result.content.length });
126
130
  return result.content;
127
131
  }
@@ -142,7 +146,11 @@ async function extractPptxBySlide(buffer, mimeType) {
142
146
  }
143
147
  async function extractWholeFile(buffer, mimeType) {
144
148
  const { extractBytes } = await loadKreuzbergNative();
145
- const result = await extractBytes(new Uint8Array(buffer), mimeType);
149
+ const result = await extractBytes(
150
+ new Uint8Array(buffer),
151
+ mimeType,
152
+ extractionConfigForMimeType(mimeType)
153
+ );
146
154
  postProgress({ unit: "file", current: 1, total: 1, characters: result.content.length });
147
155
  return result.content;
148
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veryfront/ext-document-kreuzberg",
3
- "version": "0.1.993",
3
+ "version": "0.1.994",
4
4
  "description": "Veryfront first-party extension package for ext-document-kreuzberg",
5
5
  "keywords": [
6
6
  "veryfront",
@@ -55,7 +55,7 @@
55
55
  "pdf-lib": "1.17.1"
56
56
  },
57
57
  "peerDependencies": {
58
- "veryfront": "^0.1.993"
58
+ "veryfront": "^0.1.994"
59
59
  },
60
60
  "type": "module",
61
61
  "types": "./esm/extensions/ext-document-kreuzberg/src/index.d.ts",