Switching out @budibase/auth to @budibase/backend-core.

This commit is contained in:
mike12345567 2022-01-10 19:33:00 +00:00
parent b4f83fa867
commit 836a2f5863
101 changed files with 200 additions and 175 deletions

View File

@ -4,7 +4,7 @@ This library contains core functionality, like auth and security features
which are shared between backend services. which are shared between backend services.
#### Note about top level JS files #### Note about top level JS files
For the purposes of being able to do say `require("@budibase/auth/permissions")` we need to For the purposes of being able to do say `require("@budibase/backend-core/permissions")` we need to
specify the exports at the top-level of the module. specify the exports at the top-level of the module.
For these files they should be limited to a single `require` of the file that should For these files they should be limited to a single `require` of the file that should

View File

@ -70,7 +70,7 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "^10.0.3", "@apidevtools/swagger-parser": "^10.0.3",
"@budibase/auth": "^1.0.27-alpha.7", "@budibase/backend-core": "^1.0.27-alpha.7",
"@budibase/client": "^1.0.27-alpha.7", "@budibase/client": "^1.0.27-alpha.7",
"@budibase/string-templates": "^1.0.27-alpha.7", "@budibase/string-templates": "^1.0.27-alpha.7",
"@bull-board/api": "^3.7.0", "@bull-board/api": "^3.7.0",

View File

@ -7,7 +7,7 @@
const CouchDB = require("../src/db") const CouchDB = require("../src/db")
const { DocumentTypes } = require("../src/db/utils") const { DocumentTypes } = require("../src/db/utils")
const { getAllDbs } = require("@budibase/auth/db") const { getAllDbs } = require("@budibase/backend-core/db")
const appName = process.argv[2].toLowerCase() const appName = process.argv[2].toLowerCase()
const remoteUrl = process.argv[3] const remoteUrl = process.argv[3]

View File

@ -1,5 +1,5 @@
const { StaticDatabases } = require("@budibase/auth/db") const { StaticDatabases } = require("@budibase/backend-core/db")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
const KEYS_DOC = StaticDatabases.GLOBAL.docs.apiKeys const KEYS_DOC = StaticDatabases.GLOBAL.docs.apiKeys

View File

@ -19,7 +19,10 @@ const {
DocumentTypes, DocumentTypes,
AppStatus, AppStatus,
} = require("../../db/utils") } = require("../../db/utils")
const { BUILTIN_ROLE_IDS, AccessController } = require("@budibase/auth/roles") const {
BUILTIN_ROLE_IDS,
AccessController,
} = require("@budibase/backend-core/roles")
const { BASE_LAYOUTS } = require("../../constants/layouts") const { BASE_LAYOUTS } = require("../../constants/layouts")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")
const { processObject } = require("@budibase/string-templates") const { processObject } = require("@budibase/string-templates")
@ -28,7 +31,7 @@ const {
isDevAppID, isDevAppID,
getDeployedAppID, getDeployedAppID,
Replication, Replication,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const { USERS_TABLE_SCHEMA } = require("../../constants") const { USERS_TABLE_SCHEMA } = require("../../constants")
const { const {
getDeployedApps, getDeployedApps,
@ -41,9 +44,9 @@ const {
backupClientLibrary, backupClientLibrary,
revertClientLibrary, revertClientLibrary,
} = require("../../utilities/fileSystem/clientLibrary") } = require("../../utilities/fileSystem/clientLibrary")
const { getTenantId, isMultiTenant } = require("@budibase/auth/tenancy") const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
const { syncGlobalUsers } = require("./user") const { syncGlobalUsers } = require("./user")
const { app: appCache } = require("@budibase/auth/cache") const { app: appCache } = require("@budibase/backend-core/cache")
const { cleanupAutomations } = require("../../automations/utils") const { cleanupAutomations } = require("../../automations/utils")
const URL_REGEX_SLASH = /\/|\\/g const URL_REGEX_SLASH = /\/|\\/g

View File

@ -2,7 +2,7 @@ const CouchDB = require("../../db")
const { outputProcessing } = require("../../utilities/rowProcessor") const { outputProcessing } = require("../../utilities/rowProcessor")
const { InternalTables } = require("../../db/utils") const { InternalTables } = require("../../db/utils")
const { getFullUser } = require("../../utilities/users") const { getFullUser } = require("../../utilities/users")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
exports.fetchSelf = async ctx => { exports.fetchSelf = async ctx => {
const appId = ctx.appId const appId = ctx.appId

View File

@ -1,5 +1,5 @@
const env = require("../../environment") const env = require("../../environment")
const { getAllApps } = require("@budibase/auth/db") const { getAllApps } = require("@budibase/backend-core/db")
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { const {
exportDB, exportDB,
@ -7,7 +7,10 @@ const {
readFileSync, readFileSync,
} = require("../../utilities/fileSystem") } = require("../../utilities/fileSystem")
const { stringToReadStream } = require("../../utilities") const { stringToReadStream } = require("../../utilities")
const { getGlobalDBName, getGlobalDB } = require("@budibase/auth/tenancy") const {
getGlobalDBName,
getGlobalDB,
} = require("@budibase/backend-core/tenancy")
const { create } = require("./application") const { create } = require("./application")
const { getDocParams, DocumentTypes, isDevAppID } = require("../../db/utils") const { getDocParams, DocumentTypes, isDevAppID } = require("../../db/utils")

View File

@ -1,12 +1,12 @@
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
const Deployment = require("./Deployment") const Deployment = require("./Deployment")
const { Replication, getDeployedAppID } = require("@budibase/auth/db") const { Replication, getDeployedAppID } = require("@budibase/backend-core/db")
const { DocumentTypes, getAutomationParams } = require("../../../db/utils") const { DocumentTypes, getAutomationParams } = require("../../../db/utils")
const { const {
disableAllCrons, disableAllCrons,
enableCronTrigger, enableCronTrigger,
} = require("../../../automations/utils") } = require("../../../automations/utils")
const { app: appCache } = require("@budibase/auth/cache") const { app: appCache } = require("@budibase/backend-core/cache")
// the max time we can wait for an invalidation to complete before considering it failed // the max time we can wait for an invalidation to complete before considering it failed
const MAX_PENDING_TIME_MS = 30 * 60000 const MAX_PENDING_TIME_MS = 30 * 60000

View File

@ -4,9 +4,9 @@ const env = require("../../environment")
const { checkSlashesInUrl } = require("../../utilities") const { checkSlashesInUrl } = require("../../utilities")
const { request } = require("../../utilities/workerRequests") const { request } = require("../../utilities/workerRequests")
const { clearLock } = require("../../utilities/redis") const { clearLock } = require("../../utilities/redis")
const { Replication } = require("@budibase/auth").db const { Replication } = require("@budibase/backend-core").db
const { DocumentTypes } = require("../../db/utils") const { DocumentTypes } = require("../../db/utils")
const { app: appCache } = require("@budibase/auth/cache") const { app: appCache } = require("@budibase/backend-core/cache")
async function redirect(ctx, method, path = "global") { async function redirect(ctx, method, path = "global") {
const { devPath } = ctx.params const { devPath } = ctx.params

View File

@ -1,7 +1,7 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { getDeployedApps } = require("../../utilities/workerRequests") const { getDeployedApps } = require("../../utilities/workerRequests")
const { getScopedConfig } = require("@budibase/auth/db") const { getScopedConfig } = require("@budibase/backend-core/db")
const { Configs } = require("@budibase/auth").constants const { Configs } = require("@budibase/backend-core").constants
const { checkSlashesInUrl } = require("../../utilities") const { checkSlashesInUrl } = require("../../utilities")
exports.fetchUrls = async ctx => { exports.fetchUrls = async ctx => {

View File

@ -1,10 +1,10 @@
const { getBuiltinPermissions } = require("@budibase/auth/permissions") const { getBuiltinPermissions } = require("@budibase/backend-core/permissions")
const { const {
isBuiltin, isBuiltin,
getDBRoleID, getDBRoleID,
getExternalRoleID, getExternalRoleID,
getBuiltinRoles, getBuiltinRoles,
} = require("@budibase/auth/roles") } = require("@budibase/backend-core/roles")
const { getRoleParams } = require("../../db/utils") const { getRoleParams } = require("../../db/utils")
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { const {

View File

@ -4,7 +4,7 @@ const {
getRole, getRole,
isBuiltin, isBuiltin,
getAllRoles, getAllRoles,
} = require("@budibase/auth/roles") } = require("@budibase/backend-core/roles")
const { const {
generateRoleID, generateRoleID,
getUserMetadataParams, getUserMetadataParams,

View File

@ -2,7 +2,7 @@ const { getRoutingInfo } = require("../../utilities/routing")
const { const {
getUserRoleHierarchy, getUserRoleHierarchy,
BUILTIN_ROLE_IDS, BUILTIN_ROLE_IDS,
} = require("@budibase/auth/roles") } = require("@budibase/backend-core/roles")
const URL_SEPARATOR = "/" const URL_SEPARATOR = "/"

View File

@ -1,6 +1,6 @@
const { SearchIndexes } = require("../../../db/utils") const { SearchIndexes } = require("../../../db/utils")
const fetch = require("node-fetch") const fetch = require("node-fetch")
const { getCouchUrl } = require("@budibase/auth/db") const { getCouchUrl } = require("@budibase/backend-core/db")
/** /**
* Class to build lucene query URLs. * Class to build lucene query URLs.

View File

@ -1,6 +1,6 @@
const CouchDB = require("../../db") const CouchDB = require("../../db")
const { getScreenParams, generateScreenID } = require("../../db/utils") const { getScreenParams, generateScreenID } = require("../../db/utils")
const { AccessController } = require("@budibase/auth/roles") const { AccessController } = require("@budibase/backend-core/roles")
exports.fetch = async ctx => { exports.fetch = async ctx => {
const appId = ctx.appId const appId = ctx.appId

View File

@ -8,10 +8,13 @@ const { InternalTables } = require("../../db/utils")
const { getGlobalUsers, getRawGlobalUser } = require("../../utilities/global") const { getGlobalUsers, getRawGlobalUser } = require("../../utilities/global")
const { getFullUser } = require("../../utilities/users") const { getFullUser } = require("../../utilities/users")
const { isEqual } = require("lodash") const { isEqual } = require("lodash")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { getDevelopmentAppID, getDeployedAppIDs } = require("@budibase/auth/db") const {
getDevelopmentAppID,
getDeployedAppIDs,
} = require("@budibase/backend-core/db")
const { doesDatabaseExist } = require("../../utilities") const { doesDatabaseExist } = require("../../utilities")
const { UserStatus } = require("@budibase/auth/constants") const { UserStatus } = require("@budibase/backend-core/constants")
async function rawMetadata(db) { async function rawMetadata(db) {
return ( return (

View File

@ -3,7 +3,7 @@ const { generateWebhookID, getWebhookParams } = require("../../db/utils")
const toJsonSchema = require("to-json-schema") const toJsonSchema = require("to-json-schema")
const validate = require("jsonschema").validate const validate = require("jsonschema").validate
const triggers = require("../../automations/triggers") const triggers = require("../../automations/triggers")
const { getDeployedAppID } = require("@budibase/auth/db") const { getDeployedAppID } = require("@budibase/backend-core/db")
const AUTOMATION_DESCRIPTION = "Generated from Webhook Schema" const AUTOMATION_DESCRIPTION = "Generated from Webhook Schema"

View File

@ -4,7 +4,7 @@ const {
auditLog, auditLog,
buildTenancyMiddleware, buildTenancyMiddleware,
buildAppTenancyMiddleware, buildAppTenancyMiddleware,
} = require("@budibase/auth").auth } = require("@budibase/backend-core").auth
const currentApp = require("../middleware/currentapp") const currentApp = require("../middleware/currentapp")
const compress = require("koa-compress") const compress = require("koa-compress")
const zlib = require("zlib") const zlib = require("zlib")

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/apikeys") const controller = require("../controllers/apikeys")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/application") const controller = require("../controllers/application")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const usage = require("../../middleware/usageQuota") const usage = require("../../middleware/usageQuota")
const router = Router() const router = Router()

View File

@ -6,7 +6,7 @@ const {
BUILDER, BUILDER,
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const Joi = require("joi") const Joi = require("joi")
const { bodyResource, paramResource } = require("../../middleware/resourceId") const { bodyResource, paramResource } = require("../../middleware/resourceId")
const { const {

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/backup") const controller = require("../controllers/backup")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/cloud") const controller = require("../controllers/cloud")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/component") const controller = require("../controllers/component")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -6,7 +6,7 @@ const {
BUILDER, BUILDER,
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const Joi = require("joi") const Joi = require("joi")
const { DataSourceOperation } = require("../../constants") const { DataSourceOperation } = require("../../constants")

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/deploy") const controller = require("../controllers/deploy")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -2,7 +2,7 @@ const Router = require("@koa/router")
const controller = require("../controllers/dev") const controller = require("../controllers/dev")
const env = require("../../environment") const env = require("../../environment")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/hosting") const controller = require("../controllers/hosting")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/integration") const controller = require("../controllers/integration")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,6 +1,6 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const controller = require("../controllers/layout") const controller = require("../controllers/layout")
const router = Router() const router = Router()

View File

@ -5,7 +5,7 @@ const {
AppType, AppType,
} = require("../../middleware/appInfo") } = require("../../middleware/appInfo")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,10 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/permission") const controller = require("../controllers/permission")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER, PermissionLevels } = require("@budibase/auth/permissions") const {
BUILDER,
PermissionLevels,
} = require("@budibase/backend-core/permissions")
const Joi = require("joi") const Joi = require("joi")
const joiValidator = require("../../middleware/joi-validator") const joiValidator = require("../../middleware/joi-validator")

View File

@ -5,7 +5,7 @@ const {
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
BUILDER, BUILDER,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const { const {
bodyResource, bodyResource,
bodySubResource, bodySubResource,

View File

@ -7,7 +7,7 @@ const {
BUILTIN_PERMISSION_IDS, BUILTIN_PERMISSION_IDS,
BUILDER, BUILDER,
PermissionLevels, PermissionLevels,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,6 +1,6 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const controller = require("../controllers/routing") const controller = require("../controllers/routing")
const router = Router() const router = Router()

View File

@ -9,7 +9,7 @@ const {
const { const {
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/screen") const controller = require("../controllers/screen")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const joiValidator = require("../../middleware/joi-validator") const joiValidator = require("../../middleware/joi-validator")
const Joi = require("joi") const Joi = require("joi")

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/script") const controller = require("../controllers/script")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -6,7 +6,7 @@ const {
BUILDER, BUILDER,
PermissionTypes, PermissionTypes,
PermissionLevels, PermissionLevels,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const env = require("../../environment") const env = require("../../environment")
const { paramResource } = require("../../middleware/resourceId") const { paramResource } = require("../../middleware/resourceId")

View File

@ -6,7 +6,7 @@ const {
BUILDER, BUILDER,
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const joiValidator = require("../../middleware/joi-validator") const joiValidator = require("../../middleware/joi-validator")
const Joi = require("joi") const Joi = require("joi")

View File

@ -1,7 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/templates") const controller = require("../controllers/templates")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -1,4 +1,4 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const setup = require("./utilities") const setup = require("./utilities")
const { basicRow } = setup.structures const { basicRow } = setup.structures

View File

@ -4,7 +4,7 @@ jest.mock("node-fetch")
// Mock isProdAppID to we can later mock the implementation and pretend we are // Mock isProdAppID to we can later mock the implementation and pretend we are
// using prod app IDs // using prod app IDs
const authDb = require("@budibase/auth/db") const authDb = require("@budibase/backend-core/db")
const { isProdAppID } = authDb const { isProdAppID } = authDb
const mockIsProdAppID = jest.fn(isProdAppID) const mockIsProdAppID = jest.fn(isProdAppID)
authDb.isProdAppID = mockIsProdAppID authDb.isProdAppID = mockIsProdAppID

View File

@ -1,7 +1,7 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { const {
BUILTIN_PERMISSION_IDS, BUILTIN_PERMISSION_IDS,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const setup = require("./utilities") const setup = require("./utilities")
const { basicRole } = setup.structures const { basicRole } = setup.structures

View File

@ -1,7 +1,7 @@
const setup = require("./utilities") const setup = require("./utilities")
const { basicScreen } = setup.structures const { basicScreen } = setup.structures
const { checkBuilderEndpoint } = require("./utilities/TestFunctions") const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const route = "/test" const route = "/test"

View File

@ -1,4 +1,4 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions") const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
const setup = require("./utilities") const setup = require("./utilities")

View File

@ -2,7 +2,7 @@ const rowController = require("../../../controllers/row")
const appController = require("../../../controllers/application") const appController = require("../../../controllers/application")
const CouchDB = require("../../../../db") const CouchDB = require("../../../../db")
const { AppStatus } = require("../../../../db/utils") const { AppStatus } = require("../../../../db/utils")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { TENANT_ID } = require("../../../../tests/utilities/structures") const { TENANT_ID } = require("../../../../tests/utilities/structures")
function Request(appId, params) { function Request(appId, params) {

View File

@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
const { const {
PermissionLevels, PermissionLevels,
PermissionTypes, PermissionTypes,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -7,7 +7,7 @@ const {
BUILDER, BUILDER,
PermissionTypes, PermissionTypes,
PermissionLevels, PermissionLevels,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const router = Router() const router = Router()

View File

@ -2,7 +2,7 @@ const Router = require("@koa/router")
const controller = require("../controllers/webhook") const controller = require("../controllers/webhook")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const joiValidator = require("../../middleware/joi-validator") const joiValidator = require("../../middleware/joi-validator")
const { BUILDER } = require("@budibase/auth/permissions") const { BUILDER } = require("@budibase/backend-core/permissions")
const Joi = require("joi") const Joi = require("joi")
const router = Router() const router = Router()

View File

@ -3,7 +3,7 @@ import { ExtendableContext } from "koa"
const env = require("./environment") const env = require("./environment")
const CouchDB = require("./db") const CouchDB = require("./db")
require("@budibase/auth").init(CouchDB) require("@budibase/backend-core").init(CouchDB)
const Koa = require("koa") const Koa = require("koa")
const destroyable = require("server-destroy") const destroyable = require("server-destroy")
const koaBody = require("koa-body") const koaBody = require("koa-body")

View File

@ -6,7 +6,7 @@ const Queue = env.isTest()
? require("../utilities/queue/inMemoryQueue") ? require("../utilities/queue/inMemoryQueue")
: require("bull") : require("bull")
const { JobQueues } = require("../constants") const { JobQueues } = require("../constants")
const { utils } = require("@budibase/auth/redis") const { utils } = require("@budibase/backend-core/redis")
const { opts, redisProtocolUrl } = utils.getRedisOptions() const { opts, redisProtocolUrl } = utils.getRedisOptions()
const CLEANUP_PERIOD_MS = 60 * 1000 const CLEANUP_PERIOD_MS = 60 * 1000

View File

@ -6,7 +6,7 @@ const { queue } = require("./bullboard")
const newid = require("../db/newid") const newid = require("../db/newid")
const { updateEntityMetadata } = require("../utilities") const { updateEntityMetadata } = require("../utilities")
const { MetadataTypes } = require("../constants") const { MetadataTypes } = require("../constants")
const { getDeployedAppID } = require("@budibase/auth/db") const { getDeployedAppID } = require("@budibase/backend-core/db")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")
const WH_STEP_ID = definitions.WEBHOOK.stepId const WH_STEP_ID = definitions.WEBHOOK.stepId

View File

@ -1,6 +1,6 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { UserStatus } = require("@budibase/auth").constants const { UserStatus } = require("@budibase/backend-core").constants
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore const { ObjectStoreBuckets } = require("@budibase/backend-core").objectStore
exports.JobQueues = { exports.JobQueues = {
AUTOMATIONS: "automationQueue", AUTOMATIONS: "automationQueue",

View File

@ -1,4 +1,4 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { BASE_LAYOUT_PROP_IDS } = require("./layouts") const { BASE_LAYOUT_PROP_IDS } = require("./layouts")
exports.createHomeScreen = () => ({ exports.createHomeScreen = () => ({

View File

@ -1,5 +1,5 @@
const PouchDB = require("pouchdb") const PouchDB = require("pouchdb")
const { getCouchUrl } = require("@budibase/auth/db") const { getCouchUrl } = require("@budibase/backend-core/db")
const replicationStream = require("pouchdb-replication-stream") const replicationStream = require("pouchdb-replication-stream")
const allDbs = require("pouchdb-all-dbs") const allDbs = require("pouchdb-all-dbs")
const find = require("pouchdb-find") const find = require("pouchdb-find")

View File

@ -9,7 +9,7 @@ const {
StaticDatabases, StaticDatabases,
isDevAppID, isDevAppID,
isProdAppID, isProdAppID,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const UNICODE_MAX = "\ufff0" const UNICODE_MAX = "\ufff0"

View File

@ -2,11 +2,11 @@ const {
getUserRoleHierarchy, getUserRoleHierarchy,
getRequiredResourceRole, getRequiredResourceRole,
BUILTIN_ROLE_IDS, BUILTIN_ROLE_IDS,
} = require("@budibase/auth/roles") } = require("@budibase/backend-core/roles")
const { const {
PermissionTypes, PermissionTypes,
doesHaveBasePermission, doesHaveBasePermission,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const builderMiddleware = require("./builder") const builderMiddleware = require("./builder")
const { isWebhookEndpoint } = require("./utils") const { isWebhookEndpoint } = require("./utils")

View File

@ -7,8 +7,8 @@ const {
} = require("../utilities/redis") } = require("../utilities/redis")
const CouchDB = require("../db") const CouchDB = require("../db")
const { DocumentTypes } = require("../db/utils") const { DocumentTypes } = require("../db/utils")
const { PermissionTypes } = require("@budibase/auth/permissions") const { PermissionTypes } = require("@budibase/backend-core/permissions")
const { app: appCache } = require("@budibase/auth/cache") const { app: appCache } = require("@budibase/backend-core/cache")
const DEBOUNCE_TIME_SEC = 30 const DEBOUNCE_TIME_SEC = 30

View File

@ -1,11 +1,11 @@
const { getAppId, setCookie, getCookie, clearCookie } = const { getAppId, setCookie, getCookie, clearCookie } =
require("@budibase/auth").utils require("@budibase/backend-core").utils
const { Cookies } = require("@budibase/auth").constants const { Cookies } = require("@budibase/backend-core").constants
const { getRole } = require("@budibase/auth/roles") const { getRole } = require("@budibase/backend-core/roles")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { generateUserMetadataID, isDevAppID } = require("../db/utils") const { generateUserMetadataID, isDevAppID } = require("../db/utils")
const { dbExists } = require("@budibase/auth/db") const { dbExists } = require("@budibase/backend-core/db")
const { isUserInAppTenant } = require("@budibase/auth/tenancy") const { isUserInAppTenant } = require("@budibase/backend-core/tenancy")
const { getCachedSelf } = require("../utilities/global") const { getCachedSelf } = require("../utilities/global")
const CouchDB = require("../db") const CouchDB = require("../db")
const env = require("../environment") const env = require("../environment")

View File

@ -9,8 +9,8 @@ jest.mock("../../environment", () => ({
) )
const authorizedMiddleware = require("../authorized") const authorizedMiddleware = require("../authorized")
const env = require("../../environment") const env = require("../../environment")
const { PermissionTypes, PermissionLevels } = require("@budibase/auth/permissions") const { PermissionTypes, PermissionLevels } = require("@budibase/backend-core/permissions")
require("@budibase/auth").init(require("../../db")) require("@budibase/backend-core").init(require("../../db"))
class TestConfiguration { class TestConfiguration {
constructor(role) { constructor(role) {

View File

@ -23,7 +23,7 @@ function mockReset() {
function mockAuthWithNoCookie() { function mockAuthWithNoCookie() {
jest.resetModules() jest.resetModules()
mockWorker() mockWorker()
jest.mock("@budibase/auth/cache", () => ({ jest.mock("@budibase/backend-core/cache", () => ({
user: { user: {
getUser: () => { getUser: () => {
return { return {
@ -32,7 +32,7 @@ function mockAuthWithNoCookie() {
}, },
}, },
})) }))
jest.mock("@budibase/auth", () => ({ jest.mock("@budibase/backend-core", () => ({
utils: { utils: {
getAppId: jest.fn(), getAppId: jest.fn(),
setCookie: jest.fn(), setCookie: jest.fn(),
@ -47,7 +47,7 @@ function mockAuthWithNoCookie() {
function mockAuthWithCookie() { function mockAuthWithCookie() {
jest.resetModules() jest.resetModules()
mockWorker() mockWorker()
jest.mock("@budibase/auth", () => ({ jest.mock("@budibase/backend-core", () => ({
utils: { utils: {
getAppId: () => { getAppId: () => {
return "app_test" return "app_test"
@ -121,7 +121,7 @@ describe("Current app middleware", () => {
async function checkExpected(setCookie) { async function checkExpected(setCookie) {
config.setUser() config.setUser()
await config.executeMiddleware() await config.executeMiddleware()
const cookieFn = require("@budibase/auth").utils.setCookie const cookieFn = require("@budibase/backend-core").utils.setCookie
if (setCookie) { if (setCookie) {
expect(cookieFn).toHaveBeenCalled() expect(cookieFn).toHaveBeenCalled()
} else { } else {
@ -140,7 +140,7 @@ describe("Current app middleware", () => {
it("should perform correct when no cookie exists", async () => { it("should perform correct when no cookie exists", async () => {
mockReset() mockReset()
jest.mock("@budibase/auth", () => ({ jest.mock("@budibase/backend-core", () => ({
utils: { utils: {
getAppId: () => { getAppId: () => {
return "app_test" return "app_test"
@ -157,7 +157,7 @@ describe("Current app middleware", () => {
it("lastly check what occurs when cookie doesn't need updated", async () => { it("lastly check what occurs when cookie doesn't need updated", async () => {
mockReset() mockReset()
jest.mock("@budibase/auth", () => ({ jest.mock("@budibase/backend-core", () => ({
utils: { utils: {
getAppId: () => { getAppId: () => {
return "app_test" return "app_test"

View File

@ -6,7 +6,7 @@ jest.mock("../../environment", () => ({
isDev: () => true, isDev: () => true,
_set: () => {}, _set: () => {},
})) }))
jest.mock("@budibase/auth/tenancy", () => ({ jest.mock("@budibase/backend-core/tenancy", () => ({
getTenantId: () => "testing123" getTenantId: () => "testing123"
})) }))

View File

@ -1,7 +1,7 @@
const CouchDB = require("../db") const CouchDB = require("../db")
const usageQuota = require("../utilities/usageQuota") const usageQuota = require("../utilities/usageQuota")
const env = require("../environment") const env = require("../environment")
const { getTenantId } = require("@budibase/auth/tenancy") const { getTenantId } = require("@budibase/backend-core/tenancy")
const { const {
isExternalTable, isExternalTable,
isRowId: isExternalRowId, isRowId: isExternalRowId,

View File

@ -1,4 +1,4 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const env = require("../../environment") const env = require("../../environment")
const { const {
basicTable, basicTable,
@ -15,12 +15,12 @@ const {
const controllers = require("./controllers") const controllers = require("./controllers")
const supertest = require("supertest") const supertest = require("supertest")
const { cleanup } = require("../../utilities/fileSystem") const { cleanup } = require("../../utilities/fileSystem")
const { Cookies, Headers } = require("@budibase/auth").constants const { Cookies, Headers } = require("@budibase/backend-core").constants
const { jwt } = require("@budibase/auth").auth const { jwt } = require("@budibase/backend-core").auth
const auth = require("@budibase/auth") const auth = require("@budibase/backend-core")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
const { createASession } = require("@budibase/auth/sessions") const { createASession } = require("@budibase/backend-core/sessions")
const { user: userCache } = require("@budibase/auth/cache") const { user: userCache } = require("@budibase/backend-core/cache")
const CouchDB = require("../../db") const CouchDB = require("../../db")
auth.init(CouchDB) auth.init(CouchDB)

View File

@ -1,5 +1,5 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { BUILTIN_PERMISSION_IDS } = require("@budibase/auth/permissions") const { BUILTIN_PERMISSION_IDS } = require("@budibase/backend-core/permissions")
const { createHomeScreen } = require("../../constants/screens") const { createHomeScreen } = require("../../constants/screens")
const { EMPTY_LAYOUT } = require("../../constants/layouts") const { EMPTY_LAYOUT } = require("../../constants/layouts")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")

View File

@ -4,10 +4,10 @@ const actions = require("../automations/actions")
const automationUtils = require("../automations/automationUtils") const automationUtils = require("../automations/automationUtils")
const AutomationEmitter = require("../events/AutomationEmitter") const AutomationEmitter = require("../events/AutomationEmitter")
const { processObject } = require("@budibase/string-templates") const { processObject } = require("@budibase/string-templates")
const { DEFAULT_TENANT_ID } = require("@budibase/auth").constants const { DEFAULT_TENANT_ID } = require("@budibase/backend-core").constants
const CouchDB = require("../db") const CouchDB = require("../db")
const { DocumentTypes, isDevAppID } = require("../db/utils") const { DocumentTypes, isDevAppID } = require("../db/utils")
const { doInTenant } = require("@budibase/auth/tenancy") const { doInTenant } = require("@budibase/backend-core/tenancy")
const usage = require("../utilities/usageQuota") const usage = require("../utilities/usageQuota")
const { definitions: triggerDefs } = require("../automations/triggerInfo") const { definitions: triggerDefs } = require("../automations/triggerInfo")

View File

@ -1,8 +1,8 @@
const env = require("../environment") const env = require("../environment")
const CouchDB = require("../db") const CouchDB = require("../db")
const { init } = require("@budibase/auth") const { init } = require("@budibase/backend-core")
const redis = require("@budibase/auth/redis") const redis = require("@budibase/backend-core/redis")
const { SEPARATOR } = require("@budibase/auth/db") const { SEPARATOR } = require("@budibase/backend-core/db")
const { processStringSync } = require("@budibase/string-templates") const { processStringSync } = require("@budibase/string-templates")
const VARIABLE_TTL_SECONDS = 3600 const VARIABLE_TTL_SECONDS = 3600

View File

@ -1,7 +1,7 @@
const { join } = require("./centralPath") const { join } = require("./centralPath")
const { homedir } = require("os") const { homedir } = require("os")
const env = require("../environment") const env = require("../environment")
const { budibaseTempDir } = require("@budibase/auth").objectStore const { budibaseTempDir } = require("@budibase/backend-core").objectStore
module.exports.budibaseAppsDir = function () { module.exports.budibaseAppsDir = function () {
return env.BUDIBASE_DIR || join(homedir(), ".budibase") return env.BUDIBASE_DIR || join(homedir(), ".budibase")

View File

@ -8,7 +8,7 @@ const {
deleteFolder, deleteFolder,
uploadDirectory, uploadDirectory,
downloadTarball, downloadTarball,
} = require("@budibase/auth").objectStore } = require("@budibase/backend-core").objectStore
/*********************************** /***********************************
* NOTE * * NOTE *

View File

@ -2,11 +2,14 @@ const {
getMultiIDParams, getMultiIDParams,
getGlobalIDFromUserMetadataID, getGlobalIDFromUserMetadataID,
} = require("../db/utils") } = require("../db/utils")
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
const { getDeployedAppID } = require("@budibase/auth/db") const { getDeployedAppID } = require("@budibase/backend-core/db")
const { getGlobalUserParams } = require("@budibase/auth/db") const { getGlobalUserParams } = require("@budibase/backend-core/db")
const { user: userCache } = require("@budibase/auth/cache") const { user: userCache } = require("@budibase/backend-core/cache")
const { getGlobalDB, isUserInAppTenant } = require("@budibase/auth/tenancy") const {
getGlobalDB,
isUserInAppTenant,
} = require("@budibase/backend-core/tenancy")
const env = require("../environment") const env = require("../environment")
exports.updateAppRole = (appId, user) => { exports.updateAppRole = (appId, user) => {

View File

@ -1,6 +1,6 @@
const env = require("../environment") const env = require("../environment")
const { OBJ_STORE_DIRECTORY } = require("../constants") const { OBJ_STORE_DIRECTORY } = require("../constants")
const { sanitizeKey } = require("@budibase/auth/src/objectStore") const { sanitizeKey } = require("@budibase/backend-core/src/objectStore")
const CouchDB = require("../db") const CouchDB = require("../db")
const { generateMetadataID } = require("../db/utils") const { generateMetadataID } = require("../db/utils")
const Readable = require("stream").Readable const Readable = require("stream").Readable

View File

@ -1,4 +1,4 @@
const { Client, utils } = require("@budibase/auth/redis") const { Client, utils } = require("@budibase/backend-core/redis")
const { getGlobalIDFromUserMetadataID } = require("../db/utils") const { getGlobalIDFromUserMetadataID } = require("../db/utils")
const APP_DEV_LOCK_SECONDS = 600 const APP_DEV_LOCK_SECONDS = 600

View File

@ -3,8 +3,11 @@ const {
PermissionTypes, PermissionTypes,
getBuiltinPermissionByID, getBuiltinPermissionByID,
isPermissionLevelHigherThanRead, isPermissionLevelHigherThanRead,
} = require("@budibase/auth/permissions") } = require("@budibase/backend-core/permissions")
const { lowerBuiltinRoleID, getBuiltinRoles } = require("@budibase/auth/roles") const {
lowerBuiltinRoleID,
getBuiltinRoles,
} = require("@budibase/backend-core/roles")
const { DocumentTypes } = require("../db/utils") const { DocumentTypes } = require("../db/utils")
const CURRENTLY_SUPPORTED_LEVELS = [ const CURRENTLY_SUPPORTED_LEVELS = [

View File

@ -1,9 +1,9 @@
const env = require("../environment") const env = require("../environment")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
const { const {
StaticDatabases, StaticDatabases,
generateNewUsageQuotaDoc, generateNewUsageQuotaDoc,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
function getNewQuotaReset() { function getNewQuotaReset() {
return Date.now() + 2592000000 return Date.now() + 2592000000

View File

@ -1,10 +1,10 @@
const fetch = require("node-fetch") const fetch = require("node-fetch")
const env = require("../environment") const env = require("../environment")
const { checkSlashesInUrl } = require("./index") const { checkSlashesInUrl } = require("./index")
const { getDeployedAppID } = require("@budibase/auth/db") const { getDeployedAppID } = require("@budibase/backend-core/db")
const { updateAppRole } = require("./global") const { updateAppRole } = require("./global")
const { Headers } = require("@budibase/auth/constants") const { Headers } = require("@budibase/backend-core/constants")
const { getTenantId, isTenantIdSet } = require("@budibase/auth/tenancy") const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy")
function request(ctx, request) { function request(ctx, request) {
if (!request.headers) { if (!request.headers) {

View File

@ -983,9 +983,9 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/auth@^1.0.27-alpha.0": "@budibase/backend-core@^1.0.27-alpha.0":
version "1.0.27-alpha.0" version "1.0.27-alpha.0"
resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-1.0.27-alpha.0.tgz#8020c205d20d722983906426cb5a1aaf5cc6aba4" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/auth-1.0.27-alpha.0.tgz#8020c205d20d722983906426cb5a1aaf5cc6aba4"
integrity sha512-sfXJjQJsFWfgElsHGHn7beERcsrUA5cotN2p9XEp15SrMeEmy4s9a6K58b779QB/d28GXKXtSJwmM/DrptJetQ== integrity sha512-sfXJjQJsFWfgElsHGHn7beERcsrUA5cotN2p9XEp15SrMeEmy4s9a6K58b779QB/d28GXKXtSJwmM/DrptJetQ==
dependencies: dependencies:
"@techpass/passport-openidconnect" "^0.3.0" "@techpass/passport-openidconnect" "^0.3.0"

View File

@ -29,7 +29,7 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/auth": "^1.0.27-alpha.7", "@budibase/backend-core": "^1.0.27-alpha.7",
"@budibase/string-templates": "^1.0.27-alpha.7", "@budibase/string-templates": "^1.0.27-alpha.7",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0", "@sentry/node": "^6.0.0",

View File

@ -2,7 +2,7 @@ const {
getAllApps, getAllApps,
getDeployedAppID, getDeployedAppID,
isProdAppID, isProdAppID,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const CouchDB = require("../../db") const CouchDB = require("../../db")
const URL_REGEX_SLASH = /\/|\\/g const URL_REGEX_SLASH = /\/|\\/g

View File

@ -1,7 +1,7 @@
const authPkg = require("@budibase/auth") const authPkg = require("@budibase/backend-core")
const { getScopedConfig } = require("@budibase/auth/db") const { getScopedConfig } = require("@budibase/backend-core/db")
const { google } = require("@budibase/auth/src/middleware") const { google } = require("@budibase/backend-core/src/middleware")
const { oidc } = require("@budibase/auth/src/middleware") const { oidc } = require("@budibase/backend-core/src/middleware")
const { Configs, EmailTemplatePurpose } = require("../../../constants") const { Configs, EmailTemplatePurpose } = require("../../../constants")
const { sendEmail, isEmailConfigured } = require("../../../utilities/email") const { sendEmail, isEmailConfigured } = require("../../../utilities/email")
const { const {
@ -19,7 +19,7 @@ const {
getGlobalDB, getGlobalDB,
getTenantId, getTenantId,
isMultiTenant, isMultiTenant,
} = require("@budibase/auth/tenancy") } = require("@budibase/backend-core/tenancy")
const env = require("../../../environment") const env = require("../../../environment")
const ssoCallbackUrl = async (config, type) => { const ssoCallbackUrl = async (config, type) => {

View File

@ -4,12 +4,13 @@ const {
getGlobalUserParams, getGlobalUserParams,
getScopedFullConfig, getScopedFullConfig,
getAllApps, getAllApps,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const { Configs } = require("../../../constants") const { Configs } = require("../../../constants")
const email = require("../../../utilities/email") const email = require("../../../utilities/email")
const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore const { upload, ObjectStoreBuckets } =
require("@budibase/backend-core").objectStore
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
const { getGlobalDB, getTenantId } = require("@budibase/auth/tenancy") const { getGlobalDB, getTenantId } = require("@budibase/backend-core/tenancy")
const env = require("../../../environment") const env = require("../../../environment")
const { googleCallbackUrl, oidcCallbackUrl } = require("./auth") const { googleCallbackUrl, oidcCallbackUrl } = require("./auth")

View File

@ -1,5 +1,5 @@
const { sendEmail } = require("../../../utilities/email") const { sendEmail } = require("../../../utilities/email")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
exports.sendEmail = async ctx => { exports.sendEmail = async ctx => {
let { let {

View File

@ -1,9 +1,9 @@
const { getAllRoles } = require("@budibase/auth/roles") const { getAllRoles } = require("@budibase/backend-core/roles")
const { const {
getAllApps, getAllApps,
getDeployedAppID, getDeployedAppID,
DocumentTypes, DocumentTypes,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
exports.fetch = async ctx => { exports.fetch = async ctx => {

View File

@ -2,7 +2,7 @@ const {
getAllSessions, getAllSessions,
getUserSessions, getUserSessions,
invalidateSessions, invalidateSessions,
} = require("@budibase/auth/sessions") } = require("@budibase/backend-core/sessions")
exports.fetch = async ctx => { exports.fetch = async ctx => {
ctx.body = await getAllSessions() ctx.body = await getAllSessions()

View File

@ -1,11 +1,11 @@
const { generateTemplateID } = require("@budibase/auth/db") const { generateTemplateID } = require("@budibase/backend-core/db")
const { const {
TemplateMetadata, TemplateMetadata,
TemplateBindings, TemplateBindings,
GLOBAL_OWNER, GLOBAL_OWNER,
} = require("../../../constants") } = require("../../../constants")
const { getTemplates } = require("../../../constants/templates") const { getTemplates } = require("../../../constants/templates")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
exports.save = async ctx => { exports.save = async ctx => {
const db = getGlobalDB() const db = getGlobalDB()

View File

@ -2,22 +2,22 @@ const {
getGlobalUserParams, getGlobalUserParams,
StaticDatabases, StaticDatabases,
generateNewUsageQuotaDoc, generateNewUsageQuotaDoc,
} = require("@budibase/auth/db") } = require("@budibase/backend-core/db")
const { hash, getGlobalUserByEmail, saveUser, platformLogout } = const { hash, getGlobalUserByEmail, saveUser, platformLogout } =
require("@budibase/auth").utils require("@budibase/backend-core").utils
const { EmailTemplatePurpose } = require("../../../constants") const { EmailTemplatePurpose } = require("../../../constants")
const { checkInviteCode } = require("../../../utilities/redis") const { checkInviteCode } = require("../../../utilities/redis")
const { sendEmail } = require("../../../utilities/email") const { sendEmail } = require("../../../utilities/email")
const { user: userCache } = require("@budibase/auth/cache") const { user: userCache } = require("@budibase/backend-core/cache")
const { invalidateSessions } = require("@budibase/auth/sessions") const { invalidateSessions } = require("@budibase/backend-core/sessions")
const accounts = require("@budibase/auth/accounts") const accounts = require("@budibase/backend-core/accounts")
const { const {
getGlobalDB, getGlobalDB,
getTenantId, getTenantId,
getTenantUser, getTenantUser,
doesTenantExist, doesTenantExist,
} = require("@budibase/auth/tenancy") } = require("@budibase/backend-core/tenancy")
const { removeUserFromInfoDB } = require("@budibase/auth/deprovision") const { removeUserFromInfoDB } = require("@budibase/backend-core/deprovision")
const env = require("../../../environment") const env = require("../../../environment")
const { syncUserInApps } = require("../../../utilities/appService") const { syncUserInApps } = require("../../../utilities/appService")

View File

@ -1,5 +1,8 @@
const { getWorkspaceParams, generateWorkspaceID } = require("@budibase/auth/db") const {
const { getGlobalDB } = require("@budibase/auth/tenancy") getWorkspaceParams,
generateWorkspaceID,
} = require("@budibase/backend-core/db")
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
exports.save = async function (ctx) { exports.save = async function (ctx) {
const db = getGlobalDB() const db = getGlobalDB()

View File

@ -1,7 +1,7 @@
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
const { StaticDatabases } = require("@budibase/auth/db") const { StaticDatabases } = require("@budibase/backend-core/db")
const { getTenantId } = require("@budibase/auth/tenancy") const { getTenantId } = require("@budibase/backend-core/tenancy")
const { deleteTenant } = require("@budibase/auth/deprovision") const { deleteTenant } = require("@budibase/backend-core/deprovision")
exports.exists = async ctx => { exports.exists = async ctx => {
const tenantId = ctx.request.params const tenantId = ctx.request.params

View File

@ -3,7 +3,7 @@ const compress = require("koa-compress")
const zlib = require("zlib") const zlib = require("zlib")
const { routes } = require("./routes") const { routes } = require("./routes")
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } = const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
require("@budibase/auth").auth require("@budibase/backend-core").auth
const PUBLIC_ENDPOINTS = [ const PUBLIC_ENDPOINTS = [
// old deprecated endpoints kept for backwards compat // old deprecated endpoints kept for backwards compat

View File

@ -2,7 +2,7 @@ const Router = require("@koa/router")
const authController = require("../../controllers/global/auth") const authController = require("../../controllers/global/auth")
const joiValidator = require("../../../middleware/joi-validator") const joiValidator = require("../../../middleware/joi-validator")
const Joi = require("joi") const Joi = require("joi")
const { updateTenantId } = require("@budibase/auth/tenancy") const { updateTenantId } = require("@budibase/backend-core/tenancy")
const router = Router() const router = Router()

View File

@ -54,7 +54,7 @@ describe("/api/global/auth", () => {
}) })
describe("oidc", () => { describe("oidc", () => {
const auth = require("@budibase/auth").auth const auth = require("@budibase/backend-core").auth
// mock the oidc strategy implementation and return value // mock the oidc strategy implementation and return value
strategyFactory = jest.fn() strategyFactory = jest.fn()

View File

@ -1,16 +1,16 @@
const env = require("../../../../environment") const env = require("../../../../environment")
const controllers = require("./controllers") const controllers = require("./controllers")
const supertest = require("supertest") const supertest = require("supertest")
const { jwt } = require("@budibase/auth").auth const { jwt } = require("@budibase/backend-core").auth
const { Cookies } = require("@budibase/auth").constants const { Cookies } = require("@budibase/backend-core").constants
const { Configs, LOGO_URL } = require("../../../../constants") const { Configs, LOGO_URL } = require("../../../../constants")
const { getGlobalUserByEmail } = require("@budibase/auth").utils const { getGlobalUserByEmail } = require("@budibase/backend-core").utils
const { createASession } = require("@budibase/auth/sessions") const { createASession } = require("@budibase/backend-core/sessions")
const { newid } = require("../../../../../../auth/src/hashing") const { newid } = require("../../../../../../auth/src/hashing")
const { TENANT_ID } = require("./structures") const { TENANT_ID } = require("./structures")
const auth = require("@budibase/auth") const auth = require("@budibase/backend-core")
const CouchDB = require("../../../../db") const CouchDB = require("../../../../db")
const { doInTenant } = require("@budibase/auth/tenancy") const { doInTenant } = require("@budibase/backend-core/tenancy")
auth.init(CouchDB) auth.init(CouchDB)
class TestConfiguration { class TestConfiguration {

View File

@ -1,4 +1,4 @@
const { Configs } = require("@budibase/auth").constants const { Configs } = require("@budibase/backend-core").constants
exports.LOGO_URL = exports.LOGO_URL =
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg" "https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"

View File

@ -6,8 +6,8 @@ const {
GLOBAL_OWNER, GLOBAL_OWNER,
} = require("../index") } = require("../index")
const { join } = require("path") const { join } = require("path")
const { getTemplateParams } = require("@budibase/auth/db") const { getTemplateParams } = require("@budibase/backend-core/db")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
exports.EmailTemplates = { exports.EmailTemplates = {
[EmailTemplatePurpose.PASSWORD_RECOVERY]: readStaticFile( [EmailTemplatePurpose.PASSWORD_RECOVERY]: readStaticFile(

View File

@ -1,7 +1,7 @@
const PouchDB = require("pouchdb") const PouchDB = require("pouchdb")
const allDbs = require("pouchdb-all-dbs") const allDbs = require("pouchdb-all-dbs")
const env = require("../environment") const env = require("../environment")
const { getCouchUrl } = require("@budibase/auth/db") const { getCouchUrl } = require("@budibase/backend-core/db")
// level option is purely for testing (development) // level option is purely for testing (development)
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/" const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/"

View File

@ -1,12 +1,12 @@
// need to load environment first // need to load environment first
const env = require("./environment") const env = require("./environment")
const CouchDB = require("./db") const CouchDB = require("./db")
require("@budibase/auth").init(CouchDB) require("@budibase/backend-core").init(CouchDB)
const Koa = require("koa") const Koa = require("koa")
const destroyable = require("server-destroy") const destroyable = require("server-destroy")
const koaBody = require("koa-body") const koaBody = require("koa-body")
const koaSession = require("koa-session") const koaSession = require("koa-session")
const { passport } = require("@budibase/auth").auth const { passport } = require("@budibase/backend-core").auth
const logger = require("koa-pino-logger") const logger = require("koa-pino-logger")
const http = require("http") const http = require("http")
const api = require("./api") const api = require("./api")

View File

@ -1,5 +1,5 @@
const env = require("../environment") const env = require("../environment")
const { Headers } = require("@budibase/auth").constants const { Headers } = require("@budibase/backend-core").constants
/** /**
* This is a restricted endpoint in the cloud. * This is a restricted endpoint in the cloud.

View File

@ -1,6 +1,6 @@
const fetch = require("node-fetch") const fetch = require("node-fetch")
const { Headers } = require("@budibase/auth/constants") const { Headers } = require("@budibase/backend-core/constants")
const { getTenantId, isTenantIdSet } = require("@budibase/auth/tenancy") const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy")
const { checkSlashesInUrl } = require("../utilities") const { checkSlashesInUrl } = require("../utilities")
const env = require("../environment") const env = require("../environment")

View File

@ -1,12 +1,12 @@
const nodemailer = require("nodemailer") const nodemailer = require("nodemailer")
const env = require("../environment") const env = require("../environment")
const { getScopedConfig } = require("@budibase/auth/db") const { getScopedConfig } = require("@budibase/backend-core/db")
const { EmailTemplatePurpose, TemplateTypes, Configs } = require("../constants") const { EmailTemplatePurpose, TemplateTypes, Configs } = require("../constants")
const { getTemplateByPurpose } = require("../constants/templates") const { getTemplateByPurpose } = require("../constants/templates")
const { getSettingsTemplateContext } = require("./templates") const { getSettingsTemplateContext } = require("./templates")
const { processString } = require("@budibase/string-templates") const { processString } = require("@budibase/string-templates")
const { getResetPasswordCode, getInviteCode } = require("../utilities/redis") const { getResetPasswordCode, getInviteCode } = require("../utilities/redis")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
const TEST_MODE = false const TEST_MODE = false
const TYPE = TemplateTypes.EMAIL const TYPE = TemplateTypes.EMAIL

View File

@ -1,5 +1,5 @@
const { Client, utils } = require("@budibase/auth/redis") const { Client, utils } = require("@budibase/backend-core/redis")
const { newid } = require("@budibase/auth").utils const { newid } = require("@budibase/backend-core").utils
function getExpirySecondsForDB(db) { function getExpirySecondsForDB(db) {
switch (db) { switch (db) {

Some files were not shown because too many files have changed in this diff Show More