createExportService
@forge/monorepo / backend/src / createExportService
Function: createExportService()
createExportService(
deps):object
Defined in: backend/src/export/index.ts:139
Parameters
deps
Returns
download()
download(
context,exportId):Promise<AsyncIterable<Uint8Array<ArrayBufferLike>,any,any>>
The proxied download, for a content store that cannot sign — and the fallback when one can.
Parameters
context
exportId
string
Returns
Promise<AsyncIterable<Uint8Array<ArrayBufferLike>, any, any>>
downloadUrl()
downloadUrl(
context,exportId):Promise<string|null>
A short-lived download URL — AC-5.
Delegated to the file ports, which already clamp the expiry to fifteen minutes and refuse a file whose conversation the caller is not entitled to. Nothing here can produce a permanent URL because nothing here constructs a URL at all.
Parameters
context
exportId
string
Returns
Promise<string | null>
listForArtifact()
listForArtifact(
context,input):Promise<Page<ArtifactExport>>
Parameters
context
input
cursor?
string
id
limit
number
Returns
Promise<Page<ArtifactExport>>
readyExport()
readyExport(
context,exportId):Promise<ArtifactExport>
An export that is ready to download, or the reason it is not.
Entitlement is re-checked through ArtifactService on every download rather than trusted from the
request that created the export: a user removed from a conversation must stop being able to download
what they exported while they were in it.
Parameters
context
exportId
string
Returns
Promise<ArtifactExport>
render()
render(
job,context):Promise<ArtifactExport>
Render. Called by the worker, and directly by a single-process host.
Returns the record rather than throwing for a render problem. The only throw is for an export row that is not there, which is a caller error rather than a rendering one.
Parameters
job
exportId
string
tenantId
string
context
Returns
Promise<ArtifactExport>
requestExport()
requestExport(
context,input):Promise<{enqueued:boolean;export:ArtifactExport; }>
Ask for an export — AC-3.
Entitlement first, through ArtifactService, so an export is never more accessible than the
conversation that produced the artifact and there is no second permission model here.
An existing export is returned, not re-rendered. That is the property the issue wanted from "an artifact version rather than a transient stream", and the unique constraint is what makes it hold under two simultaneous requests rather than under one.
Parameters
context
input
format
"pdf" | "markdown"
id
version?
number
Returns
Promise<{ enqueued: boolean; export: ArtifactExport; }>
resolveTarget()
resolveTarget(
context,input):Promise<{artifact: {conversationId:ConversationId;id:ArtifactId;name:string; };version:number; }>
Which version an export targets. The latest unless one is named.
Parameters
context
input
id
version?
number
Returns
Promise<{ artifact: { conversationId: ConversationId; id: ArtifactId; name: string; }; version: number; }>