Merge branch 'develop' of github.com:Budibase/budibase into fix/june-fixes

This commit is contained in:
mike12345567 2022-07-08 19:12:43 +01:00
commit 24f416cdde
28 changed files with 125 additions and 84 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -5,4 +5,5 @@ module.exports = {
app: require("./src/cache/appMetadata"), app: require("./src/cache/appMetadata"),
writethrough: require("./src/cache/writethrough"), writethrough: require("./src/cache/writethrough"),
...generic, ...generic,
cache: generic,
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/types": "^1.0.219-alpha.17",
"@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

@ -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.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/string-templates": "^1.0.219-alpha.17",
"@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

@ -10,6 +10,7 @@ filterTests(['all'], () => {
it("should add Radio Buttons options picker on form, add data, and confirm", () => { it("should add Radio Buttons options picker on form, add data, and confirm", () => {
cy.navigateToFrontend() cy.navigateToFrontend()
cy.wait(500)
cy.addComponent("Form", "Form") cy.addComponent("Form", "Form")
cy.addComponent("Form", "Options Picker").then((componentId) => { cy.addComponent("Form", "Options Picker").then((componentId) => {
// Provide field setting // Provide field setting

View File

@ -43,7 +43,7 @@ filterTests(["smoke", "all"], () => {
const uuid = () => Cypress._.random(0, 1e6) const uuid = () => Cypress._.random(0, 1e6)
const name = uuid() const name = uuid()
if(i < 1){ if(i < 1){
cy.createApp(name) cy.createApp(name, false)
} else { } else {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
cy.wait(1000) cy.wait(1000)
@ -56,7 +56,7 @@ filterTests(["smoke", "all"], () => {
// Navigate back to the user // Navigate back to the user
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000}) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000})
cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click() cy.get(interact.SPECTRUM_SIDENAV).contains("Users").click()
cy.get(interact.SPECTRUM_TABLE, { timeout: 500 }).contains("bbuser").click() cy.get(interact.SPECTRUM_TABLE, { timeout: 1000 }).contains("bbuser").click()
for (let i = 0; i < 3; i++) { for (let i = 0; i < 3; i++) {
cy.get(interact.SPECTRUM_TABLE, { timeout: 3000}) cy.get(interact.SPECTRUM_TABLE, { timeout: 3000})
.eq(1) .eq(1)
@ -65,24 +65,24 @@ filterTests(["smoke", "all"], () => {
.find(interact.SPECTRUM_TABLE_CELL) .find(interact.SPECTRUM_TABLE_CELL)
.eq(0) .eq(0)
.click() .click()
cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 500 }) cy.get(interact.SPECTRUM_DIALOG_GRID, { timeout: 1000 })
.contains("Choose an option") .contains("Choose an option")
.click() .click()
.then(() => { .then(() => {
if (i == 0) { if (i == 0) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Admin").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Admin").click({ force: true })
} }
else if (i == 1) { else if (i == 1) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Power").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Power").click({ force: true })
} }
else if (i == 2) { else if (i == 2) {
cy.get(interact.SPECTRUM_MENU, { timeout: 1000 }).contains("Basic").click({ force: true }) cy.get(interact.SPECTRUM_MENU, { timeout: 2000 }).contains("Basic").click({ force: true })
} }
cy.get(interact.SPECTRUM_BUTTON, { timeout: 1000 }) cy.get(interact.SPECTRUM_BUTTON, { timeout: 2000 })
.contains("Update role") .contains("Update role")
.click({ force: true }) .click({ force: true })
}) })
cy.reload() cy.reload({ timeout: 5000 })
cy.wait(1000) cy.wait(1000)
} }
// Confirm roles exist within Configure roles table // Confirm roles exist within Configure roles table

View File

@ -6,7 +6,7 @@ filterTests(["all"], () => {
before(() => { before(() => {
cy.login() cy.login()
cy.deleteAllApps() cy.deleteAllApps()
cy.createTestApp() cy.createApp("Cypress Tests")
}) })
it("Should be accessible from the applications list", () => { it("Should be accessible from the applications list", () => {
@ -82,13 +82,14 @@ filterTests(["all"], () => {
}) })
it("Should reflect the app deployment state", () => { it("Should reflect the app deployment state", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
cy.get(".appTable .app-row-actions button") cy.get(".appTable .app-row-actions button")
.contains("Edit") .contains("Edit")
.eq(0) .eq(0)
.click({ force: true }) .click({ force: true })
cy.get(".toprightnav button.spectrum-Button") cy.wait(500)
cy.get(".toprightnav button.spectrum-Button", { timeout: 2000 })
.contains("Publish") .contains("Publish")
.click({ force: true }) .click({ force: true })
cy.get(".spectrum-Modal [data-cy='deploy-app-modal']") cy.get(".spectrum-Modal [data-cy='deploy-app-modal']")

View File

@ -5,7 +5,6 @@ filterTests(['smoke', 'all'], () => {
context("Create a View", () => { context("Create a View", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.createTestApp() cy.createTestApp()
cy.createTable("data") cy.createTable("data")
cy.addColumn("data", "group", "Text") cy.addColumn("data", "group", "Text")

View File

@ -217,20 +217,21 @@ filterTests(["all"], () => {
it("should edit a query name", () => { it("should edit a query name", () => {
// Access query // Access query
cy.get(".hierarchy-items-container") cy.get(".hierarchy-items-container", { timeout: 2000 })
.contains(queryName + " (1)") .contains(queryName + " (1)")
.click() .click()
// Rename query // Rename query
cy.get(".spectrum-Form-item") cy.wait(1000)
cy.get(".spectrum-Form-item", { timeout: 2000 })
.eq(0) .eq(0)
.within(() => { .within(() => {
cy.get("input").clear().type(queryRename) cy.get("input").clear().type(queryRename)
}) })
// Run and Save query // Run and Save query
cy.get(".spectrum-Button").contains("Run Query").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 }).contains("Run Query").click({ force: true })
cy.wait(500) cy.wait(1000)
cy.get(".spectrum-Button", { timeout: 2000 }).contains("Save Query").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 }).contains("Save Query").click({ force: true })
cy.reload({ timeout: 5000 }) cy.reload({ timeout: 5000 })
cy.get(".nav-item", { timeout: 2000 }).should("contain", queryRename) cy.get(".nav-item", { timeout: 2000 }).should("contain", queryRename)
@ -250,6 +251,7 @@ filterTests(["all"], () => {
.contains("Delete Query") .contains("Delete Query")
.click({ force: true }) .click({ force: true })
// Confirm deletion // Confirm deletion
cy.reload({ timeout: 5000 })
cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName) cy.get(".nav-item", { timeout: 1000 }).should("not.contain", queryName)
}) })

View File

@ -403,17 +403,19 @@ Cypress.Commands.add("createAppFromScratch", appName => {
Cypress.Commands.add("createTable", (tableName, initialTable) => { Cypress.Commands.add("createTable", (tableName, initialTable) => {
if (!initialTable) { if (!initialTable) {
cy.navigateToDataSection() cy.navigateToDataSection()
cy.get(`[data-cy="new-table"]`).click() cy.get(`[data-cy="new-table"]`, { timeout: 2000 }).click()
} }
cy.wait(2000) cy.wait(2000)
cy.get(".item") cy.get(".item", { timeout: 2000 })
.contains("Budibase DB") .contains("Budibase DB")
.click({ force: true }) .click({ force: true })
.then(() => { .then(() => {
cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.get(".spectrum-Button", { timeout: 2000 })
.contains("Continue")
.click({ force: true })
}) })
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => {
cy.get("input", { timeout: 1000 }).first().type(tableName).blur() cy.get("input", { timeout: 2000 }).first().type(tableName).blur()
cy.get(".spectrum-ButtonGroup").contains("Create").click() cy.get(".spectrum-ButtonGroup").contains("Create").click()
}) })
cy.contains(tableName).should("be.visible") cy.contains(tableName).should("be.visible")
@ -507,12 +509,13 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => {
// DESIGN AREA // DESIGN AREA
Cypress.Commands.add("addComponent", (category, component) => { Cypress.Commands.add("addComponent", (category, component) => {
if (category) { if (category) {
cy.get(`[data-cy="category-${category}"]`, { timeout: 1000 }).click({ cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({
force: true, force: true,
}) })
} }
cy.wait(500)
if (component) { if (component) {
cy.get(`[data-cy="component-${component}"]`, { timeout: 1000 }).click({ cy.get(`[data-cy="component-${component}"]`, { timeout: 3000 }).click({
force: true, force: true,
}) })
} }
@ -520,7 +523,7 @@ Cypress.Commands.add("addComponent", (category, component) => {
cy.location().then(loc => { cy.location().then(loc => {
const params = loc.pathname.split("/") const params = loc.pathname.split("/")
const componentId = params[params.length - 1] const componentId = params[params.length - 1]
cy.getComponent(componentId).should("exist") cy.getComponent(componentId, { timeout: 3000 }).should("exist")
return cy.wrap(componentId) return cy.wrap(componentId)
}) })
}) })
@ -624,8 +627,8 @@ Cypress.Commands.add("navigateToFrontend", () => {
// Clicks on Design tab and then the Home nav item // Clicks on Design tab and then the Home nav item
cy.wait(500) cy.wait(500)
cy.contains("Design").click() cy.contains("Design").click()
cy.get(".spectrum-Search").type("/") cy.get(".spectrum-Search", { timeout: 2000 }).type("/")
cy.get(".nav-item").contains("home").click() cy.get(".nav-item", { timeout: 2000 }).contains("home").click()
}) })
Cypress.Commands.add("navigateToDataSection", () => { Cypress.Commands.add("navigateToDataSection", () => {
@ -785,7 +788,7 @@ Cypress.Commands.add("createRestQuery", (method, restUrl, queryPrettyName) => {
// MISC // MISC
Cypress.Commands.add("closeModal", () => { Cypress.Commands.add("closeModal", () => {
cy.get(".spectrum-Modal").within(() => { cy.get(".spectrum-Modal", { timeout: 2000 }).within(() => {
cy.get(".close-icon").click() cy.get(".close-icon").click()
cy.wait(1000) // Wait for modal to close cy.wait(1000) // Wait for modal to close
}) })

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -69,10 +69,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.219-alpha.11", "@budibase/bbui": "^1.0.219-alpha.17",
"@budibase/client": "^1.0.219-alpha.11", "@budibase/client": "^1.0.219-alpha.17",
"@budibase/frontend-core": "^1.0.219-alpha.11", "@budibase/frontend-core": "^1.0.219-alpha.17",
"@budibase/string-templates": "^1.0.219-alpha.11", "@budibase/string-templates": "^1.0.219-alpha.17",
"@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

@ -74,7 +74,10 @@
rev: smtpConfig._rev, rev: smtpConfig._rev,
}) })
smtpConfig = { smtpConfig = {
config: {}, type: ConfigTypes.SMTP,
config: {
secure: true,
},
} }
await admin.getChecklist() await admin.getChecklist()
notifications.success(`Settings cleared`) notifications.success(`Settings cleared`)

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/bbui": "^1.0.219-alpha.17",
"@budibase/frontend-core": "^1.0.219-alpha.11", "@budibase/frontend-core": "^1.0.219-alpha.17",
"@budibase/string-templates": "^1.0.219-alpha.11", "@budibase/string-templates": "^1.0.219-alpha.17",
"@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",

View File

@ -61,7 +61,9 @@
clonedSchema = schema clonedSchema = schema
} else { } else {
allowedFields?.forEach(field => { allowedFields?.forEach(field => {
clonedSchema[field] = schema[field] if (schema[field]) {
clonedSchema[field] = schema[field]
}
}) })
} }
return Object.values(clonedSchema || {}) return Object.values(clonedSchema || {})

View File

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/bbui": "^1.0.219-alpha.17",
"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.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/backend-core": "^1.0.219-alpha.17",
"@budibase/client": "^1.0.219-alpha.11", "@budibase/client": "^1.0.219-alpha.17",
"@budibase/pro": "1.0.219-alpha.11", "@budibase/pro": "1.0.219-alpha.17",
"@budibase/string-templates": "^1.0.219-alpha.11", "@budibase/string-templates": "^1.0.219-alpha.17",
"@budibase/types": "^1.0.219-alpha.11", "@budibase/types": "^1.0.219-alpha.17",
"@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

@ -166,14 +166,19 @@ export async function preview(ctx: any) {
} }
} }
async function execute(ctx: any, opts = { rowsOnly: false }) { async function execute(
ctx: any,
opts: any = { rowsOnly: false, isAutomation: false }
) {
const db = getAppDB() const db = getAppDB()
const query = await db.get(ctx.params.queryId) const query = await db.get(ctx.params.queryId)
const datasource = await db.get(query.datasourceId) const datasource = await db.get(query.datasourceId)
const authConfigCtx: any = getAuthConfig(ctx) let authConfigCtx: any = {}
if (!opts.isAutomation) {
authConfigCtx = getAuthConfig(ctx)
}
const enrichedParameters = ctx.request.body.parameters || {} const enrichedParameters = ctx.request.body.parameters || {}
// make sure parameters are fully enriched with defaults // make sure parameters are fully enriched with defaults
if (query && query.parameters) { if (query && query.parameters) {
@ -217,8 +222,11 @@ export async function executeV1(ctx: any) {
return execute(ctx, { rowsOnly: true }) return execute(ctx, { rowsOnly: true })
} }
export async function executeV2(ctx: any) { export async function executeV2(
return execute(ctx, { rowsOnly: false }) ctx: any,
{ isAutomation }: { isAutomation?: boolean } = {}
) {
return execute(ctx, { rowsOnly: false, isAutomation })
} }
const removeDynamicVariables = async (queryId: any) => { const removeDynamicVariables = async (queryId: any) => {

View File

@ -218,7 +218,6 @@ describe("/queries", () => {
expect(res.body.schemaFields).toEqual(["a", "b"]) expect(res.body.schemaFields).toEqual(["a", "b"])
expect(res.body.rows.length).toEqual(1) expect(res.body.rows.length).toEqual(1)
expect(events.query.previewed).toBeCalledTimes(1) expect(events.query.previewed).toBeCalledTimes(1)
datasource.config = { schema: "public" }
expect(events.query.previewed).toBeCalledWith(datasource, query) expect(events.query.previewed).toBeCalledWith(datasource, query)
}) })

View File

@ -72,7 +72,7 @@ exports.run = async function ({ inputs, appId, emitter }) {
}) })
try { try {
await queryController.executeV2(ctx) await queryController.executeV2(ctx, { isAutomation: true })
const { data, ...rest } = ctx.body const { data, ...rest } = ctx.body
return { return {
response: data, response: data,

View File

@ -99,8 +99,12 @@ function generateSelectStatement(
const fieldNames = field.split(/\./g) const fieldNames = field.split(/\./g)
const tableName = fieldNames[0] const tableName = fieldNames[0]
const columnName = fieldNames[1] const columnName = fieldNames[1]
if (columnName && knex.client.config.client === SqlClients.POSTGRES) { if (
const externalType = schema?.[columnName].externalType columnName &&
schema?.[columnName] &&
knex.client.config.client === SqlClients.POSTGRES
) {
const externalType = schema[columnName].externalType
if (externalType?.includes("money")) { if (externalType?.includes("money")) {
return knex.raw( return knex.raw(
`"${tableName}"."${columnName}"::money::numeric as "${field}"` `"${tableName}"."${columnName}"::money::numeric as "${field}"`

View File

@ -10,6 +10,7 @@ const {
} = require("@budibase/backend-core/auth") } = require("@budibase/backend-core/auth")
const { user: userCache } = require("@budibase/backend-core/cache") const { user: userCache } = require("@budibase/backend-core/cache")
const { getGlobalIDFromUserMetadataID } = require("../db/utils") const { getGlobalIDFromUserMetadataID } = require("../db/utils")
const { cloneDeep } = require("lodash/fp")
const { isSQL } = require("../integrations/utils") const { isSQL } = require("../integrations/utils")
const { const {
@ -41,20 +42,22 @@ class QueryRunner {
async execute() { async execute() {
let { datasource, fields, queryVerb, transformer } = this let { datasource, fields, queryVerb, transformer } = this
const Integration = integrations[datasource.source] let datasourceClone = cloneDeep(datasource)
let fieldsClone = cloneDeep(fields)
const Integration = integrations[datasourceClone.source]
if (!Integration) { if (!Integration) {
throw "Integration type does not exist." throw "Integration type does not exist."
} }
if (datasource.config.authConfigs) { if (datasourceClone.config.authConfigs) {
datasource.config.authConfigs = datasource.config.authConfigs.map( datasourceClone.config.authConfigs =
config => { datasourceClone.config.authConfigs.map(config => {
return enrichQueryFields(config, this.ctx) return enrichQueryFields(config, this.ctx)
} })
)
} }
const integration = new Integration(datasource.config) const integration = new Integration(datasourceClone.config)
// pre-query, make sure datasource variables are added to parameters // pre-query, make sure datasource variables are added to parameters
const parameters = await this.addDatasourceVariables() const parameters = await this.addDatasourceVariables()
@ -65,19 +68,19 @@ class QueryRunner {
const enrichedContext = { ...enrichedParameters, ...this.ctx } const enrichedContext = { ...enrichedParameters, ...this.ctx }
// Parse global headers // Parse global headers
if (datasource.config.defaultHeaders) { if (datasourceClone.config.defaultHeaders) {
datasource.config.defaultHeaders = enrichQueryFields( datasourceClone.config.defaultHeaders = enrichQueryFields(
datasource.config.defaultHeaders, datasourceClone.config.defaultHeaders,
enrichedContext enrichedContext
) )
} }
let query let query
// handle SQL injections by interpolating the variables // handle SQL injections by interpolating the variables
if (isSQL(datasource)) { if (isSQL(datasourceClone)) {
query = interpolateSQL(fields, enrichedParameters, integration) query = interpolateSQL(fieldsClone, enrichedParameters, integration)
} else { } else {
query = enrichQueryFields(fields, enrichedContext) query = enrichQueryFields(fieldsClone, enrichedContext)
} }
// Add pagination values for REST queries // Add pagination values for REST queries
@ -116,9 +119,10 @@ class QueryRunner {
await this.refreshOAuth2(this.ctx) 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
} else {
this.hasRerun = true
} }
this.hasRerun = true
await threadUtils.invalidateDynamicVariables(this.cachedVariables) await threadUtils.invalidateDynamicVariables(this.cachedVariables)
return this.execute() return this.execute()
} }
@ -187,8 +191,9 @@ class QueryRunner {
} else { } else {
// In this event the user may have oAuth issues that // In this event the user may have oAuth issues that
// could require re-authenticating with their provider. // could require re-authenticating with their provider.
let errorMessage = resp.err.data ? resp.err.data : resp.err.toString()
throw new Error( throw new Error(
"OAuth2 access token could not be refreshed: " + resp.err.toString() "OAuth2 access token could not be refreshed: " + errorMessage
) )
} }

View File

@ -1100,6 +1100,7 @@
passport-google-oauth "2.0.0" passport-google-oauth "2.0.0"
passport-jwt "4.0.0" passport-jwt "4.0.0"
passport-local "1.0.0" passport-local "1.0.0"
passport-oauth2-refresh "^2.1.0"
posthog-node "1.3.0" posthog-node "1.3.0"
pouchdb "7.3.0" pouchdb "7.3.0"
pouchdb-find "7.2.2" pouchdb-find "7.2.2"
@ -10564,6 +10565,11 @@ passport-oauth1@1.x.x:
passport-strategy "1.x.x" passport-strategy "1.x.x"
utils-merge "1.x.x" utils-merge "1.x.x"
passport-oauth2-refresh@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/passport-oauth2-refresh/-/passport-oauth2-refresh-2.1.0.tgz#c31cd133826383f5539d16ad8ab4f35ca73ce4a4"
integrity sha512-4ML7ooCESCqiTgdDBzNUFTBcPR8zQq9iM6eppEUGMMvLdsjqRL93jKwWm4Az3OJcI+Q2eIVyI8sVRcPFvxcF/A==
passport-oauth2@1.x.x: passport-oauth2@1.x.x:
version "1.6.1" version "1.6.1"
resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.6.1.tgz#c5aee8f849ce8bd436c7f81d904a3cd1666f181b" resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.6.1.tgz#c5aee8f849ce8bd436c7f81d904a3cd1666f181b"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "1.0.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "version": "1.0.219-alpha.17",
"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.219-alpha.11", "@budibase/backend-core": "^1.0.219-alpha.17",
"@budibase/pro": "1.0.219-alpha.11", "@budibase/pro": "1.0.219-alpha.17",
"@budibase/string-templates": "^1.0.219-alpha.11", "@budibase/string-templates": "^1.0.219-alpha.17",
"@budibase/types": "^1.0.219-alpha.11", "@budibase/types": "^1.0.219-alpha.17",
"@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",

View File

@ -17,6 +17,7 @@ const {
withCache, withCache,
CacheKeys, CacheKeys,
bustCache, bustCache,
cache,
} = require("@budibase/backend-core/cache") } = require("@budibase/backend-core/cache")
const { events } = require("@budibase/backend-core") const { events } = require("@budibase/backend-core")
const { checkAnyUserExists } = require("../../../utilities/users") const { checkAnyUserExists } = require("../../../utilities/users")
@ -365,9 +366,9 @@ exports.upload = async function (ctx) {
exports.destroy = async function (ctx) { exports.destroy = async function (ctx) {
const db = getGlobalDB() const db = getGlobalDB()
const { id, rev } = ctx.params const { id, rev } = ctx.params
try { try {
await db.remove(id, rev) await db.remove(id, rev)
await cache.delete(CacheKeys.CHECKLIST)
ctx.body = { message: "Config deleted successfully" } ctx.body = { message: "Config deleted successfully" }
} catch (err) { } catch (err) {
ctx.throw(err.status, err) ctx.throw(err.status, err)

View File

@ -313,6 +313,7 @@
passport-google-oauth "2.0.0" passport-google-oauth "2.0.0"
passport-jwt "4.0.0" passport-jwt "4.0.0"
passport-local "1.0.0" passport-local "1.0.0"
passport-oauth2-refresh "^2.1.0"
posthog-node "1.3.0" posthog-node "1.3.0"
pouchdb "7.3.0" pouchdb "7.3.0"
pouchdb-find "7.2.2" pouchdb-find "7.2.2"
@ -4975,6 +4976,11 @@ passport-oauth1@1.x.x:
passport-strategy "1.x.x" passport-strategy "1.x.x"
utils-merge "1.x.x" utils-merge "1.x.x"
passport-oauth2-refresh@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/passport-oauth2-refresh/-/passport-oauth2-refresh-2.1.0.tgz#c31cd133826383f5539d16ad8ab4f35ca73ce4a4"
integrity sha512-4ML7ooCESCqiTgdDBzNUFTBcPR8zQq9iM6eppEUGMMvLdsjqRL93jKwWm4Az3OJcI+Q2eIVyI8sVRcPFvxcF/A==
passport-oauth2@1.x.x: passport-oauth2@1.x.x:
version "1.6.1" version "1.6.1"
resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.6.1.tgz#c5aee8f849ce8bd436c7f81d904a3cd1666f181b" resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.6.1.tgz#c5aee8f849ce8bd436c7f81d904a3cd1666f181b"