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.
- StorageAdapterBaseInterface for the shared base contract
- StorageAdapterPresignedUrl for the abstract base class to extend
Extends
Section titled “Extends”Properties
Section titled “Properties”admin:
object
Defined in: packages/core/src/media/types.ts:129
softDelete
Section titled “softDelete”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.
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”StorageAdapterBaseInterface.admin
mediaCollections
Section titled “mediaCollections”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.
Inherited from
Section titled “Inherited from”StorageAdapterBaseInterface.mediaCollections
readonlyname:string
Defined in: packages/core/src/media/types.ts:115
Protocol name — tells the admin panel what the identifier of this storage adapter is.
Inherited from
Section titled “Inherited from”StorageAdapterBaseInterface.name
readonlytype:"presigned-url"
Defined in: packages/core/src/media/types.ts:229
Protocol type — tells the admin panel how to upload files.
Overrides
Section titled “Overrides”StorageAdapterBaseInterface.type
Methods
Section titled “Methods”createMediaDocument()
Section titled “createMediaDocument()”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.
Type Parameters
Section titled “Type Parameters”TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Parameters
Section titled “Parameters”GenericMutationCtx<TDataModel>
adapterFields?
Section titled “adapterFields?”Record<string, unknown>
string
collectionSlug
Section titled “collectionSlug”string
filename
Section titled “filename”string
mimeType
Section titled “mimeType”string
number
storageId
Section titled “storageId”string
Returns
Section titled “Returns”Promise<string>
Inherited from
Section titled “Inherited from”StorageAdapterBaseInterface.createMediaDocument
deleteMedia()
Section titled “deleteMedia()”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.
Type Parameters
Section titled “Type Parameters”TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Parameters
Section titled “Parameters”GenericMutationCtx<TDataModel>
collectionSlug
Section titled “collectionSlug”string
mediaId
Section titled “mediaId”string
softDelete?
Section titled “softDelete?”boolean
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”StorageAdapterBaseInterface.deleteMedia
generateUploadUrl()
Section titled “generateUploadUrl()”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
Type Parameters
Section titled “Type Parameters”TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Parameters
Section titled “Parameters”GenericMutationCtx<TDataModel>
Returns
Section titled “Returns”Promise<GenerateUploadUrlReturn>
getUrl()
Section titled “getUrl()”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.
Type Parameters
Section titled “Type Parameters”TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Parameters
Section titled “Parameters”GenericQueryCtx<TDataModel>
collectionSlug
Section titled “collectionSlug”string
mediaId
Section titled “mediaId”string
Returns
Section titled “Returns”Promise<GetUrlReturn>
Inherited from
Section titled “Inherited from”StorageAdapterBaseInterface.getUrl
uploadFile()
Section titled “uploadFile()”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.
Parameters
Section titled “Parameters”any
The file to upload
uploadUrl
Section titled “uploadUrl”string
The presigned URL from generateUploadUrl
Returns
Section titled “Returns”Promise<UploadFileReturn>
Promise resolving to { storageId, url, … } with adapter-specific fields
Example
Section titled “Example”// React componentconst { storageId } = await adapter.uploadFile(file, uploadUrl);await createMediaDocument({ storageId, ... });