Fixing issue with object store functions not being mockable in the server.

This commit is contained in:
mike12345567 2021-05-07 14:27:46 +01:00
parent ac89e5c713
commit d517ca1ac9
4 changed files with 33 additions and 3 deletions

View File

@ -4,7 +4,7 @@ const send = require("koa-send")
const { resolve, join } = require("../../../utilities/centralPath") const { resolve, join } = require("../../../utilities/centralPath")
const fetch = require("node-fetch") const fetch = require("node-fetch")
const uuid = require("uuid") const uuid = require("uuid")
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore const { ObjectStoreBuckets } = require("../../../constants")
const { prepareUpload } = require("../deploy/utils") const { prepareUpload } = require("../deploy/utils")
const { processString } = require("@budibase/string-templates") const { processString } = require("@budibase/string-templates")
const { budibaseTempDir } = require("../../../utilities/budibaseDir") const { budibaseTempDir } = require("../../../utilities/budibaseDir")

View File

@ -12,7 +12,7 @@ const {
streamUpload, streamUpload,
deleteFolder, deleteFolder,
downloadTarball, downloadTarball,
} = require("@budibase/auth").objectStore } = require("./utilities")
const { downloadLibraries, newAppPublicPath } = require("./newApp") const { downloadLibraries, newAppPublicPath } = require("./newApp")
const download = require("download") const download = require("download")
const env = require("../../environment") const env = require("../../environment")

View File

@ -1,7 +1,7 @@
const packageJson = require("../../../package.json") const packageJson = require("../../../package.json")
const { join } = require("path") const { join } = require("path")
const { ObjectStoreBuckets } = require("../../constants") const { ObjectStoreBuckets } = require("../../constants")
const { streamUpload, downloadTarball } = require("@budibase/auth").objectStore const { streamUpload, downloadTarball } = require("./utilities")
const fs = require("fs") const fs = require("fs")
const BUCKET_NAME = ObjectStoreBuckets.APPS const BUCKET_NAME = ObjectStoreBuckets.APPS

View File

@ -0,0 +1,30 @@
const {
ObjectStore,
makeSureBucketExists,
upload,
streamUpload,
retrieve,
retrieveToTmp,
deleteFolder,
uploadDirectory,
downloadTarball,
} = require("@budibase/auth").objectStore
/***********************************
* NOTE *
* This file purely exists so that *
* the object store functionality *
* can easily be mocked out of *
* the server without mocking the *
* entire core library. *
***********************************/
exports.ObjectStore = ObjectStore
exports.makeSureBucketExists = makeSureBucketExists
exports.upload = upload
exports.streamUpload = streamUpload
exports.retrieve = retrieve
exports.retrieveToTmp = retrieveToTmp
exports.deleteFolder = deleteFolder
exports.uploadDirectory = uploadDirectory
exports.downloadTarball = downloadTarball