@@ -28,15 +28,15 @@ export default class UploadPlugin extends AdminForthPlugin {
28
28
}
29
29
30
30
async setupLifecycleRule ( ) {
31
- this . options . storage . adapter . setupLifecycle ( ) ;
31
+ this . options . storageAdapter . setupLifecycle ( ) ;
32
32
}
33
33
34
34
async genPreviewUrl ( record : any ) {
35
35
if ( this . options . preview ?. previewUrl ) {
36
36
record [ `previewUrl_${ this . pluginInstanceId } ` ] = this . options . preview . previewUrl ( { filePath : record [ this . options . pathColumnName ] } ) ;
37
37
return ;
38
38
}
39
- const previewUrl = await this . options . storage . adapter . getDownloadUrl ( record [ this . options . pathColumnName ] , 1800 ) ;
39
+ const previewUrl = await this . options . storageAdapter . getDownloadUrl ( record [ this . options . pathColumnName ] , 1800 ) ;
40
40
41
41
record [ `previewUrl_${ this . pluginInstanceId } ` ] = previewUrl ;
42
42
}
@@ -161,7 +161,7 @@ export default class UploadPlugin extends AdminForthPlugin {
161
161
if ( record [ pathColumnName ] ) {
162
162
process . env . HEAVY_DEBUG && console . log ( '🪥🪥 remove ObjectTagging' , record [ pathColumnName ] ) ;
163
163
// let it crash if it fails: this is a new file which just was uploaded.
164
- await this . options . storage . adapter . markKeyForNotDeletation ( record [ pathColumnName ] ) ;
164
+ await this . options . storageAdapter . markKeyForNotDeletation ( record [ pathColumnName ] ) ;
165
165
}
166
166
return { ok : true } ;
167
167
} ) ;
@@ -204,7 +204,7 @@ export default class UploadPlugin extends AdminForthPlugin {
204
204
resourceConfig . hooks . delete . afterSave . push ( async ( { record } : { record : any } ) => {
205
205
if ( record [ pathColumnName ] ) {
206
206
try {
207
- await this . options . storage . adapter . markKeyForDeletation ( record [ pathColumnName ] ) ;
207
+ await this . options . storageAdapter . markKeyForDeletation ( record [ pathColumnName ] ) ;
208
208
} catch ( e ) {
209
209
// file might be e.g. already deleted, so we catch error
210
210
console . error ( `Error setting tag ${ ADMINFORTH_NOT_YET_USED_TAG } to true for object ${ record [ pathColumnName ] } . File will not be auto-cleaned up` , e ) ;
@@ -233,7 +233,7 @@ export default class UploadPlugin extends AdminForthPlugin {
233
233
if ( oldRecord [ pathColumnName ] ) {
234
234
// put tag to delete old file
235
235
try {
236
- await this . options . storage . adapter . markKeyForDeletation ( oldRecord [ pathColumnName ] ) ;
236
+ await this . options . storageAdapter . markKeyForDeletation ( oldRecord [ pathColumnName ] ) ;
237
237
} catch ( e ) {
238
238
// file might be e.g. already deleted, so we catch error
239
239
console . error ( `Error setting tag ${ ADMINFORTH_NOT_YET_USED_TAG } to true for object ${ oldRecord [ pathColumnName ] } . File will not be auto-cleaned up` , e ) ;
@@ -242,7 +242,7 @@ export default class UploadPlugin extends AdminForthPlugin {
242
242
if ( updates [ virtualColumn . name ] !== null ) {
243
243
// remove tag from new file
244
244
// in this case we let it crash if it fails: this is a new file which just was uploaded.
245
- await this . options . storage . adapter . markKeyForNotDeletation ( updates [ pathColumnName ] ) ;
245
+ await this . options . storageAdapter . markKeyForNotDeletation ( updates [ pathColumnName ] ) ;
246
246
}
247
247
}
248
248
return { ok : true } ;
@@ -296,12 +296,12 @@ export default class UploadPlugin extends AdminForthPlugin {
296
296
if ( filePath . startsWith ( '/' ) ) {
297
297
throw new Error ( 's3Path should not start with /, please adjust s3path function to not return / at the start of the path' ) ;
298
298
}
299
- const { uploadUrl, uploadExtraParams } = await this . options . storage . adapter . getUploadSignedUrl ( filePath , contentType , 1800 ) ;
299
+ const { uploadUrl, uploadExtraParams } = await this . options . storageAdapter . getUploadSignedUrl ( filePath , contentType , 1800 ) ;
300
300
let previewUrl ;
301
301
if ( this . options . preview ?. previewUrl ) {
302
302
previewUrl = this . options . preview . previewUrl ( { filePath } ) ;
303
303
} else {
304
- previewUrl = await this . options . storage . adapter . getDownloadUrl ( filePath , 1800 ) ;
304
+ previewUrl = await this . options . storageAdapter . getDownloadUrl ( filePath , 1800 ) ;
305
305
}
306
306
307
307
return {
0 commit comments