Merge remote-tracking branch 'origin/develop' into feat/user-groups-tab

This commit is contained in:
Peter Clement 2022-07-06 16:30:24 +01:00
commit 8a66a38470
23 changed files with 2895 additions and 3979 deletions

View File

@ -11,8 +11,8 @@ sources:
- https://github.com/Budibase/budibase - https://github.com/Budibase/budibase
- https://budibase.com - https://budibase.com
type: application type: application
version: 0.2.10 version: 0.2.11
appVersion: 1.0.48 appVersion: 1.0.214
dependencies: dependencies:
- name: couchdb - name: couchdb
version: 3.6.1 version: 3.6.1

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "1.0.212-alpha.15", "version": "1.0.219-alpha.4",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll" "test:watch": "jest --watchAll"
}, },
"dependencies": { "dependencies": {
"@budibase/types": "^1.0.212-alpha.15", "@budibase/types": "^1.0.219-alpha.4",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0", "aws-sdk": "2.1030.0",
"bcrypt": "5.0.1", "bcrypt": "5.0.1",

View File

@ -20,6 +20,8 @@ const {
internalApi, internalApi,
} = require("./middleware") } = require("./middleware")
const { invalidateUser } = require("./cache/user")
// Strategies // Strategies
passport.use(new LocalStrategy(local.options, local.authenticate)) passport.use(new LocalStrategy(local.options, local.authenticate))
passport.use(new JwtStrategy(jwt.options, jwt.authenticate)) passport.use(new JwtStrategy(jwt.options, jwt.authenticate))
@ -149,6 +151,8 @@ async function updateUserOAuth(userId, oAuthConfig) {
} }
await db.put(dbUser) await db.put(dbUser)
await invalidateUser(userId)
} catch (e) { } catch (e) {
console.error("Could not update OAuth details for current user", e) console.error("Could not update OAuth details for current user", e)
} }

View File

@ -1,10 +1,10 @@
const NonErrors = ["AccountError"] const NonErrors = ["AccountError"]
function isSuppressed(e) { function isSuppressed(e?: any) {
return e && e["suppressAlert"] return e && e["suppressAlert"]
} }
module.exports.logAlert = (message, e) => { export function logAlert(message: string, e?: any) {
if (e && NonErrors.includes(e.name) && isSuppressed(e)) { if (e && NonErrors.includes(e.name) && isSuppressed(e)) {
return return
} }
@ -14,3 +14,7 @@ module.exports.logAlert = (message, e) => {
} }
console.error(`bb-alert: ${message} ${errorJson}`) console.error(`bb-alert: ${message} ${errorJson}`)
} }
export default {
logAlert,
}

View File

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

View File

@ -5,7 +5,7 @@
const displayLimit = 5 const displayLimit = 5
$: badges = value?.slice(0, displayLimit) ?? [] $: badges = Array.isArray(value) ? value.slice(0, displayLimit) : []
$: leftover = (value?.length ?? 0) - badges.length $: leftover = (value?.length ?? 0) - badges.length
</script> </script>

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "1.0.212-alpha.15", "version": "1.0.219-alpha.4",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -69,10 +69,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.212-alpha.15", "@budibase/bbui": "^1.0.219-alpha.4",
"@budibase/client": "^1.0.212-alpha.15", "@budibase/client": "^1.0.219-alpha.4",
"@budibase/frontend-core": "^1.0.212-alpha.15", "@budibase/frontend-core": "^1.0.219-alpha.4",
"@budibase/string-templates": "^1.0.212-alpha.15", "@budibase/string-templates": "^1.0.219-alpha.4",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",

View File

@ -53,7 +53,7 @@ export default class IntercomClient {
* @returns Intercom global object * @returns Intercom global object
*/ */
show(user = {}) { show(user = {}) {
if (!this.initialised) return if (!this.initialised || !user?.admin) return
return window.Intercom("boot", { return window.Intercom("boot", {
app_id: this.token, app_id: this.token,

View File

@ -22,10 +22,8 @@
RelationshipTypes, RelationshipTypes,
ALLOWABLE_STRING_OPTIONS, ALLOWABLE_STRING_OPTIONS,
ALLOWABLE_NUMBER_OPTIONS, ALLOWABLE_NUMBER_OPTIONS,
ALLOWABLE_JSON_OPTIONS,
ALLOWABLE_STRING_TYPES, ALLOWABLE_STRING_TYPES,
ALLOWABLE_NUMBER_TYPES, ALLOWABLE_NUMBER_TYPES,
ALLOWABLE_JSON_TYPES,
SWITCHABLE_TYPES, SWITCHABLE_TYPES,
} from "constants/backend" } from "constants/backend"
import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils" import { getAutoColumnInformation, buildAutoColumn } from "builderStore/utils"
@ -255,11 +253,6 @@
ALLOWABLE_NUMBER_TYPES.indexOf(field.type) !== -1 ALLOWABLE_NUMBER_TYPES.indexOf(field.type) !== -1
) { ) {
return ALLOWABLE_NUMBER_OPTIONS return ALLOWABLE_NUMBER_OPTIONS
} else if (
originalName &&
ALLOWABLE_JSON_TYPES.indexOf(field.type) !== -1
) {
return ALLOWABLE_JSON_OPTIONS
} else if (!external) { } else if (!external) {
return [ return [
...Object.values(fieldDefinitions), ...Object.values(fieldDefinitions),

View File

@ -158,13 +158,9 @@ export const ALLOWABLE_NUMBER_TYPES = ALLOWABLE_NUMBER_OPTIONS.map(
opt => opt.type opt => opt.type
) )
export const ALLOWABLE_JSON_OPTIONS = [FIELDS.JSON, FIELDS.ARRAY]
export const ALLOWABLE_JSON_TYPES = ALLOWABLE_JSON_OPTIONS.map(opt => opt.type)
export const SWITCHABLE_TYPES = [ export const SWITCHABLE_TYPES = [
...ALLOWABLE_STRING_TYPES, ...ALLOWABLE_STRING_TYPES,
...ALLOWABLE_NUMBER_TYPES, ...ALLOWABLE_NUMBER_TYPES,
...ALLOWABLE_JSON_TYPES,
] ]
export const IntegrationTypes = { export const IntegrationTypes = {

View File

@ -64,6 +64,8 @@ export function createAuthStore() {
name: user.account?.name, name: user.account?.name,
user_id: user._id, user_id: user._id,
tenant: user.tenantId, tenant: user.tenantId,
admin: user?.admin?.global,
builder: user?.builder?.global,
"Company size": user.account?.size, "Company size": user.account?.size,
"Job role": user.account?.profession, "Job role": user.account?.profession,
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "1.0.212-alpha.15", "version": "1.0.219-alpha.4",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -8,6 +8,7 @@ const {
refreshOAuthToken, refreshOAuthToken,
updateUserOAuth, updateUserOAuth,
} = require("@budibase/backend-core/auth") } = require("@budibase/backend-core/auth")
const { user: userCache } = require("@budibase/backend-core/cache")
const { getGlobalIDFromUserMetadataID } = require("../db/utils") const { getGlobalIDFromUserMetadataID } = require("../db/utils")
const { isSQL } = require("../integrations/utils") const { isSQL } = require("../integrations/utils")
@ -112,15 +113,9 @@ class QueryRunner {
info.code === 401 && info.code === 401 &&
!this.hasRefreshedOAuth !this.hasRefreshedOAuth
) { ) {
await this.refreshOAuth2(this.ctx)
// Attempt to refresh the access token from the provider // Attempt to refresh the access token from the provider
this.hasRefreshedOAuth = true this.hasRefreshedOAuth = true
const authResponse = await this.refreshOAuth2(this.ctx)
if (!authResponse || authResponse.err) {
// In this event the user may have oAuth issues that
// could require re-authenticating with their provider.
throw new Error("OAuth2 access token could not be refreshed")
}
} }
this.hasRerun = true this.hasRerun = true
@ -174,8 +169,7 @@ class QueryRunner {
const { configId } = ctx.auth const { configId } = ctx.auth
if (!providerType || !oauth2?.refreshToken) { if (!providerType || !oauth2?.refreshToken) {
console.error("No refresh token found for authenticated user") throw new Error("No refresh token found for authenticated user")
return
} }
const resp = await refreshOAuthToken( const resp = await refreshOAuthToken(
@ -186,9 +180,16 @@ class QueryRunner {
// Refresh session flow. Should be in same location as refreshOAuthToken // Refresh session flow. Should be in same location as refreshOAuthToken
// There are several other properties available in 'resp' // There are several other properties available in 'resp'
if (!resp.error) { if (!resp.err) {
const globalUserId = getGlobalIDFromUserMetadataID(_id) const globalUserId = getGlobalIDFromUserMetadataID(_id)
await updateUserOAuth(globalUserId, resp) await updateUserOAuth(globalUserId, resp)
this.ctx.user = await userCache.getUser(globalUserId)
} else {
// In this event the user may have oAuth issues that
// could require re-authenticating with their provider.
throw new Error(
"OAuth2 access token could not be refreshed: " + resp.err.toString()
)
} }
return resp return resp

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff