Move tenancy/utils to db/tenancy to resolve circular imports between tenancy and db package. This should remove all reliance on the tenancy package from the db package
This commit is contained in:
parent
f699bf1b56
commit
f7ec431a45
|
@ -2,7 +2,7 @@ import env from "../environment"
|
|||
import { SEPARATOR, DocumentType } from "../db/constants"
|
||||
import cls from "./FunctionContext"
|
||||
import { dangerousGetDB, closeDB } from "../db"
|
||||
import { baseGlobalDBName } from "../tenancy/utils"
|
||||
import { baseGlobalDBName } from "../db/tenancy"
|
||||
import { IdentityContext } from "@budibase/types"
|
||||
import { DEFAULT_TENANT_ID as _DEFAULT_TENANT_ID } from "../constants"
|
||||
import { ContextKey } from "./constants"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { DEFAULT_TENANT_ID } from "../constants"
|
||||
import { StaticDatabases, SEPARATOR } from "../db/constants"
|
||||
import { StaticDatabases, SEPARATOR } from "./constants"
|
||||
import { getTenantId } from "../context"
|
||||
|
||||
export const getGlobalDBName = (tenantId?: string) => {
|
|
@ -3,7 +3,7 @@ import { DEFAULT_TENANT_ID, Configs } from "../constants"
|
|||
import env from "../environment"
|
||||
import { SEPARATOR, DocumentType, UNICODE_MAX, ViewName } from "./constants"
|
||||
import { getTenantId, getGlobalDB } from "../context"
|
||||
import { getGlobalDBName } from "../tenancy"
|
||||
import { getGlobalDBName } from "./tenancy"
|
||||
import fetch from "node-fetch"
|
||||
import { doWithDB, allDbs } from "./index"
|
||||
import { getCouchInfo } from "./pouch"
|
||||
|
@ -16,6 +16,7 @@ import * as events from "../events"
|
|||
export * from "./constants"
|
||||
export * from "./conversions"
|
||||
export { default as Replication } from "./Replication"
|
||||
export * from "./tenancy"
|
||||
|
||||
/**
|
||||
* Generates a new app ID.
|
||||
|
|
|
@ -3,12 +3,8 @@ import { doWithDB } from "../db"
|
|||
import { DocumentType, StaticDatabases } from "../db/constants"
|
||||
import { getAllApps } from "../db/utils"
|
||||
import environment from "../environment"
|
||||
import {
|
||||
doInTenant,
|
||||
getTenantIds,
|
||||
getGlobalDBName,
|
||||
getTenantId,
|
||||
} from "../tenancy"
|
||||
import { doInTenant, getTenantIds, getTenantId } from "../tenancy"
|
||||
import { getGlobalDBName } from "../db/tenancy"
|
||||
import * as context from "../context"
|
||||
import { DEFINITIONS } from "."
|
||||
import {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import * as context from "../context"
|
||||
import * as tenancy from "./tenancy"
|
||||
import * as utils from "./utils"
|
||||
|
||||
const pkg = {
|
||||
...context,
|
||||
...tenancy,
|
||||
...utils,
|
||||
}
|
||||
|
||||
export = pkg
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { doWithDB } from "../db"
|
||||
import { queryPlatformView } from "../db/views"
|
||||
import { StaticDatabases, ViewName } from "../db/constants"
|
||||
import { getGlobalDBName } from "./utils"
|
||||
import { getGlobalDBName } from "../db/tenancy"
|
||||
import {
|
||||
getTenantId,
|
||||
DEFAULT_TENANT_ID,
|
||||
|
@ -9,7 +9,7 @@ import {
|
|||
getTenantIDFromAppID,
|
||||
} from "../context"
|
||||
import env from "../environment"
|
||||
import { PlatformUser, PlatformUserByEmail } from "@budibase/types"
|
||||
import { PlatformUser } from "@budibase/types"
|
||||
|
||||
const TENANT_DOC = StaticDatabases.PLATFORM_INFO.docs.tenants
|
||||
const PLATFORM_INFO_DB = StaticDatabases.PLATFORM_INFO.name
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
const env = require("../../environment")
|
||||
const { getAllApps } = require("@budibase/backend-core/db")
|
||||
const { getAllApps, getGlobalDBName } = require("@budibase/backend-core/db")
|
||||
const {
|
||||
exportDB,
|
||||
sendTempFile,
|
||||
readFileSync,
|
||||
} = require("../../utilities/fileSystem")
|
||||
const { stringToReadStream } = require("../../utilities")
|
||||
const {
|
||||
getGlobalDBName,
|
||||
getGlobalDB,
|
||||
} = require("@budibase/backend-core/tenancy")
|
||||
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
||||
const { create } = require("./application")
|
||||
const { getDocParams, DocumentType, isDevAppID } = require("../../db/utils")
|
||||
|
||||
|
|
Loading…
Reference in New Issue