@uploadista/flow-documents-nodes 0.0.18-beta.16 → 0.0.18-beta.2
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/.turbo/turbo-build.log +32 -33
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +14 -195
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +14 -195
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/convert-to-markdown-node.ts +0 -8
- package/src/describe-document-node.ts +0 -1
- package/src/extract-text-node.ts +0 -1
- package/src/merge-pdf-node.ts +2 -28
- package/src/ocr-node.ts +0 -8
- package/src/split-pdf-node.ts +2 -44
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[34mℹ[39m tsdown
|
|
7
|
-
[34mℹ[39m
|
|
8
|
-
[34mℹ[39m
|
|
9
|
-
[34mℹ[39m
|
|
10
|
-
[34mℹ[39m
|
|
11
|
-
[34mℹ[39m
|
|
12
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[
|
|
13
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[
|
|
14
|
-
[34mℹ[39m [33m[CJS][39m
|
|
15
|
-
[34mℹ[39m [
|
|
16
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[
|
|
17
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
18
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.
|
|
19
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
20
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
21
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
22
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
23
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[
|
|
24
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[
|
|
25
|
-
[34mℹ[39m [34m[ESM][39m
|
|
26
|
-
[34mℹ[39m [
|
|
27
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.cts.map
|
|
28
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[
|
|
29
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[
|
|
30
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[
|
|
31
|
-
[34mℹ[39m [33m[CJS][39m
|
|
32
|
-
[
|
|
33
|
-
[32m✔[39m Build complete in [32m7659ms[39m
|
|
1
|
+
|
|
2
|
+
> @uploadista/flow-documents-nodes@0.0.18-beta.1 build /Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/documents/nodes
|
|
3
|
+
> tsdown
|
|
4
|
+
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.16.6[22m powered by rolldown [2mv1.0.0-beta.51[22m
|
|
6
|
+
[34mℹ[39m Using tsdown config: [4m/Users/denislaboureyras/Documents/uploadista/dev/uploadista-workspace/uploadista-sdk/packages/flow/documents/nodes/tsdown.config.ts[24m
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/types/index.ts[39m
|
|
8
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m Cleaning 19 files
|
|
11
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m10.50 kB[22m [2m│ gzip: 2.50 kB[22m
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mtypes/index.cjs[22m [2m 0.25 kB[22m [2m│ gzip: 0.15 kB[22m
|
|
13
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mtypes-Cz0s5Dxw.cjs [2m 1.09 kB[22m [2m│ gzip: 0.36 kB[22m
|
|
14
|
+
[34mℹ[39m [33m[CJS][39m 3 files, total: 11.84 kB
|
|
15
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.mjs[22m [2m 9.28 kB[22m [2m│ gzip: 2.57 kB[22m
|
|
16
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mtypes/index.mjs[22m [2m 0.25 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
17
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.mjs.map [2m33.83 kB[22m [2m│ gzip: 5.79 kB[22m
|
|
18
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex.d.mts.map [2m 6.28 kB[22m [2m│ gzip: 0.95 kB[22m
|
|
19
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mtypes-wF9yqL-x.mjs.map [2m 2.57 kB[22m [2m│ gzip: 0.77 kB[22m
|
|
20
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mindex-aD9vy0kH.d.mts.map [2m 1.02 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
21
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mtypes-wF9yqL-x.mjs [2m 0.70 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
22
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m31.85 kB[22m [2m│ gzip: 1.74 kB[22m
|
|
23
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mtypes/index.d.mts[22m[39m [2m 0.63 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
24
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-aD9vy0kH.d.mts[39m [2m 2.33 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
25
|
+
[34mℹ[39m [34m[ESM][39m 10 files, total: 88.73 kB
|
|
26
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex.d.cts.map [2m 6.28 kB[22m [2m│ gzip: 0.95 kB[22m
|
|
27
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mindex-DN0piYEv.d.cts.map [2m 1.02 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
28
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m31.85 kB[22m [2m│ gzip: 1.74 kB[22m
|
|
29
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mtypes/index.d.cts[22m[39m [2m 0.63 kB[22m [2m│ gzip: 0.23 kB[22m
|
|
30
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-DN0piYEv.d.cts[39m [2m 2.33 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
31
|
+
[34mℹ[39m [33m[CJS][39m 5 files, total: 42.11 kB
|
|
32
|
+
[32m✔[39m Build complete in [32m4592ms[39m
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const e=require(`./types-Cz0s5Dxw.cjs`);let t=require(`@uploadista/core/errors`),n=require(`@uploadista/core/flow`),r=require(`@uploadista/core/types`),i=require(`@uploadista/core/upload`),a=require(`effect`),o=require(`zod`);function s(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*n.DocumentAiPlugin,l=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Convert to Markdown`,description:`Convert documents to Markdown format (intelligently uses OCR if needed)`,type:n.NodeType.process,
|
|
1
|
+
const e=require(`./types-Cz0s5Dxw.cjs`);let t=require(`@uploadista/core/errors`),n=require(`@uploadista/core/flow`),r=require(`@uploadista/core/types`),i=require(`@uploadista/core/upload`),a=require(`effect`),o=require(`zod`);function s(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*n.DocumentAiPlugin,l=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Convert to Markdown`,description:`Convert documents to Markdown format (intelligently uses OCR if needed)`,type:n.NodeType.process,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:u,clientId:d})=>a.Effect.gen(function*(){let f={flowId:i,nodeId:e,jobId:u};yield*a.Effect.logInfo(`Converting file ${r.id} to Markdown`);let p=yield*l.read(r.id,d),m=yield*s.extractText(p).pipe(a.Effect.either),h,g;if(a.Either.isRight(m)&&m.right.trim().length>0){let e=m.right;yield*a.Effect.logInfo(`Successfully extracted ${e.length} characters from searchable PDF`),h=e.split(`
|
|
2
2
|
|
|
3
3
|
`).map(e=>e.trim()).filter(e=>e.length>0).join(`
|
|
4
4
|
|
|
5
|
-
`),g=`text`,yield*a.Effect.logInfo(`Converted text to Markdown (${h.length} characters)`)}else{yield*a.Effect.logInfo(`Text extraction failed or returned empty, falling back to OCR`);let e=r.url;if(!e)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for OCR-based markdown conversion`}).toEffect();let n={clientId:d,credentialId:o.credentialId};h=(yield*c.performOCR(e,{taskType:`convertToMarkdown`,resolution:o.resolution||`gundam`},n).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to perform OCR`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to perform OCR for markdown conversion`}).toEffect()})))).extractedText,g=`ocr`,yield*a.Effect.logInfo(`Successfully converted scanned document to Markdown using OCR (${h.length} characters)`)}let{metadata:_}=(0,n.resolveUploadMetadata)(r.metadata),v={...r.metadata,..._,markdown:h,markdownSource:g};return yield*a.Effect.logInfo(`Successfully converted file ${r.id} to Markdown via ${g}`),(0,n.completeNodeExecution)({...r,metadata:v,flow:f})})})})}function c(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Describe Document`,description:`Extract metadata from PDF documents`,type:n.NodeType.process,nodeTypeId:`describe-document`,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:o,clientId:l})=>a.Effect.gen(function*(){let u={flowId:i,nodeId:e,jobId:o};yield*a.Effect.logInfo(`Extracting metadata from PDF file ${r.id}`);let d=yield*c.read(r.id,l),f=yield*s.getMetadata(d).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to extract metadata`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to extract metadata`}).toEffect()}))),{metadata:p}=(0,n.resolveUploadMetadata)(r.metadata),m={...r.metadata,...p,pageCount:f.pageCount,format:f.format,...f.author&&{author:f.author},...f.title&&{title:f.title},...f.subject&&{subject:f.subject},...f.creator&&{creator:f.creator},...f.creationDate&&{creationDate:f.creationDate},...f.modifiedDate&&{modifiedDate:f.modifiedDate},fileSize:f.fileSize};return yield*a.Effect.logInfo(`Successfully extracted metadata from file ${r.id}: ${f.pageCount} pages`),(0,n.completeNodeExecution)({...r,metadata:m,flow:u})})})})}function l(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Extract Text`,description:`Extract text from searchable PDF documents`,type:n.NodeType.process,nodeTypeId:`extract-text`,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:o,clientId:l})=>a.Effect.gen(function*(){let u={flowId:i,nodeId:e,jobId:o};yield*a.Effect.logInfo(`Extracting text from PDF file ${r.id}`);let d=yield*c.read(r.id,l),f=yield*s.extractText(d).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to extract text`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to extract text`}).toEffect()}))),{metadata:p}=(0,n.resolveUploadMetadata)(r.metadata),m={...r.metadata,...p,extractedText:f};return!f||f.trim().length===0?yield*a.Effect.logWarning(`No text extracted from file ${r.id}. This might be a scanned document. Consider using the OCR node instead.`):yield*a.Effect.logInfo(`Successfully extracted ${f.length} characters from file ${r.id}`),(0,n.completeNodeExecution)({...r,metadata:m,flow:u})})})})}const u=o.z.array(r.uploadFileSchema);function d(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Merge PDFs`,description:`Merge multiple PDF documents into one`,type:n.NodeType.process,nodeTypeId:`merge-pdf`,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:u,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:l,clientId:u})=>a.Effect.gen(function*(){let d={flowId:i,nodeId:e,jobId:l};if(!Array.isArray(r))return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`Merge PDF node requires an array of files from a Merge utility node`}).toEffect();if(r.length===0)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`At least one PDF file is required for merging`}).toEffect();let f=[],p=0;for(let e of r){let t=yield*c.read(e.id,u);f.push(t);let r=(0,n.resolveUploadMetadata)(e.metadata).metadata;r?.pageCount&&typeof r.pageCount==`number`&&(p+=r.pageCount)}yield*a.Effect.logInfo(`Merging ${r.length} PDF files`);let m=yield*s.mergePdfs({pdfs:f}).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to merge PDFs`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to merge PDFs`}).toEffect()}))),h=r[0],{metadata:g}=(0,n.resolveUploadMetadata)(h.metadata),_=new ReadableStream({start(e){e.enqueue(m),e.close()}}),v=`merged-${r.length}-documents.pdf`;if(o.naming){let t={...o.naming,autoSuffix:o.naming.autoSuffix??(()=>`merged`)};v=`${(0,n.getBaseName)((0,n.applyFileNaming)(h,(0,n.buildNamingContext)(h,{flowId:i,jobId:l,nodeId:e,nodeType:`merge-pdf`},{mergedCount:r.length}),t))}.pdf`}let y=yield*c.upload({storageId:h.storage.id,size:m.byteLength,type:`application/pdf`,fileName:v,lastModified:0,metadata:JSON.stringify({...g,pageCount:p,mergedFrom:r.length}),flow:d},u,_),b={...g,pageCount:p,mergedFrom:r.length,fileName:v};return yield*a.Effect.logInfo(`Successfully merged ${r.length} PDFs into one document with ${p} pages`),(0,n.completeNodeExecution)({...y,metadata:b})})})})}function f(e,i){return a.Effect.gen(function*(){let o=yield*n.DocumentAiPlugin;return yield*(0,n.createFlowNode)({id:e,name:`OCR`,description:`Extract text from scanned documents using AI`,type:n.NodeType.process,nodeTypeId:`ocr`,outputTypeId:n.OCR_OUTPUT_TYPE_ID,keepOutput:i.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:n.ocrOutputSchema,circuitBreaker:{enabled:!0,failureThreshold:5,resetTimeout:6e4,fallback:{type:`skip`,passThrough:!0}},run:({data:r,flowId:s,jobId:c,clientId:l})=>a.Effect.gen(function*(){let u={flowId:s,nodeId:e,jobId:c},d=r.url;if(!d)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for OCR operation`}).toEffect();yield*a.Effect.logInfo(`Starting OCR for file ${r.id} with task type: ${i.taskType}`);let f={clientId:l,credentialId:i.credentialId},p=yield*o.performOCR(d,{taskType:i.taskType,resolution:i.resolution,referenceText:i.referenceText},f).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to perform OCR`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to perform OCR`}).toEffect()})));return yield*a.Effect.logInfo(`Successfully completed OCR for file ${r.id}, extracted ${p.extractedText.length} characters`),(0,n.completeNodeExecution)({extractedText:p.extractedText,format:p.format,taskType:i.taskType,confidence:p.confidence,flow:u})})})})}function p(e,o){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Split PDF`,description:`Split PDF into pages or page ranges`,type:n.NodeType.process,nodeTypeId:`split-pdf`,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:l,clientId:u})=>a.Effect.gen(function*(){let d={flowId:i,nodeId:e,jobId:l};yield*a.Effect.logInfo(`Splitting PDF file ${r.id} in ${o.mode} mode`);let f=yield*c.read(r.id,u),p=yield*s.splitPdf(f,o).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to split PDF`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to split PDF`}).toEffect()}))),{metadata:m}=(0,n.resolveUploadMetadata)(r.metadata);if(p.mode===`individual`){yield*a.Effect.logInfo(`Successfully split PDF into ${p.pdfs.length} individual pages`),yield*a.Effect.logWarning(`Individual page mode returns multiple files - flow engine support required`);let t=p.pdfs[0],s=new ReadableStream({start(e){e.enqueue(t),e.close()}}),f=`${(0,n.getBaseName)(m?.fileName||`document`)}-page-1.pdf`;if(o.naming){let t={...o.naming,autoSuffix:o.naming.autoSuffix??(e=>`page-${e.pageNumber??1}`)};f=`${(0,n.getBaseName)((0,n.applyFileNaming)(r,(0,n.buildNamingContext)(r,{flowId:i,jobId:l,nodeId:e,nodeType:`split-pdf`},{pageNumber:1}),t))}.pdf`}let h=yield*c.upload({storageId:r.storage.id,size:t.byteLength,type:`application/pdf`,fileName:f,lastModified:0,metadata:JSON.stringify({...m,pageCount:1,splitMode:`individual`}),flow:d},u,s),g={...m,pageCount:1,splitMode:`individual`};return(0,n.completeNodeExecution)({...h,metadata:g})}let h=o.endPage&&o.startPage?o.endPage-o.startPage+1:1,g=p.pdf,_=new ReadableStream({start(e){e.enqueue(g),e.close()}}),v=`${(0,n.getBaseName)(m?.fileName||`document`)}-pages-${o.startPage}-${o.endPage}.pdf`;if(o.naming){let t={...o.naming,autoSuffix:o.naming.autoSuffix??(e=>`pages-${o.startPage}-${o.endPage}`)};v=`${(0,n.getBaseName)((0,n.applyFileNaming)(r,(0,n.buildNamingContext)(r,{flowId:i,jobId:l,nodeId:e,nodeType:`split-pdf`},{startPage:o.startPage,endPage:o.endPage}),t))}.pdf`}let y=yield*c.upload({storageId:r.storage.id,size:g.byteLength,type:`application/pdf`,fileName:v,lastModified:0,metadata:JSON.stringify({...m,pageCount:h,splitMode:`range`,splitRange:`${o.startPage}-${o.endPage}`}),flow:d},u,_),b={...m,pageCount:h,splitMode:`range`,splitRange:`${o.startPage}-${o.endPage}`};return yield*a.Effect.logInfo(`Successfully split PDF to pages ${o.startPage}-${o.endPage}`),(0,n.completeNodeExecution)({...y,metadata:b})})})})}exports.convertToMarkdownParamsSchema=e.o,exports.createConvertToMarkdownNode=s,exports.createDescribeDocumentNode=c,exports.createExtractTextNode=l,exports.createMergePdfNode=d,exports.createOcrNode=f,exports.createSplitPdfNode=p,exports.describeDocumentParamsSchema=e.a,exports.extractTextParamsSchema=e.i,exports.mergePdfParamsSchema=e.r,exports.ocrParamsSchema=e.n,exports.splitPdfParamsSchema=e.t;
|
|
5
|
+
`),g=`text`,yield*a.Effect.logInfo(`Converted text to Markdown (${h.length} characters)`)}else{yield*a.Effect.logInfo(`Text extraction failed or returned empty, falling back to OCR`);let e=r.url;if(!e)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for OCR-based markdown conversion`}).toEffect();let n={clientId:d,credentialId:o.credentialId};h=(yield*c.performOCR(e,{taskType:`convertToMarkdown`,resolution:o.resolution||`gundam`},n).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to perform OCR`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to perform OCR for markdown conversion`}).toEffect()})))).extractedText,g=`ocr`,yield*a.Effect.logInfo(`Successfully converted scanned document to Markdown using OCR (${h.length} characters)`)}let{metadata:_}=(0,n.resolveUploadMetadata)(r.metadata),v={...r.metadata,..._,markdown:h,markdownSource:g};return yield*a.Effect.logInfo(`Successfully converted file ${r.id} to Markdown via ${g}`),(0,n.completeNodeExecution)({...r,metadata:v,flow:f})})})})}function c(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Describe Document`,description:`Extract metadata from PDF documents`,type:n.NodeType.process,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:o,clientId:l})=>a.Effect.gen(function*(){let u={flowId:i,nodeId:e,jobId:o};yield*a.Effect.logInfo(`Extracting metadata from PDF file ${r.id}`);let d=yield*c.read(r.id,l),f=yield*s.getMetadata(d).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to extract metadata`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to extract metadata`}).toEffect()}))),{metadata:p}=(0,n.resolveUploadMetadata)(r.metadata),m={...r.metadata,...p,pageCount:f.pageCount,format:f.format,...f.author&&{author:f.author},...f.title&&{title:f.title},...f.subject&&{subject:f.subject},...f.creator&&{creator:f.creator},...f.creationDate&&{creationDate:f.creationDate},...f.modifiedDate&&{modifiedDate:f.modifiedDate},fileSize:f.fileSize};return yield*a.Effect.logInfo(`Successfully extracted metadata from file ${r.id}: ${f.pageCount} pages`),(0,n.completeNodeExecution)({...r,metadata:m,flow:u})})})})}function l(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Extract Text`,description:`Extract text from searchable PDF documents`,type:n.NodeType.process,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:o,clientId:l})=>a.Effect.gen(function*(){let u={flowId:i,nodeId:e,jobId:o};yield*a.Effect.logInfo(`Extracting text from PDF file ${r.id}`);let d=yield*c.read(r.id,l),f=yield*s.extractText(d).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to extract text`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to extract text`}).toEffect()}))),{metadata:p}=(0,n.resolveUploadMetadata)(r.metadata),m={...r.metadata,...p,extractedText:f};return!f||f.trim().length===0?yield*a.Effect.logWarning(`No text extracted from file ${r.id}. This might be a scanned document. Consider using the OCR node instead.`):yield*a.Effect.logInfo(`Successfully extracted ${f.length} characters from file ${r.id}`),(0,n.completeNodeExecution)({...r,metadata:m,flow:u})})})})}const u=o.z.array(r.uploadFileSchema);function d(e,o={}){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Merge PDFs`,description:`Merge multiple PDF documents into one`,type:n.NodeType.process,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:u,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:o,clientId:l})=>a.Effect.gen(function*(){let u={flowId:i,nodeId:e,jobId:o};if(!Array.isArray(r))return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`Merge PDF node requires an array of files from a Merge utility node`}).toEffect();if(r.length===0)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`At least one PDF file is required for merging`}).toEffect();let d=[],f=0;for(let e of r){let t=yield*c.read(e.id,l);d.push(t);let r=(0,n.resolveUploadMetadata)(e.metadata).metadata;r?.pageCount&&typeof r.pageCount==`number`&&(f+=r.pageCount)}yield*a.Effect.logInfo(`Merging ${r.length} PDF files`);let p=yield*s.mergePdfs({pdfs:d}).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to merge PDFs`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to merge PDFs`}).toEffect()}))),m=r[0],{metadata:h}=(0,n.resolveUploadMetadata)(m.metadata),g=new ReadableStream({start(e){e.enqueue(p),e.close()}}),_=yield*c.upload({storageId:m.storage.id,size:p.byteLength,type:`application/pdf`,fileName:`merged-${r.length}-documents.pdf`,lastModified:0,metadata:JSON.stringify({...h,pageCount:f,mergedFrom:r.length}),flow:u},l,g),v={...h,pageCount:f,mergedFrom:r.length,fileName:`merged-${r.length}-documents.pdf`};return yield*a.Effect.logInfo(`Successfully merged ${r.length} PDFs into one document with ${f} pages`),(0,n.completeNodeExecution)({..._,metadata:v})})})})}function f(e,i){return a.Effect.gen(function*(){let o=yield*n.DocumentAiPlugin;return yield*(0,n.createFlowNode)({id:e,name:`OCR`,description:`Extract text from scanned documents using AI`,type:n.NodeType.process,outputTypeId:n.OCR_OUTPUT_TYPE_ID,keepOutput:i.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:n.ocrOutputSchema,run:({data:r,flowId:s,jobId:c,clientId:l})=>a.Effect.gen(function*(){let u={flowId:s,nodeId:e,jobId:c},d=r.url;if(!d)return yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:`URL is required for OCR operation`}).toEffect();yield*a.Effect.logInfo(`Starting OCR for file ${r.id} with task type: ${i.taskType}`);let f={clientId:l,credentialId:i.credentialId},p=yield*o.performOCR(d,{taskType:i.taskType,resolution:i.resolution,referenceText:i.referenceText},f).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to perform OCR`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to perform OCR`}).toEffect()})));return yield*a.Effect.logInfo(`Successfully completed OCR for file ${r.id}, extracted ${p.extractedText.length} characters`),(0,n.completeNodeExecution)({extractedText:p.extractedText,format:p.format,taskType:i.taskType,confidence:p.confidence,flow:u})})})})}function p(e,o){return a.Effect.gen(function*(){let s=yield*n.DocumentPlugin,c=yield*i.UploadServer;return yield*(0,n.createFlowNode)({id:e,name:`Split PDF`,description:`Split PDF into pages or page ranges`,type:n.NodeType.process,outputTypeId:n.STORAGE_OUTPUT_TYPE_ID,keepOutput:o.keepOutput,inputSchema:r.uploadFileSchema,outputSchema:r.uploadFileSchema,run:({data:r,flowId:i,jobId:l,clientId:u})=>a.Effect.gen(function*(){let d={flowId:i,nodeId:e,jobId:l};yield*a.Effect.logInfo(`Splitting PDF file ${r.id} in ${o.mode} mode`);let f=yield*c.read(r.id,u),p=yield*s.splitPdf(f,o).pipe(a.Effect.catchAll(e=>a.Effect.gen(function*(){return yield*a.Effect.logError(`Failed to split PDF`,e),yield*t.UploadistaError.fromCode(`FLOW_NODE_ERROR`,{cause:e instanceof Error?e.message:`Failed to split PDF`}).toEffect()}))),{metadata:m}=(0,n.resolveUploadMetadata)(r.metadata);if(p.mode===`individual`){yield*a.Effect.logInfo(`Successfully split PDF into ${p.pdfs.length} individual pages`),yield*a.Effect.logWarning(`Individual page mode returns multiple files - flow engine support required`);let e=p.pdfs[0],t=new ReadableStream({start(t){t.enqueue(e),t.close()}}),i=yield*c.upload({storageId:r.storage.id,size:e.byteLength,type:`application/pdf`,fileName:`${m?.fileName||`document`}-page-1.pdf`,lastModified:0,metadata:JSON.stringify({...m,pageCount:1,splitMode:`individual`}),flow:d},u,t),o={...m,pageCount:1,splitMode:`individual`};return(0,n.completeNodeExecution)({...i,metadata:o})}let h=o.endPage&&o.startPage?o.endPage-o.startPage+1:1,g=p.pdf,_=new ReadableStream({start(e){e.enqueue(g),e.close()}}),v=yield*c.upload({storageId:r.storage.id,size:g.byteLength,type:`application/pdf`,fileName:`${m?.fileName||`document`}-pages-${o.startPage}-${o.endPage}.pdf`,lastModified:0,metadata:JSON.stringify({...m,pageCount:h,splitMode:`range`,splitRange:`${o.startPage}-${o.endPage}`}),flow:d},u,_),y={...m,pageCount:h,splitMode:`range`,splitRange:`${o.startPage}-${o.endPage}`};return yield*a.Effect.logInfo(`Successfully split PDF to pages ${o.startPage}-${o.endPage}`),(0,n.completeNodeExecution)({...v,metadata:y})})})})}exports.convertToMarkdownParamsSchema=e.o,exports.createConvertToMarkdownNode=s,exports.createDescribeDocumentNode=c,exports.createExtractTextNode=l,exports.createMergePdfNode=d,exports.createOcrNode=f,exports.createSplitPdfNode=p,exports.describeDocumentParamsSchema=e.a,exports.extractTextParamsSchema=e.i,exports.mergePdfParamsSchema=e.r,exports.ocrParamsSchema=e.n,exports.splitPdfParamsSchema=e.t;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as MergePdfParams, c as extractTextParamsSchema, d as ConvertToMarkdownParams, f as convertToMarkdownParamsSchema, i as ocrParamsSchema, l as DescribeDocumentParams, n as splitPdfParamsSchema, o as mergePdfParamsSchema, r as OcrParams, s as ExtractTextParams, t as SplitPdfParams, u as describeDocumentParamsSchema } from "./index-DN0piYEv.cjs";
|
|
2
|
-
import * as
|
|
3
|
-
import { DocumentAiPlugin, DocumentPlugin,
|
|
2
|
+
import * as _uploadista_core_flow1 from "@uploadista/core/flow";
|
|
3
|
+
import { DocumentAiPlugin, DocumentPlugin, NodeType, OcrResolution, OcrTaskType } from "@uploadista/core/flow";
|
|
4
4
|
import * as zod_v4_core1 from "zod/v4/core";
|
|
5
5
|
import * as zod1 from "zod";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -14,7 +14,7 @@ type ConvertToMarkdownNodeParams = {
|
|
|
14
14
|
resolution?: "tiny" | "small" | "base" | "gundam" | "large";
|
|
15
15
|
keepOutput?: boolean;
|
|
16
16
|
};
|
|
17
|
-
declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkdownNodeParams): Effect.Effect<
|
|
17
|
+
declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkdownNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
18
18
|
inputSchema: zod1.ZodType<{
|
|
19
19
|
id: string;
|
|
20
20
|
offset: number;
|
|
@@ -42,11 +42,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
42
42
|
nodeId: string;
|
|
43
43
|
jobId: string;
|
|
44
44
|
} | undefined;
|
|
45
|
-
traceContext?: {
|
|
46
|
-
traceId: string;
|
|
47
|
-
spanId: string;
|
|
48
|
-
traceFlags: number;
|
|
49
|
-
} | undefined;
|
|
50
45
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
51
46
|
id: string;
|
|
52
47
|
offset: number;
|
|
@@ -74,11 +69,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
74
69
|
nodeId: string;
|
|
75
70
|
jobId: string;
|
|
76
71
|
} | undefined;
|
|
77
|
-
traceContext?: {
|
|
78
|
-
traceId: string;
|
|
79
|
-
spanId: string;
|
|
80
|
-
traceFlags: number;
|
|
81
|
-
} | undefined;
|
|
82
72
|
}, unknown>>;
|
|
83
73
|
outputSchema: zod1.ZodType<{
|
|
84
74
|
id: string;
|
|
@@ -107,11 +97,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
107
97
|
nodeId: string;
|
|
108
98
|
jobId: string;
|
|
109
99
|
} | undefined;
|
|
110
|
-
traceContext?: {
|
|
111
|
-
traceId: string;
|
|
112
|
-
spanId: string;
|
|
113
|
-
traceFlags: number;
|
|
114
|
-
} | undefined;
|
|
115
100
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
116
101
|
id: string;
|
|
117
102
|
offset: number;
|
|
@@ -139,11 +124,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
139
124
|
nodeId: string;
|
|
140
125
|
jobId: string;
|
|
141
126
|
} | undefined;
|
|
142
|
-
traceContext?: {
|
|
143
|
-
traceId: string;
|
|
144
|
-
spanId: string;
|
|
145
|
-
traceFlags: number;
|
|
146
|
-
} | undefined;
|
|
147
127
|
}, unknown>>;
|
|
148
128
|
run: (args: {
|
|
149
129
|
data: {
|
|
@@ -173,18 +153,13 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
173
153
|
nodeId: string;
|
|
174
154
|
jobId: string;
|
|
175
155
|
} | undefined;
|
|
176
|
-
traceContext?: {
|
|
177
|
-
traceId: string;
|
|
178
|
-
spanId: string;
|
|
179
|
-
traceFlags: number;
|
|
180
|
-
} | undefined;
|
|
181
156
|
};
|
|
182
157
|
jobId: string;
|
|
183
158
|
storageId: string;
|
|
184
159
|
flowId: string;
|
|
185
160
|
inputs?: Record<string, unknown>;
|
|
186
161
|
clientId: string | null;
|
|
187
|
-
}) => Effect.Effect<
|
|
162
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
188
163
|
id: string;
|
|
189
164
|
offset: number;
|
|
190
165
|
storage: {
|
|
@@ -211,11 +186,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
211
186
|
nodeId: string;
|
|
212
187
|
jobId: string;
|
|
213
188
|
} | undefined;
|
|
214
|
-
traceContext?: {
|
|
215
|
-
traceId: string;
|
|
216
|
-
spanId: string;
|
|
217
|
-
traceFlags: number;
|
|
218
|
-
} | undefined;
|
|
219
189
|
}>, UploadistaError, never>;
|
|
220
190
|
condition?: {
|
|
221
191
|
field: string;
|
|
@@ -230,7 +200,6 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
230
200
|
retryDelay?: number;
|
|
231
201
|
exponentialBackoff?: boolean;
|
|
232
202
|
};
|
|
233
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
234
203
|
} & {
|
|
235
204
|
type: NodeType.process;
|
|
236
205
|
}, UploadistaError, UploadServer | DocumentPlugin | DocumentAiPlugin>;
|
|
@@ -239,7 +208,7 @@ declare function createConvertToMarkdownNode(id: string, params?: ConvertToMarkd
|
|
|
239
208
|
type DescribeDocumentNodeParams = {
|
|
240
209
|
keepOutput?: boolean;
|
|
241
210
|
};
|
|
242
|
-
declare function createDescribeDocumentNode(id: string, params?: DescribeDocumentNodeParams): Effect.Effect<
|
|
211
|
+
declare function createDescribeDocumentNode(id: string, params?: DescribeDocumentNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
243
212
|
inputSchema: zod1.ZodType<{
|
|
244
213
|
id: string;
|
|
245
214
|
offset: number;
|
|
@@ -267,11 +236,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
267
236
|
nodeId: string;
|
|
268
237
|
jobId: string;
|
|
269
238
|
} | undefined;
|
|
270
|
-
traceContext?: {
|
|
271
|
-
traceId: string;
|
|
272
|
-
spanId: string;
|
|
273
|
-
traceFlags: number;
|
|
274
|
-
} | undefined;
|
|
275
239
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
276
240
|
id: string;
|
|
277
241
|
offset: number;
|
|
@@ -299,11 +263,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
299
263
|
nodeId: string;
|
|
300
264
|
jobId: string;
|
|
301
265
|
} | undefined;
|
|
302
|
-
traceContext?: {
|
|
303
|
-
traceId: string;
|
|
304
|
-
spanId: string;
|
|
305
|
-
traceFlags: number;
|
|
306
|
-
} | undefined;
|
|
307
266
|
}, unknown>>;
|
|
308
267
|
outputSchema: zod1.ZodType<{
|
|
309
268
|
id: string;
|
|
@@ -332,11 +291,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
332
291
|
nodeId: string;
|
|
333
292
|
jobId: string;
|
|
334
293
|
} | undefined;
|
|
335
|
-
traceContext?: {
|
|
336
|
-
traceId: string;
|
|
337
|
-
spanId: string;
|
|
338
|
-
traceFlags: number;
|
|
339
|
-
} | undefined;
|
|
340
294
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
341
295
|
id: string;
|
|
342
296
|
offset: number;
|
|
@@ -364,11 +318,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
364
318
|
nodeId: string;
|
|
365
319
|
jobId: string;
|
|
366
320
|
} | undefined;
|
|
367
|
-
traceContext?: {
|
|
368
|
-
traceId: string;
|
|
369
|
-
spanId: string;
|
|
370
|
-
traceFlags: number;
|
|
371
|
-
} | undefined;
|
|
372
321
|
}, unknown>>;
|
|
373
322
|
run: (args: {
|
|
374
323
|
data: {
|
|
@@ -398,18 +347,13 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
398
347
|
nodeId: string;
|
|
399
348
|
jobId: string;
|
|
400
349
|
} | undefined;
|
|
401
|
-
traceContext?: {
|
|
402
|
-
traceId: string;
|
|
403
|
-
spanId: string;
|
|
404
|
-
traceFlags: number;
|
|
405
|
-
} | undefined;
|
|
406
350
|
};
|
|
407
351
|
jobId: string;
|
|
408
352
|
storageId: string;
|
|
409
353
|
flowId: string;
|
|
410
354
|
inputs?: Record<string, unknown>;
|
|
411
355
|
clientId: string | null;
|
|
412
|
-
}) => Effect.Effect<
|
|
356
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
413
357
|
id: string;
|
|
414
358
|
offset: number;
|
|
415
359
|
storage: {
|
|
@@ -436,11 +380,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
436
380
|
nodeId: string;
|
|
437
381
|
jobId: string;
|
|
438
382
|
} | undefined;
|
|
439
|
-
traceContext?: {
|
|
440
|
-
traceId: string;
|
|
441
|
-
spanId: string;
|
|
442
|
-
traceFlags: number;
|
|
443
|
-
} | undefined;
|
|
444
383
|
}>, UploadistaError, never>;
|
|
445
384
|
condition?: {
|
|
446
385
|
field: string;
|
|
@@ -455,7 +394,6 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
455
394
|
retryDelay?: number;
|
|
456
395
|
exponentialBackoff?: boolean;
|
|
457
396
|
};
|
|
458
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
459
397
|
} & {
|
|
460
398
|
type: NodeType.process;
|
|
461
399
|
}, UploadistaError, UploadServer | DocumentPlugin>;
|
|
@@ -464,7 +402,7 @@ declare function createDescribeDocumentNode(id: string, params?: DescribeDocumen
|
|
|
464
402
|
type ExtractTextNodeParams = {
|
|
465
403
|
keepOutput?: boolean;
|
|
466
404
|
};
|
|
467
|
-
declare function createExtractTextNode(id: string, params?: ExtractTextNodeParams): Effect.Effect<
|
|
405
|
+
declare function createExtractTextNode(id: string, params?: ExtractTextNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
468
406
|
inputSchema: zod1.ZodType<{
|
|
469
407
|
id: string;
|
|
470
408
|
offset: number;
|
|
@@ -492,11 +430,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
492
430
|
nodeId: string;
|
|
493
431
|
jobId: string;
|
|
494
432
|
} | undefined;
|
|
495
|
-
traceContext?: {
|
|
496
|
-
traceId: string;
|
|
497
|
-
spanId: string;
|
|
498
|
-
traceFlags: number;
|
|
499
|
-
} | undefined;
|
|
500
433
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
501
434
|
id: string;
|
|
502
435
|
offset: number;
|
|
@@ -524,11 +457,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
524
457
|
nodeId: string;
|
|
525
458
|
jobId: string;
|
|
526
459
|
} | undefined;
|
|
527
|
-
traceContext?: {
|
|
528
|
-
traceId: string;
|
|
529
|
-
spanId: string;
|
|
530
|
-
traceFlags: number;
|
|
531
|
-
} | undefined;
|
|
532
460
|
}, unknown>>;
|
|
533
461
|
outputSchema: zod1.ZodType<{
|
|
534
462
|
id: string;
|
|
@@ -557,11 +485,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
557
485
|
nodeId: string;
|
|
558
486
|
jobId: string;
|
|
559
487
|
} | undefined;
|
|
560
|
-
traceContext?: {
|
|
561
|
-
traceId: string;
|
|
562
|
-
spanId: string;
|
|
563
|
-
traceFlags: number;
|
|
564
|
-
} | undefined;
|
|
565
488
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
566
489
|
id: string;
|
|
567
490
|
offset: number;
|
|
@@ -589,11 +512,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
589
512
|
nodeId: string;
|
|
590
513
|
jobId: string;
|
|
591
514
|
} | undefined;
|
|
592
|
-
traceContext?: {
|
|
593
|
-
traceId: string;
|
|
594
|
-
spanId: string;
|
|
595
|
-
traceFlags: number;
|
|
596
|
-
} | undefined;
|
|
597
515
|
}, unknown>>;
|
|
598
516
|
run: (args: {
|
|
599
517
|
data: {
|
|
@@ -623,18 +541,13 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
623
541
|
nodeId: string;
|
|
624
542
|
jobId: string;
|
|
625
543
|
} | undefined;
|
|
626
|
-
traceContext?: {
|
|
627
|
-
traceId: string;
|
|
628
|
-
spanId: string;
|
|
629
|
-
traceFlags: number;
|
|
630
|
-
} | undefined;
|
|
631
544
|
};
|
|
632
545
|
jobId: string;
|
|
633
546
|
storageId: string;
|
|
634
547
|
flowId: string;
|
|
635
548
|
inputs?: Record<string, unknown>;
|
|
636
549
|
clientId: string | null;
|
|
637
|
-
}) => Effect.Effect<
|
|
550
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
638
551
|
id: string;
|
|
639
552
|
offset: number;
|
|
640
553
|
storage: {
|
|
@@ -661,11 +574,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
661
574
|
nodeId: string;
|
|
662
575
|
jobId: string;
|
|
663
576
|
} | undefined;
|
|
664
|
-
traceContext?: {
|
|
665
|
-
traceId: string;
|
|
666
|
-
spanId: string;
|
|
667
|
-
traceFlags: number;
|
|
668
|
-
} | undefined;
|
|
669
577
|
}>, UploadistaError, never>;
|
|
670
578
|
condition?: {
|
|
671
579
|
field: string;
|
|
@@ -680,7 +588,6 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
680
588
|
retryDelay?: number;
|
|
681
589
|
exponentialBackoff?: boolean;
|
|
682
590
|
};
|
|
683
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
684
591
|
} & {
|
|
685
592
|
type: NodeType.process;
|
|
686
593
|
}, UploadistaError, UploadServer | DocumentPlugin>;
|
|
@@ -689,13 +596,8 @@ declare function createExtractTextNode(id: string, params?: ExtractTextNodeParam
|
|
|
689
596
|
type MergePdfNodeParams = {
|
|
690
597
|
inputCount?: number;
|
|
691
598
|
keepOutput?: boolean;
|
|
692
|
-
/**
|
|
693
|
-
* Optional file naming configuration.
|
|
694
|
-
* Auto suffix: `merged`
|
|
695
|
-
*/
|
|
696
|
-
naming?: FileNamingConfig;
|
|
697
599
|
};
|
|
698
|
-
declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Effect.Effect<
|
|
600
|
+
declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
699
601
|
inputSchema: z.ZodType<{
|
|
700
602
|
id: string;
|
|
701
603
|
offset: number;
|
|
@@ -723,11 +625,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
723
625
|
nodeId: string;
|
|
724
626
|
jobId: string;
|
|
725
627
|
} | undefined;
|
|
726
|
-
traceContext?: {
|
|
727
|
-
traceId: string;
|
|
728
|
-
spanId: string;
|
|
729
|
-
traceFlags: number;
|
|
730
|
-
} | undefined;
|
|
731
628
|
}[], unknown, z.core.$ZodTypeInternals<{
|
|
732
629
|
id: string;
|
|
733
630
|
offset: number;
|
|
@@ -755,11 +652,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
755
652
|
nodeId: string;
|
|
756
653
|
jobId: string;
|
|
757
654
|
} | undefined;
|
|
758
|
-
traceContext?: {
|
|
759
|
-
traceId: string;
|
|
760
|
-
spanId: string;
|
|
761
|
-
traceFlags: number;
|
|
762
|
-
} | undefined;
|
|
763
655
|
}[], unknown>>;
|
|
764
656
|
outputSchema: z.ZodType<{
|
|
765
657
|
id: string;
|
|
@@ -788,11 +680,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
788
680
|
nodeId: string;
|
|
789
681
|
jobId: string;
|
|
790
682
|
} | undefined;
|
|
791
|
-
traceContext?: {
|
|
792
|
-
traceId: string;
|
|
793
|
-
spanId: string;
|
|
794
|
-
traceFlags: number;
|
|
795
|
-
} | undefined;
|
|
796
683
|
}, unknown, z.core.$ZodTypeInternals<{
|
|
797
684
|
id: string;
|
|
798
685
|
offset: number;
|
|
@@ -820,11 +707,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
820
707
|
nodeId: string;
|
|
821
708
|
jobId: string;
|
|
822
709
|
} | undefined;
|
|
823
|
-
traceContext?: {
|
|
824
|
-
traceId: string;
|
|
825
|
-
spanId: string;
|
|
826
|
-
traceFlags: number;
|
|
827
|
-
} | undefined;
|
|
828
710
|
}, unknown>>;
|
|
829
711
|
run: (args: {
|
|
830
712
|
data: {
|
|
@@ -854,18 +736,13 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
854
736
|
nodeId: string;
|
|
855
737
|
jobId: string;
|
|
856
738
|
} | undefined;
|
|
857
|
-
traceContext?: {
|
|
858
|
-
traceId: string;
|
|
859
|
-
spanId: string;
|
|
860
|
-
traceFlags: number;
|
|
861
|
-
} | undefined;
|
|
862
739
|
}[];
|
|
863
740
|
jobId: string;
|
|
864
741
|
storageId: string;
|
|
865
742
|
flowId: string;
|
|
866
743
|
inputs?: Record<string, unknown>;
|
|
867
744
|
clientId: string | null;
|
|
868
|
-
}) => Effect.Effect<
|
|
745
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
869
746
|
id: string;
|
|
870
747
|
offset: number;
|
|
871
748
|
storage: {
|
|
@@ -892,11 +769,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
892
769
|
nodeId: string;
|
|
893
770
|
jobId: string;
|
|
894
771
|
} | undefined;
|
|
895
|
-
traceContext?: {
|
|
896
|
-
traceId: string;
|
|
897
|
-
spanId: string;
|
|
898
|
-
traceFlags: number;
|
|
899
|
-
} | undefined;
|
|
900
772
|
}>, UploadistaError, never>;
|
|
901
773
|
condition?: {
|
|
902
774
|
field: string;
|
|
@@ -911,7 +783,6 @@ declare function createMergePdfNode(id: string, params?: MergePdfNodeParams): Ef
|
|
|
911
783
|
retryDelay?: number;
|
|
912
784
|
exponentialBackoff?: boolean;
|
|
913
785
|
};
|
|
914
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
915
786
|
} & {
|
|
916
787
|
type: NodeType.process;
|
|
917
788
|
}, UploadistaError, UploadServer | DocumentPlugin>;
|
|
@@ -924,7 +795,7 @@ type OcrNodeParams = {
|
|
|
924
795
|
referenceText?: string;
|
|
925
796
|
keepOutput?: boolean;
|
|
926
797
|
};
|
|
927
|
-
declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect<
|
|
798
|
+
declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
928
799
|
inputSchema: zod1.ZodType<{
|
|
929
800
|
id: string;
|
|
930
801
|
offset: number;
|
|
@@ -952,11 +823,6 @@ declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect
|
|
|
952
823
|
nodeId: string;
|
|
953
824
|
jobId: string;
|
|
954
825
|
} | undefined;
|
|
955
|
-
traceContext?: {
|
|
956
|
-
traceId: string;
|
|
957
|
-
spanId: string;
|
|
958
|
-
traceFlags: number;
|
|
959
|
-
} | undefined;
|
|
960
826
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
961
827
|
id: string;
|
|
962
828
|
offset: number;
|
|
@@ -984,11 +850,6 @@ declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect
|
|
|
984
850
|
nodeId: string;
|
|
985
851
|
jobId: string;
|
|
986
852
|
} | undefined;
|
|
987
|
-
traceContext?: {
|
|
988
|
-
traceId: string;
|
|
989
|
-
spanId: string;
|
|
990
|
-
traceFlags: number;
|
|
991
|
-
} | undefined;
|
|
992
853
|
}, unknown>>;
|
|
993
854
|
outputSchema: zod1.ZodType<{
|
|
994
855
|
extractedText: string;
|
|
@@ -1029,18 +890,13 @@ declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect
|
|
|
1029
890
|
nodeId: string;
|
|
1030
891
|
jobId: string;
|
|
1031
892
|
} | undefined;
|
|
1032
|
-
traceContext?: {
|
|
1033
|
-
traceId: string;
|
|
1034
|
-
spanId: string;
|
|
1035
|
-
traceFlags: number;
|
|
1036
|
-
} | undefined;
|
|
1037
893
|
};
|
|
1038
894
|
jobId: string;
|
|
1039
895
|
storageId: string;
|
|
1040
896
|
flowId: string;
|
|
1041
897
|
inputs?: Record<string, unknown>;
|
|
1042
898
|
clientId: string | null;
|
|
1043
|
-
}) => Effect.Effect<
|
|
899
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
1044
900
|
extractedText: string;
|
|
1045
901
|
format: "markdown" | "plain" | "structured";
|
|
1046
902
|
taskType: "convertToMarkdown" | "freeOcr" | "parseFigure" | "locateObject";
|
|
@@ -1059,7 +915,6 @@ declare function createOcrNode(id: string, params: OcrNodeParams): Effect.Effect
|
|
|
1059
915
|
retryDelay?: number;
|
|
1060
916
|
exponentialBackoff?: boolean;
|
|
1061
917
|
};
|
|
1062
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
1063
918
|
} & {
|
|
1064
919
|
type: NodeType.process;
|
|
1065
920
|
}, UploadistaError, DocumentAiPlugin>;
|
|
@@ -1070,13 +925,8 @@ type SplitPdfNodeParams = {
|
|
|
1070
925
|
startPage?: number;
|
|
1071
926
|
endPage?: number;
|
|
1072
927
|
keepOutput?: boolean;
|
|
1073
|
-
/**
|
|
1074
|
-
* Optional file naming configuration.
|
|
1075
|
-
* Auto suffix: `page-${pageNumber}` for individual mode, `pages-${start}-${end}` for range mode
|
|
1076
|
-
*/
|
|
1077
|
-
naming?: FileNamingConfig;
|
|
1078
928
|
};
|
|
1079
|
-
declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Effect.Effect<
|
|
929
|
+
declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Effect.Effect<_uploadista_core_flow1.FlowNodeData & {
|
|
1080
930
|
inputSchema: zod1.ZodType<{
|
|
1081
931
|
id: string;
|
|
1082
932
|
offset: number;
|
|
@@ -1104,11 +954,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1104
954
|
nodeId: string;
|
|
1105
955
|
jobId: string;
|
|
1106
956
|
} | undefined;
|
|
1107
|
-
traceContext?: {
|
|
1108
|
-
traceId: string;
|
|
1109
|
-
spanId: string;
|
|
1110
|
-
traceFlags: number;
|
|
1111
|
-
} | undefined;
|
|
1112
957
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
1113
958
|
id: string;
|
|
1114
959
|
offset: number;
|
|
@@ -1136,11 +981,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1136
981
|
nodeId: string;
|
|
1137
982
|
jobId: string;
|
|
1138
983
|
} | undefined;
|
|
1139
|
-
traceContext?: {
|
|
1140
|
-
traceId: string;
|
|
1141
|
-
spanId: string;
|
|
1142
|
-
traceFlags: number;
|
|
1143
|
-
} | undefined;
|
|
1144
984
|
}, unknown>>;
|
|
1145
985
|
outputSchema: zod1.ZodType<{
|
|
1146
986
|
id: string;
|
|
@@ -1169,11 +1009,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1169
1009
|
nodeId: string;
|
|
1170
1010
|
jobId: string;
|
|
1171
1011
|
} | undefined;
|
|
1172
|
-
traceContext?: {
|
|
1173
|
-
traceId: string;
|
|
1174
|
-
spanId: string;
|
|
1175
|
-
traceFlags: number;
|
|
1176
|
-
} | undefined;
|
|
1177
1012
|
}, unknown, zod_v4_core1.$ZodTypeInternals<{
|
|
1178
1013
|
id: string;
|
|
1179
1014
|
offset: number;
|
|
@@ -1201,11 +1036,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1201
1036
|
nodeId: string;
|
|
1202
1037
|
jobId: string;
|
|
1203
1038
|
} | undefined;
|
|
1204
|
-
traceContext?: {
|
|
1205
|
-
traceId: string;
|
|
1206
|
-
spanId: string;
|
|
1207
|
-
traceFlags: number;
|
|
1208
|
-
} | undefined;
|
|
1209
1039
|
}, unknown>>;
|
|
1210
1040
|
run: (args: {
|
|
1211
1041
|
data: {
|
|
@@ -1235,18 +1065,13 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1235
1065
|
nodeId: string;
|
|
1236
1066
|
jobId: string;
|
|
1237
1067
|
} | undefined;
|
|
1238
|
-
traceContext?: {
|
|
1239
|
-
traceId: string;
|
|
1240
|
-
spanId: string;
|
|
1241
|
-
traceFlags: number;
|
|
1242
|
-
} | undefined;
|
|
1243
1068
|
};
|
|
1244
1069
|
jobId: string;
|
|
1245
1070
|
storageId: string;
|
|
1246
1071
|
flowId: string;
|
|
1247
1072
|
inputs?: Record<string, unknown>;
|
|
1248
1073
|
clientId: string | null;
|
|
1249
|
-
}) => Effect.Effect<
|
|
1074
|
+
}) => Effect.Effect<_uploadista_core_flow1.NodeExecutionResult<{
|
|
1250
1075
|
id: string;
|
|
1251
1076
|
offset: number;
|
|
1252
1077
|
storage: {
|
|
@@ -1273,11 +1098,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1273
1098
|
nodeId: string;
|
|
1274
1099
|
jobId: string;
|
|
1275
1100
|
} | undefined;
|
|
1276
|
-
traceContext?: {
|
|
1277
|
-
traceId: string;
|
|
1278
|
-
spanId: string;
|
|
1279
|
-
traceFlags: number;
|
|
1280
|
-
} | undefined;
|
|
1281
1101
|
}>, UploadistaError, never>;
|
|
1282
1102
|
condition?: {
|
|
1283
1103
|
field: string;
|
|
@@ -1292,7 +1112,6 @@ declare function createSplitPdfNode(id: string, params: SplitPdfNodeParams): Eff
|
|
|
1292
1112
|
retryDelay?: number;
|
|
1293
1113
|
exponentialBackoff?: boolean;
|
|
1294
1114
|
};
|
|
1295
|
-
circuitBreaker?: _uploadista_core_flow2.FlowCircuitBreakerConfig;
|
|
1296
1115
|
} & {
|
|
1297
1116
|
type: NodeType.process;
|
|
1298
1117
|
}, UploadistaError, UploadServer | DocumentPlugin>;
|