@uploadista/flow-documents-unpdf 1.0.0-beta.3 → 1.0.0-beta.4

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,16 +1,17 @@
1
-
2
- > @uploadista/flow-documents-unpdf@1.0.0-beta.3 build /home/runner/work/uploadista-sdk/uploadista-sdk/packages/flow/documents/unpdf
3
- > tsc --noEmit && tsdown
4
-
5
- ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
1
+ $ tsc --noEmit && tsdown
2
+ ℹ tsdown v0.22.3 powered by rolldown v1.1.3
3
+ ℹ config file: /home/runner/work/uploadista-sdk/uploadista-sdk/packages/flow/documents/unpdf/package.json
6
4
  ℹ entry: src/index.ts
7
5
  ℹ tsconfig: tsconfig.json
8
6
  ℹ Build start
9
7
  ℹ dist/index.mjs 2.41 kB │ gzip: 0.83 kB
10
- ℹ dist/index.mjs.map 4.58 kB │ gzip: 1.38 kB
8
+ ℹ dist/index.mjs.map 4.67 kB │ gzip: 1.38 kB
11
9
  ℹ dist/index.d.mts.map 0.19 kB │ gzip: 0.15 kB
12
10
  ℹ dist/index.d.mts 0.39 kB │ gzip: 0.21 kB
13
- ℹ 4 files, total: 7.57 kB
14
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
11
+ ℹ 4 files, total: 7.67 kB
12
+ [PLUGIN_TIMINGS] Your build spent significant time in plugins. Here is a breakdown:
13
+ - rolldown-plugin-dts:generate (67%)
14
+ - tsdown:deps (32%)
15
+ See https://rolldown.rs/reference/InputOptions.checks#plugintimings for more details.
15
16
 
16
- ✔ Build complete in 13839ms
17
+ ✔ Build complete in 14429ms
package/dist/index.mjs CHANGED
@@ -3,7 +3,6 @@ import { DocumentPlugin } from "@uploadista/core/flow";
3
3
  import { withOperationSpan } from "@uploadista/observability";
4
4
  import { Effect, Layer } from "effect";
5
5
  import { extractText } from "unpdf";
6
-
7
6
  //#region src/document-plugin.ts
8
7
  const unpdfDocumentPlugin = Layer.succeed(DocumentPlugin, DocumentPlugin.of({
9
8
  extractText: (input) => {
@@ -40,7 +39,7 @@ const unpdfDocumentPlugin = Layer.succeed(DocumentPlugin, DocumentPlugin.of({
40
39
  }
41
40
  }));
42
41
  const UnpdfDocumentPluginLive = unpdfDocumentPlugin;
43
-
44
42
  //#endregion
45
43
  export { UnpdfDocumentPluginLive, unpdfDocumentPlugin };
44
+
46
45
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/document-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { DocumentPlugin } from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer } from \"effect\";\nimport { extractText } from \"unpdf\";\n\nexport const unpdfDocumentPlugin = Layer.succeed(\n DocumentPlugin,\n DocumentPlugin.of({\n extractText: (input) => {\n return Effect.gen(function* () {\n const text = yield* Effect.tryPromise({\n try: async () => {\n const result = await extractText(input, {\n mergePages: true,\n });\n return result.text;\n },\n catch: (error) => {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n if (\n errorMessage.toLowerCase().includes(\"encrypt\") ||\n errorMessage.toLowerCase().includes(\"password\")\n ) {\n return UploadistaError.fromCode(\"PDF_ENCRYPTED\", {\n cause: errorMessage,\n });\n }\n\n if (\n errorMessage.toLowerCase().includes(\"corrupt\") ||\n errorMessage.toLowerCase().includes(\"invalid\") ||\n errorMessage.toLowerCase().includes(\"malformed\")\n ) {\n return UploadistaError.fromCode(\"PDF_CORRUPTED\", {\n cause: errorMessage,\n });\n }\n\n return UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause: errorMessage,\n });\n },\n });\n\n // If no text was extracted, log a warning\n if (!text || text.trim().length === 0) {\n yield* Effect.logWarning(\n \"No text extracted from PDF. This might be a scanned document or image-based PDF. Consider using OCR instead.\",\n );\n }\n\n return text;\n }).pipe(\n withOperationSpan(\"document\", \"extract-text\", {\n \"document.input_size\": input.byteLength,\n }),\n );\n },\n\n getMetadata: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support metadata extraction\n // Return an error indicating that pdf-lib should be used instead\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support metadata extraction. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n\n splitPdf: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support PDF splitting\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support PDF splitting. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n\n mergePdfs: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support PDF merging\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support PDF merging. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n }),\n);\n\nexport const UnpdfDocumentPluginLive = unpdfDocumentPlugin;\n"],"mappings":";;;;;;;AAMA,MAAa,sBAAsB,MAAM,QACvC,gBACA,eAAe,GAAG;CAChB,cAAc,UAAU;AACtB,SAAO,OAAO,IAAI,aAAa;GAC7B,MAAM,OAAO,OAAO,OAAO,WAAW;IACpC,KAAK,YAAY;AAIf,aAHe,MAAM,YAAY,OAAO,EACtC,YAAY,MACb,CAAC,EACY;;IAEhB,QAAQ,UAAU;KAChB,MAAM,eACJ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAExD,SACE,aAAa,aAAa,CAAC,SAAS,UAAU,IAC9C,aAAa,aAAa,CAAC,SAAS,WAAW,CAE/C,QAAO,gBAAgB,SAAS,iBAAiB,EAC/C,OAAO,cACR,CAAC;AAGJ,SACE,aAAa,aAAa,CAAC,SAAS,UAAU,IAC9C,aAAa,aAAa,CAAC,SAAS,UAAU,IAC9C,aAAa,aAAa,CAAC,SAAS,YAAY,CAEhD,QAAO,gBAAgB,SAAS,iBAAiB,EAC/C,OAAO,cACR,CAAC;AAGJ,YAAO,gBAAgB,SAAS,8BAA8B,EAC5D,OAAO,cACR,CAAC;;IAEL,CAAC;AAGF,OAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,WAAW,EAClC,QAAO,OAAO,WACZ,+GACD;AAGH,UAAO;IACP,CAAC,KACD,kBAAkB,YAAY,gBAAgB,EAC5C,uBAAuB,MAAM,YAC9B,CAAC,CACH;;CAGH,mBAAmB;AACjB,SAAO,OAAO,IAAI,aAAa;AAG7B,UAAO,OAAO,gBAAgB,SAAS,8BAA8B,EACnE,OACE,8FACH,CAAC,CAAC,UAAU;IACb;;CAGJ,gBAAgB;AACd,SAAO,OAAO,IAAI,aAAa;AAE7B,UAAO,OAAO,gBAAgB,SAAS,8BAA8B,EACnE,OACE,wFACH,CAAC,CAAC,UAAU;IACb;;CAGJ,iBAAiB;AACf,SAAO,OAAO,IAAI,aAAa;AAE7B,UAAO,OAAO,gBAAgB,SAAS,8BAA8B,EACnE,OACE,sFACH,CAAC,CAAC,UAAU;IACb;;CAEL,CAAC,CACH;AAED,MAAa,0BAA0B"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/document-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport { DocumentPlugin } from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer } from \"effect\";\nimport { extractText } from \"unpdf\";\n\nexport const unpdfDocumentPlugin = Layer.succeed(\n DocumentPlugin,\n DocumentPlugin.of({\n extractText: (input) => {\n return Effect.gen(function* () {\n const text = yield* Effect.tryPromise({\n try: async () => {\n const result = await extractText(input, {\n mergePages: true,\n });\n return result.text;\n },\n catch: (error) => {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n if (\n errorMessage.toLowerCase().includes(\"encrypt\") ||\n errorMessage.toLowerCase().includes(\"password\")\n ) {\n return UploadistaError.fromCode(\"PDF_ENCRYPTED\", {\n cause: errorMessage,\n });\n }\n\n if (\n errorMessage.toLowerCase().includes(\"corrupt\") ||\n errorMessage.toLowerCase().includes(\"invalid\") ||\n errorMessage.toLowerCase().includes(\"malformed\")\n ) {\n return UploadistaError.fromCode(\"PDF_CORRUPTED\", {\n cause: errorMessage,\n });\n }\n\n return UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause: errorMessage,\n });\n },\n });\n\n // If no text was extracted, log a warning\n if (!text || text.trim().length === 0) {\n yield* Effect.logWarning(\n \"No text extracted from PDF. This might be a scanned document or image-based PDF. Consider using OCR instead.\",\n );\n }\n\n return text;\n }).pipe(\n withOperationSpan(\"document\", \"extract-text\", {\n \"document.input_size\": input.byteLength,\n }),\n );\n },\n\n getMetadata: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support metadata extraction\n // Return an error indicating that pdf-lib should be used instead\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support metadata extraction. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n\n splitPdf: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support PDF splitting\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support PDF splitting. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n\n mergePdfs: () => {\n return Effect.gen(function* () {\n // unpdf doesn't support PDF merging\n return yield* UploadistaError.fromCode(\"DOCUMENT_PROCESSING_FAILED\", {\n cause:\n \"unpdf does not support PDF merging. Use @uploadista/flow-documents-pdflib instead.\",\n }).toEffect();\n });\n },\n }),\n);\n\nexport const UnpdfDocumentPluginLive = unpdfDocumentPlugin;\n"],"mappings":";;;;;;AAMA,MAAa,sBAAsB,MAAM,QACvC,gBACA,eAAe,GAAG;CAChB,cAAc,UAAU;EACtB,OAAO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AC,CAAC,SAAS;EACd,CAAC;CACH;AACF,CAAC,CACH;AAEA,MAAa,0BAA0B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uploadista/flow-documents-unpdf",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.3",
4
+ "version": "1.0.0-beta.4",
5
5
  "description": "unpdf plugin for Uploadista document text extraction",
6
6
  "license": "MIT",
7
7
  "author": "Uploadista",
@@ -15,20 +15,20 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "unpdf": "^1.4.0",
18
- "@uploadista/core": "1.0.0-beta.3",
19
- "@uploadista/observability": "1.0.0-beta.3"
18
+ "@uploadista/core": "1.0.0-beta.4",
19
+ "@uploadista/observability": "1.0.0-beta.4"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "effect": "^3.0.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@effect/vitest": "0.27.0",
25
+ "@effect/vitest": "0.29.0",
26
26
  "@types/node": "24.10.9",
27
- "effect": "3.19.19",
27
+ "effect": "3.21.4",
28
28
  "pdf-lib": "^1.17.1",
29
- "tsdown": "0.20.3",
29
+ "tsdown": "0.22.3",
30
30
  "vitest": "4.0.18",
31
- "@uploadista/typescript-config": "1.0.0-beta.3"
31
+ "@uploadista/typescript-config": "1.0.0-beta.4"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsc --noEmit && tsdown",
package/tsconfig.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "@uploadista/typescript-config/server.json",
3
3
  "compilerOptions": {
4
- "baseUrl": "./",
5
4
  "paths": {
6
5
  "@/*": ["./src/*"]
7
6
  },