Skip to main content

ExtractionServiceDeps

@forge/monorepo


@forge/monorepo / backend/src / ExtractionServiceDeps

Type Alias: ExtractionServiceDeps

ExtractionServiceDeps = object

Defined in: backend/src/documents/extraction.ts:31

Properties

blobs

readonly blobs: BlobStore

Defined in: backend/src/documents/extraction.ts:35

Where the extracted document goes. BlobStore stores JSON, which is what an ExtractedDocument is.


clock?

readonly optional clock?: () => string

Defined in: backend/src/documents/extraction.ts:59

Returns

string


content

readonly content: FileContentStore

Defined in: backend/src/documents/extraction.ts:33


dispatcher?

readonly optional dispatcher?: ExtractionDispatcher

Defined in: backend/src/documents/extraction.ts:67

The queue. Optional, and its absence means extraction runs only when something calls extract directly.

Optional rather than required because a single-process deployment is a real configuration, and requiring a queue there would mean standing up Redis to attach a text file. What is not optional is that upload never blocks on extraction — that holds either way.


fallbackParsers?

readonly optional fallbackParsers?: readonly DocumentParser[]

Defined in: backend/src/documents/extraction.ts:46

Parsers to try when the primary one reports no-text-layer (#132).

Keyed by media type like parsers, and separate because the dispatch table holds one parser per type: both the text-layer PDF parser and the OCR one claim application/pdf. This is where #131's insistence that no-text-layer be its own reason becomes load-bearing — the fallback triggers on exactly that answer and on nothing else. An encrypted or malformed document is not retried through OCR, because OCR will not decrypt it and the second attempt would cost money to reach the same conclusion.


limits?

readonly optional limits?: ExtractionLimits

Defined in: backend/src/documents/extraction.ts:58


log?

readonly optional log?: (message, detail?) => void

Defined in: backend/src/documents/extraction.ts:68

Parameters

message

string

detail?

Readonly<Record<string, unknown>>

Returns

void


metadata

readonly metadata: FileMetadataStore

Defined in: backend/src/documents/extraction.ts:32


onPricedOperation?

readonly optional onPricedOperation?: (input) => Promise<void>

Defined in: backend/src/documents/extraction.ts:53

Bills a vision or OCR call (#132, AC-4).

A callback rather than a UsageRecorder, so documents does not depend on usage. The pipeline knows when a priced operation happened; what it costs is the caller's pricing model.

Parameters

input
fileId

FileId

tenantId

TenantId

usage

PricedExtractionUsage

Returns

Promise<void>


parsers

readonly parsers: readonly DocumentParser[]

Defined in: backend/src/documents/extraction.ts:36