Switching out @budibase/auth to @budibase/backend-core.
This commit is contained in:
parent
b4f83fa867
commit
836a2f5863
|
@ -4,7 +4,7 @@ This library contains core functionality, like auth and security features
|
|||
which are shared between backend services.
|
||||
|
||||
#### 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.
|
||||
|
||||
For these files they should be limited to a single `require` of the file that should
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@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/string-templates": "^1.0.27-alpha.7",
|
||||
"@bull-board/api": "^3.7.0",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
const CouchDB = require("../src/db")
|
||||
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 remoteUrl = process.argv[3]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { StaticDatabases } = require("@budibase/auth/db")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { StaticDatabases } = require("@budibase/backend-core/db")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
const KEYS_DOC = StaticDatabases.GLOBAL.docs.apiKeys
|
||||
|
||||
|
|
|
@ -19,7 +19,10 @@ const {
|
|||
DocumentTypes,
|
||||
AppStatus,
|
||||
} = 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 { cloneDeep } = require("lodash/fp")
|
||||
const { processObject } = require("@budibase/string-templates")
|
||||
|
@ -28,7 +31,7 @@ const {
|
|||
isDevAppID,
|
||||
getDeployedAppID,
|
||||
Replication,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
const { USERS_TABLE_SCHEMA } = require("../../constants")
|
||||
const {
|
||||
getDeployedApps,
|
||||
|
@ -41,9 +44,9 @@ const {
|
|||
backupClientLibrary,
|
||||
revertClientLibrary,
|
||||
} = require("../../utilities/fileSystem/clientLibrary")
|
||||
const { getTenantId, isMultiTenant } = require("@budibase/auth/tenancy")
|
||||
const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
|
||||
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 URL_REGEX_SLASH = /\/|\\/g
|
||||
|
|
|
@ -2,7 +2,7 @@ const CouchDB = require("../../db")
|
|||
const { outputProcessing } = require("../../utilities/rowProcessor")
|
||||
const { InternalTables } = require("../../db/utils")
|
||||
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 => {
|
||||
const appId = ctx.appId
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const env = require("../../environment")
|
||||
const { getAllApps } = require("@budibase/auth/db")
|
||||
const { getAllApps } = require("@budibase/backend-core/db")
|
||||
const CouchDB = require("../../db")
|
||||
const {
|
||||
exportDB,
|
||||
|
@ -7,7 +7,10 @@ const {
|
|||
readFileSync,
|
||||
} = require("../../utilities/fileSystem")
|
||||
const { stringToReadStream } = require("../../utilities")
|
||||
const { getGlobalDBName, getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const {
|
||||
getGlobalDBName,
|
||||
getGlobalDB,
|
||||
} = require("@budibase/backend-core/tenancy")
|
||||
const { create } = require("./application")
|
||||
const { getDocParams, DocumentTypes, isDevAppID } = require("../../db/utils")
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const CouchDB = require("../../../db")
|
||||
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 {
|
||||
disableAllCrons,
|
||||
enableCronTrigger,
|
||||
} = 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
|
||||
const MAX_PENDING_TIME_MS = 30 * 60000
|
||||
|
|
|
@ -4,9 +4,9 @@ const env = require("../../environment")
|
|||
const { checkSlashesInUrl } = require("../../utilities")
|
||||
const { request } = require("../../utilities/workerRequests")
|
||||
const { clearLock } = require("../../utilities/redis")
|
||||
const { Replication } = require("@budibase/auth").db
|
||||
const { Replication } = require("@budibase/backend-core").db
|
||||
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") {
|
||||
const { devPath } = ctx.params
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const CouchDB = require("../../db")
|
||||
const { getDeployedApps } = require("../../utilities/workerRequests")
|
||||
const { getScopedConfig } = require("@budibase/auth/db")
|
||||
const { Configs } = require("@budibase/auth").constants
|
||||
const { getScopedConfig } = require("@budibase/backend-core/db")
|
||||
const { Configs } = require("@budibase/backend-core").constants
|
||||
const { checkSlashesInUrl } = require("../../utilities")
|
||||
|
||||
exports.fetchUrls = async ctx => {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const { getBuiltinPermissions } = require("@budibase/auth/permissions")
|
||||
const { getBuiltinPermissions } = require("@budibase/backend-core/permissions")
|
||||
const {
|
||||
isBuiltin,
|
||||
getDBRoleID,
|
||||
getExternalRoleID,
|
||||
getBuiltinRoles,
|
||||
} = require("@budibase/auth/roles")
|
||||
} = require("@budibase/backend-core/roles")
|
||||
const { getRoleParams } = require("../../db/utils")
|
||||
const CouchDB = require("../../db")
|
||||
const {
|
||||
|
|
|
@ -4,7 +4,7 @@ const {
|
|||
getRole,
|
||||
isBuiltin,
|
||||
getAllRoles,
|
||||
} = require("@budibase/auth/roles")
|
||||
} = require("@budibase/backend-core/roles")
|
||||
const {
|
||||
generateRoleID,
|
||||
getUserMetadataParams,
|
||||
|
|
|
@ -2,7 +2,7 @@ const { getRoutingInfo } = require("../../utilities/routing")
|
|||
const {
|
||||
getUserRoleHierarchy,
|
||||
BUILTIN_ROLE_IDS,
|
||||
} = require("@budibase/auth/roles")
|
||||
} = require("@budibase/backend-core/roles")
|
||||
|
||||
const URL_SEPARATOR = "/"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { SearchIndexes } = require("../../../db/utils")
|
||||
const fetch = require("node-fetch")
|
||||
const { getCouchUrl } = require("@budibase/auth/db")
|
||||
const { getCouchUrl } = require("@budibase/backend-core/db")
|
||||
|
||||
/**
|
||||
* Class to build lucene query URLs.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const CouchDB = require("../../db")
|
||||
const { getScreenParams, generateScreenID } = require("../../db/utils")
|
||||
const { AccessController } = require("@budibase/auth/roles")
|
||||
const { AccessController } = require("@budibase/backend-core/roles")
|
||||
|
||||
exports.fetch = async ctx => {
|
||||
const appId = ctx.appId
|
||||
|
|
|
@ -8,10 +8,13 @@ const { InternalTables } = require("../../db/utils")
|
|||
const { getGlobalUsers, getRawGlobalUser } = require("../../utilities/global")
|
||||
const { getFullUser } = require("../../utilities/users")
|
||||
const { isEqual } = require("lodash")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
const { getDevelopmentAppID, getDeployedAppIDs } = require("@budibase/auth/db")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const {
|
||||
getDevelopmentAppID,
|
||||
getDeployedAppIDs,
|
||||
} = require("@budibase/backend-core/db")
|
||||
const { doesDatabaseExist } = require("../../utilities")
|
||||
const { UserStatus } = require("@budibase/auth/constants")
|
||||
const { UserStatus } = require("@budibase/backend-core/constants")
|
||||
|
||||
async function rawMetadata(db) {
|
||||
return (
|
||||
|
|
|
@ -3,7 +3,7 @@ const { generateWebhookID, getWebhookParams } = require("../../db/utils")
|
|||
const toJsonSchema = require("to-json-schema")
|
||||
const validate = require("jsonschema").validate
|
||||
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"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const {
|
|||
auditLog,
|
||||
buildTenancyMiddleware,
|
||||
buildAppTenancyMiddleware,
|
||||
} = require("@budibase/auth").auth
|
||||
} = require("@budibase/backend-core").auth
|
||||
const currentApp = require("../middleware/currentapp")
|
||||
const compress = require("koa-compress")
|
||||
const zlib = require("zlib")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/apikeys")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/application")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const usage = require("../../middleware/usageQuota")
|
||||
|
||||
const router = Router()
|
||||
|
|
|
@ -6,7 +6,7 @@ const {
|
|||
BUILDER,
|
||||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const Joi = require("joi")
|
||||
const { bodyResource, paramResource } = require("../../middleware/resourceId")
|
||||
const {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/backup")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/cloud")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/component")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const {
|
|||
BUILDER,
|
||||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const Joi = require("joi")
|
||||
const { DataSourceOperation } = require("../../constants")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/deploy")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const Router = require("@koa/router")
|
|||
const controller = require("../controllers/dev")
|
||||
const env = require("../../environment")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/hosting")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/integration")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Router = require("@koa/router")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const controller = require("../controllers/layout")
|
||||
|
||||
const router = Router()
|
||||
|
|
|
@ -5,7 +5,7 @@ const {
|
|||
AppType,
|
||||
} = require("../../middleware/appInfo")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/permission")
|
||||
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 joiValidator = require("../../middleware/joi-validator")
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const {
|
|||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
BUILDER,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const {
|
||||
bodyResource,
|
||||
bodySubResource,
|
||||
|
|
|
@ -7,7 +7,7 @@ const {
|
|||
BUILTIN_PERMISSION_IDS,
|
||||
BUILDER,
|
||||
PermissionLevels,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Router = require("@koa/router")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const controller = require("../controllers/routing")
|
||||
|
||||
const router = Router()
|
||||
|
|
|
@ -9,7 +9,7 @@ const {
|
|||
const {
|
||||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/screen")
|
||||
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 Joi = require("joi")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/script")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const {
|
|||
BUILDER,
|
||||
PermissionTypes,
|
||||
PermissionLevels,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const env = require("../../environment")
|
||||
const { paramResource } = require("../../middleware/resourceId")
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const {
|
|||
BUILDER,
|
||||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const joiValidator = require("../../middleware/joi-validator")
|
||||
const Joi = require("joi")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const Router = require("@koa/router")
|
||||
const controller = require("../controllers/templates")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -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 { basicRow } = setup.structures
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ jest.mock("node-fetch")
|
|||
|
||||
// Mock isProdAppID to we can later mock the implementation and pretend we are
|
||||
// using prod app IDs
|
||||
const authDb = require("@budibase/auth/db")
|
||||
const authDb = require("@budibase/backend-core/db")
|
||||
const { isProdAppID } = authDb
|
||||
const mockIsProdAppID = jest.fn(isProdAppID)
|
||||
authDb.isProdAppID = mockIsProdAppID
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const setup = require("./utilities")
|
||||
const { basicRole } = setup.structures
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const setup = require("./utilities")
|
||||
const { basicScreen } = setup.structures
|
||||
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"
|
||||
|
||||
|
|
|
@ -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 setup = require("./utilities")
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const rowController = require("../../../controllers/row")
|
|||
const appController = require("../../../controllers/application")
|
||||
const CouchDB = require("../../../../db")
|
||||
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")
|
||||
|
||||
function Request(appId, params) {
|
||||
|
|
|
@ -4,7 +4,7 @@ const authorized = require("../../middleware/authorized")
|
|||
const {
|
||||
PermissionLevels,
|
||||
PermissionTypes,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const {
|
|||
BUILDER,
|
||||
PermissionTypes,
|
||||
PermissionLevels,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const Router = require("@koa/router")
|
|||
const controller = require("../controllers/webhook")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const joiValidator = require("../../middleware/joi-validator")
|
||||
const { BUILDER } = require("@budibase/auth/permissions")
|
||||
const { BUILDER } = require("@budibase/backend-core/permissions")
|
||||
const Joi = require("joi")
|
||||
|
||||
const router = Router()
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ExtendableContext } from "koa"
|
|||
|
||||
const env = require("./environment")
|
||||
const CouchDB = require("./db")
|
||||
require("@budibase/auth").init(CouchDB)
|
||||
require("@budibase/backend-core").init(CouchDB)
|
||||
const Koa = require("koa")
|
||||
const destroyable = require("server-destroy")
|
||||
const koaBody = require("koa-body")
|
||||
|
|
|
@ -6,7 +6,7 @@ const Queue = env.isTest()
|
|||
? require("../utilities/queue/inMemoryQueue")
|
||||
: require("bull")
|
||||
const { JobQueues } = require("../constants")
|
||||
const { utils } = require("@budibase/auth/redis")
|
||||
const { utils } = require("@budibase/backend-core/redis")
|
||||
const { opts, redisProtocolUrl } = utils.getRedisOptions()
|
||||
|
||||
const CLEANUP_PERIOD_MS = 60 * 1000
|
||||
|
|
|
@ -6,7 +6,7 @@ const { queue } = require("./bullboard")
|
|||
const newid = require("../db/newid")
|
||||
const { updateEntityMetadata } = require("../utilities")
|
||||
const { MetadataTypes } = require("../constants")
|
||||
const { getDeployedAppID } = require("@budibase/auth/db")
|
||||
const { getDeployedAppID } = require("@budibase/backend-core/db")
|
||||
const { cloneDeep } = require("lodash/fp")
|
||||
|
||||
const WH_STEP_ID = definitions.WEBHOOK.stepId
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
const { UserStatus } = require("@budibase/auth").constants
|
||||
const { ObjectStoreBuckets } = require("@budibase/auth").objectStore
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const { UserStatus } = require("@budibase/backend-core").constants
|
||||
const { ObjectStoreBuckets } = require("@budibase/backend-core").objectStore
|
||||
|
||||
exports.JobQueues = {
|
||||
AUTOMATIONS: "automationQueue",
|
||||
|
|
|
@ -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")
|
||||
|
||||
exports.createHomeScreen = () => ({
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const PouchDB = require("pouchdb")
|
||||
const { getCouchUrl } = require("@budibase/auth/db")
|
||||
const { getCouchUrl } = require("@budibase/backend-core/db")
|
||||
const replicationStream = require("pouchdb-replication-stream")
|
||||
const allDbs = require("pouchdb-all-dbs")
|
||||
const find = require("pouchdb-find")
|
||||
|
|
|
@ -9,7 +9,7 @@ const {
|
|||
StaticDatabases,
|
||||
isDevAppID,
|
||||
isProdAppID,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
|
||||
const UNICODE_MAX = "\ufff0"
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ const {
|
|||
getUserRoleHierarchy,
|
||||
getRequiredResourceRole,
|
||||
BUILTIN_ROLE_IDS,
|
||||
} = require("@budibase/auth/roles")
|
||||
} = require("@budibase/backend-core/roles")
|
||||
const {
|
||||
PermissionTypes,
|
||||
doesHaveBasePermission,
|
||||
} = require("@budibase/auth/permissions")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const builderMiddleware = require("./builder")
|
||||
const { isWebhookEndpoint } = require("./utils")
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ const {
|
|||
} = require("../utilities/redis")
|
||||
const CouchDB = require("../db")
|
||||
const { DocumentTypes } = require("../db/utils")
|
||||
const { PermissionTypes } = require("@budibase/auth/permissions")
|
||||
const { app: appCache } = require("@budibase/auth/cache")
|
||||
const { PermissionTypes } = require("@budibase/backend-core/permissions")
|
||||
const { app: appCache } = require("@budibase/backend-core/cache")
|
||||
|
||||
const DEBOUNCE_TIME_SEC = 30
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const { getAppId, setCookie, getCookie, clearCookie } =
|
||||
require("@budibase/auth").utils
|
||||
const { Cookies } = require("@budibase/auth").constants
|
||||
const { getRole } = require("@budibase/auth/roles")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
require("@budibase/backend-core").utils
|
||||
const { Cookies } = require("@budibase/backend-core").constants
|
||||
const { getRole } = require("@budibase/backend-core/roles")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const { generateUserMetadataID, isDevAppID } = require("../db/utils")
|
||||
const { dbExists } = require("@budibase/auth/db")
|
||||
const { isUserInAppTenant } = require("@budibase/auth/tenancy")
|
||||
const { dbExists } = require("@budibase/backend-core/db")
|
||||
const { isUserInAppTenant } = require("@budibase/backend-core/tenancy")
|
||||
const { getCachedSelf } = require("../utilities/global")
|
||||
const CouchDB = require("../db")
|
||||
const env = require("../environment")
|
||||
|
|
|
@ -9,8 +9,8 @@ jest.mock("../../environment", () => ({
|
|||
)
|
||||
const authorizedMiddleware = require("../authorized")
|
||||
const env = require("../../environment")
|
||||
const { PermissionTypes, PermissionLevels } = require("@budibase/auth/permissions")
|
||||
require("@budibase/auth").init(require("../../db"))
|
||||
const { PermissionTypes, PermissionLevels } = require("@budibase/backend-core/permissions")
|
||||
require("@budibase/backend-core").init(require("../../db"))
|
||||
|
||||
class TestConfiguration {
|
||||
constructor(role) {
|
||||
|
|
|
@ -23,7 +23,7 @@ function mockReset() {
|
|||
function mockAuthWithNoCookie() {
|
||||
jest.resetModules()
|
||||
mockWorker()
|
||||
jest.mock("@budibase/auth/cache", () => ({
|
||||
jest.mock("@budibase/backend-core/cache", () => ({
|
||||
user: {
|
||||
getUser: () => {
|
||||
return {
|
||||
|
@ -32,7 +32,7 @@ function mockAuthWithNoCookie() {
|
|||
},
|
||||
},
|
||||
}))
|
||||
jest.mock("@budibase/auth", () => ({
|
||||
jest.mock("@budibase/backend-core", () => ({
|
||||
utils: {
|
||||
getAppId: jest.fn(),
|
||||
setCookie: jest.fn(),
|
||||
|
@ -47,7 +47,7 @@ function mockAuthWithNoCookie() {
|
|||
function mockAuthWithCookie() {
|
||||
jest.resetModules()
|
||||
mockWorker()
|
||||
jest.mock("@budibase/auth", () => ({
|
||||
jest.mock("@budibase/backend-core", () => ({
|
||||
utils: {
|
||||
getAppId: () => {
|
||||
return "app_test"
|
||||
|
@ -121,7 +121,7 @@ describe("Current app middleware", () => {
|
|||
async function checkExpected(setCookie) {
|
||||
config.setUser()
|
||||
await config.executeMiddleware()
|
||||
const cookieFn = require("@budibase/auth").utils.setCookie
|
||||
const cookieFn = require("@budibase/backend-core").utils.setCookie
|
||||
if (setCookie) {
|
||||
expect(cookieFn).toHaveBeenCalled()
|
||||
} else {
|
||||
|
@ -140,7 +140,7 @@ describe("Current app middleware", () => {
|
|||
|
||||
it("should perform correct when no cookie exists", async () => {
|
||||
mockReset()
|
||||
jest.mock("@budibase/auth", () => ({
|
||||
jest.mock("@budibase/backend-core", () => ({
|
||||
utils: {
|
||||
getAppId: () => {
|
||||
return "app_test"
|
||||
|
@ -157,7 +157,7 @@ describe("Current app middleware", () => {
|
|||
|
||||
it("lastly check what occurs when cookie doesn't need updated", async () => {
|
||||
mockReset()
|
||||
jest.mock("@budibase/auth", () => ({
|
||||
jest.mock("@budibase/backend-core", () => ({
|
||||
utils: {
|
||||
getAppId: () => {
|
||||
return "app_test"
|
||||
|
|
|
@ -6,7 +6,7 @@ jest.mock("../../environment", () => ({
|
|||
isDev: () => true,
|
||||
_set: () => {},
|
||||
}))
|
||||
jest.mock("@budibase/auth/tenancy", () => ({
|
||||
jest.mock("@budibase/backend-core/tenancy", () => ({
|
||||
getTenantId: () => "testing123"
|
||||
}))
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const CouchDB = require("../db")
|
||||
const usageQuota = require("../utilities/usageQuota")
|
||||
const env = require("../environment")
|
||||
const { getTenantId } = require("@budibase/auth/tenancy")
|
||||
const { getTenantId } = require("@budibase/backend-core/tenancy")
|
||||
const {
|
||||
isExternalTable,
|
||||
isRowId: isExternalRowId,
|
||||
|
|
|
@ -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 {
|
||||
basicTable,
|
||||
|
@ -15,12 +15,12 @@ const {
|
|||
const controllers = require("./controllers")
|
||||
const supertest = require("supertest")
|
||||
const { cleanup } = require("../../utilities/fileSystem")
|
||||
const { Cookies, Headers } = require("@budibase/auth").constants
|
||||
const { jwt } = require("@budibase/auth").auth
|
||||
const auth = require("@budibase/auth")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { createASession } = require("@budibase/auth/sessions")
|
||||
const { user: userCache } = require("@budibase/auth/cache")
|
||||
const { Cookies, Headers } = require("@budibase/backend-core").constants
|
||||
const { jwt } = require("@budibase/backend-core").auth
|
||||
const auth = require("@budibase/backend-core")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
const { createASession } = require("@budibase/backend-core/sessions")
|
||||
const { user: userCache } = require("@budibase/backend-core/cache")
|
||||
const CouchDB = require("../../db")
|
||||
auth.init(CouchDB)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
const { BUILTIN_PERMISSION_IDS } = require("@budibase/auth/permissions")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const { BUILTIN_PERMISSION_IDS } = require("@budibase/backend-core/permissions")
|
||||
const { createHomeScreen } = require("../../constants/screens")
|
||||
const { EMPTY_LAYOUT } = require("../../constants/layouts")
|
||||
const { cloneDeep } = require("lodash/fp")
|
||||
|
|
|
@ -4,10 +4,10 @@ const actions = require("../automations/actions")
|
|||
const automationUtils = require("../automations/automationUtils")
|
||||
const AutomationEmitter = require("../events/AutomationEmitter")
|
||||
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 { DocumentTypes, isDevAppID } = require("../db/utils")
|
||||
const { doInTenant } = require("@budibase/auth/tenancy")
|
||||
const { doInTenant } = require("@budibase/backend-core/tenancy")
|
||||
const usage = require("../utilities/usageQuota")
|
||||
const { definitions: triggerDefs } = require("../automations/triggerInfo")
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const env = require("../environment")
|
||||
const CouchDB = require("../db")
|
||||
const { init } = require("@budibase/auth")
|
||||
const redis = require("@budibase/auth/redis")
|
||||
const { SEPARATOR } = require("@budibase/auth/db")
|
||||
const { init } = require("@budibase/backend-core")
|
||||
const redis = require("@budibase/backend-core/redis")
|
||||
const { SEPARATOR } = require("@budibase/backend-core/db")
|
||||
const { processStringSync } = require("@budibase/string-templates")
|
||||
|
||||
const VARIABLE_TTL_SECONDS = 3600
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { join } = require("./centralPath")
|
||||
const { homedir } = require("os")
|
||||
const env = require("../environment")
|
||||
const { budibaseTempDir } = require("@budibase/auth").objectStore
|
||||
const { budibaseTempDir } = require("@budibase/backend-core").objectStore
|
||||
|
||||
module.exports.budibaseAppsDir = function () {
|
||||
return env.BUDIBASE_DIR || join(homedir(), ".budibase")
|
||||
|
|
|
@ -8,7 +8,7 @@ const {
|
|||
deleteFolder,
|
||||
uploadDirectory,
|
||||
downloadTarball,
|
||||
} = require("@budibase/auth").objectStore
|
||||
} = require("@budibase/backend-core").objectStore
|
||||
|
||||
/***********************************
|
||||
* NOTE *
|
||||
|
|
|
@ -2,11 +2,14 @@ const {
|
|||
getMultiIDParams,
|
||||
getGlobalIDFromUserMetadataID,
|
||||
} = require("../db/utils")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
|
||||
const { getDeployedAppID } = require("@budibase/auth/db")
|
||||
const { getGlobalUserParams } = require("@budibase/auth/db")
|
||||
const { user: userCache } = require("@budibase/auth/cache")
|
||||
const { getGlobalDB, isUserInAppTenant } = require("@budibase/auth/tenancy")
|
||||
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
||||
const { getDeployedAppID } = require("@budibase/backend-core/db")
|
||||
const { getGlobalUserParams } = require("@budibase/backend-core/db")
|
||||
const { user: userCache } = require("@budibase/backend-core/cache")
|
||||
const {
|
||||
getGlobalDB,
|
||||
isUserInAppTenant,
|
||||
} = require("@budibase/backend-core/tenancy")
|
||||
const env = require("../environment")
|
||||
|
||||
exports.updateAppRole = (appId, user) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const env = require("../environment")
|
||||
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 { generateMetadataID } = require("../db/utils")
|
||||
const Readable = require("stream").Readable
|
||||
|
|
|
@ -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 APP_DEV_LOCK_SECONDS = 600
|
||||
|
|
|
@ -3,8 +3,11 @@ const {
|
|||
PermissionTypes,
|
||||
getBuiltinPermissionByID,
|
||||
isPermissionLevelHigherThanRead,
|
||||
} = require("@budibase/auth/permissions")
|
||||
const { lowerBuiltinRoleID, getBuiltinRoles } = require("@budibase/auth/roles")
|
||||
} = require("@budibase/backend-core/permissions")
|
||||
const {
|
||||
lowerBuiltinRoleID,
|
||||
getBuiltinRoles,
|
||||
} = require("@budibase/backend-core/roles")
|
||||
const { DocumentTypes } = require("../db/utils")
|
||||
|
||||
const CURRENTLY_SUPPORTED_LEVELS = [
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const env = require("../environment")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
const {
|
||||
StaticDatabases,
|
||||
generateNewUsageQuotaDoc,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
|
||||
function getNewQuotaReset() {
|
||||
return Date.now() + 2592000000
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const fetch = require("node-fetch")
|
||||
const env = require("../environment")
|
||||
const { checkSlashesInUrl } = require("./index")
|
||||
const { getDeployedAppID } = require("@budibase/auth/db")
|
||||
const { getDeployedAppID } = require("@budibase/backend-core/db")
|
||||
const { updateAppRole } = require("./global")
|
||||
const { Headers } = require("@budibase/auth/constants")
|
||||
const { getTenantId, isTenantIdSet } = require("@budibase/auth/tenancy")
|
||||
const { Headers } = require("@budibase/backend-core/constants")
|
||||
const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
function request(ctx, request) {
|
||||
if (!request.headers) {
|
||||
|
|
|
@ -983,9 +983,9 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/auth@^1.0.27-alpha.0":
|
||||
"@budibase/backend-core@^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==
|
||||
dependencies:
|
||||
"@techpass/passport-openidconnect" "^0.3.0"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/auth": "^1.0.27-alpha.7",
|
||||
"@budibase/backend-core": "^1.0.27-alpha.7",
|
||||
"@budibase/string-templates": "^1.0.27-alpha.7",
|
||||
"@koa/router": "^8.0.0",
|
||||
"@sentry/node": "^6.0.0",
|
||||
|
|
|
@ -2,7 +2,7 @@ const {
|
|||
getAllApps,
|
||||
getDeployedAppID,
|
||||
isProdAppID,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
const CouchDB = require("../../db")
|
||||
|
||||
const URL_REGEX_SLASH = /\/|\\/g
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const authPkg = require("@budibase/auth")
|
||||
const { getScopedConfig } = require("@budibase/auth/db")
|
||||
const { google } = require("@budibase/auth/src/middleware")
|
||||
const { oidc } = require("@budibase/auth/src/middleware")
|
||||
const authPkg = require("@budibase/backend-core")
|
||||
const { getScopedConfig } = require("@budibase/backend-core/db")
|
||||
const { google } = require("@budibase/backend-core/src/middleware")
|
||||
const { oidc } = require("@budibase/backend-core/src/middleware")
|
||||
const { Configs, EmailTemplatePurpose } = require("../../../constants")
|
||||
const { sendEmail, isEmailConfigured } = require("../../../utilities/email")
|
||||
const {
|
||||
|
@ -19,7 +19,7 @@ const {
|
|||
getGlobalDB,
|
||||
getTenantId,
|
||||
isMultiTenant,
|
||||
} = require("@budibase/auth/tenancy")
|
||||
} = require("@budibase/backend-core/tenancy")
|
||||
const env = require("../../../environment")
|
||||
|
||||
const ssoCallbackUrl = async (config, type) => {
|
||||
|
|
|
@ -4,12 +4,13 @@ const {
|
|||
getGlobalUserParams,
|
||||
getScopedFullConfig,
|
||||
getAllApps,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
const { Configs } = require("../../../constants")
|
||||
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 { getGlobalDB, getTenantId } = require("@budibase/auth/tenancy")
|
||||
const { getGlobalDB, getTenantId } = require("@budibase/backend-core/tenancy")
|
||||
const env = require("../../../environment")
|
||||
const { googleCallbackUrl, oidcCallbackUrl } = require("./auth")
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { sendEmail } = require("../../../utilities/email")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
exports.sendEmail = async ctx => {
|
||||
let {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const { getAllRoles } = require("@budibase/auth/roles")
|
||||
const { getAllRoles } = require("@budibase/backend-core/roles")
|
||||
const {
|
||||
getAllApps,
|
||||
getDeployedAppID,
|
||||
DocumentTypes,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
const CouchDB = require("../../../db")
|
||||
|
||||
exports.fetch = async ctx => {
|
||||
|
|
|
@ -2,7 +2,7 @@ const {
|
|||
getAllSessions,
|
||||
getUserSessions,
|
||||
invalidateSessions,
|
||||
} = require("@budibase/auth/sessions")
|
||||
} = require("@budibase/backend-core/sessions")
|
||||
|
||||
exports.fetch = async ctx => {
|
||||
ctx.body = await getAllSessions()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
const { generateTemplateID } = require("@budibase/auth/db")
|
||||
const { generateTemplateID } = require("@budibase/backend-core/db")
|
||||
const {
|
||||
TemplateMetadata,
|
||||
TemplateBindings,
|
||||
GLOBAL_OWNER,
|
||||
} = require("../../../constants")
|
||||
const { getTemplates } = require("../../../constants/templates")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
exports.save = async ctx => {
|
||||
const db = getGlobalDB()
|
||||
|
|
|
@ -2,22 +2,22 @@ const {
|
|||
getGlobalUserParams,
|
||||
StaticDatabases,
|
||||
generateNewUsageQuotaDoc,
|
||||
} = require("@budibase/auth/db")
|
||||
} = require("@budibase/backend-core/db")
|
||||
const { hash, getGlobalUserByEmail, saveUser, platformLogout } =
|
||||
require("@budibase/auth").utils
|
||||
require("@budibase/backend-core").utils
|
||||
const { EmailTemplatePurpose } = require("../../../constants")
|
||||
const { checkInviteCode } = require("../../../utilities/redis")
|
||||
const { sendEmail } = require("../../../utilities/email")
|
||||
const { user: userCache } = require("@budibase/auth/cache")
|
||||
const { invalidateSessions } = require("@budibase/auth/sessions")
|
||||
const accounts = require("@budibase/auth/accounts")
|
||||
const { user: userCache } = require("@budibase/backend-core/cache")
|
||||
const { invalidateSessions } = require("@budibase/backend-core/sessions")
|
||||
const accounts = require("@budibase/backend-core/accounts")
|
||||
const {
|
||||
getGlobalDB,
|
||||
getTenantId,
|
||||
getTenantUser,
|
||||
doesTenantExist,
|
||||
} = require("@budibase/auth/tenancy")
|
||||
const { removeUserFromInfoDB } = require("@budibase/auth/deprovision")
|
||||
} = require("@budibase/backend-core/tenancy")
|
||||
const { removeUserFromInfoDB } = require("@budibase/backend-core/deprovision")
|
||||
const env = require("../../../environment")
|
||||
const { syncUserInApps } = require("../../../utilities/appService")
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
const { getWorkspaceParams, generateWorkspaceID } = require("@budibase/auth/db")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const {
|
||||
getWorkspaceParams,
|
||||
generateWorkspaceID,
|
||||
} = require("@budibase/backend-core/db")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
exports.save = async function (ctx) {
|
||||
const db = getGlobalDB()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const CouchDB = require("../../../db")
|
||||
const { StaticDatabases } = require("@budibase/auth/db")
|
||||
const { getTenantId } = require("@budibase/auth/tenancy")
|
||||
const { deleteTenant } = require("@budibase/auth/deprovision")
|
||||
const { StaticDatabases } = require("@budibase/backend-core/db")
|
||||
const { getTenantId } = require("@budibase/backend-core/tenancy")
|
||||
const { deleteTenant } = require("@budibase/backend-core/deprovision")
|
||||
|
||||
exports.exists = async ctx => {
|
||||
const tenantId = ctx.request.params
|
||||
|
|
|
@ -3,7 +3,7 @@ const compress = require("koa-compress")
|
|||
const zlib = require("zlib")
|
||||
const { routes } = require("./routes")
|
||||
const { buildAuthMiddleware, auditLog, buildTenancyMiddleware } =
|
||||
require("@budibase/auth").auth
|
||||
require("@budibase/backend-core").auth
|
||||
|
||||
const PUBLIC_ENDPOINTS = [
|
||||
// old deprecated endpoints kept for backwards compat
|
||||
|
|
|
@ -2,7 +2,7 @@ const Router = require("@koa/router")
|
|||
const authController = require("../../controllers/global/auth")
|
||||
const joiValidator = require("../../../middleware/joi-validator")
|
||||
const Joi = require("joi")
|
||||
const { updateTenantId } = require("@budibase/auth/tenancy")
|
||||
const { updateTenantId } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
const router = Router()
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ describe("/api/global/auth", () => {
|
|||
})
|
||||
|
||||
describe("oidc", () => {
|
||||
const auth = require("@budibase/auth").auth
|
||||
const auth = require("@budibase/backend-core").auth
|
||||
|
||||
// mock the oidc strategy implementation and return value
|
||||
strategyFactory = jest.fn()
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
const env = require("../../../../environment")
|
||||
const controllers = require("./controllers")
|
||||
const supertest = require("supertest")
|
||||
const { jwt } = require("@budibase/auth").auth
|
||||
const { Cookies } = require("@budibase/auth").constants
|
||||
const { jwt } = require("@budibase/backend-core").auth
|
||||
const { Cookies } = require("@budibase/backend-core").constants
|
||||
const { Configs, LOGO_URL } = require("../../../../constants")
|
||||
const { getGlobalUserByEmail } = require("@budibase/auth").utils
|
||||
const { createASession } = require("@budibase/auth/sessions")
|
||||
const { getGlobalUserByEmail } = require("@budibase/backend-core").utils
|
||||
const { createASession } = require("@budibase/backend-core/sessions")
|
||||
const { newid } = require("../../../../../../auth/src/hashing")
|
||||
const { TENANT_ID } = require("./structures")
|
||||
const auth = require("@budibase/auth")
|
||||
const auth = require("@budibase/backend-core")
|
||||
const CouchDB = require("../../../../db")
|
||||
const { doInTenant } = require("@budibase/auth/tenancy")
|
||||
const { doInTenant } = require("@budibase/backend-core/tenancy")
|
||||
auth.init(CouchDB)
|
||||
|
||||
class TestConfiguration {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const { Configs } = require("@budibase/auth").constants
|
||||
const { Configs } = require("@budibase/backend-core").constants
|
||||
|
||||
exports.LOGO_URL =
|
||||
"https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"
|
||||
|
|
|
@ -6,8 +6,8 @@ const {
|
|||
GLOBAL_OWNER,
|
||||
} = require("../index")
|
||||
const { join } = require("path")
|
||||
const { getTemplateParams } = require("@budibase/auth/db")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { getTemplateParams } = require("@budibase/backend-core/db")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
exports.EmailTemplates = {
|
||||
[EmailTemplatePurpose.PASSWORD_RECOVERY]: readStaticFile(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const PouchDB = require("pouchdb")
|
||||
const allDbs = require("pouchdb-all-dbs")
|
||||
const env = require("../environment")
|
||||
const { getCouchUrl } = require("@budibase/auth/db")
|
||||
const { getCouchUrl } = require("@budibase/backend-core/db")
|
||||
|
||||
// level option is purely for testing (development)
|
||||
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// need to load environment first
|
||||
const env = require("./environment")
|
||||
const CouchDB = require("./db")
|
||||
require("@budibase/auth").init(CouchDB)
|
||||
require("@budibase/backend-core").init(CouchDB)
|
||||
const Koa = require("koa")
|
||||
const destroyable = require("server-destroy")
|
||||
const koaBody = require("koa-body")
|
||||
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 http = require("http")
|
||||
const api = require("./api")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const fetch = require("node-fetch")
|
||||
const { Headers } = require("@budibase/auth/constants")
|
||||
const { getTenantId, isTenantIdSet } = require("@budibase/auth/tenancy")
|
||||
const { Headers } = require("@budibase/backend-core/constants")
|
||||
const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy")
|
||||
const { checkSlashesInUrl } = require("../utilities")
|
||||
const env = require("../environment")
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
const nodemailer = require("nodemailer")
|
||||
const env = require("../environment")
|
||||
const { getScopedConfig } = require("@budibase/auth/db")
|
||||
const { getScopedConfig } = require("@budibase/backend-core/db")
|
||||
const { EmailTemplatePurpose, TemplateTypes, Configs } = require("../constants")
|
||||
const { getTemplateByPurpose } = require("../constants/templates")
|
||||
const { getSettingsTemplateContext } = require("./templates")
|
||||
const { processString } = require("@budibase/string-templates")
|
||||
const { getResetPasswordCode, getInviteCode } = require("../utilities/redis")
|
||||
const { getGlobalDB } = require("@budibase/auth/tenancy")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
|
||||
const TEST_MODE = false
|
||||
const TYPE = TemplateTypes.EMAIL
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const { Client, utils } = require("@budibase/auth/redis")
|
||||
const { newid } = require("@budibase/auth").utils
|
||||
const { Client, utils } = require("@budibase/backend-core/redis")
|
||||
const { newid } = require("@budibase/backend-core").utils
|
||||
|
||||
function getExpirySecondsForDB(db) {
|
||||
switch (db) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue