Renaming some variables to core, fixing test cases that referenced auth directly.

This commit is contained in:
mike12345567 2022-01-11 16:18:30 +00:00
parent b33523a73d
commit 37d0617ace
4 changed files with 17 additions and 13 deletions

View File

@ -17,12 +17,12 @@ const supertest = require("supertest")
const { cleanup } = require("../../utilities/fileSystem") const { cleanup } = require("../../utilities/fileSystem")
const { Cookies, Headers } = require("@budibase/backend-core").constants const { Cookies, Headers } = require("@budibase/backend-core").constants
const { jwt } = require("@budibase/backend-core").auth const { jwt } = require("@budibase/backend-core").auth
const auth = require("@budibase/backend-core") const core = require("@budibase/backend-core")
const { getGlobalDB } = require("@budibase/backend-core/tenancy") const { getGlobalDB } = require("@budibase/backend-core/tenancy")
const { createASession } = require("@budibase/backend-core/sessions") const { createASession } = require("@budibase/backend-core/sessions")
const { user: userCache } = require("@budibase/backend-core/cache") const { user: userCache } = require("@budibase/backend-core/cache")
const CouchDB = require("../../db") const CouchDB = require("../../db")
auth.init(CouchDB) core.init(CouchDB)
const GLOBAL_USER_ID = "us_uuid1" const GLOBAL_USER_ID = "us_uuid1"
const EMAIL = "babs@babs.com" const EMAIL = "babs@babs.com"

View File

@ -5,7 +5,11 @@ const { attachmentsRelativeURL } = require("../index")
const { processFormulas } = require("./utils") const { processFormulas } = require("./utils")
const { deleteFiles } = require("../../utilities/fileSystem/utilities") const { deleteFiles } = require("../../utilities/fileSystem/utilities")
const { ObjectStoreBuckets } = require("../../constants") const { ObjectStoreBuckets } = require("../../constants")
const { isProdAppID, getDeployedAppID, dbExists } = require("@budibase/auth/db") const {
isProdAppID,
getDeployedAppID,
dbExists,
} = require("@budibase/backend-core/db")
const CouchDB = require("../../db") const CouchDB = require("../../db")
const BASE_AUTO_ID = 1 const BASE_AUTO_ID = 1

View File

@ -1,4 +1,4 @@
const authPkg = require("@budibase/backend-core") const core = require("@budibase/backend-core")
const { getScopedConfig } = require("@budibase/backend-core/db") const { getScopedConfig } = require("@budibase/backend-core/db")
const { google } = require("@budibase/backend-core/src/middleware") const { google } = require("@budibase/backend-core/src/middleware")
const { oidc } = require("@budibase/backend-core/src/middleware") const { oidc } = require("@budibase/backend-core/src/middleware")
@ -11,9 +11,9 @@ const {
getGlobalUserByEmail, getGlobalUserByEmail,
hash, hash,
platformLogout, platformLogout,
} = authPkg.utils } = core.utils
const { Cookies, Headers } = authPkg.constants const { Cookies, Headers } = core.constants
const { passport } = authPkg.auth const { passport } = core.auth
const { checkResetPasswordCode } = require("../../../utilities/redis") const { checkResetPasswordCode } = require("../../../utilities/redis")
const { const {
getGlobalDB, getGlobalDB,
@ -152,7 +152,7 @@ exports.logout = async ctx => {
exports.googlePreAuth = async (ctx, next) => { exports.googlePreAuth = async (ctx, next) => {
const db = getGlobalDB() const db = getGlobalDB()
const config = await authPkg.db.getScopedConfig(db, { const config = await core.db.getScopedConfig(db, {
type: Configs.GOOGLE, type: Configs.GOOGLE,
workspace: ctx.query.workspace, workspace: ctx.query.workspace,
}) })
@ -167,7 +167,7 @@ exports.googlePreAuth = async (ctx, next) => {
exports.googleAuth = async (ctx, next) => { exports.googleAuth = async (ctx, next) => {
const db = getGlobalDB() const db = getGlobalDB()
const config = await authPkg.db.getScopedConfig(db, { const config = await core.db.getScopedConfig(db, {
type: Configs.GOOGLE, type: Configs.GOOGLE,
workspace: ctx.query.workspace, workspace: ctx.query.workspace,
}) })
@ -187,7 +187,7 @@ exports.googleAuth = async (ctx, next) => {
async function oidcStrategyFactory(ctx, configId) { async function oidcStrategyFactory(ctx, configId) {
const db = getGlobalDB() const db = getGlobalDB()
const config = await authPkg.db.getScopedConfig(db, { const config = await core.db.getScopedConfig(db, {
type: Configs.OIDC, type: Configs.OIDC,
group: ctx.query.group, group: ctx.query.group,
}) })

View File

@ -6,12 +6,12 @@ const { Cookies } = require("@budibase/backend-core").constants
const { Configs, LOGO_URL } = require("../../../../constants") const { Configs, LOGO_URL } = require("../../../../constants")
const { getGlobalUserByEmail } = require("@budibase/backend-core").utils const { getGlobalUserByEmail } = require("@budibase/backend-core").utils
const { createASession } = require("@budibase/backend-core/sessions") const { createASession } = require("@budibase/backend-core/sessions")
const { newid } = require("../../../../../../auth/src/hashing") const { newid } = require("@budibase/backend-core/src/hashing")
const { TENANT_ID } = require("./structures") const { TENANT_ID } = require("./structures")
const auth = require("@budibase/backend-core") const core = require("@budibase/backend-core")
const CouchDB = require("../../../../db") const CouchDB = require("../../../../db")
const { doInTenant } = require("@budibase/backend-core/tenancy") const { doInTenant } = require("@budibase/backend-core/tenancy")
auth.init(CouchDB) core.init(CouchDB)
class TestConfiguration { class TestConfiguration {
constructor(openServer = true) { constructor(openServer = true) {