Merge branch 'develop' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
85cb766d14
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase backend core libraries used in server and worker",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"test:watch": "jest --watchAll"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/types": "^1.0.219-alpha.0",
|
||||
"@budibase/types": "^1.0.219-alpha.2",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
"aws-sdk": "2.1030.0",
|
||||
"bcrypt": "5.0.1",
|
||||
|
|
|
@ -20,6 +20,8 @@ const {
|
|||
internalApi,
|
||||
} = require("./middleware")
|
||||
|
||||
const { invalidateUser } = require("./cache/user")
|
||||
|
||||
// Strategies
|
||||
passport.use(new LocalStrategy(local.options, local.authenticate))
|
||||
passport.use(new JwtStrategy(jwt.options, jwt.authenticate))
|
||||
|
@ -149,6 +151,8 @@ async function updateUserOAuth(userId, oAuthConfig) {
|
|||
}
|
||||
|
||||
await db.put(dbUser)
|
||||
|
||||
await invalidateUser(userId)
|
||||
} catch (e) {
|
||||
console.error("Could not update OAuth details for current user", e)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"module": "dist/bbui.es.js",
|
||||
|
@ -38,7 +38,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.2",
|
||||
"@spectrum-css/actionbutton": "^1.0.1",
|
||||
"@spectrum-css/actiongroup": "^1.0.1",
|
||||
"@spectrum-css/avatar": "^3.0.2",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -69,10 +69,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.219-alpha.0",
|
||||
"@budibase/client": "^1.0.219-alpha.0",
|
||||
"@budibase/frontend-core": "^1.0.219-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.0",
|
||||
"@budibase/bbui": "^1.0.219-alpha.2",
|
||||
"@budibase/client": "^1.0.219-alpha.2",
|
||||
"@budibase/frontend-core": "^1.0.219-alpha.2",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.2",
|
||||
"@sentry/browser": "5.19.1",
|
||||
"@spectrum-css/page": "^3.0.1",
|
||||
"@spectrum-css/vars": "^3.0.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||
"main": "src/index.js",
|
||||
"bin": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"license": "MPL-2.0",
|
||||
"module": "dist/budibase-client.js",
|
||||
"main": "dist/budibase-client.js",
|
||||
|
@ -19,9 +19,9 @@
|
|||
"dev:builder": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.219-alpha.0",
|
||||
"@budibase/frontend-core": "^1.0.219-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.0",
|
||||
"@budibase/bbui": "^1.0.219-alpha.2",
|
||||
"@budibase/frontend-core": "^1.0.219-alpha.2",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.2",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase frontend core libraries used in builder and client",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "^1.0.219-alpha.0",
|
||||
"@budibase/bbui": "^1.0.219-alpha.2",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -77,11 +77,11 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3",
|
||||
"@budibase/backend-core": "^1.0.219-alpha.0",
|
||||
"@budibase/client": "^1.0.219-alpha.0",
|
||||
"@budibase/pro": "1.0.219-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.0",
|
||||
"@budibase/types": "^1.0.219-alpha.0",
|
||||
"@budibase/backend-core": "^1.0.219-alpha.2",
|
||||
"@budibase/client": "^1.0.219-alpha.2",
|
||||
"@budibase/pro": "1.0.219-alpha.1",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.2",
|
||||
"@budibase/types": "^1.0.219-alpha.2",
|
||||
"@bull-board/api": "3.7.0",
|
||||
"@bull-board/koa": "3.9.4",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
|
|
@ -8,6 +8,7 @@ const {
|
|||
refreshOAuthToken,
|
||||
updateUserOAuth,
|
||||
} = require("@budibase/backend-core/auth")
|
||||
const { user: userCache } = require("@budibase/backend-core/cache")
|
||||
const { getGlobalIDFromUserMetadataID } = require("../db/utils")
|
||||
|
||||
const { isSQL } = require("../integrations/utils")
|
||||
|
@ -112,15 +113,9 @@ class QueryRunner {
|
|||
info.code === 401 &&
|
||||
!this.hasRefreshedOAuth
|
||||
) {
|
||||
await this.refreshOAuth2(this.ctx)
|
||||
// Attempt to refresh the access token from the provider
|
||||
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
|
||||
|
@ -174,8 +169,7 @@ class QueryRunner {
|
|||
const { configId } = ctx.auth
|
||||
|
||||
if (!providerType || !oauth2?.refreshToken) {
|
||||
console.error("No refresh token found for authenticated user")
|
||||
return
|
||||
throw new Error("No refresh token found for authenticated user")
|
||||
}
|
||||
|
||||
const resp = await refreshOAuthToken(
|
||||
|
@ -186,9 +180,16 @@ class QueryRunner {
|
|||
|
||||
// Refresh session flow. Should be in same location as refreshOAuthToken
|
||||
// There are several other properties available in 'resp'
|
||||
if (!resp.error) {
|
||||
if (!resp.err) {
|
||||
const globalUserId = getGlobalIDFromUserMetadataID(_id)
|
||||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/types",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase types",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.0.219-alpha.0",
|
||||
"version": "1.0.219-alpha.2",
|
||||
"description": "Budibase background service",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -34,10 +34,10 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "^1.0.219-alpha.0",
|
||||
"@budibase/pro": "1.0.219-alpha.0",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.0",
|
||||
"@budibase/types": "^1.0.219-alpha.0",
|
||||
"@budibase/backend-core": "^1.0.219-alpha.2",
|
||||
"@budibase/pro": "1.0.219-alpha.1",
|
||||
"@budibase/string-templates": "^1.0.219-alpha.2",
|
||||
"@budibase/types": "^1.0.219-alpha.2",
|
||||
"@koa/router": "8.0.8",
|
||||
"@sentry/node": "6.17.7",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
|
|
Loading…
Reference in New Issue