Private Readonly _cacheProtected Optional _configTrait instance configuration.
Protected _globalWhether this is a global (not bound to any specific schema item) trait instance.
Protected Optional _typeTrait type.
Protected Readonly accessProtected Readonly cacheProtected Readonly dataProtected Readonly graphqlProtected Readonly runtimeStatic s3Private _fileChecks if given media file was uploaded to S3.
Private _generateGenerate S3 object key for a file.
Private _getHelper method which initializes/returns RepositoryTrait storage object.
Private _s3Private _sanitizeReturns sanitized file URL.
Download URL field resolver.
Makes this Trait instance global.
Post-create hook implementation.
Sets file S3 path. This is done on postCreate() since the entity ID is used in URL key.
Post-delete hook implementation.
Deletes the associated file from S3 when a vertex is deleted.
Pre-create hook implementation.
Verifies filename.
This method is triggered when a trait callback has been activated
This is the name of the callback function to call.
References to the Graph Hanlder
Request data passed along as part of the request.
Adds downloadUrl and uploadUrl fields definitions.
TODO: Remove resolvers assignment; this hook should only return a schema string. Resolvers (or 'handlers' should be defined and retrieved via separate hook).
Updated GraphQL query schema string.
Configuration setter.
The new configuration.
Updates file upload status.
Upload URL field resolver.
Helper method for wrapping legacy Kosmos traits callbacks.
TODO: Remove this method once all Traits are converted.
Optional callbackName: stringOptional callback name; passing this parameter will additionally wrap the callback into legacy process().
Static traitGenerated using TypeDoc
File URL Trait provides
downloadUrlanduploadUrlquery fields and globalsetFileUploadedmutation triggered by S3 file upload Lambda.Usage:
Mermaid
Media file upload
Mermaid
Retrieving file entity before file was uploaded
Mermaid
Retrieving file entity after file was uploaded