Merge branch 'develop' of github.com:Budibase/budibase into feature/multi-tenants

This commit is contained in:
mike12345567 2021-07-19 17:35:48 +01:00
commit 358b2aef89
17 changed files with 90 additions and 56 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "0.9.74", "version": "0.9.78",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/auth", "name": "@budibase/auth",
"version": "0.9.74", "version": "0.9.78",
"description": "Authentication middlewares for budibase builder and apps", "description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js", "main": "src/index.js",
"author": "Budibase", "author": "Budibase",

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": "0.9.74", "version": "0.9.78",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "0.9.74", "version": "0.9.78",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -65,10 +65,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.74", "@budibase/bbui": "^0.9.78",
"@budibase/client": "^0.9.74", "@budibase/client": "^0.9.78",
"@budibase/colorpicker": "1.1.2", "@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.74", "@budibase/string-templates": "^0.9.78",
"@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

@ -16,6 +16,7 @@
import Editor from "components/integration/QueryEditor.svelte" import Editor from "components/integration/QueryEditor.svelte"
import TemplateBindings from "./_components/TemplateBindings.svelte" import TemplateBindings from "./_components/TemplateBindings.svelte"
// this is the email purpose
export let template export let template
let htmlEditor let htmlEditor
@ -24,9 +25,11 @@
$: selectedTemplate = $email.templates?.find( $: selectedTemplate = $email.templates?.find(
({ purpose }) => purpose === template ({ purpose }) => purpose === template
) )
$: name = $email.definitions?.info[template]?.name
$: description = $email.definitions?.info[template]?.description
$: baseTemplate = $email.templates?.find(({ purpose }) => purpose === "base") $: baseTemplate = $email.templates?.find(({ purpose }) => purpose === "base")
$: templateBindings = $: templateBindings =
$email.definitions?.bindings?.[selectedTemplate.purpose] || [] $email.definitions?.bindings?.[selectedTemplate?.purpose] || []
$: previewContent = makePreviewContent(baseTemplate, selectedTemplate) $: previewContent = makePreviewContent(baseTemplate, selectedTemplate)
async function saveTemplate() { async function saveTemplate() {
@ -81,10 +84,12 @@
</div> </div>
<header> <header>
<Heading> <Heading>
Email Template: {template} Email Template: {name}
</Heading> </Heading>
<Button cta on:click={saveTemplate}>Save</Button> <Button cta on:click={saveTemplate}>Save</Button>
</header> </header>
<Detail>Description</Detail>
<Body>{description}</Body>
<Body <Body
>Change the email template here. Add dynamic content by using the bindings >Change the email template here. Add dynamic content by using the bindings
menu on the right.</Body menu on the right.</Body

View File

@ -1,13 +0,0 @@
<script>
import { goto } from "@roxi/routify"
export let value
</script>
<span on:click={() => $goto(`./${value}`)}>{value}</span>
<style>
span {
text-transform: capitalize;
}
</style>

View File

@ -14,7 +14,6 @@
Checkbox, Checkbox,
} from "@budibase/bbui" } from "@budibase/bbui"
import { email } from "stores/portal" import { email } from "stores/portal"
import TemplateLink from "./_components/TemplateLink.svelte"
import api from "builderStore/api" import api from "builderStore/api"
import { cloneDeep } from "lodash/fp" import { cloneDeep } from "lodash/fp"
@ -23,23 +22,30 @@
} }
const templateSchema = { const templateSchema = {
purpose: { name: {
displayName: "Email", displayName: "Name",
editable: false,
},
category: {
displayName: "Category",
editable: false, editable: false,
}, },
} }
const customRenderers = [ $: emailInfo = getEmailInfo($email.definitions)
{
column: "purpose",
component: TemplateLink,
},
]
let smtpConfig let smtpConfig
let loading let loading
let requireAuth = false let requireAuth = false
function getEmailInfo(definitions) {
if (!definitions) {
return []
}
const entries = Object.entries(definitions.info)
return entries.map(([key, value]) => ({ purpose: key, ...value }))
}
async function saveSmtp() { async function saveSmtp() {
// clone it so we can remove stuff if required // clone it so we can remove stuff if required
const smtp = cloneDeep(smtpConfig) const smtp = cloneDeep(smtpConfig)
@ -159,8 +165,7 @@
</Body> </Body>
</Layout> </Layout>
<Table <Table
{customRenderers} data={emailInfo}
data={$email.templates}
schema={templateSchema} schema={templateSchema}
{loading} {loading}
on:click={({ detail }) => $goto(`./${detail.purpose}`)} on:click={({ detail }) => $goto(`./${detail.purpose}`)}

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "0.9.74", "version": "0.9.78",
"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": "0.9.74", "version": "0.9.78",
"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",
@ -18,9 +18,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.74", "@budibase/bbui": "^0.9.78",
"@budibase/standard-components": "^0.9.74", "@budibase/standard-components": "^0.9.78",
"@budibase/string-templates": "^0.9.74", "@budibase/string-templates": "^0.9.78",
"regexparam": "^1.3.0", "regexparam": "^1.3.0",
"shortid": "^2.2.15", "shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5" "svelte-spa-router": "^3.0.5"

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.74", "version": "0.9.78",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -60,9 +60,9 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.74", "@budibase/auth": "^0.9.78",
"@budibase/client": "^0.9.74", "@budibase/client": "^0.9.78",
"@budibase/string-templates": "^0.9.74", "@budibase/string-templates": "^0.9.78",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0", "@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1", "@sendgrid/mail": "7.1.1",
@ -115,7 +115,7 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.14.3", "@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4", "@babel/preset-env": "^7.14.4",
"@budibase/standard-components": "^0.9.74", "@budibase/standard-components": "^0.9.78",
"@jest/test-sequencer": "^24.8.0", "@jest/test-sequencer": "^24.8.0",
"@types/bull": "^3.15.1", "@types/bull": "^3.15.1",
"@types/jest": "^26.0.23", "@types/jest": "^26.0.23",

View File

@ -148,12 +148,20 @@ class QueryBuilder {
} }
if (this.query.equal) { if (this.query.equal) {
build(this.query.equal, (key, value) => { build(this.query.equal, (key, value) => {
return value ? `${key}:${luceneEscape(value.toLowerCase())}` : null const escapedValue = luceneEscape(value.toLowerCase())
// have to do the or to manage straight values, or strings
return value
? `(${key}:${escapedValue} OR ${key}:"${escapedValue}")`
: null
}) })
} }
if (this.query.notEqual) { if (this.query.notEqual) {
build(this.query.notEqual, (key, value) => { build(this.query.notEqual, (key, value) => {
return value ? `!${key}:${luceneEscape(value.toLowerCase())}` : null const escapedValue = luceneEscape(value.toLowerCase())
// have to do the or to manage straight values, or strings
return value
? `(!${key}:${escapedValue} OR !${key}:"${escapedValue}")`
: null
}) })
} }
if (this.query.empty) { if (this.query.empty) {

View File

@ -76,7 +76,10 @@ module.exports.run = async function ({ inputs, appId, emitter }) {
rowId: inputs.rowId, rowId: inputs.rowId,
}, },
request: { request: {
body: inputs.row, body: {
...inputs.row,
_id: inputs.rowId,
},
}, },
appId, appId,
eventEmitter: emitter, eventEmitter: emitter,

View File

@ -29,12 +29,12 @@
"keywords": [ "keywords": [
"svelte" "svelte"
], ],
"version": "0.9.74", "version": "0.9.78",
"license": "MIT", "license": "MIT",
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": { "dependencies": {
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@budibase/bbui": "^0.9.74", "@budibase/bbui": "^0.9.78",
"@spectrum-css/link": "^3.1.3", "@spectrum-css/link": "^3.1.3",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/typography": "^3.0.2", "@spectrum-css/typography": "^3.0.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "0.9.74", "version": "0.9.78",
"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,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.74", "version": "0.9.78",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -21,8 +21,8 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.74", "@budibase/auth": "^0.9.78",
"@budibase/string-templates": "^0.9.74", "@budibase/string-templates": "^0.9.78",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"aws-sdk": "^2.811.0", "aws-sdk": "^2.811.0",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",

View File

@ -25,12 +25,18 @@ exports.save = async ctx => {
exports.definitions = async ctx => { exports.definitions = async ctx => {
const bindings = {} const bindings = {}
const info = {}
for (let template of TemplateMetadata.email) { for (let template of TemplateMetadata.email) {
bindings[template.purpose] = template.bindings bindings[template.purpose] = template.bindings
info[template.purpose] = {
name: template.name,
description: template.description,
category: template.category,
}
} }
ctx.body = { ctx.body = {
info,
bindings: { bindings: {
...bindings, ...bindings,
common: Object.values(TemplateBindings), common: Object.values(TemplateBindings),

View File

@ -92,7 +92,10 @@ const TemplateBindings = {
const TemplateMetadata = { const TemplateMetadata = {
[TemplateTypes.EMAIL]: [ [TemplateTypes.EMAIL]: [
{ {
name: "Base Format", name: "Base format",
description:
"This is the base template, all others are based on it. The {{ body }} will be replaced with another email template.",
category: "miscellaneous",
purpose: EmailTemplatePurpose.BASE, purpose: EmailTemplatePurpose.BASE,
bindings: [ bindings: [
{ {
@ -106,7 +109,10 @@ const TemplateMetadata = {
], ],
}, },
{ {
name: "Password Recovery", name: "Password recovery",
description:
"When a user requests a password reset they will receive an email built with this template.",
category: "user management",
purpose: EmailTemplatePurpose.PASSWORD_RECOVERY, purpose: EmailTemplatePurpose.PASSWORD_RECOVERY,
bindings: [ bindings: [
{ {
@ -122,7 +128,18 @@ const TemplateMetadata = {
], ],
}, },
{ {
name: "New User Invitation", name: "User welcome",
description:
"When a new user is added they will be sent a welcome email using this template.",
category: "user management",
purpose: EmailTemplatePurpose.WELCOME,
bindings: [],
},
{
name: "User invitation",
description:
"When inviting a user via the email on-boarding this template will be used.",
category: "user management",
purpose: EmailTemplatePurpose.INVITATION, purpose: EmailTemplatePurpose.INVITATION,
bindings: [ bindings: [
{ {
@ -139,6 +156,9 @@ const TemplateMetadata = {
}, },
{ {
name: "Custom", name: "Custom",
description:
"A custom template, this is currently used for SMTP email actions in automations.",
category: "automations",
purpose: EmailTemplatePurpose.CUSTOM, purpose: EmailTemplatePurpose.CUSTOM,
bindings: [ bindings: [
{ {