Merge branch 'develop' of github.com:Budibase/budibase into onboarding

This commit is contained in:
Andrew Kingston 2023-01-23 13:26:40 +00:00
commit d004fb59e9
40 changed files with 589 additions and 463 deletions

View File

@ -6,7 +6,7 @@ labels: bug
assignees: '' assignees: ''
--- ---
## Checklist **Checklist**
- [ ] I have searched budibase discussions and github issues to check if my issue already exists - [ ] I have searched budibase discussions and github issues to check if my issue already exists
**Hosting** **Hosting**

View File

@ -1,5 +1,5 @@
{ {
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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",
@ -23,7 +23,7 @@
}, },
"dependencies": { "dependencies": {
"@budibase/nano": "10.1.1", "@budibase/nano": "10.1.1",
"@budibase/types": "2.2.12-alpha.22", "@budibase/types": "2.2.12-alpha.32",
"@shopify/jest-koa-mocks": "5.0.1", "@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0", "aws-cloudfront-sign": "2.2.0",

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": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": "2.2.12-alpha.22", "@budibase/string-templates": "2.2.12-alpha.32",
"@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

@ -45,7 +45,9 @@
getOptionLabel getOptionLabel
) )
const onClick = () => { const onClick = e => {
e.preventDefault()
e.stopPropagation()
dispatch("click") dispatch("click")
if (readonly) { if (readonly) {
return return
@ -88,7 +90,6 @@
class:is-open={open} class:is-open={open}
aria-haspopup="listbox" aria-haspopup="listbox"
on:click={onClick} on:click={onClick}
use:clickOutside={() => (open = false)}
bind:this={button} bind:this={button}
> >
{#if fieldIcon} {#if fieldIcon}
@ -130,14 +131,17 @@
<Popover <Popover
anchor={button} anchor={button}
align="left" align="left"
portalTarget={document.documentElement}
bind:this={popover} bind:this={popover}
{open} {open}
on:close={() => (open = false)} on:close={() => (open = false)}
useAnchorWidth={!autoWidth} useAnchorWidth={!autoWidth}
maxWidth={autoWidth ? 400 : null} maxWidth={autoWidth ? 400 : null}
> >
<div class="popover-content" class:auto-width={autoWidth}> <div
class="popover-content"
class:auto-width={autoWidth}
use:clickOutside={() => (open = false)}
>
{#if autocomplete} {#if autocomplete}
<Search <Search
value={searchTerm} value={searchTerm}

View File

@ -5,6 +5,8 @@
import positionDropdown from "../Actions/position_dropdown" import positionDropdown from "../Actions/position_dropdown"
import clickOutside from "../Actions/click_outside" import clickOutside from "../Actions/click_outside"
import { fly } from "svelte/transition" import { fly } from "svelte/transition"
import { getContext } from "svelte"
import Context from "../context"
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -24,6 +26,7 @@
$: tooltipClasses = showTip $: tooltipClasses = showTip
? `spectrum-Popover--withTip spectrum-Popover--${direction}` ? `spectrum-Popover--withTip spectrum-Popover--${direction}`
: "" : ""
$: target = portalTarget || getContext(Context.PopoverRoot) || ".spectrum"
export const show = () => { export const show = () => {
dispatch("open") dispatch("open")
@ -61,7 +64,7 @@
</script> </script>
{#if open} {#if open}
<Portal target={portalTarget}> <Portal {target}>
<div <div
tabindex="0" tabindex="0"
use:positionDropdown={{ anchor, align, maxWidth, useAnchorWidth }} use:positionDropdown={{ anchor, align, maxWidth, useAnchorWidth }}

View File

@ -1,3 +1,4 @@
export default { export default {
Modal: "bbui-modal", Modal: "bbui-modal",
PopoverRoot: "bbui-popover-root",
} }

View File

@ -11,9 +11,5 @@
"WORKER_PORT": "4200", "WORKER_PORT": "4200",
"JWT_SECRET": "test", "JWT_SECRET": "test",
"HOST_IP": "" "HOST_IP": ""
},
"retries": {
"runMode": 1,
"openMode": 0
} }
} }

View File

@ -2,7 +2,7 @@ import filterTests from "../../support/filterTests"
// const interact = require("../support/interact") // const interact = require("../support/interact")
filterTests(["smoke", "all"], () => { filterTests(["smoke", "all"], () => {
context("Auth Configuration", () => { xcontext("Auth Configuration", () => {
before(() => { before(() => {
cy.login() cy.login()
}) })

View File

@ -27,7 +27,7 @@ filterTests(["smoke", "all"], () => {
}) })
}) })
it("should allow copying of the users API key", () => { xit("should allow copying of the users API key", () => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
@ -41,12 +41,17 @@ filterTests(["smoke", "all"], () => {
}) })
it("should allow API key regeneration", () => { it("should allow API key regeneration", () => {
cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("View API key").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
cy.get(interact.SPECTRUM_ICON).click({ force: true })
})
// Get initial API key value // Get initial API key value
cy.get(interact.SPECTRUM_DIALOG_CONTENT) cy.get(interact.SPECTRUM_DIALOG_CONTENT)
.find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne') .find(interact.SPECTRUM_TEXTFIELD_INPUT).invoke('val').as('keyOne')
// Click re-generate key button // Click re-generate key button
cy.get("button").contains("Re-generate key").click({ force: true }) cy.get("button").contains("Regenerate key").click({ force: true })
// Verify API key was changed // Verify API key was changed
cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => { cy.get(interact.SPECTRUM_DIALOG_CONTENT).within(() => {
@ -59,7 +64,7 @@ filterTests(["smoke", "all"], () => {
it("should update password", () => { it("should update password", () => {
// Access Update password modal // Access Update password modal
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true })
// Enter new password and update // Enter new password and update
@ -76,8 +81,8 @@ filterTests(["smoke", "all"], () => {
cy.login("test@test.com", "newpwd") cy.login("test@test.com", "newpwd")
}) })
it("should open and close developer mode", () => { xit("should open and close developer mode", () => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
// Close developer mode & verify // Close developer mode & verify
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Close developer mode").click({ force: true })
@ -88,13 +93,13 @@ filterTests(["smoke", "all"], () => {
// Open developer mode & verify // Open developer mode & verify
cy.get(".avatar > .icon").click({ force: true }) cy.get(".avatar > .icon").click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Open developer mode").click({ force: true })
cy.get(interact.SPECTRUM_SIDENAV).should('exist') // config sections available cy.get(".app-table").should('exist') // config sections available
cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available cy.get(interact.CREATE_APP_BUTTON).should('exist') // create app button available
}) })
after(() => { after(() => {
// Change password back to original value // Change password back to original value
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ force: true }) cy.get(".user-dropdown .icon", { timeout: 2000 }).click({ force: true })
cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true }) cy.get(interact.SPECTRUM_MENU_ITEM).contains("Update password").click({ force: true })
cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => { cy.get(interact.SPECTRUM_DIALOG_GRID).within(() => {
for (let i = 0; i < 2; i++) { for (let i = 0; i < 2; i++) {

View File

@ -2,7 +2,7 @@ import filterTests from "../support/filterTests"
import clientPackage from "@budibase/client/package.json" import clientPackage from "@budibase/client/package.json"
filterTests(["all"], () => { filterTests(["all"], () => {
context("Application Overview screen", () => { xcontext("Application Overview screen", () => {
before(() => { before(() => {
cy.login() cy.login()
cy.deleteAllApps() cy.deleteAllApps()

View File

@ -22,7 +22,7 @@ filterTests(['smoke', 'all'], () => {
}) })
} }
it("should provide filterable templates", () => { xit("should provide filterable templates", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 })
cy.wait(500) cy.wait(500)
@ -30,7 +30,7 @@ filterTests(['smoke', 'all'], () => {
.its("body") .its("body")
.then(val => { .then(val => {
if (val.length > 0) { if (val.length > 0) {
cy.get(interact.SPECTRUM_BUTTON).contains("Templates").click({force: true}) cy.get(interact.SPECTRUM_BUTTON).contains("View Templates").click({ force: true })
} }
}) })
@ -123,35 +123,49 @@ filterTests(['smoke', 'all'], () => {
const exportedApp = 'cypress/fixtures/exported-app.txt' const exportedApp = 'cypress/fixtures/exported-app.txt'
cy.importApp(exportedApp, "") cy.importApp(exportedApp, "")
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 })
cy.applicationInAppTable("My app") cy.applicationInAppTable("My app")
cy.get(".app-table .name").eq(0).click()
cy.get(".appTable .name").eq(0).click() cy.closeModal()
cy.get(`[aria-label="ShowMenu"]`).click()
cy.deleteApp("My app") cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
})
cy.get(".app-overview-actions-icon").within(() => {
cy.get(".spectrum-Icon").click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click({ force: true })
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get("input").type("My app")
})
cy.get(".spectrum-Button--warning").click()
}) })
it("should create an application from an export, using the users first name as the default app name", () => { it("should create an application from an export, using the users first name as the default app name", () => {
const exportedApp = 'cypress/fixtures/exported-app.txt' const exportedApp = 'cypress/fixtures/exported-app.txt'
cy.updateUserInformation("Ted", "Userman") cy.updateUserInformation("Ted", "Userman")
cy.importApp(exportedApp, "") cy.importApp(exportedApp, "")
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.applicationInAppTable("Teds app") cy.applicationInAppTable("Teds app")
cy.get(".app-table .name").eq(0).click()
cy.get(".appTable .name").eq(0).click() cy.closeModal()
cy.get(`[aria-label="ShowMenu"]`).click()
cy.deleteApp("Teds app") cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
})
cy.get(".app-overview-actions-icon").within(() => {
cy.get(".spectrum-Icon").click({ force: true })
})
cy.get(".spectrum-Menu").contains("Delete").click({ force: true })
cy.get(".spectrum-Dialog-grid").within(() => {
cy.get("input").type("Teds app")
})
cy.get(".spectrum-Button--warning").click()
cy.updateUserInformation("", "") cy.updateUserInformation("", "")
}) })
it("should generate the first application from a template", () => { xit("should generate the first application from a template", () => {
cy.visit(`${Cypress.config().baseUrl}/builder`) cy.visit(`${Cypress.config().baseUrl}/builder`)
cy.wait(500) cy.wait(500)

View File

@ -101,7 +101,7 @@ Cypress.Commands.add("deleteUser", email => {
}) })
Cypress.Commands.add("updateUserInformation", (firstName, lastName) => { Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
cy.get(".user-dropdown .avatar > .icon", { timeout: 2000 }).click({ cy.get(".user-dropdown .icon", { timeout: 2000 }).click({
force: true, force: true,
}) })
@ -132,7 +132,7 @@ Cypress.Commands.add("updateUserInformation", (firstName, lastName) => {
.blur() .blur()
} }
cy.get(".confirm-wrap").within(() => { cy.get(".confirm-wrap").within(() => {
cy.get("button").contains("Update information").click({ force: true }) cy.get("button").contains("Save").click({ force: true })
}) })
cy.get(".spectrum-Dialog-grid").should("not.exist") cy.get(".spectrum-Dialog-grid").should("not.exist")
}) })
@ -222,9 +222,12 @@ Cypress.Commands.add("deleteApp", name => {
// Go to app overview // Go to app overview
const appIdParsed = appId.split("_").pop() const appIdParsed = appId.split("_").pop()
const actionEleId = `[data-cy=row_actions_${appIdParsed}]` const actionEleId = `[data-cy=row_actions_${appIdParsed}]`
cy.get(actionEleId).within(() => { cy.get(actionEleId).click()
cy.contains("Manage").click({ force: true }) cy.get(`[aria-label="ShowMenu"]`).click()
cy.get(".spectrum-Menu").within(() => {
cy.contains("Overview").click()
}) })
cy.wait(500) cy.wait(500)
// Unpublish first if needed // Unpublish first if needed
@ -400,7 +403,7 @@ Cypress.Commands.add("searchForApplication", appName => {
return return
} else { } else {
// Searches for the app // Searches for the app
cy.get(".filter").then(() => { cy.get(".spectrum-Search").then(() => {
cy.get(".spectrum-Textfield").within(() => { cy.get(".spectrum-Textfield").within(() => {
cy.get("input").eq(0).clear({ force: true }) cy.get("input").eq(0).clear({ force: true })
cy.get("input").eq(0).type(appName, { force: true }) cy.get("input").eq(0).type(appName, { force: true })
@ -413,7 +416,7 @@ Cypress.Commands.add("searchForApplication", appName => {
// Assumes there are no others // Assumes there are no others
Cypress.Commands.add("applicationInAppTable", appName => { Cypress.Commands.add("applicationInAppTable", appName => {
cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 })
cy.get(".appTable", { timeout: 30000 }).within(() => { cy.get(".app-table", { timeout: 30000 }).within(() => {
cy.get(".title").contains(appName).should("exist") cy.get(".title").contains(appName).should("exist")
}) })
}) })

View File

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

@ -378,6 +378,7 @@ const getProviderContextBindings = (asset, dataProviders) => {
providerId, providerId,
// Table ID is used by JSON fields to know what table the field is in // Table ID is used by JSON fields to know what table the field is in
tableId: table?._id, tableId: table?._id,
component: component._component,
category: component._instanceName, category: component._instanceName,
icon: def.icon, icon: def.icon,
display: { display: {

View File

@ -10,7 +10,6 @@
} from "@budibase/bbui" } from "@budibase/bbui"
import { tables } from "stores/backend" import { tables } from "stores/backend"
import { Helpers } from "@budibase/bbui" import { Helpers } from "@budibase/bbui"
import { writable } from "svelte/store"
export let save export let save
export let datasource export let datasource
@ -18,41 +17,95 @@
export let fromRelationship = {} export let fromRelationship = {}
export let toRelationship = {} export let toRelationship = {}
export let close export let close
export let selectedFromTable
let originalFromName = fromRelationship.name, const colNotSet = "Please specify a column name"
originalToName = toRelationship.name const relationshipTypes = [
let fromTable, toTable, through, linkTable, tableOptions {
let isManyToMany, isManyToOne, relationshipTypes label: "One to Many",
let errors, valid value: RelationshipTypes.MANY_TO_ONE,
let currentTables = {} },
{
label: "Many to Many",
value: RelationshipTypes.MANY_TO_MANY,
},
]
if (fromRelationship && !fromRelationship.relationshipType) { let originalFromColumnName = toRelationship.name,
fromRelationship.relationshipType = RelationshipTypes.MANY_TO_ONE originalToColumnName = fromRelationship.name
let originalFromTable = plusTables.find(
table => table._id === toRelationship?.tableId
)
let originalToTable = plusTables.find(
table => table._id === fromRelationship?.tableId
)
let tableOptions
let errors = {}
let hasClickedSave = !!fromRelationship.relationshipType
let fromPrimary,
fromForeign,
fromTable,
toTable,
throughTable,
fromColumn,
toColumn
let fromId, toId, throughId, throughToKey, throughFromKey
let isManyToMany, isManyToOne, relationshipType
$: {
if (!fromPrimary) {
fromPrimary = fromRelationship.foreignKey
fromForeign = toRelationship.foreignKey
}
if (!fromColumn && !errors.fromColumn) {
fromColumn = toRelationship.name
}
if (!toColumn && !errors.toColumn) {
toColumn = fromRelationship.name
}
if (!fromId) {
fromId = toRelationship.tableId
}
if (!toId) {
toId = fromRelationship.tableId
}
if (!throughId) {
throughId = fromRelationship.through
throughFromKey = fromRelationship.throughFrom
throughToKey = fromRelationship.throughTo
}
if (!relationshipType) {
relationshipType = fromRelationship.relationshipType
}
} }
if (toRelationship && selectedFromTable) { $: tableOptions = plusTables.map(table => ({
toRelationship.tableId = selectedFromTable._id label: table.name,
} value: table._id,
}))
$: valid = getErrorCount(errors) === 0 || !hasClickedSave
function inSchema(table, prop, ogName) { $: isManyToMany = relationshipType === RelationshipTypes.MANY_TO_MANY
if (!table || !prop || prop === ogName) { $: isManyToOne = relationshipType === RelationshipTypes.MANY_TO_ONE
return false $: fromTable = plusTables.find(table => table._id === fromId)
} $: toTable = plusTables.find(table => table._id === toId)
const keys = Object.keys(table.schema).map(key => key.toLowerCase()) $: throughTable = plusTables.find(table => table._id === throughId)
return keys.indexOf(prop.toLowerCase()) !== -1
}
const touched = writable({}) $: toRelationship.relationshipType = fromRelationship?.relationshipType
function invalidThroughTable({ through, throughTo, throughFrom }) { const getErrorCount = errors =>
Object.entries(errors)
.filter(entry => !!entry[1])
.map(entry => entry[0]).length
function invalidThroughTable() {
// need to know the foreign key columns to check error // need to know the foreign key columns to check error
if (!through || !throughTo || !throughFrom) { if (!throughId || !throughToKey || !throughFromKey) {
return false return false
} }
const throughTable = plusTables.find(tbl => tbl._id === through) const throughTbl = plusTables.find(tbl => tbl._id === throughId)
const otherColumns = Object.values(throughTable.schema).filter( const otherColumns = Object.values(throughTbl.schema).filter(
col => col.name !== throughFrom && col.name !== throughTo col => col.name !== throughFromKey && col.name !== throughToKey
) )
for (let col of otherColumns) { for (let col of otherColumns) {
if (col.constraints?.presence && !col.autocolumn) { if (col.constraints?.presence && !col.autocolumn) {
@ -62,142 +115,134 @@
return false return false
} }
function checkForErrors(fromRelate, toRelate) { function validate() {
const isMany = const isMany = relationshipType === RelationshipTypes.MANY_TO_MANY
fromRelate.relationshipType === RelationshipTypes.MANY_TO_MANY
const tableNotSet = "Please specify a table" const tableNotSet = "Please specify a table"
const foreignKeyNotSet = "Please pick a foreign key"
const errObj = {} const errObj = {}
if ($touched.from && !fromTable) { if (!relationshipType) {
errObj.from = tableNotSet errObj.relationshipType = "Please specify a relationship type"
} }
if ($touched.to && !toTable) { if (!fromTable) {
errObj.to = tableNotSet errObj.fromTable = tableNotSet
} }
if ($touched.through && isMany && !fromRelate.through) { if (!toTable) {
errObj.through = tableNotSet errObj.toTable = tableNotSet
} }
if ($touched.through && invalidThroughTable(fromRelate)) { if (isMany && !throughTable) {
errObj.through = errObj.throughTable = tableNotSet
"Ensure all columns in table are nullable or auto generated"
} }
if ($touched.foreign && !isMany && !fromRelate.fieldName) { if (isMany && !throughFromKey) {
errObj.foreign = "Please pick the foreign key" errObj.throughFromKey = foreignKeyNotSet
} }
const colNotSet = "Please specify a column name" if (isMany && !throughToKey) {
if ($touched.fromCol && !fromRelate.name) { errObj.throughToKey = foreignKeyNotSet
errObj.fromCol = colNotSet
} }
if ($touched.toCol && !toRelate.name) { if (invalidThroughTable()) {
errObj.toCol = colNotSet errObj.throughTable =
"Ensure non-key columns are nullable or auto-generated"
} }
if ($touched.primary && !fromPrimary) { if (!isMany && !fromForeign) {
errObj.primary = "Please pick the primary key" errObj.fromForeign = foreignKeyNotSet
} }
if (!fromColumn) {
errObj.fromColumn = colNotSet
}
if (!toColumn) {
errObj.toColumn = colNotSet
}
if (!isMany && !fromPrimary) {
errObj.fromPrimary = "Please pick the primary key"
}
// currently don't support relationships back onto the table itself, needs to relate out // currently don't support relationships back onto the table itself, needs to relate out
const tableError = "From/to/through tables must be different" const tableError = "From/to/through tables must be different"
if (fromTable && (fromTable === toTable || fromTable === through)) { if (fromTable && (fromTable === toTable || fromTable === throughTable)) {
errObj.from = tableError errObj.fromTable = tableError
} }
if (toTable && (toTable === fromTable || toTable === through)) { if (toTable && (toTable === fromTable || toTable === throughTable)) {
errObj.to = tableError errObj.toTable = tableError
} }
if (through && (through === fromTable || through === toTable)) { if (
errObj.through = tableError throughTable &&
(throughTable === fromTable || throughTable === toTable)
) {
errObj.throughTable = tableError
} }
const colError = "Column name cannot be an existing column" const colError = "Column name cannot be an existing column"
if (inSchema(fromTable, fromRelate.name, originalFromName)) { if (isColumnNameBeingUsed(toTable, fromColumn, originalFromColumnName)) {
errObj.fromCol = colError errObj.fromColumn = colError
} }
if (inSchema(toTable, toRelate.name, originalToName)) { if (isColumnNameBeingUsed(fromTable, toColumn, originalToColumnName)) {
errObj.toCol = colError errObj.toColumn = colError
} }
let fromType, toType let fromType, toType
if (fromPrimary && fromRelate.fieldName) { if (fromPrimary && fromForeign) {
fromType = fromTable?.schema[fromPrimary]?.type fromType = fromTable?.schema[fromPrimary]?.type
toType = toTable?.schema[fromRelate.fieldName]?.type toType = toTable?.schema[fromForeign]?.type
} }
if (fromType && toType && fromType !== toType) { if (fromType && toType && fromType !== toType) {
errObj.foreign = errObj.fromForeign =
"Column type of the foreign key must match the primary key" "Column type of the foreign key must match the primary key"
} }
errors = errObj errors = errObj
return getErrorCount(errors) === 0
} }
let fromPrimary function isColumnNameBeingUsed(table, columnName, originalName) {
$: { if (!table || !columnName || columnName === originalName) {
if (!fromPrimary && fromTable) { return false
fromPrimary = fromTable.primary[0]
}
}
$: isManyToMany =
fromRelationship?.relationshipType === RelationshipTypes.MANY_TO_MANY
$: isManyToOne =
fromRelationship?.relationshipType === RelationshipTypes.MANY_TO_ONE
$: tableOptions = plusTables.map(table => ({
label: table.name,
value: table._id,
}))
$: fromTable = plusTables.find(table => table._id === toRelationship?.tableId)
$: toTable = plusTables.find(table => table._id === fromRelationship?.tableId)
$: through = plusTables.find(table => table._id === fromRelationship?.through)
$: checkForErrors(fromRelationship, toRelationship)
$: valid =
Object.keys(errors).length === 0 && Object.keys($touched).length !== 0
$: linkTable = through || toTable
$: relationshipTypes = [
{
label: "Many",
value: RelationshipTypes.MANY_TO_MANY,
},
{
label: "One",
value: RelationshipTypes.MANY_TO_ONE,
},
]
$: updateRelationshipType(fromRelationship?.relationshipType)
$: tableChanged(fromTable, toTable)
function updateRelationshipType(fromType) {
if (fromType === RelationshipTypes.MANY_TO_MANY) {
toRelationship.relationshipType = RelationshipTypes.MANY_TO_MANY
} else {
toRelationship.relationshipType = RelationshipTypes.MANY_TO_ONE
} }
const keys = Object.keys(table.schema).map(key => key.toLowerCase())
return keys.indexOf(columnName.toLowerCase()) !== -1
} }
function buildRelationships() { function buildRelationships() {
// if any to many only need to check from
const manyToMany =
fromRelationship.relationshipType === RelationshipTypes.MANY_TO_MANY
// main is simply used to know this is the side the user configured it from
const id = Helpers.uuid() const id = Helpers.uuid()
if (!manyToMany) { //Map temporary variables
delete fromRelationship.through
delete toRelationship.through
}
let relateFrom = { let relateFrom = {
...fromRelationship, ...fromRelationship,
tableId: toId,
name: toColumn,
relationshipType,
fieldName: fromForeign,
through: throughId,
throughFrom: throughFromKey,
throughTo: throughToKey,
type: "link", type: "link",
main: true, main: true,
_id: id, _id: id,
} }
let relateTo = { let relateTo = (toRelationship = {
...toRelationship, ...toRelationship,
tableId: fromId,
name: fromColumn,
through: throughId,
type: "link", type: "link",
_id: id, _id: id,
})
// if any to many only need to check from
const manyToMany =
relateFrom.relationshipType === RelationshipTypes.MANY_TO_MANY
if (!manyToMany) {
delete relateFrom.through
delete relateTo.through
} }
// [0] is because we don't support composite keys for relationships right now // [0] is because we don't support composite keys for relationships right now
if (manyToMany) { if (manyToMany) {
relateFrom = { relateFrom = {
...relateFrom, ...relateFrom,
through: through._id, through: throughTable._id,
fieldName: toTable.primary[0], fieldName: toTable.primary[0],
} }
relateTo = { relateTo = {
...relateTo, ...relateTo,
through: through._id, through: throughTable._id,
fieldName: fromTable.primary[0], fieldName: fromTable.primary[0],
throughFrom: relateFrom.throughTo, throughFrom: relateFrom.throughTo,
throughTo: relateFrom.throughFrom, throughTo: relateFrom.throughFrom,
@ -226,9 +271,27 @@
toRelationship = relateTo toRelationship = relateTo
} }
// save the relationship on to the datasource function removeExistingRelationship() {
if (originalFromTable && originalFromColumnName) {
delete datasource.entities[originalFromTable.name].schema[
originalToColumnName
]
}
if (originalToTable && originalToColumnName) {
delete datasource.entities[originalToTable.name].schema[
originalFromColumnName
]
}
}
async function saveRelationship() { async function saveRelationship() {
hasClickedSave = true
if (!validate()) {
return false
}
buildRelationships() buildRelationships()
removeExistingRelationship()
// source of relationship // source of relationship
datasource.entities[fromTable.name].schema[fromRelationship.name] = datasource.entities[fromTable.name].schema[fromRelationship.name] =
fromRelationship fromRelationship
@ -236,43 +299,14 @@
datasource.entities[toTable.name].schema[toRelationship.name] = datasource.entities[toTable.name].schema[toRelationship.name] =
toRelationship toRelationship
// If relationship has been renamed
if (originalFromName !== fromRelationship.name) {
delete datasource.entities[fromTable.name].schema[originalFromName]
}
if (originalToName !== toRelationship.name) {
delete datasource.entities[toTable.name].schema[originalToName]
}
// store the original names so it won't cause an error
originalToName = toRelationship.name
originalFromName = fromRelationship.name
await save() await save()
} }
async function deleteRelationship() { async function deleteRelationship() {
delete datasource.entities[fromTable.name].schema[fromRelationship.name] removeExistingRelationship()
delete datasource.entities[toTable.name].schema[toRelationship.name]
await save() await save()
await tables.fetch() await tables.fetch()
close() close()
} }
function tableChanged(fromTbl, toTbl) {
if (
(currentTables?.from?._id === fromTbl?._id &&
currentTables?.to?._id === toTbl?._id) ||
originalFromName ||
originalToName
) {
return
}
fromRelationship.name = toTbl?.name || ""
errors.fromCol = ""
toRelationship.name = fromTbl?.name || ""
errors.toCol = ""
currentTables = { from: fromTbl, to: toTbl }
}
</script> </script>
<ModalContent <ModalContent
@ -284,7 +318,9 @@
<Select <Select
label="Relationship type" label="Relationship type"
options={relationshipTypes} options={relationshipTypes}
bind:value={fromRelationship.relationshipType} bind:value={relationshipType}
bind:error={errors.relationshipType}
on:change={() => (errors.relationshipType = null)}
/> />
<div class="headings"> <div class="headings">
<Detail>Tables</Detail> <Detail>Tables</Detail>
@ -292,58 +328,74 @@
<Select <Select
label="Select from table" label="Select from table"
options={tableOptions} options={tableOptions}
disabled={!!selectedFromTable} bind:value={fromId}
on:change={() => ($touched.from = true)} bind:error={errors.fromTable}
bind:error={errors.from} on:change={e => {
bind:value={toRelationship.tableId} fromColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
errors.fromTable = null
errors.fromColumn = null
}}
/> />
{#if isManyToOne && fromTable} {#if isManyToOne && fromTable}
<Select <Select
label={`Primary Key (${fromTable?.name})`} label={`Primary Key (${fromTable.name})`}
options={Object.keys(fromTable?.schema)} options={Object.keys(fromTable.schema)}
on:change={() => ($touched.primary = true)}
bind:error={errors.primary}
bind:value={fromPrimary} bind:value={fromPrimary}
bind:error={errors.fromPrimary}
on:change={() => (errors.fromPrimary = null)}
/> />
{/if} {/if}
<Select <Select
label={"Select to table"} label={"Select to table"}
options={tableOptions} options={tableOptions}
on:change={() => ($touched.to = true)} bind:value={toId}
bind:error={errors.to} bind:error={errors.toTable}
bind:value={fromRelationship.tableId} on:change={e => {
toColumn = tableOptions.find(opt => opt.value === e.detail)?.label || ""
errors.toTable = null
errors.toColumn = null
}}
/> />
{#if isManyToMany} {#if isManyToMany}
<Select <Select
label={"Through"} label={"Through"}
options={tableOptions} options={tableOptions}
on:change={() => ($touched.through = true)} bind:value={throughId}
bind:error={errors.through} bind:error={errors.throughTable}
bind:value={fromRelationship.through}
/> />
{#if fromTable && toTable && through} {#if fromTable && toTable && throughTable}
<Select <Select
label={`Foreign Key (${fromTable?.name})`} label={`Foreign Key (${fromTable?.name})`}
options={Object.keys(through?.schema)} options={Object.keys(throughTable?.schema)}
on:change={() => ($touched.fromForeign = true)} bind:value={throughToKey}
bind:error={errors.fromForeign} bind:error={errors.throughToKey}
bind:value={fromRelationship.throughTo} on:change={e => {
if (throughFromKey === e.detail) {
throughFromKey = null
}
errors.throughToKey = null
}}
/> />
<Select <Select
label={`Foreign Key (${toTable?.name})`} label={`Foreign Key (${toTable?.name})`}
options={Object.keys(through?.schema)} options={Object.keys(throughTable?.schema)}
on:change={() => ($touched.toForeign = true)} bind:value={throughFromKey}
bind:error={errors.toForeign} bind:error={errors.throughFromKey}
bind:value={fromRelationship.throughFrom} on:change={e => {
if (throughToKey === e.detail) {
throughToKey = null
}
errors.throughFromKey = null
}}
/> />
{/if} {/if}
{:else if isManyToOne && toTable} {:else if isManyToOne && toTable}
<Select <Select
label={`Foreign Key (${toTable?.name})`} label={`Foreign Key (${toTable?.name})`}
options={Object.keys(toTable?.schema)} options={Object.keys(toTable?.schema)}
on:change={() => ($touched.foreign = true)} bind:value={fromForeign}
bind:error={errors.foreign} bind:error={errors.fromForeign}
bind:value={fromRelationship.fieldName} on:change={() => (errors.fromForeign = null)}
/> />
{/if} {/if}
<div class="headings"> <div class="headings">
@ -354,19 +406,21 @@
provide a name for these columns. provide a name for these columns.
</Body> </Body>
<Input <Input
on:blur={() => ($touched.fromCol = true)}
bind:error={errors.fromCol}
label="From table column" label="From table column"
bind:value={fromRelationship.name} bind:value={fromColumn}
bind:error={errors.fromColumn}
on:change={e => {
errors.fromColumn = e.detail?.length > 0 ? null : colNotSet
}}
/> />
<Input <Input
on:blur={() => ($touched.toCol = true)}
bind:error={errors.toCol}
label="To table column" label="To table column"
bind:value={toRelationship.name} bind:value={toColumn}
bind:error={errors.toColumn}
on:change={e => (errors.toColumn = e.detail?.length > 0 ? null : colNotSet)}
/> />
<div slot="footer"> <div slot="footer">
{#if originalFromName != null} {#if originalFromColumnName != null}
<Button warning text on:click={deleteRelationship}>Delete</Button> <Button warning text on:click={deleteRelationship}>Delete</Button>
{/if} {/if}
</div> </div>

View File

@ -70,7 +70,10 @@
type: "provider", type: "provider",
})) }))
$: links = bindings $: links = bindings
// Get only link bindings
.filter(x => x.fieldSchema?.type === "link") .filter(x => x.fieldSchema?.type === "link")
// Filter out bindings provided by forms
.filter(x => !x.component?.endsWith("/form"))
.map(binding => { .map(binding => {
const { providerId, readableBinding, fieldSchema } = binding || {} const { providerId, readableBinding, fieldSchema } = binding || {}
const { name, tableId } = fieldSchema || {} const { name, tableId } = fieldSchema || {}

View File

@ -176,7 +176,6 @@
const addComponent = async component => { const addComponent = async component => {
try { try {
await store.actions.components.create(component) await store.actions.components.create(component)
$goto("../")
} catch (error) { } catch (error) {
notifications.error(error || "Error creating component") notifications.error(error || "Error creating component")
} }

View File

@ -7,6 +7,7 @@
{#if $admin.cloud && $auth?.user?.accountPortalAccess} {#if $admin.cloud && $auth?.user?.accountPortalAccess}
<Button <Button
cta cta
size="S"
on:click on:click
on:click={() => { on:click={() => {
$goto($admin.accountPortalUrl + "/portal/upgrade") $goto($admin.accountPortalUrl + "/portal/upgrade")

View File

@ -26,9 +26,6 @@
<Avatar size="M" initials={$auth.initials} url={$auth.user.pictureUrl} /> <Avatar size="M" initials={$auth.initials} url={$auth.user.pictureUrl} />
<Icon size="XL" name="ChevronDown" /> <Icon size="XL" name="ChevronDown" />
</div> </div>
<MenuItem icon="Moon" on:click={() => themeModal.show()} dataCy="theme">
Theme
</MenuItem>
<MenuItem <MenuItem
icon="UserEdit" icon="UserEdit"
on:click={() => profileModal.show()} on:click={() => profileModal.show()}
@ -36,6 +33,9 @@
> >
My profile My profile
</MenuItem> </MenuItem>
<MenuItem icon="Moon" on:click={() => themeModal.show()} dataCy="theme">
Theme
</MenuItem>
<MenuItem icon="LockClosed" on:click={() => updatePasswordModal.show()}> <MenuItem icon="LockClosed" on:click={() => updatePasswordModal.show()}>
Update password Update password
</MenuItem> </MenuItem>

View File

@ -172,6 +172,8 @@
delete element.createdAt delete element.createdAt
delete element.updatedAt delete element.updatedAt
const { activated } = element.config
if (element.type === ConfigTypes.OIDC) { if (element.type === ConfigTypes.OIDC) {
// Add a UUID here so each config is distinguishable when it arrives at the login page // Add a UUID here so each config is distinguishable when it arrives at the login page
for (let config of element.config.configs) { for (let config of element.config.configs) {
@ -181,32 +183,28 @@
// Callback urls shouldn't be included // Callback urls shouldn't be included
delete config.callbackURL delete config.callbackURL
} }
if (partialOidc) { if ((partialOidc || activated) && !oidcComplete) {
if (!oidcComplete) {
notifications.error( notifications.error(
`Please fill in all required ${ConfigTypes.OIDC} fields` `Please fill in all required ${ConfigTypes.OIDC} fields`
) )
} else { } else if (oidcComplete || !activated) {
calls.push(API.saveConfig(element)) calls.push(API.saveConfig(element))
// Turn the save button grey when clicked // Turn the save button grey when clicked
oidcSaveButtonDisabled = true oidcSaveButtonDisabled = true
originalOidcDoc = cloneDeep(providers.oidc) originalOidcDoc = cloneDeep(providers.oidc)
} }
} }
}
if (element.type === ConfigTypes.Google) { if (element.type === ConfigTypes.Google) {
if (partialGoogle) { if ((partialGoogle || activated) && !googleComplete) {
if (!googleComplete) {
notifications.error( notifications.error(
`Please fill in all required ${ConfigTypes.Google} fields` `Please fill in all required ${ConfigTypes.Google} fields`
) )
} else { } else if (googleComplete || !activated) {
calls.push(API.saveConfig(element)) calls.push(API.saveConfig(element))
googleSaveButtonDisabled = true googleSaveButtonDisabled = true
originalGoogleDoc = cloneDeep(providers.google) originalGoogleDoc = cloneDeep(providers.google)
} }
} }
}
}) })
if (calls.length) { if (calls.length) {
Promise.all(calls) Promise.all(calls)

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": {
@ -26,9 +26,9 @@
"outputPath": "build" "outputPath": "build"
}, },
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.2.12-alpha.22", "@budibase/backend-core": "2.2.12-alpha.32",
"@budibase/string-templates": "2.2.12-alpha.22", "@budibase/string-templates": "2.2.12-alpha.32",
"@budibase/types": "2.2.12-alpha.22", "@budibase/types": "2.2.12-alpha.32",
"axios": "0.21.2", "axios": "0.21.2",
"chalk": "4.1.0", "chalk": "4.1.0",
"cli-progress": "3.11.2", "cli-progress": "3.11.2",

View File

@ -4019,7 +4019,8 @@
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
"key": "filter" "key": "filter",
"nested": true
}, },
{ {
"type": "field", "type": "field",
@ -4535,7 +4536,8 @@
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
"key": "filter" "key": "filter",
"nested": true
}, },
{ {
"type": "searchfield", "type": "searchfield",
@ -4665,7 +4667,8 @@
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
"key": "filter" "key": "filter",
"nested": true
}, },
{ {
"type": "field/sortable", "type": "field/sortable",
@ -4831,7 +4834,8 @@
{ {
"type": "filter", "type": "filter",
"label": "Filtering", "label": "Filtering",
"key": "filter" "key": "filter",
"nested": true
}, },
{ {
"type": "field/sortable", "type": "field/sortable",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": "2.2.12-alpha.22", "@budibase/bbui": "2.2.12-alpha.32",
"@budibase/frontend-core": "2.2.12-alpha.22", "@budibase/frontend-core": "2.2.12-alpha.32",
"@budibase/string-templates": "2.2.12-alpha.22", "@budibase/string-templates": "2.2.12-alpha.32",
"@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

@ -38,7 +38,7 @@
...$component.styles?.normal, ...$component.styles?.normal,
}, },
custom: custom:
definition._styles?.custom || "" + $component.styles?.custom || "", (definition._styles?.custom || "") + ($component.styles?.custom || ""),
} }
// Create component tree // Create component tree

View File

@ -1,5 +1,9 @@
<script> <script>
import { themeStore } from "stores" import { themeStore } from "stores"
import { setContext } from "svelte"
import { Context } from "@budibase/bbui"
setContext(Context.PopoverRoot, "#theme-root")
</script> </script>
<div style={$themeStore.customThemeCss} id="theme-root"> <div style={$themeStore.customThemeCss} id="theme-root">

View File

@ -36,9 +36,12 @@
let dataProviderId let dataProviderId
let repeaterId let repeaterId
let schema let schema
let enrichedSearchColumns
$: fetchSchema(dataSource) $: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema) $: enrichSearchColumns(searchColumns, schema).then(
val => (enrichedSearchColumns = val)
)
$: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId) $: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId)
$: cardWidth = cardHorizontal ? 420 : 300 $: cardWidth = cardHorizontal ? 420 : 300
$: fullCardURL = buildFullCardUrl( $: fullCardURL = buildFullCardUrl(

View File

@ -36,9 +36,12 @@
let newRowSidePanelId let newRowSidePanelId
let schema let schema
let primaryDisplay let primaryDisplay
let enrichedSearchColumns
$: fetchSchema(dataSource) $: fetchSchema(dataSource)
$: enrichedSearchColumns = enrichSearchColumns(searchColumns, schema) $: enrichSearchColumns(searchColumns, schema).then(
val => (enrichedSearchColumns = val)
)
$: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId) $: enrichedFilter = enrichFilter(filter, enrichedSearchColumns, formId)
$: editTitle = getEditTitle(detailsFormBlockId, primaryDisplay) $: editTitle = getEditTitle(detailsFormBlockId, primaryDisplay)
$: normalFields = getNormalFields(schema) $: normalFields = getNormalFields(schema)

View File

@ -24,6 +24,11 @@
let table let table
$: fetchSchema(dataSource) $: fetchSchema(dataSource)
$: schemaKey = generateSchemaKey(schema)
$: initialValues = getInitialValues(actionType, dataSource, $context)
$: resetKey = Helpers.hashString(
schemaKey + JSON.stringify(initialValues) + disabled
)
// Returns the closes data context which isn't a built in context // Returns the closes data context which isn't a built in context
const getInitialValues = (type, dataSource, context) => { const getInitialValues = (type, dataSource, context) => {
@ -57,13 +62,17 @@
schema = res || {} schema = res || {}
} }
$: initialValues = getInitialValues(actionType, dataSource, $context) // Generates a predictable string that uniquely identifies a schema. We can't
$: resetKey = Helpers.hashString( // simply stringify the whole schema as there are array fields which have
!!schema + // random order.
JSON.stringify(initialValues) + const generateSchemaKey = schema => {
JSON.stringify(dataSource) + if (!schema) {
disabled return null
) }
const fields = Object.keys(schema)
fields.sort()
return fields.map(field => `${field}:${schema[field].type}`).join("-")
}
</script> </script>
{#key resetKey} {#key resetKey}

View File

@ -1,4 +1,5 @@
import { makePropSafe as safe } from "@budibase/string-templates" import { makePropSafe as safe } from "@budibase/string-templates"
import { API } from "../api/index.js"
// Map of data types to component types for search fields inside blocks // Map of data types to component types for search fields inside blocks
const schemaComponentMap = { const schemaComponentMap = {
@ -15,10 +16,28 @@ const schemaComponentMap = {
* @param searchColumns the search columns to use * @param searchColumns the search columns to use
* @param schema the datasource schema * @param schema the datasource schema
*/ */
export const enrichSearchColumns = (searchColumns, schema) => { export const enrichSearchColumns = async (searchColumns, schema) => {
if (!searchColumns?.length || !schema) {
return []
}
let enrichedColumns = [] let enrichedColumns = []
searchColumns?.forEach(column => { for (let column of searchColumns) {
const schemaType = schema?.[column]?.type let schemaType = schema[column]?.type
// Check if this is a field in another related table. The only way we can
// check this is checking for a "." inside the column, then checking if we
// have a link field named the same as that field prefix.
if (column.includes(".")) {
const split = column.split(".")
const sourceField = split[0]
const linkField = split.slice(1).join(".")
const linkSchema = schema[sourceField]
if (linkSchema?.type === "link") {
const linkedDef = await API.fetchTableDefinition(linkSchema.tableId)
schemaType = linkedDef?.schema?.[linkField]?.type
}
}
const componentType = schemaComponentMap[schemaType] const componentType = schemaComponentMap[schemaType]
if (componentType) { if (componentType) {
enrichedColumns.push({ enrichedColumns.push({
@ -27,7 +46,7 @@ export const enrichSearchColumns = (searchColumns, schema) => {
type: schemaType, type: schemaType,
}) })
} }
}) }
return enrichedColumns.slice(0, 5) return enrichedColumns.slice(0, 5)
} }
@ -57,12 +76,14 @@ export const enrichFilter = (filter, columns, formId) => {
value: `{{ ${binding} }}`, value: `{{ ${binding} }}`,
}) })
const format = "YYYY-MM-DDTHH:mm:ss.SSSZ" const format = "YYYY-MM-DDTHH:mm:ss.SSSZ"
let hbs = `{{ date (add (date ${binding} "x") 86399999) "${format}" }}`
hbs = `{{#if ${binding} }}${hbs}{{/if}}`
enrichedFilter.push({ enrichedFilter.push({
field: column.name, field: column.name,
type: column.type, type: column.type,
operator: "rangeHigh", operator: "rangeHigh",
valueType: "Binding", valueType: "Binding",
value: `{{ date (add (date ${binding} "x") 86399999) "${format}" }}`, value: hbs,
}) })
} }

View File

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": "2.2.12-alpha.22", "@budibase/bbui": "2.2.12-alpha.32",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View File

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

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -43,11 +43,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": "2.2.12-alpha.22", "@budibase/backend-core": "2.2.12-alpha.32",
"@budibase/client": "2.2.12-alpha.22", "@budibase/client": "2.2.12-alpha.32",
"@budibase/pro": "2.2.12-alpha.22", "@budibase/pro": "2.2.12-alpha.32",
"@budibase/string-templates": "2.2.12-alpha.22", "@budibase/string-templates": "2.2.12-alpha.32",
"@budibase/types": "2.2.12-alpha.22", "@budibase/types": "2.2.12-alpha.32",
"@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",
@ -77,7 +77,7 @@
"joi": "17.6.0", "joi": "17.6.0",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"jsonschema": "1.4.0", "jsonschema": "1.4.0",
"knex": "0.95.15", "knex": "2.4.0",
"koa": "2.13.4", "koa": "2.13.4",
"koa-body": "4.2.0", "koa-body": "4.2.0",
"koa-compress": "4.0.1", "koa-compress": "4.0.1",

View File

@ -681,6 +681,12 @@ export class ExternalRequest {
config, config,
table table
) )
//if the sort column is a formula, remove it
for (let sortColumn of Object.keys(sort || {})) {
if (table.schema[sortColumn]?.type === "formula") {
delete sort?.[sortColumn]
}
}
filters = buildFilters(id, filters || {}, table) filters = buildFilters(id, filters || {}, table)
const relationships = this.buildRelationships(table) const relationships = this.buildRelationships(table)
// clean up row on ingress using schema // clean up row on ingress using schema

View File

@ -1273,13 +1273,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.2.12-alpha.22": "@budibase/backend-core@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.22.tgz#120ee25139f88e3b7f96355b4fe5b7ca2ccff5f4" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.32.tgz#5d53fdde38e80fdade73c59cb81623041984a5fc"
integrity sha512-rhQ7fHneJKo5qKWrSwSX0Ud4xcCbv5qg7fNr2AqxClEpkNbY9DH8YZn9C9yDyvpQj/UM39jvUiwnN2lrKi8b4A== integrity sha512-XoaqGrttx01wlblI0+O23R9uS5FTMgK07juY6mUkdReCK46IvmG7FFnuYu0euKVRbhChSf5X8S+fvKIAEi1ZFw==
dependencies: dependencies:
"@budibase/nano" "10.1.1" "@budibase/nano" "10.1.1"
"@budibase/types" "2.2.12-alpha.22" "@budibase/types" "2.2.12-alpha.32"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0" aws-cloudfront-sign "2.2.0"
@ -1374,13 +1374,13 @@
qs "^6.11.0" qs "^6.11.0"
tough-cookie "^4.1.2" tough-cookie "^4.1.2"
"@budibase/pro@2.2.12-alpha.22": "@budibase/pro@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.22.tgz#5ffe51546b7ec1b685c954ae111792b66f1d9653" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.32.tgz#4f35b0ada97458cc69ee41ebb40d56b361518065"
integrity sha512-zFZC37mOMgY9c1nnFlWyDpkP2RT4nKbC6z/oobed7P5yjykc8LZGTOpVz7RZE0eRa1+S4pGrjw1wFRM/TUFvFw== integrity sha512-Kn/IahgIb9Ydzmasv4Bhlh3rvyAC2tBVSoI33OZ/6PKF0vPYJNJkFds3iGELNV7SyWoLbVWb2z5SQ4SSaOYsJw==
dependencies: dependencies:
"@budibase/backend-core" "2.2.12-alpha.22" "@budibase/backend-core" "2.2.12-alpha.32"
"@budibase/types" "2.2.12-alpha.22" "@budibase/types" "2.2.12-alpha.32"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
bull "4.10.1" bull "4.10.1"
joi "17.6.0" joi "17.6.0"
@ -1405,10 +1405,10 @@
svelte-apexcharts "^1.0.2" svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0" svelte-flatpickr "^3.1.0"
"@budibase/types@2.2.12-alpha.22": "@budibase/types@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.22.tgz#b34026ec0176482c9e93431f4db25442f48e933f" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.32.tgz#71af8e8cff66acbfd65aa87e66183dd95d76ce6f"
integrity sha512-wCFfD0Awa+RNUJmHYS4Iuhpj6zRPvNIlFMvgOnZes+tIbvLjmOF+9cuDY11qea6pLoG2i+T5Z4NaDv7xn5ATMQ== integrity sha512-ZZwmO+0ORGEFbU/EQvtnjo1VonUbBdsciFkTOiopVupU5iNY2oCKgbYTQiTZZisQrRuiKdPV6P17uV+YTkjQSQ==
"@bull-board/api@3.7.0": "@bull-board/api@3.7.0":
version "3.7.0" version "3.7.0"
@ -5301,15 +5301,10 @@ color@^3.1.3:
color-convert "^1.9.3" color-convert "^1.9.3"
color-string "^1.6.0" color-string "^1.6.0"
colorette@2.0.16: colorette@2.0.19, colorette@^2.0.14:
version "2.0.16" version "2.0.19"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.16.tgz#713b9af84fdb000139f04546bd4a93f62a5085da" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
integrity sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g== integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==
colorette@^2.0.14:
version "2.0.17"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.17.tgz#5dd4c0d15e2984b7433cb4a9f2ead45063b80c47"
integrity sha512-hJo+3Bkn0NCHybn9Tu35fIeoOKGOk5OCC32y4Hz2It+qlCO2Q3DeQ1hRn/tDDMQKRYUEzqsl7jbF6dYKjlE60g==
colorspace@1.1.x: colorspace@1.1.x:
version "1.1.4" version "1.1.4"
@ -5346,7 +5341,7 @@ commander@^5.1.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
commander@^7.0.0, commander@^7.1.0: commander@^7.0.0:
version "7.2.0" version "7.2.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7"
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==
@ -5356,6 +5351,11 @@ commander@^8.3.0:
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
commander@^9.1.0:
version "9.5.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30"
integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==
commoner@^0.10.1: commoner@^0.10.1:
version "0.10.8" version "0.10.8"
resolved "https://registry.yarnpkg.com/commoner/-/commoner-0.10.8.tgz#34fc3672cd24393e8bb47e70caa0293811f4f2c5" resolved "https://registry.yarnpkg.com/commoner/-/commoner-0.10.8.tgz#34fc3672cd24393e8bb47e70caa0293811f4f2c5"
@ -5659,20 +5659,13 @@ dayjs@^1.10.4, dayjs@^1.10.5:
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258"
integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A== integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A==
debug@4, debug@^4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: debug@4, debug@4.3.4, debug@^4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2:
version "4.3.4" version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
dependencies: dependencies:
ms "2.1.2" ms "2.1.2"
debug@4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"
debug@^2.2.0, debug@^2.3.3: debug@^2.2.0, debug@^2.3.3:
version "2.6.9" version "2.6.9"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
@ -7441,10 +7434,10 @@ get-value@^2.0.3, get-value@^2.0.6:
resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28"
integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA== integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==
getopts@2.2.5: getopts@2.3.0:
version "2.2.5" version "2.3.0"
resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.2.5.tgz#67a0fe471cacb9c687d817cab6450b96dde8313b" resolved "https://registry.yarnpkg.com/getopts/-/getopts-2.3.0.tgz#71e5593284807e03e2427449d4f6712a268666f4"
integrity sha512-9jb7AW5p3in+IiJWhQiZmmwkpLaR/ccTWdWQCtZM66HJcHHLegowh4q4tSD7gouUyeNvFWRavfK9GXosQHDpFA== integrity sha512-5eDf9fuSXwxBL6q5HX+dhDj+dslFGWzU5thZ9kNKUkcPtaPdatmUFKwHFrLb/uf/WpA4BHET+AX3Scl56cAjpA==
getpass@^0.1.1: getpass@^0.1.1:
version "0.1.7" version "0.1.7"
@ -9825,23 +9818,24 @@ kleur@^3.0.3:
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==
knex@0.95.15: knex@2.4.0:
version "0.95.15" version "2.4.0"
resolved "https://registry.yarnpkg.com/knex/-/knex-0.95.15.tgz#39d7e7110a6e2ad7de5d673d2dea94143015e0e7" resolved "https://registry.yarnpkg.com/knex/-/knex-2.4.0.tgz#7d33cc36f320cdac98741010544b4c6a98b8b19e"
integrity sha512-Loq6WgHaWlmL2bfZGWPsy4l8xw4pOE+tmLGkPG0auBppxpI0UcK+GYCycJcqz9W54f2LiGewkCVLBm3Wq4ur/w== integrity sha512-i0GWwqYp1Hs2yvc2rlDO6nzzkLhwdyOZKRdsMTB8ZxOs2IXQyL5rBjSbS1krowCh6V65T4X9CJaKtuIfkaPGSA==
dependencies: dependencies:
colorette "2.0.16" colorette "2.0.19"
commander "^7.1.0" commander "^9.1.0"
debug "4.3.2" debug "4.3.4"
escalade "^3.1.1" escalade "^3.1.1"
esm "^3.2.25" esm "^3.2.25"
getopts "2.2.5" get-package-type "^0.1.0"
getopts "2.3.0"
interpret "^2.2.0" interpret "^2.2.0"
lodash "^4.17.21" lodash "^4.17.21"
pg-connection-string "2.5.0" pg-connection-string "2.5.0"
rechoir "0.7.0" rechoir "^0.8.0"
resolve-from "^5.0.0" resolve-from "^5.0.0"
tarn "^3.0.1" tarn "^3.0.2"
tildify "2.0.0" tildify "2.0.0"
koa-body@4.2.0: koa-body@4.2.0:
@ -12561,13 +12555,6 @@ recast@^0.11.17:
private "~0.1.5" private "~0.1.5"
source-map "~0.5.0" source-map "~0.5.0"
rechoir@0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.0.tgz#32650fd52c21ab252aa5d65b19310441c7e03aca"
integrity sha512-ADsDEH2bvbjltXEP+hTIAmeFekTFK0V2BTxMkok6qILyAJEXV0AFfoWcAq4yfll5VdIMd/RVXq0lR+wQi5ZU3Q==
dependencies:
resolve "^1.9.0"
rechoir@^0.7.0: rechoir@^0.7.0:
version "0.7.1" version "0.7.1"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.7.1.tgz#9478a96a1ca135b5e88fc027f03ee92d6c645686"
@ -12575,6 +12562,13 @@ rechoir@^0.7.0:
dependencies: dependencies:
resolve "^1.9.0" resolve "^1.9.0"
rechoir@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.8.0.tgz#49f866e0d32146142da3ad8f0eff352b3215ff22"
integrity sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==
dependencies:
resolve "^1.20.0"
redis-commands@1.7.0, redis-commands@^1.7.0: redis-commands@1.7.0, redis-commands@^1.7.0:
version "1.7.0" version "1.7.0"
resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89" resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89"
@ -14051,7 +14045,7 @@ tarn@^1.1.5:
resolved "https://registry.yarnpkg.com/tarn/-/tarn-1.1.5.tgz#7be88622e951738b9fa3fb77477309242cdddc2d" resolved "https://registry.yarnpkg.com/tarn/-/tarn-1.1.5.tgz#7be88622e951738b9fa3fb77477309242cdddc2d"
integrity sha512-PMtJ3HCLAZeedWjJPgGnCvcphbCOMbtZpjKgLq3qM5Qq9aQud+XHrL0WlrlgnTyS8U+jrjGbEXprFcQrxPy52g== integrity sha512-PMtJ3HCLAZeedWjJPgGnCvcphbCOMbtZpjKgLq3qM5Qq9aQud+XHrL0WlrlgnTyS8U+jrjGbEXprFcQrxPy52g==
tarn@^3.0.1: tarn@^3.0.2:
version "3.0.2" version "3.0.2"
resolved "https://registry.yarnpkg.com/tarn/-/tarn-3.0.2.tgz#73b6140fbb881b71559c4f8bfde3d9a4b3d27693" resolved "https://registry.yarnpkg.com/tarn/-/tarn-3.0.2.tgz#73b6140fbb881b71559c4f8bfde3d9a4b3d27693"
integrity sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ== integrity sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"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": "2.2.12-alpha.22", "version": "2.2.12-alpha.32",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -36,10 +36,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.2.12-alpha.22", "@budibase/backend-core": "2.2.12-alpha.32",
"@budibase/pro": "2.2.12-alpha.22", "@budibase/pro": "2.2.12-alpha.32",
"@budibase/string-templates": "2.2.12-alpha.22", "@budibase/string-templates": "2.2.12-alpha.32",
"@budibase/types": "2.2.12-alpha.22", "@budibase/types": "2.2.12-alpha.32",
"@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

@ -34,8 +34,8 @@ function settingValidation() {
function googleValidation() { function googleValidation() {
// prettier-ignore // prettier-ignore
return Joi.object({ return Joi.object({
clientID: Joi.string().required(), clientID: Joi.when('activated', { is: true, then: Joi.string().required() }),
clientSecret: Joi.string().required(), clientSecret: Joi.when('activated', { is: true, then: Joi.string().required() }),
activated: Joi.boolean().required(), activated: Joi.boolean().required(),
}).unknown(true) }).unknown(true)
} }
@ -45,12 +45,12 @@ function oidcValidation() {
return Joi.object({ return Joi.object({
configs: Joi.array().items( configs: Joi.array().items(
Joi.object({ Joi.object({
clientID: Joi.string().required(), clientID: Joi.when('activated', { is: true, then: Joi.string().required() }),
clientSecret: Joi.string().required(), clientSecret: Joi.when('activated', { is: true, then: Joi.string().required() }),
configUrl: Joi.string().required(), configUrl: Joi.when('activated', { is: true, then: Joi.string().required() }),
logo: Joi.string().allow("", null), logo: Joi.string().allow("", null),
name: Joi.string().allow("", null), name: Joi.string().allow("", null),
uuid: Joi.string().required(), uuid: Joi.when('activated', { is: true, then: Joi.string().required() }),
activated: Joi.boolean().required(), activated: Joi.boolean().required(),
scopes: Joi.array().optional() scopes: Joi.array().optional()
}) })

View File

@ -470,13 +470,13 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.2.12-alpha.22": "@budibase/backend-core@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.22.tgz#120ee25139f88e3b7f96355b4fe5b7ca2ccff5f4" resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.12-alpha.32.tgz#5d53fdde38e80fdade73c59cb81623041984a5fc"
integrity sha512-rhQ7fHneJKo5qKWrSwSX0Ud4xcCbv5qg7fNr2AqxClEpkNbY9DH8YZn9C9yDyvpQj/UM39jvUiwnN2lrKi8b4A== integrity sha512-XoaqGrttx01wlblI0+O23R9uS5FTMgK07juY6mUkdReCK46IvmG7FFnuYu0euKVRbhChSf5X8S+fvKIAEi1ZFw==
dependencies: dependencies:
"@budibase/nano" "10.1.1" "@budibase/nano" "10.1.1"
"@budibase/types" "2.2.12-alpha.22" "@budibase/types" "2.2.12-alpha.32"
"@shopify/jest-koa-mocks" "5.0.1" "@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2" "@techpass/passport-openidconnect" "0.3.2"
aws-cloudfront-sign "2.2.0" aws-cloudfront-sign "2.2.0"
@ -521,23 +521,23 @@
qs "^6.11.0" qs "^6.11.0"
tough-cookie "^4.1.2" tough-cookie "^4.1.2"
"@budibase/pro@2.2.12-alpha.22": "@budibase/pro@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.22.tgz#5ffe51546b7ec1b685c954ae111792b66f1d9653" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.12-alpha.32.tgz#4f35b0ada97458cc69ee41ebb40d56b361518065"
integrity sha512-zFZC37mOMgY9c1nnFlWyDpkP2RT4nKbC6z/oobed7P5yjykc8LZGTOpVz7RZE0eRa1+S4pGrjw1wFRM/TUFvFw== integrity sha512-Kn/IahgIb9Ydzmasv4Bhlh3rvyAC2tBVSoI33OZ/6PKF0vPYJNJkFds3iGELNV7SyWoLbVWb2z5SQ4SSaOYsJw==
dependencies: dependencies:
"@budibase/backend-core" "2.2.12-alpha.22" "@budibase/backend-core" "2.2.12-alpha.32"
"@budibase/types" "2.2.12-alpha.22" "@budibase/types" "2.2.12-alpha.32"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
bull "4.10.1" bull "4.10.1"
joi "17.6.0" joi "17.6.0"
jsonwebtoken "8.5.1" jsonwebtoken "8.5.1"
node-fetch "^2.6.1" node-fetch "^2.6.1"
"@budibase/types@2.2.12-alpha.22": "@budibase/types@2.2.12-alpha.32":
version "2.2.12-alpha.22" version "2.2.12-alpha.32"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.22.tgz#b34026ec0176482c9e93431f4db25442f48e933f" resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.32.tgz#71af8e8cff66acbfd65aa87e66183dd95d76ce6f"
integrity sha512-wCFfD0Awa+RNUJmHYS4Iuhpj6zRPvNIlFMvgOnZes+tIbvLjmOF+9cuDY11qea6pLoG2i+T5Z4NaDv7xn5ATMQ== integrity sha512-ZZwmO+0ORGEFbU/EQvtnjo1VonUbBdsciFkTOiopVupU5iNY2oCKgbYTQiTZZisQrRuiKdPV6P17uV+YTkjQSQ==
"@cspotcode/source-map-support@^0.8.0": "@cspotcode/source-map-support@^0.8.0":
version "0.8.1" version "0.8.1"