ConusAI vendor v0.1.0-beta.114
ci / gate (push) Waiting to run

This commit is contained in:
ConusAI vendor v0.1.0-beta.114
2026-11-14 09:56:45 +00:00
commit 1ce8d23c35
867 changed files with 122104 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
// The handlers of the module's procedures: each resolves its ports from the request's container and
// calls one use case. No rule lives here.
import type { Container } from "@conusai-kit/core"
import { implement } from "@conusai-kit/core"
import { DATA_SOURCE } from "@conusai-kit/data"
import { filesDeps, toBase64 } from "@conusai-kit/files"
import { proposalsDeps } from "@conusai-kit/proposals"
import { documentGet, documentGetMany, documentList, exportCreate, lineEdit } from "../contract/index.js"
import { exportApproved } from "../core/export.js"
import type { DocumentsDeps } from "../core/lines.js"
import { editLine, getDocument, getManyDocuments, listDocuments } from "../core/review.js"
/** The ports a handler needs: this module's data source and the two kernel modules it builds on. */
export function documentsDeps(container: Container): DocumentsDeps {
return { data: container.resolve(DATA_SOURCE), files: filesDeps(container), proposals: proposalsDeps(container) }
}
export const documentListImpl = implement(documentList, async ({ ctx }) => ({
documents: await listDocuments(documentsDeps(ctx.container), ctx.scope),
}))
export const documentGetManyImpl = implement(documentGetMany, async ({ input, ctx }) => ({
items: await getManyDocuments(documentsDeps(ctx.container), ctx.scope, input.ids),
}))
export const documentGetImpl = implement(documentGet, async ({ input, ctx }) =>
getDocument(documentsDeps(ctx.container), ctx.scope, input.fileId),
)
export const lineEditImpl = implement(lineEdit, async ({ input, ctx }) =>
editLine(documentsDeps(ctx.container), ctx.scope, input),
)
export const exportCreateImpl = implement(exportCreate, async ({ input, ctx }) => {
const made = await exportApproved(documentsDeps(ctx.container), ctx.scope, input.fileId)
return {
filename: made.filename,
contentType: made.contentType,
body: toBase64(made.bytes),
lineCount: made.lineCount,
}
})
export const DOCUMENT_PROCEDURES = [
documentListImpl,
documentGetManyImpl,
documentGetImpl,
lineEditImpl,
exportCreateImpl,
]