Merge branch 'master' of github.com:Budibase/budibase into feature/opinionated-sql

This commit is contained in:
mike12345567 2021-06-10 14:26:47 +01:00
commit 7737ac149d
18 changed files with 102 additions and 48 deletions

View File

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

View File

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

@ -98,6 +98,16 @@
</script> </script>
<Button secondary on:click={publishModal.show}>Publish</Button> <Button secondary on:click={publishModal.show}>Publish</Button>
<Modal bind:this={feedbackModal}>
<ModalContent
title="Enjoying Budibase?"
size="L"
showConfirmButton={false}
showCancelButton={false}
>
<FeedbackIframe on:finished={feedbackModal.hide} />
</ModalContent>
</Modal>
<Modal bind:this={publishModal}> <Modal bind:this={publishModal}>
<ModalContent <ModalContent
title="Publish to Production" title="Publish to Production"

View File

@ -127,7 +127,9 @@
return return
} }
try { try {
const response = await del(`/api/applications/${selectedApp.prodId}`) const response = await del(
`/api/applications/${selectedApp.prodId}?unpublish=1`
)
if (response.status !== 200) { if (response.status !== 200) {
const json = await response.json() const json = await response.json()
throw json.message throw json.message

View File

@ -5,16 +5,18 @@
Heading, Heading,
Divider, Divider,
Label, Label,
Page,
notifications, notifications,
Layout, Layout,
Input, Input,
Select,
Body, Body,
Table, Table,
Checkbox,
} from "@budibase/bbui" } from "@budibase/bbui"
import { email } from "stores/portal" import { email } from "stores/portal"
import TemplateLink from "./_components/TemplateLink.svelte" import TemplateLink from "./_components/TemplateLink.svelte"
import api from "builderStore/api" import api from "builderStore/api"
import { cloneDeep } from "lodash/fp"
const ConfigTypes = { const ConfigTypes = {
SMTP: "smtp", SMTP: "smtp",
@ -36,10 +38,16 @@
let smtpConfig let smtpConfig
let loading let loading
let requireAuth = false
async function saveSmtp() { async function saveSmtp() {
// clone it so we can remove stuff if required
const smtp = cloneDeep(smtpConfig)
if (!requireAuth) {
delete smtp.config.auth
}
// Save your SMTP config // Save your SMTP config
const response = await api.post(`/api/admin/configs`, smtpConfig) const response = await api.post(`/api/admin/configs`, smtp)
if (response.status !== 200) { if (response.status !== 200) {
const error = await response.text() const error = await response.text()
@ -66,15 +74,19 @@
smtpConfig = { smtpConfig = {
type: ConfigTypes.SMTP, type: ConfigTypes.SMTP,
config: { config: {
auth: { secure: true,
type: "login",
},
}, },
} }
} else { } else {
smtpConfig = smtpDoc smtpConfig = smtpDoc
} }
loading = false loading = false
requireAuth = smtpConfig.config.auth != null
// always attach the auth for the forms purpose -
// this will be removed later if required
smtpConfig.config.auth = {
type: "login",
}
} }
fetchSmtp() fetchSmtp()
@ -103,22 +115,35 @@
<Label size="L">Host</Label> <Label size="L">Host</Label>
<Input bind:value={smtpConfig.config.host} /> <Input bind:value={smtpConfig.config.host} />
</div> </div>
<div class="form-row">
<Label size="L">Security type</Label>
<Select
bind:value={smtpConfig.config.secure}
options={[
{ label: "SSL/TLS", value: true },
{ label: "None/STARTTLS", value: false },
]}
/>
</div>
<div class="form-row"> <div class="form-row">
<Label size="L">Port</Label> <Label size="L">Port</Label>
<Input type="number" bind:value={smtpConfig.config.port} /> <Input type="number" bind:value={smtpConfig.config.port} />
</div> </div>
<div class="form-row">
<Label size="L">User</Label>
<Input bind:value={smtpConfig.config.auth.user} />
</div>
<div class="form-row">
<Label size="L">Password</Label>
<Input type="password" bind:value={smtpConfig.config.auth.pass} />
</div>
<div class="form-row"> <div class="form-row">
<Label size="L">From email address</Label> <Label size="L">From email address</Label>
<Input type="email" bind:value={smtpConfig.config.from} /> <Input type="email" bind:value={smtpConfig.config.from} />
</div> </div>
<Checkbox bind:value={requireAuth} text="Require sign-in" />
{#if requireAuth}
<div class="form-row">
<Label size="L">User</Label>
<Input bind:value={smtpConfig.config.auth.user} />
</div>
<div class="form-row">
<Label size="L">Password</Label>
<Input type="password" bind:value={smtpConfig.config.auth.pass} />
</div>
{/if}
</Layout> </Layout>
<div> <div>
<Button cta on:click={saveSmtp}>Save</Button> <Button cta on:click={saveSmtp}>Save</Button>

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "0.9.42", "version": "0.9.45",
"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.42", "version": "0.9.45",
"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,13 +18,13 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/string-templates": "^0.9.42", "@budibase/string-templates": "^0.9.45",
"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"
}, },
"devDependencies": { "devDependencies": {
"@budibase/standard-components": "^0.9.42", "@budibase/standard-components": "^0.9.45",
"@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1", "@rollup/plugin-node-resolve": "^11.2.1",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.42", "version": "0.9.45",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/electron.js", "main": "src/electron.js",
"repository": { "repository": {
@ -55,9 +55,9 @@
"author": "Budibase", "author": "Budibase",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"dependencies": { "dependencies": {
"@budibase/auth": "^0.9.42", "@budibase/auth": "^0.9.45",
"@budibase/client": "^0.9.42", "@budibase/client": "^0.9.45",
"@budibase/string-templates": "^0.9.42", "@budibase/string-templates": "^0.9.45",
"@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",
@ -110,7 +110,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.42", "@budibase/standard-components": "^0.9.45",
"@jest/test-sequencer": "^24.8.0", "@jest/test-sequencer": "^24.8.0",
"babel-jest": "^27.0.2", "babel-jest": "^27.0.2",
"docker-compose": "^0.23.6", "docker-compose": "^0.23.6",

View File

@ -245,9 +245,10 @@ exports.update = async function (ctx) {
exports.delete = async function (ctx) { exports.delete = async function (ctx) {
const db = new CouchDB(ctx.params.appId) const db = new CouchDB(ctx.params.appId)
const result = await db.destroy() const result = await db.destroy()
/* istanbul ignore next */ /* istanbul ignore next */
if (!env.isTest()) { if (!env.isTest() && !ctx.query.unpublish) {
await deleteApp(ctx.params.appId) await deleteApp(ctx.params.appId)
} }
// make sure the app/role doesn't stick around after the app has been deleted // make sure the app/role doesn't stick around after the app has been deleted

View File

@ -29,11 +29,11 @@
"keywords": [ "keywords": [
"svelte" "svelte"
], ],
"version": "0.9.42", "version": "0.9.45",
"license": "MIT", "license": "MIT",
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": { "dependencies": {
"@budibase/bbui": "^0.9.42", "@budibase/bbui": "^0.9.45",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",
"apexcharts": "^3.22.1", "apexcharts": "^3.22.1",

View File

@ -245,7 +245,7 @@
"options" "options"
], ],
"numArgs": 3, "numArgs": 3,
"example": "{{equalsLength [1, 2, 3] 3}} -> true", "example": "{{equalsLength '[1,2,3]' 3}} -> true",
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n" "description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
}, },
"last": { "last": {
@ -262,7 +262,7 @@
"value" "value"
], ],
"numArgs": 1, "numArgs": 1,
"example": "{{length [1, 2, 3]}} -> 3", "example": "{{length '[1, 2, 3]'}} -> 3",
"description": "<p>Returns the length of the given string or array.</p>\n" "description": "<p>Returns the length of the given string or array.</p>\n"
}, },
"lengthEqual": { "lengthEqual": {
@ -272,7 +272,7 @@
"options" "options"
], ],
"numArgs": 3, "numArgs": 3,
"example": "{{equalsLength [1, 2, 3] 3}} -> true", "example": "{{equalsLength '[1,2,3]' 3}} -> true",
"description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n" "description": "<p>Returns true if the the length of the given <code>value</code> is equal to the given <code>length</code>. Can be used as a block or inline helper.</p>\n"
}, },
"map": { "map": {
@ -1097,8 +1097,8 @@
"format" "format"
], ],
"numArgs": 2, "numArgs": 2,
"example": "{{date now \"DD-MM-YYYY\"}} -> 21-01-2021", "example": "{{date now \"DD-MM-YYYY\" \"America/New_York\" }} -> 21-01-2021",
"description": "<p>Format a date using moment.js date formatting.</p>\n" "description": "<p>Format a date using moment.js date formatting - the timezone is optional and uses the tz database.</p>\n"
}, },
"duration": { "duration": {
"args": [ "args": [

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "0.9.42", "version": "0.9.45",
"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",
@ -20,7 +20,7 @@
"manifest": "node ./scripts/gen-collection-info.js" "manifest": "node ./scripts/gen-collection-info.js"
}, },
"dependencies": { "dependencies": {
"@budibase/handlebars-helpers": "^0.11.3", "@budibase/handlebars-helpers": "^0.11.4",
"dayjs": "^1.10.4", "dayjs": "^1.10.4",
"handlebars": "^4.7.6", "handlebars": "^4.7.6",
"handlebars-utils": "^1.0.6", "handlebars-utils": "^1.0.6",

View File

@ -305,6 +305,17 @@ describe("Test the object/array helper", () => {
const output = await processString("{{ literal ( sum ( pluck items 'price' ) ) }}", context) const output = await processString("{{ literal ( sum ( pluck items 'price' ) ) }}", context)
expect(output).toBe(50) expect(output).toBe(50)
}) })
it("should allow use of the length helper", async () => {
const array = [1, 2, 3]
const output = await processString("{{ length array }}", { array })
expect(output).toBe("3")
})
it("should allow use of the length helper inline", async () => {
const output = await processString(`{{ length '[1, 2, 3]' }}`, {})
expect(output).toBe("3")
})
}) })
describe("Test the literal helper", () => { describe("Test the literal helper", () => {

View File

@ -270,10 +270,10 @@
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/handlebars-helpers@^0.11.3": "@budibase/handlebars-helpers@^0.11.4":
version "0.11.3" version "0.11.4"
resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.3.tgz#b6e5c91b83e8906e7d7ff10ddde277a3d561016e" resolved "https://registry.yarnpkg.com/@budibase/handlebars-helpers/-/handlebars-helpers-0.11.4.tgz#8acfa2ee84134f7be4b2906e710fce6d25c5d000"
integrity sha512-MS1ptZEYq8o9J3tNLM7cZ2RGSSJIer4GiMIUHtbBI3sC9UKqZebao1JYNfmZKpNjntuqhZKgjqc5GfnVIEjsYQ== integrity sha512-AJNJYlJnxZmn9QJ8tBl8nrm4YxbwHP4AR0pbiVGK+EoOylkNBlUnZ/QDL1VyqM5fTkAE/Z2IZVLKrrG3kxuWLA==
dependencies: dependencies:
arr-flatten "^1.1.0" arr-flatten "^1.1.0"
array-sort "^0.1.4" array-sort "^0.1.4"

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "0.9.42", "version": "0.9.45",
"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.42", "@budibase/auth": "^0.9.45",
"@budibase/string-templates": "^0.9.42", "@budibase/string-templates": "^0.9.45",
"@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

@ -20,11 +20,16 @@ const FULL_EMAIL_PURPOSES = [
function createSMTPTransport(config) { function createSMTPTransport(config) {
let options let options
let secure = config.secure
// default it if not specified
if (secure == null) {
secure = config.port === 465
}
if (!TEST_MODE) { if (!TEST_MODE) {
options = { options = {
port: config.port, port: config.port,
host: config.host, host: config.host,
secure: config.secure || false, secure: secure,
auth: config.auth, auth: config.auth,
} }
options.tls = { options.tls = {