1
0
Fork 0
mirror of synced 2024-07-10 16:55:46 +12:00

Merge branch 'develop' of github.com:Budibase/budibase into test/coverage-bckend-core

This commit is contained in:
mike12345567 2023-03-30 14:14:25 +01:00
commit d6f38bc0ba
24 changed files with 169 additions and 80 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.4.42-alpha.2",
"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.2",
"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.2",
"@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

@ -162,7 +162,7 @@ export async function getGoogleConfig(): Promise<
export async function getGoogleDatasourceConfig(): Promise<
GoogleInnerConfig | undefined
> {
if (!env.isDev() && !env.SELF_HOSTED) {
if (!env.SELF_HOSTED) {
// always use the env vars in cloud
return getDefaultGoogleConfig()
}

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.2",
"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.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@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.2",
"version": "2.4.42-alpha.4",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -58,11 +58,11 @@
}
},
"dependencies": {
"@budibase/bbui": "2.4.42-alpha.2",
"@budibase/client": "2.4.42-alpha.2",
"@budibase/frontend-core": "2.4.42-alpha.2",
"@budibase/shared-core": "2.4.42-alpha.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@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

@ -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,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.4.42-alpha.2",
"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.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@budibase/types": "2.4.42-alpha.2",
"@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.2",
"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.2",
"@budibase/frontend-core": "2.4.42-alpha.2",
"@budibase/shared-core": "2.4.42-alpha.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@budibase/types": "2.4.42-alpha.2",
"@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.2",
"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.2",
"@budibase/shared-core": "2.4.42-alpha.2",
"@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

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.4.42-alpha.2",
"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.2",
"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.2",
"@budibase/client": "2.4.42-alpha.2",
"@budibase/pro": "2.4.42-alpha.2",
"@budibase/shared-core": "2.4.42-alpha.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@budibase/types": "2.4.42-alpha.2",
"@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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.2.tgz#b51c6fadb97f9f0a6d980a132d073e88c1c53bf8"
integrity sha512-lgEiSHHioKAOn34DT0mfZ31S/SvPxDn671Zjazc33QCwAEEtzPuU6/z3N/xkwDYc32fZkh1up5CuAce55UPU6w==
"@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.2"
"@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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.2.tgz#037bc36e8a64b35f31d5625f9a6c2687b2bc22b2"
integrity sha512-fpdBvSuz2mrNPxI9zDtBi1TFuGHw6xQNHJhNjwtJXFxDbPiIUsxitrQA4neZvYQ0BH/0PPSw5tmrE+2uemZcEw==
"@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.2"
"@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.2"
"@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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.2.tgz#57eb9c224dd13c4a25cf3f6b1c440a1354fd38e0"
integrity sha512-LzmMywUeK82YHOXw9mhrh/PXryOn+JahB/zZWkcSjiIPF+VPEfhGK4ZSKV9jvNrVycAjcwzgEGbjrXfT289Qqg==
"@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.2",
"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.2"
"@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.2",
"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.2",
"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.2",
"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.2",
"@budibase/pro": "2.4.42-alpha.2",
"@budibase/string-templates": "2.4.42-alpha.2",
"@budibase/types": "2.4.42-alpha.2",
"@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

@ -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

@ -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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.42-alpha.2.tgz#b51c6fadb97f9f0a6d980a132d073e88c1c53bf8"
integrity sha512-lgEiSHHioKAOn34DT0mfZ31S/SvPxDn671Zjazc33QCwAEEtzPuU6/z3N/xkwDYc32fZkh1up5CuAce55UPU6w==
"@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.2"
"@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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.42-alpha.2.tgz#037bc36e8a64b35f31d5625f9a6c2687b2bc22b2"
integrity sha512-fpdBvSuz2mrNPxI9zDtBi1TFuGHw6xQNHJhNjwtJXFxDbPiIUsxitrQA4neZvYQ0BH/0PPSw5tmrE+2uemZcEw==
"@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.2"
"@budibase/backend-core" "2.4.42-alpha.4"
"@budibase/string-templates" "2.3.20"
"@budibase/types" "2.4.42-alpha.2"
"@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.2":
version "2.4.42-alpha.2"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.42-alpha.2.tgz#57eb9c224dd13c4a25cf3f6b1c440a1354fd38e0"
integrity sha512-LzmMywUeK82YHOXw9mhrh/PXryOn+JahB/zZWkcSjiIPF+VPEfhGK4ZSKV9jvNrVycAjcwzgEGbjrXfT289Qqg==
"@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"