Merge branch 'develop' of github.com:Budibase/budibase into fix/budi-6797

This commit is contained in:
mike12345567 2023-03-30 17:29:58 +01:00
commit 42320b1d95
37 changed files with 198 additions and 163 deletions

View File

@ -1,5 +1,5 @@
{
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": {
"@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.4.42-alpha.1",
"@budibase/types": "2.4.42-alpha.4",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0",

View File

@ -32,8 +32,7 @@ export async function getConfig<T extends Config>(
const db = context.getGlobalDB()
try {
// await to catch error
const config = (await db.get(generateConfigID(type))) as T
return config
return (await db.get(generateConfigID(type))) as T
} catch (e: any) {
if (e.status === 404) {
return
@ -162,7 +161,10 @@ export async function getGoogleConfig(): Promise<
export async function getGoogleDatasourceConfig(): Promise<
GoogleInnerConfig | undefined
> {
return getDefaultGoogleConfig()
if (!env.SELF_HOSTED) {
// always use the env vars in cloud
return getDefaultGoogleConfig()
}
// prefer the config in self-host
let config = await getGoogleConfig()
@ -176,14 +178,13 @@ export async function getGoogleDatasourceConfig(): Promise<
}
export function getDefaultGoogleConfig(): GoogleInnerConfig | undefined {
//if (environment.GOOGLE_CLIENT_ID && environment.GOOGLE_CLIENT_SECRET) {
return {
clientID:
"77746844610-62k43m9b4so4gcmf6ibs7p3l7jv81rug.apps.googleusercontent.com",
clientSecret: "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",
activated: true,
if (environment.GOOGLE_CLIENT_ID && environment.GOOGLE_CLIENT_SECRET) {
return {
clientID: environment.GOOGLE_CLIENT_ID!,
clientSecret: environment.GOOGLE_CLIENT_SECRET!,
activated: true,
}
}
//}
}
// OIDC

View File

@ -1,4 +1,9 @@
import { DBTestConfiguration, generator, testEnv } from "../../../tests"
import {
DBTestConfiguration,
generator,
testEnv,
structures,
} from "../../../tests"
import { ConfigType } from "@budibase/types"
import env from "../../environment"
import * as configs from "../configs"
@ -113,4 +118,71 @@ describe("configs", () => {
})
})
})
describe("getGoogleDatasourceConfig", () => {
function setEnvVars() {
env.GOOGLE_CLIENT_SECRET = "test"
env.GOOGLE_CLIENT_ID = "test"
}
function unsetEnvVars() {
env.GOOGLE_CLIENT_SECRET = undefined
env.GOOGLE_CLIENT_ID = undefined
}
describe("cloud", () => {
beforeEach(() => {
testEnv.cloudHosted()
})
it("returns from env vars", async () => {
await config.doInTenant(async () => {
setEnvVars()
const config = await configs.getGoogleDatasourceConfig()
unsetEnvVars()
expect(config).toEqual({
activated: true,
clientID: "test",
clientSecret: "test",
})
})
})
it("returns undefined when no env vars are configured", async () => {
await config.doInTenant(async () => {
const config = await configs.getGoogleDatasourceConfig()
expect(config).toBeUndefined()
})
})
})
describe("self host", () => {
beforeEach(() => {
testEnv.selfHosted()
})
it("returns from config", async () => {
await config.doInTenant(async () => {
const googleDoc = structures.sso.googleConfigDoc()
await configs.save(googleDoc)
const config = await configs.getGoogleDatasourceConfig()
expect(config).toEqual(googleDoc.config)
})
})
it("falls back to env vars when config is disabled", async () => {
await config.doInTenant(async () => {
setEnvVars()
const config = await configs.getGoogleDatasourceConfig()
unsetEnvVars()
expect(config).toEqual({
activated: true,
clientID: "test",
clientSecret: "test",
})
})
})
})
})
})

View File

@ -1,4 +1,6 @@
import {
ConfigType,
GoogleConfig,
GoogleInnerConfig,
JwtClaims,
OAuth2,
@ -10,10 +12,10 @@ import {
User,
} from "@budibase/types"
import { generator } from "./generator"
import { uuid, email } from "./common"
import { email, uuid } from "./common"
import * as shared from "./shared"
import _ from "lodash"
import { user } from "./shared"
import _ from "lodash"
export function OAuth(): OAuth2 {
return {
@ -107,3 +109,11 @@ export function googleConfig(): GoogleInnerConfig {
clientSecret: generator.string(),
}
}
export function googleConfigDoc(): GoogleConfig {
return {
_id: "config_google",
type: ConfigType.GOOGLE,
config: googleConfig(),
}
}

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
],
"dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,11 +58,11 @@
}
},
"dependencies": {
"@budibase/bbui": "2.4.42-alpha.1",
"@budibase/client": "2.4.42-alpha.1",
"@budibase/frontend-core": "2.4.42-alpha.1",
"@budibase/shared-core": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/bbui": "2.4.42-alpha.4",
"@budibase/client": "2.4.42-alpha.4",
"@budibase/frontend-core": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",

View File

@ -12,7 +12,7 @@
// kill the reference so the input isn't saved
let datasource = cloneDeep(integration)
$: isGoogleConfigured = !!$organisation.google
$: isGoogleConfigured = !!$organisation.googleDatasourceConfigured
onMount(async () => {
await organisation.init()

View File

@ -1,6 +1,6 @@
<script>
import { isActive, redirect, params } from "@roxi/routify"
import { admin, auth, licensing, tenants } from "stores/portal"
import { admin, auth, licensing } from "stores/portal"
import { onMount } from "svelte"
import { CookieUtils, Constants } from "@budibase/frontend-core"
import { API } from "api"
@ -10,24 +10,27 @@
$: multiTenancyEnabled = $admin.multiTenancy
$: hasAdminUser = $admin?.checklist?.adminUser?.checked
$: baseUrl = $admin?.baseUrl
$: tenantSet = $auth.tenantSet
$: cloud = $admin.cloud
$: cloud = $admin?.cloud
$: user = $auth.user
$: useAccountPortal = cloud && !$admin.disableAccountPortal
const validateTenantId = async () => {
const host = window.location.host
if (host.includes("localhost:")) {
if (host.includes("localhost:") || !baseUrl) {
// ignore local dev
return
}
// e.g. ['tenant', 'budibase', 'app'] vs ['budibase', 'app']
const mainHost = new URL(baseUrl).host
let urlTenantId
const hostParts = host.split(".")
if (hostParts.length > 2) {
urlTenantId = hostParts[0]
// remove the main host part
const hostParts = host.split(mainHost).filter(part => part !== "")
// if there is a part left, it has to be the tenant ID subdomain
if (hostParts.length === 1) {
urlTenantId = hostParts[0].replace(/\./g, "")
}
if (user && user.tenantId) {
@ -41,16 +44,15 @@
return
}
// check if real tenant
const { exists: tenantExists } = await tenants.info(urlTenantId)
if (tenantExists && user.tenantId !== urlTenantId) {
if (urlTenantId && user.tenantId !== urlTenantId) {
// user should not be here - play it safe and log them out
try {
await auth.logout()
await auth.setOrganisation(null)
} catch (error) {
console.error("Tenant mis-match, logout.")
console.error(
`Tenant mis-match - "${urlTenantId}" and "${user.tenantId}" - logout`
)
}
}
} else {

View File

@ -53,6 +53,7 @@ export function createAdminStore() {
store.disableAccountPortal = environment.disableAccountPortal
store.accountPortalUrl = environment.accountPortalUrl
store.isDev = environment.isDev
store.baseUrl = environment.baseUrl
return store
})
}

View File

@ -14,4 +14,3 @@ export { overview } from "./overview"
export { environment } from "./environment"
export { menu } from "./menu"
export { auditLogs } from "./auditLogs"
export { tenants } from "./tenants"

View File

@ -19,6 +19,7 @@ const DEFAULT_CONFIG = {
company: "Budibase",
oidc: undefined,
google: undefined,
googleDatasourceConfigured: undefined,
oidcCallbackUrl: "",
googleCallbackUrl: "",
isSSOEnforced: false,
@ -39,6 +40,7 @@ export function createOrganisationStore() {
const storeConfig = _.cloneDeep(get(store))
delete storeConfig.oidc
delete storeConfig.google
delete storeConfig.googleDatasourceConfigured
delete storeConfig.oidcCallbackUrl
delete storeConfig.googleCallbackUrl
await API.saveConfig({

View File

@ -1,27 +0,0 @@
import { writable, get } from "svelte/store"
import { API } from "api"
export function tenantsStore() {
const store = writable({ tenantInfo: {} })
return {
info: async tenantId => {
if (!tenantId) {
return { exists: false }
}
const contents = get(store)
const found = contents.tenantInfo[tenantId]
if (found) {
return found
}
const tenantInfo = await API.getTenantInfo(tenantId)
store.update(state => {
state.tenantInfo[tenantId] = tenantInfo
return state
})
return tenantInfo
},
}
}
export const tenants = tenantsStore()

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js",
"bin": {
@ -29,9 +29,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/types": "2.4.42-alpha.1",
"@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.4",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/bbui": "2.4.42-alpha.1",
"@budibase/frontend-core": "2.4.42-alpha.1",
"@budibase/shared-core": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/types": "2.4.42-alpha.1",
"@budibase/bbui": "2.4.42-alpha.4",
"@budibase/frontend-core": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.4",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,13 +1,13 @@
{
"name": "@budibase/frontend-core",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "2.4.42-alpha.1",
"@budibase/shared-core": "2.4.42-alpha.1",
"@budibase/bbui": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.4",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -29,7 +29,6 @@ import { buildBackupsEndpoints } from "./backups"
import { buildEnvironmentVariableEndpoints } from "./environmentVariables"
import { buildEventEndpoints } from "./events"
import { buildAuditLogsEndpoints } from "./auditLogs"
import { buildTenantEndpoints } from "./tenants"
const defaultAPIClientConfig = {
/**
@ -254,6 +253,5 @@ export const createAPIClient = config => {
...buildEnvironmentVariableEndpoints(API),
...buildEventEndpoints(API),
...buildAuditLogsEndpoints(API),
...buildTenantEndpoints(API),
}
}

View File

@ -1,8 +0,0 @@
export const buildTenantEndpoints = API => ({
/**
* Get information about a tenant
*/
getTenantInfo: async tenantId => {
return await API.get({ url: `/api/system/tenants/${tenantId}/info` })
},
})

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -44,12 +44,12 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.4.42-alpha.1",
"@budibase/client": "2.4.42-alpha.1",
"@budibase/pro": "2.4.42-alpha.1",
"@budibase/shared-core": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/types": "2.4.42-alpha.1",
"@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/client": "2.4.42-alpha.4",
"@budibase/pro": "2.4.42-alpha.4",
"@budibase/shared-core": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.4",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -23,7 +23,7 @@
<!-- Opengraph Meta Tags -->
<meta property="og:site_name" content="Budibase" />
<meta property="og:title" content="{title} - built with Budibase" />
<meta property="og:title" content={metaTitle} />
<meta property="og:description" content={metaDescription} />
<meta property="og:type" content="website" />
<meta property="og:image" content={metaImage} />
@ -32,8 +32,8 @@
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:site" content="@budibase" />
<meta property="twitter:image" content={metaImage} />
<meta property="twitter:image:alt" content="{title} - built with Budibase" />
<meta property="twitter:title" content="{title} - built with Budibase" />
<meta property="twitter:image:alt" content={metaTitle} />
<meta property="twitter:title" content={metaTitle} />
<meta property="twitter:description" content={metaDescription} />
<title>{title}</title>

View File

@ -1290,14 +1290,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.1.tgz#bdba3782aa57864bbb86b13c27315780c40a550d"
integrity sha512-GH3OJAJB0FHJ/xYUHTFkYvOLqoDp9vDtYhB9McKYY6dZJJdkTa89PJgsVBb5vMDo8y6y5sFLQg1nBoDbzgDSMQ==
"@budibase/backend-core@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.4.tgz#e4e86811dab639e211c3c4ad540841279f634115"
integrity sha512-var93QWJbwPHQtR4zIy/7g8ABOT2fQb43FMC2A+CLAQnJxBCu0Rcvk/5jkwOe18Te2+AiylC1OIGfvVbD3TTYA==
dependencies:
"@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.42-alpha.1"
"@budibase/types" "2.4.42-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -1429,14 +1429,14 @@
pouchdb-promise "^6.0.4"
through2 "^2.0.0"
"@budibase/pro@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.1.tgz#c38d730d10673d783a5c841d49af27412177c165"
integrity sha512-s1Le0l8rCGCd1wK3lOHlMWH0I+mNClhSydvTTsdqSw1lz97u+5ZXxx+Rd2DPEhitJUrpghoCgg+stArdWhzmeA==
"@budibase/pro@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.4.tgz#8e81d08b4363c59e6aa872f532287327c2ef5e1e"
integrity sha512-6/CMcDnLRSzimR1JVy2FindRzN0YEo/B4lwYPtS2T5ORyCSBL24flwD15lhp2W4g0e1TF/+fPK/EaEXhJZglBg==
dependencies:
"@budibase/backend-core" "2.4.42-alpha.1"
"@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.1"
"@budibase/types" "2.4.42-alpha.4"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -1475,10 +1475,10 @@
lodash "^4.17.20"
vm2 "^3.9.4"
"@budibase/types@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.1.tgz#5e69ffe9ab255af883735113e6c81c00b3391f46"
integrity sha512-bKqXKbPX+G9oEaF3mWM43s8Molosgr5OcVjqlNDcb2lWIWHJ8E7hDNYd3y4tGIet8Af0oyAXcMQsLSkotBWZAQ==
"@budibase/types@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.4.tgz#4a1ae0a9cd03e4ee0f81f64a494fbfd13ddbfdf6"
integrity sha512-eBB+VVtkld140Jno/quRlwlu9Q1GkeLyUQeXSrOed8dlmmImS4UKpOpAru+YxTklIvexJsM9H+AQw39IZR7L3g==
"@bull-board/api@3.7.0":
version "3.7.0"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/shared-core",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Shared data utils",
"main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
},
"dependencies": {
"@budibase/types": "2.4.42-alpha.1"
"@budibase/types": "2.4.42-alpha.4"
},
"devDependencies": {
"concurrently": "^7.6.0",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase types",
"main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts",

View File

@ -5,6 +5,7 @@ import { SettingsConfig, SettingsInnerConfig } from "../../../documents"
*/
export interface PublicSettingsInnerConfig extends SettingsInnerConfig {
google: boolean
googleDatasourceConfigured: boolean
oidc: boolean
oidcCallbackUrl: string
googleCallbackUrl: string

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "2.4.42-alpha.1",
"version": "2.4.42-alpha.4",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "2.4.42-alpha.1",
"@budibase/pro": "2.4.42-alpha.1",
"@budibase/string-templates": "2.4.42-alpha.1",
"@budibase/types": "2.4.42-alpha.1",
"@budibase/backend-core": "2.4.42-alpha.4",
"@budibase/pro": "2.4.42-alpha.4",
"@budibase/string-templates": "2.4.42-alpha.4",
"@budibase/types": "2.4.42-alpha.4",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View File

@ -332,6 +332,8 @@ export async function publicSettings(
// google
const googleConfig = await configs.getGoogleConfig()
const googleDatasourceConfigured =
!!(await configs.getGoogleDatasourceConfig())
const preActivated = googleConfig && googleConfig.activated == null
const google = preActivated || !!googleConfig?.activated
const _googleCallbackUrl = await googleCallbackUrl(googleConfig)
@ -352,6 +354,7 @@ export async function publicSettings(
...config,
...branding,
google,
googleDatasourceConfigured,
oidc,
isSSOEnforced,
oidcCallbackUrl: _oidcCallbackUrl,

View File

@ -7,6 +7,7 @@ export const fetch = async (ctx: BBContext) => {
cloud: !env.SELF_HOSTED,
accountPortalUrl: env.ACCOUNT_PORTAL_URL,
disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL,
baseUrl: env.PLATFORM_URL,
// in test need to pretend its in production for the UI (Cypress)
isDev: env.isDev() && !env.isTest(),
}

View File

@ -290,6 +290,7 @@ describe("configs", () => {
logoUrl: "",
analyticsEnabled: false,
google: false,
googleDatasourceConfigured: false,
googleCallbackUrl: `http://localhost:10000/api/global/auth/${config.tenantId}/google/callback`,
isSSOEnforced: false,
oidc: false,

View File

@ -10,6 +10,4 @@ router.delete(
controller.destroy
)
router.get("/api/system/tenants/:tenantId/info", controller.info)
export default router

View File

@ -23,6 +23,7 @@ describe("/api/system/environment", () => {
disableAccountPortal: 0,
isDev: false,
multiTenancy: true,
baseUrl: "http://localhost:10000",
})
})
})

View File

@ -58,17 +58,4 @@ describe("/api/global/tenants", () => {
expect(res.body).toEqual(config.adminOnlyResponse())
})
})
describe("GET /api/system/tenants/:tenantId/info", () => {
it("allows retrieving information about the tenant", async () => {
const user1 = await config.createTenant()
const res = await config.api.tenants.info(user1.tenantId)
expect(res.body.exists).toEqual(true)
})
it("check a tenant that doesn't exist", async () => {
const res = await config.api.tenants.info("cannot-exist-tenantid")
expect(res.body.exists).toEqual(false)
})
})
})

View File

@ -14,11 +14,4 @@ export class TenantAPI extends TestAPI {
.set(opts?.headers)
.expect(opts?.status ? opts.status : 204)
}
info = (tenantId: string) => {
return this.request
.get(`/api/system/tenants/${tenantId}/info`)
.set(this.config.defaultHeaders())
.expect(200)
}
}

View File

@ -475,14 +475,14 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.1.tgz#bdba3782aa57864bbb86b13c27315780c40a550d"
integrity sha512-GH3OJAJB0FHJ/xYUHTFkYvOLqoDp9vDtYhB9McKYY6dZJJdkTa89PJgsVBb5vMDo8y6y5sFLQg1nBoDbzgDSMQ==
"@budibase/backend-core@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.4.tgz#e4e86811dab639e211c3c4ad540841279f634115"
integrity sha512-var93QWJbwPHQtR4zIy/7g8ABOT2fQb43FMC2A+CLAQnJxBCu0Rcvk/5jkwOe18Te2+AiylC1OIGfvVbD3TTYA==
dependencies:
"@budibase/nano" "10.1.2"
"@budibase/pouchdb-replication-stream" "1.2.10"
"@budibase/types" "2.4.42-alpha.1"
"@budibase/types" "2.4.42-alpha.4"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0"
@ -564,14 +564,14 @@
pouchdb-promise "^6.0.4"
through2 "^2.0.0"
"@budibase/pro@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.1.tgz#c38d730d10673d783a5c841d49af27412177c165"
integrity sha512-s1Le0l8rCGCd1wK3lOHlMWH0I+mNClhSydvTTsdqSw1lz97u+5ZXxx+Rd2DPEhitJUrpghoCgg+stArdWhzmeA==
"@budibase/pro@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.4.tgz#8e81d08b4363c59e6aa872f532287327c2ef5e1e"
integrity sha512-6/CMcDnLRSzimR1JVy2FindRzN0YEo/B4lwYPtS2T5ORyCSBL24flwD15lhp2W4g0e1TF/+fPK/EaEXhJZglBg==
dependencies:
"@budibase/backend-core" "2.4.42-alpha.1"
"@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.1"
"@budibase/types" "2.4.42-alpha.4"
"@koa/router" "8.0.8"
bull "4.10.1"
joi "17.6.0"
@ -592,10 +592,10 @@
lodash "^4.17.20"
vm2 "^3.9.4"
"@budibase/types@2.4.42-alpha.1":
version "2.4.42-alpha.1"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.1.tgz#5e69ffe9ab255af883735113e6c81c00b3391f46"
integrity sha512-bKqXKbPX+G9oEaF3mWM43s8Molosgr5OcVjqlNDcb2lWIWHJ8E7hDNYd3y4tGIet8Af0oyAXcMQsLSkotBWZAQ==
"@budibase/types@2.4.42-alpha.4":
version "2.4.42-alpha.4"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.4.tgz#4a1ae0a9cd03e4ee0f81f64a494fbfd13ddbfdf6"
integrity sha512-eBB+VVtkld140Jno/quRlwlu9Q1GkeLyUQeXSrOed8dlmmImS4UKpOpAru+YxTklIvexJsM9H+AQw39IZR7L3g==
"@cspotcode/source-map-support@^0.8.0":
version "0.8.1"

View File

@ -21,7 +21,7 @@
"api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test",
"api:test": "start-server-and-test api:server:setup http://localhost:4100/builder test",
"api:test:local": "env-cmd jest --runInBand --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"",
"api:test:nightly": "env-cmd jest --runInBand --outputFile=testResults.json"
"api:test:nightly": "env-cmd jest --runInBand --json --outputFile=testResults.json"
},
"jest": {
"preset": "ts-jest",

View File

@ -10,7 +10,7 @@ const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
async function generateReport() {
// read the report file
const REPORT_PATH = path.resolve(__dirname, "..", "testReport.json")
const REPORT_PATH = path.resolve(__dirname, "..", "testResults.json")
const report = fs.readFileSync(REPORT_PATH, "utf-8")
return JSON.parse(report)
}