Files
template-app/modules/documents/module.convex.ts
T

21 lines
853 B
TypeScript

// Convex can execute documents.ocr only through documentsActions:process, where the Node runtime
// boundary contains the OCR/model SDKs. This manifest keeps the same payload validator and makes
// accidental invocation through the transaction dispatcher fail closed.
import { defineModule, internal, type JobDef } from "@conusai-kit/core"
import { type ProcessorJobPayload, processorJobPayloadSchema } from "@conusai-kit/files"
import { OCR_JOB } from "./contract/index.js"
import { DOCUMENTS_MODULE_BASE } from "./module.shared.js"
const actionOnlyJob: JobDef<ProcessorJobPayload> = {
payload: processorJobPayloadSchema,
async handler() {
throw internal("documents.ocr must run through the Convex Node action")
},
}
export const convexDocumentsModule = defineModule({
...DOCUMENTS_MODULE_BASE,
jobs: { [OCR_JOB]: actionOnlyJob },
})