Skip to main content

FileServiceDeps

@retinue/monorepo


@retinue/monorepo / backend/src / FileServiceDeps

Type Alias: FileServiceDeps

FileServiceDeps = object

Defined in: backend/src/files/index.ts:128

Properties​

authorization​

readonly authorization: AuthorizationPolicy

Defined in: backend/src/files/index.ts:138

AC-3, enforced rather than asserted.

Required, not optional. Entitlement to a file is entitlement to its conversation, and a service that would run without a policy is a service someone constructs without one — at which point every attachment in the tenant is readable by every member of it. Tenant scoping alone is not AC-3.


clock?​

readonly optional clock?: () => string

Defined in: backend/src/files/index.ts:140

Returns​

string


content​

readonly content: FileContentStore

Defined in: backend/src/files/index.ts:130


contentKey?​

readonly optional contentKey?: () => string

Defined in: backend/src/files/index.ts:149

Mints the opaque content key.

Injectable so it can be asserted, and not derived from the filename or the file id: a key a caller can construct is a key a caller can guess. sanitizeMediaRefs in ShareFlow is the cautionary tale — its workspace-prefix check was "the ONLY thing standing between a forged path and a signed URL to another tenant's private object."

Returns​

string


fileId?​

readonly optional fileId?: () => string

Defined in: backend/src/files/index.ts:150

Returns​

string


limits?​

readonly optional limits?: UploadLimits

Defined in: backend/src/files/index.ts:139


log?​

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

Defined in: backend/src/files/index.ts:167

Parameters​

message​

string

detail?​

Readonly<Record<string, unknown>>

Returns​

void


metadata​

readonly metadata: FileMetadataStore

Defined in: backend/src/files/index.ts:129


requestExtraction?​

readonly optional requestExtraction?: (input) => Promise<unknown>

Defined in: backend/src/files/index.ts:162

Asks for text extraction after a successful upload (#131).

A function rather than the service itself, so files does not depend on documents — the dependency runs the other way, and a cycle here would make attaching a file require the extraction pipeline to exist. Optional: a deployment with no extraction is a valid one.

It is not awaited in a way that can fail the upload. AC-2 is that the user's next request is served without waiting, so a rejection here is logged and dropped — the file is stored, and the sweep will find an extraction that never got requested.

Parameters​

input​
fileId​

FileId

mediaType​

string

tenantId​

TenantId

Returns​

Promise<unknown>