Skip to content

StorageAdapterPresignedUrlInterface

Defined in: packages/core/src/media/types.ts:228

Storage adapter interface for the presigned-URL upload protocol.

Extends StorageAdapterBaseInterface with generateUploadUrl — the client requests a short-lived URL from the server, POSTs the file directly to storage, then calls createMediaDocument with the returned storageId.

admin: object

Defined in: packages/core/src/media/types.ts:129

softDelete: boolean

When true, delete operations set deleted: true on the media document instead of physically removing the file. The file remains in storage until a scheduled cleanup job purges it.

false

StorageAdapterBaseInterface.admin


mediaCollections: MediaCollectionConfig<BaseFieldMeta, MediaCollectionMeta, string, string, ComponentHKT>[]

Defined in: packages/core/src/media/types.ts:127

Processed media collections ready for schema generation and admin panel.

The adapter validates, augments, and returns these collections. Each collection is tagged with meta.storageAdapterName equal to this adapter’s name. Core merges all collections from all adapters into VexConfig.mediaCollections — separate from user-defined collections.

StorageAdapterBaseInterface.mediaCollections


readonly name: string

Defined in: packages/core/src/media/types.ts:115

Protocol name — tells the admin panel what the identifier of this storage adapter is.

StorageAdapterBaseInterface.name


readonly type: "presigned-url"

Defined in: packages/core/src/media/types.ts:229

Protocol type — tells the admin panel how to upload files.

StorageAdapterBaseInterface.type

createMediaDocument<TDataModel>(ctx, args): Promise<string>

Defined in: packages/core/src/media/types.ts:144

Creates a media document in Convex after the file is uploaded. All adapters must use this exact signature.

TDataModel extends GenericDataModel = GenericDataModel

GenericMutationCtx<TDataModel>

Record<string, unknown>

string

string

string

string

number

string

Promise<string>

StorageAdapterBaseInterface.createMediaDocument


deleteMedia<TDataModel>(ctx, args): Promise<boolean>

Defined in: packages/core/src/media/types.ts:161

Deletes a media document and its file from storage. All adapters must use this exact signature.

TDataModel extends GenericDataModel = GenericDataModel

GenericMutationCtx<TDataModel>

string

string

boolean

Promise<boolean>

StorageAdapterBaseInterface.deleteMedia


generateUploadUrl<TDataModel>(ctx): Promise<GenerateUploadUrlReturn>

Defined in: packages/core/src/media/types.ts:237

Generates a URL to upload a file to. Returns different shapes per protocol:

  • presigned-url: { url: string } — POST the file to this URL
  • direct-upload: { url: string; storageId?: string } — PUT the file to this URL
  • streaming: { url: string; storageId?: string } — resumable upload session

TDataModel extends GenericDataModel = GenericDataModel

GenericMutationCtx<TDataModel>

Promise<GenerateUploadUrlReturn>


getUrl<TDataModel>(ctx, args): Promise<GetUrlReturn>

Defined in: packages/core/src/media/types.ts:170

Returns a URL for a media file. All adapters must use this exact signature.

TDataModel extends GenericDataModel = GenericDataModel

GenericQueryCtx<TDataModel>

string

string

Promise<GetUrlReturn>

StorageAdapterBaseInterface.getUrl


uploadFile(file, uploadUrl): Promise<UploadFileReturn>

Defined in: packages/core/src/media/types.ts:258

Uploads a file to the storage backend and returns the storage ID.

This is a pure JS function that can be called from any framework (React, Next.js, Svelte, etc.) or even directly in the browser.

any

The file to upload

string

The presigned URL from generateUploadUrl

Promise<UploadFileReturn>

Promise resolving to { storageId, url, … } with adapter-specific fields

// React component
const { storageId } = await adapter.uploadFile(file, uploadUrl);
await createMediaDocument({ storageId, ... });

StorageAdapterBaseInterface.uploadFile