feat(medusa): Extend file-service interface + move to core (#1577)

This commit is contained in:
Philip Korsholm authored and GitHub committed 2022-06-04 10:11:17 +02:00
1 parent d7a3218fbe
commit 8e42d37e84
7 files changed
+279 -70

No files matched your search

@@ -1,8 +1,9 @@
import fs from "fs"
import aws from "aws-sdk"
import { FileService } from "medusa-interfaces"
import { AbstractFileService } from '@medusajs/medusa'
class MinioService extends FileService {
class MinioService extends AbstractFileService {
constructor({}, options) {
super()
@@ -15,14 +16,14 @@ class MinioService extends FileService {
}
upload(file) {
aws.config.setPromisesDependency()
aws.config.setPromisesDependency(null)
aws.config.update({
accessKeyId: this.accessKeyId_,
secretAccessKey: this.secretAccessKey_,
endpoint: this.endpoint_,
s3ForcePathStyle: this.s3ForcePathStyle_,
signatureVersion: this.signatureVersion_,
})
}, true)
const s3 = new aws.S3()
const params = {
@@ -46,14 +47,14 @@ class MinioService extends FileService {
}
delete(file) {
aws.config.setPromisesDependency()
aws.config.setPromisesDependency(null)
aws.config.update({
accessKeyId: this.accessKeyId_,
secretAccessKey: this.secretAccessKey_,
endpoint: this.endpoint_,
s3ForcePathStyle: this.s3ForcePathStyle_,
signatureVersion: this.signatureVersion_,
})
}, true)
const s3 = new aws.S3()
const params = {
@@ -71,6 +72,18 @@ class MinioService extends FileService {
})
})
}
async getUploadStreamDescriptor(fileData) {
throw new Error("Method not implemented.")
}
async getDownloadStream(fileData) {
throw new Error("Method not implemented.")
}
async getPresignedDownloadUrl(fileData) {
throw new Error("Method not implemented.")
}
}
export default MinioService