Merge branch 'master' into develop
This commit is contained in:
commit
45a43baee2
|
@ -65,10 +65,6 @@ http {
|
|||
proxy_pass http://{{ address }}:4001;
|
||||
}
|
||||
|
||||
location /preview {
|
||||
proxy_pass http://{{ address }}:4001;
|
||||
}
|
||||
|
||||
location /builder {
|
||||
proxy_pass http://{{ address }}:3000;
|
||||
rewrite ^/builder(.*)$ /builder/$1 break;
|
||||
|
|
|
@ -88,10 +88,6 @@ http {
|
|||
proxy_pass http://$apps:4002;
|
||||
}
|
||||
|
||||
location /preview {
|
||||
proxy_pass http://$apps:4002;
|
||||
}
|
||||
|
||||
location = / {
|
||||
proxy_pass http://$apps:4002;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ echo ${TARGETBUILD} > /buildtarget.txt
|
|||
if [[ "${TARGETBUILD}" = "aas" ]]; then
|
||||
# Azure AppService uses /home for persisent data & SSH on port 2222
|
||||
DATA_DIR=/home
|
||||
mkdir -p $DATA_DIR/{search,minio,couchdb}
|
||||
mkdir -p $DATA_DIR/couchdb/{dbs,views}
|
||||
chown -R couchdb:couchdb $DATA_DIR/couchdb/
|
||||
mkdir -p $DATA_DIR/{search,minio,couch}
|
||||
mkdir -p $DATA_DIR/couch/{dbs,views}
|
||||
chown -R couchdb:couchdb $DATA_DIR/couch/
|
||||
apt update
|
||||
apt-get install -y openssh-server
|
||||
sed -i "s/#Port 22/Port 2222/" /etc/ssh/sshd_config
|
||||
|
@ -16,5 +16,4 @@ if [[ "${TARGETBUILD}" = "aas" ]]; then
|
|||
else
|
||||
sed -i "s#DATA_DIR#/data#g" /opt/clouseau/clouseau.ini
|
||||
sed -i "s#DATA_DIR#/data#g" /opt/couchdb/etc/local.ini
|
||||
|
||||
fi
|
|
@ -1,5 +1,5 @@
|
|||
; CouchDB Configuration Settings
|
||||
|
||||
[couchdb]
|
||||
database_dir = DATA_DIR/couchdb/dbs
|
||||
view_index_dir = DATA_DIR/couchdb/views
|
||||
database_dir = DATA_DIR/couch/dbs
|
||||
view_index_dir = DATA_DIR/couch/views
|
||||
|
|
|
@ -36,10 +36,10 @@ fi
|
|||
export COUCH_DB_URL=http://$COUCHDB_USER:$COUCHDB_PASSWORD@localhost:5984
|
||||
|
||||
# make these directories in runner, incase of mount
|
||||
mkdir -p ${DATA_DIR}/couchdb/{dbs,views}
|
||||
mkdir -p ${DATA_DIR}/couch/{dbs,views}
|
||||
mkdir -p ${DATA_DIR}/minio
|
||||
mkdir -p ${DATA_DIR}/search
|
||||
chown -R couchdb:couchdb ${DATA_DIR}/couchdb
|
||||
chown -R couchdb:couchdb ${DATA_DIR}/couch
|
||||
redis-server --requirepass $REDIS_PASSWORD &
|
||||
/opt/clouseau/bin/clouseau &
|
||||
/minio/minio server ${DATA_DIR}/minio &
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/*"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/backend-core",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase backend core libraries used in server and worker",
|
||||
"main": "dist/src/index.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"test:watch": "jest --watchAll"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/types": "1.3.12-alpha.3",
|
||||
"@budibase/types": "^1.3.14",
|
||||
"@shopify/jest-koa-mocks": "5.0.1",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
"aws-sdk": "2.1030.0",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { dangerousGetDB, closeDB } from "."
|
||||
import { DocumentType } from "./constants"
|
||||
|
||||
class Replication {
|
||||
source: any
|
||||
|
@ -53,6 +54,14 @@ class Replication {
|
|||
return this.replication
|
||||
}
|
||||
|
||||
appReplicateOpts() {
|
||||
return {
|
||||
filter: (doc: any) => {
|
||||
return doc._id !== DocumentType.APP_METADATA
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rollback the target DB back to the state of the source DB
|
||||
*/
|
||||
|
@ -60,6 +69,7 @@ class Replication {
|
|||
await this.target.destroy()
|
||||
// Recreate the DB again
|
||||
this.target = dangerousGetDB(this.target.name)
|
||||
// take the opportunity to remove deleted tombstones
|
||||
await this.replicate()
|
||||
}
|
||||
|
||||
|
|
|
@ -254,8 +254,17 @@ export async function getAllApps({ dev, all, idsOnly, efficient }: any = {}) {
|
|||
return false
|
||||
})
|
||||
if (idsOnly) {
|
||||
const devAppIds = appDbNames.filter(appId => isDevAppID(appId))
|
||||
const prodAppIds = appDbNames.filter(appId => !isDevAppID(appId))
|
||||
switch (dev) {
|
||||
case true:
|
||||
return devAppIds
|
||||
case false:
|
||||
return prodAppIds
|
||||
default:
|
||||
return appDbNames
|
||||
}
|
||||
}
|
||||
const appPromises = appDbNames.map((app: any) =>
|
||||
// skip setup otherwise databases could be re-created
|
||||
getAppMetadata(app)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/bbui",
|
||||
"description": "A UI solution used in the different Budibase projects.",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"module": "dist/bbui.es.js",
|
||||
|
@ -38,7 +38,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "^1.3.14",
|
||||
"@spectrum-css/actionbutton": "^1.0.1",
|
||||
"@spectrum-css/actiongroup": "^1.0.1",
|
||||
"@spectrum-css/avatar": "^3.0.2",
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
export let noHorizPadding = false
|
||||
export let quiet = false
|
||||
export let emphasized = false
|
||||
export let onTop = false
|
||||
export let size = "M"
|
||||
|
||||
let thisSelected = undefined
|
||||
|
@ -75,6 +76,7 @@
|
|||
bind:this={container}
|
||||
class:spectrum-Tabs--quiet={quiet}
|
||||
class:noHorizPadding
|
||||
class:onTop
|
||||
class:spectrum-Tabs--vertical={vertical}
|
||||
class:spectrum-Tabs--horizontal={!vertical}
|
||||
class="spectrum-Tabs spectrum-Tabs--size{size}"
|
||||
|
@ -122,4 +124,7 @@
|
|||
.noPadding {
|
||||
margin: 0;
|
||||
}
|
||||
.onTop {
|
||||
z-index: 100;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/builder",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"license": "GPL-3.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
@ -69,10 +69,10 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "1.3.12-alpha.3",
|
||||
"@budibase/client": "1.3.12-alpha.3",
|
||||
"@budibase/frontend-core": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/bbui": "^1.3.14",
|
||||
"@budibase/client": "^1.3.14",
|
||||
"@budibase/frontend-core": "^1.3.14",
|
||||
"@budibase/string-templates": "^1.3.14",
|
||||
"@sentry/browser": "5.19.1",
|
||||
"@spectrum-css/page": "^3.0.1",
|
||||
"@spectrum-css/vars": "^3.0.1",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script>
|
||||
import { Button, Select, Input, Label } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { onMount, createEventDispatcher } from "svelte"
|
||||
import { flags } from "stores/backend"
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
export let value
|
||||
|
@ -29,11 +30,16 @@
|
|||
label: "Every Night at Midnight",
|
||||
value: "0 0 * * *",
|
||||
},
|
||||
{
|
||||
]
|
||||
|
||||
onMount(() => {
|
||||
if (!$flags.cloud) {
|
||||
CRON_EXPRESSIONS.push({
|
||||
label: "Every Budibase Reboot",
|
||||
value: "@reboot",
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<div class="block-field">
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
const dispatch = createEventDispatcher()
|
||||
let bindingDrawer
|
||||
let valid = true
|
||||
let currentVal = value
|
||||
|
||||
$: readableValue = runtimeToReadableBinding(bindings, value)
|
||||
$: tempValue = readableValue
|
||||
|
@ -30,11 +31,17 @@
|
|||
|
||||
const saveBinding = () => {
|
||||
onChange(tempValue)
|
||||
onBlur()
|
||||
bindingDrawer.hide()
|
||||
}
|
||||
|
||||
const onChange = value => {
|
||||
dispatch("change", readableToRuntimeBinding(bindings, value))
|
||||
currentVal = readableToRuntimeBinding(bindings, value)
|
||||
dispatch("change", currentVal)
|
||||
}
|
||||
|
||||
const onBlur = () => {
|
||||
dispatch("blur", currentVal)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
@ -45,6 +52,7 @@
|
|||
readonly={isJS}
|
||||
value={isJS ? "(JavaScript function)" : readableValue}
|
||||
on:change={event => onChange(event.detail)}
|
||||
on:blur={onBlur}
|
||||
{placeholder}
|
||||
{updateOnChange}
|
||||
/>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
)
|
||||
|
||||
newBlock.inputs = {
|
||||
fields: Object.keys(parameters.fields).reduce((fields, key) => {
|
||||
fields: Object.keys(parameters.fields ?? {}).reduce((fields, key) => {
|
||||
fields[key] = "string"
|
||||
return fields
|
||||
}, {}),
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
placeholder={keyPlaceholder}
|
||||
readonly={readOnly}
|
||||
bind:value={field.name}
|
||||
on:change={changed}
|
||||
on:blur={changed}
|
||||
/>
|
||||
{#if options}
|
||||
<Select bind:value={field.value} on:change={changed} {options} />
|
||||
|
@ -115,7 +115,10 @@
|
|||
<DrawerBindableInput
|
||||
{bindings}
|
||||
placeholder="Value"
|
||||
on:change={e => (field.value = e.detail)}
|
||||
on:blur={e => {
|
||||
field.value = e.detail
|
||||
changed()
|
||||
}}
|
||||
disabled={readOnly}
|
||||
value={field.value}
|
||||
allowJS={false}
|
||||
|
@ -127,7 +130,7 @@
|
|||
placeholder={valuePlaceholder}
|
||||
readonly={readOnly}
|
||||
bind:value={field.value}
|
||||
on:change={changed}
|
||||
on:blur={changed}
|
||||
/>
|
||||
{/if}
|
||||
{#if toggle}
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
<script>
|
||||
import { ModalContent, Toggle } from "@budibase/bbui"
|
||||
import { ModalContent, Toggle, Body } from "@budibase/bbui"
|
||||
|
||||
export let app
|
||||
export let published
|
||||
let excludeRows = false
|
||||
|
||||
$: title = published ? "Export published app" : "Export latest app"
|
||||
$: confirmText = published ? "Export published" : "Export latest"
|
||||
|
||||
const exportApp = () => {
|
||||
const id = app.deployed ? app.prodId : app.devId
|
||||
const id = published ? app.prodId : app.devId
|
||||
const appName = encodeURIComponent(app.name)
|
||||
window.location = `/api/backups/export?appId=${id}&appname=${appName}&excludeRows=${excludeRows}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<ModalContent title={"Export"} confirmText={"Export"} onConfirm={exportApp}>
|
||||
<ModalContent {title} {confirmText} onConfirm={exportApp}>
|
||||
<Body
|
||||
>Apps can be exported with or without data that is within internal tables -
|
||||
select this below.</Body
|
||||
>
|
||||
<Toggle text="Exclude Rows" bind:value={excludeRows} />
|
||||
</ModalContent>
|
||||
|
|
|
@ -46,7 +46,7 @@ export function buildQueryString(obj) {
|
|||
if (str !== "") {
|
||||
str += "&"
|
||||
}
|
||||
str += `${key}=${value || ""}`
|
||||
str += `${key}=${encodeURIComponent(value || "")}`
|
||||
}
|
||||
}
|
||||
return str
|
||||
|
|
|
@ -28,25 +28,25 @@
|
|||
import { onMount } from "svelte"
|
||||
import restUtils from "helpers/data/utils"
|
||||
import {
|
||||
RestBodyTypes as bodyTypes,
|
||||
SchemaTypeOptions,
|
||||
PaginationLocations,
|
||||
PaginationTypes,
|
||||
RawRestBodyTypes,
|
||||
RestBodyTypes as bodyTypes,
|
||||
SchemaTypeOptions,
|
||||
} from "constants/backend"
|
||||
import JSONPreview from "components/integration/JSONPreview.svelte"
|
||||
import AccessLevelSelect from "components/integration/AccessLevelSelect.svelte"
|
||||
import DynamicVariableModal from "../../_components/DynamicVariableModal.svelte"
|
||||
import Placeholder from "assets/bb-spaceship.svg"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
import { RawRestBodyTypes } from "constants/backend"
|
||||
|
||||
import {
|
||||
getRestBindings,
|
||||
toBindingsArray,
|
||||
runtimeToReadableBinding,
|
||||
readableToRuntimeBinding,
|
||||
runtimeToReadableMap,
|
||||
readableToRuntimeMap,
|
||||
runtimeToReadableBinding,
|
||||
runtimeToReadableMap,
|
||||
toBindingsArray,
|
||||
} from "builderStore/dataBinding"
|
||||
|
||||
let query, datasource
|
||||
|
@ -95,7 +95,7 @@
|
|||
$: runtimeUrlQueries = readableToRuntimeMap(mergedBindings, breakQs)
|
||||
|
||||
function getSelectedQuery() {
|
||||
const cloneQuery = cloneDeep(
|
||||
return cloneDeep(
|
||||
$queries.list.find(q => q._id === $queries.selected) || {
|
||||
datasourceId: $params.selectedDatasource,
|
||||
parameters: [],
|
||||
|
@ -107,7 +107,6 @@
|
|||
queryVerb: "read",
|
||||
}
|
||||
)
|
||||
return cloneQuery
|
||||
}
|
||||
|
||||
function checkQueryName(inputUrl = null) {
|
||||
|
@ -121,14 +120,15 @@
|
|||
if (!base) {
|
||||
return base
|
||||
}
|
||||
const qs = restUtils.buildQueryString(
|
||||
let qs = restUtils.buildQueryString(
|
||||
runtimeToReadableMap(mergedBindings, qsObj)
|
||||
)
|
||||
let newUrl = base
|
||||
if (base.includes("?")) {
|
||||
newUrl = base.split("?")[0]
|
||||
const split = base.split("?")
|
||||
newUrl = split[0]
|
||||
}
|
||||
return qs.length > 0 ? `${newUrl}?${qs}` : newUrl
|
||||
return qs.length === 0 ? newUrl : `${newUrl}?${qs}`
|
||||
}
|
||||
|
||||
function buildQuery() {
|
||||
|
@ -314,6 +314,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
const paramsChanged = evt => {
|
||||
breakQs = {}
|
||||
for (let param of evt.detail) {
|
||||
breakQs[param.name] = param.value
|
||||
}
|
||||
}
|
||||
|
||||
const urlChanged = evt => {
|
||||
breakQs = {}
|
||||
const qs = evt.target.value.split("?")[1]
|
||||
if (qs && qs.length > 0) {
|
||||
const parts = qs.split("&")
|
||||
for (let part of parts) {
|
||||
const [key, value] = part.split("=")
|
||||
breakQs[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
query = getSelectedQuery()
|
||||
|
||||
|
@ -426,7 +445,11 @@
|
|||
/>
|
||||
</div>
|
||||
<div class="url">
|
||||
<Input bind:value={url} placeholder="http://www.api.com/endpoint" />
|
||||
<Input
|
||||
on:blur={urlChanged}
|
||||
bind:value={url}
|
||||
placeholder="http://www.api.com/endpoint"
|
||||
/>
|
||||
</div>
|
||||
<Button primary disabled={!url} on:click={runQuery}>Send</Button>
|
||||
<Button
|
||||
|
@ -456,13 +479,16 @@
|
|||
/>
|
||||
</Tab>
|
||||
<Tab title="Params">
|
||||
{#key breakQs}
|
||||
<KeyValueBuilder
|
||||
bind:object={breakQs}
|
||||
on:change={paramsChanged}
|
||||
object={breakQs}
|
||||
name="param"
|
||||
headings
|
||||
bindings={mergedBindings}
|
||||
bindingDrawerLeft="260px"
|
||||
/>
|
||||
{/key}
|
||||
</Tab>
|
||||
<Tab title="Headers">
|
||||
<KeyValueBuilder
|
||||
|
|
|
@ -291,7 +291,7 @@
|
|||
<iframe
|
||||
title="componentPreview"
|
||||
bind:this={iframe}
|
||||
src="/preview"
|
||||
src="/app/preview"
|
||||
class:hidden={loading || error}
|
||||
class:tablet={$store.previewDevice === "tablet"}
|
||||
class:mobile={$store.previewDevice === "mobile"}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
import Spinner from "components/common/Spinner.svelte"
|
||||
import CreateAppModal from "components/start/CreateAppModal.svelte"
|
||||
import UpdateAppModal from "components/start/UpdateAppModal.svelte"
|
||||
import ExportAppModal from "components/start/ExportAppModal.svelte"
|
||||
|
||||
import { store, automationStore } from "builderStore"
|
||||
import { API } from "api"
|
||||
|
@ -33,7 +32,6 @@
|
|||
let selectedApp
|
||||
let creationModal
|
||||
let updatingModal
|
||||
let exportModal
|
||||
let creatingApp = false
|
||||
let loaded = $apps?.length || $templates?.length
|
||||
let searchTerm = ""
|
||||
|
@ -407,10 +405,6 @@
|
|||
<UpdateAppModal app={selectedApp} />
|
||||
</Modal>
|
||||
|
||||
<Modal bind:this={exportModal} padding={false} width="600px">
|
||||
<ExportAppModal app={selectedApp} />
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.appTable {
|
||||
border-top: var(--border-light);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
MenuItem,
|
||||
Icon,
|
||||
Helpers,
|
||||
Modal,
|
||||
} from "@budibase/bbui"
|
||||
import OverviewTab from "../_components/OverviewTab.svelte"
|
||||
import SettingsTab from "../_components/SettingsTab.svelte"
|
||||
|
@ -29,6 +30,7 @@
|
|||
import EditableIcon from "components/common/EditableIcon.svelte"
|
||||
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
||||
import HistoryTab from "components/portal/overview/automation/HistoryTab.svelte"
|
||||
import ExportAppModal from "components/start/ExportAppModal.svelte"
|
||||
import { checkIncomingDeploymentStatus } from "components/deploy/utils"
|
||||
import { onDestroy, onMount } from "svelte"
|
||||
|
||||
|
@ -38,7 +40,9 @@
|
|||
let loaded = false
|
||||
let deletionModal
|
||||
let unpublishModal
|
||||
let exportModal
|
||||
let appName = ""
|
||||
let published
|
||||
|
||||
// App
|
||||
$: filteredApps = $apps.filter(app => app.devId === application)
|
||||
|
@ -140,11 +144,9 @@
|
|||
notifications.success("App ID copied to clipboard.")
|
||||
}
|
||||
|
||||
const exportApp = (app, opts = { published: false }) => {
|
||||
const appName = encodeURIComponent(app.name)
|
||||
const id = opts?.published ? app.prodId : app.devId
|
||||
// always export the development version
|
||||
window.location = `/api/backups/export?appId=${id}&appname=${appName}`
|
||||
const exportApp = opts => {
|
||||
published = opts.published
|
||||
exportModal.show()
|
||||
}
|
||||
|
||||
const unpublishApp = app => {
|
||||
|
@ -206,6 +208,10 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
<Modal bind:this={exportModal} padding={false} width="600px">
|
||||
<ExportAppModal app={selectedApp} {published} />
|
||||
</Modal>
|
||||
|
||||
<span class="overview-wrap">
|
||||
<Page wide noPadding>
|
||||
{#await promise}
|
||||
|
@ -269,14 +275,14 @@
|
|||
<Icon hoverable name="More" />
|
||||
</span>
|
||||
<MenuItem
|
||||
on:click={() => exportApp(selectedApp, { published: false })}
|
||||
on:click={() => exportApp({ published: false })}
|
||||
icon="DownloadFromCloud"
|
||||
>
|
||||
Export latest
|
||||
</MenuItem>
|
||||
{#if isPublished}
|
||||
<MenuItem
|
||||
on:click={() => exportApp(selectedApp, { published: true })}
|
||||
on:click={() => exportApp({ published: true })}
|
||||
icon="DownloadFromCloudOutline"
|
||||
>
|
||||
Export published
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/cli",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||
"main": "src/index.js",
|
||||
"bin": {
|
||||
|
@ -26,18 +26,18 @@
|
|||
"outputPath": "build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/types": "1.3.12-alpha.3",
|
||||
"@budibase/backend-core": "1.3.14",
|
||||
"@budibase/string-templates": "1.3.14",
|
||||
"@budibase/types": "1.3.14",
|
||||
"axios": "0.21.2",
|
||||
"chalk": "4.1.0",
|
||||
"cli-progress": "3.11.2",
|
||||
"commander": "7.1.0",
|
||||
"docker-compose": "0.23.6",
|
||||
"dotenv": "16.0.1",
|
||||
"download": "^8.0.0",
|
||||
"download": "8.0.0",
|
||||
"inquirer": "8.0.0",
|
||||
"joi": "^17.6.0",
|
||||
"joi": "17.6.0",
|
||||
"lookpath": "1.1.0",
|
||||
"node-fetch": "2",
|
||||
"pkg": "5.7.0",
|
||||
|
|
|
@ -753,7 +753,7 @@ double-ended-queue@2.1.0-0:
|
|||
resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c"
|
||||
integrity sha512-+BNfZ+deCo8hMNpDqDnvT+c0XpJ5cUa6mqYq89bho2Ifze4URTqRkcwR399hWoTrTkbZ/XJYDgP6rc7pRgffEQ==
|
||||
|
||||
download@^8.0.0:
|
||||
download@8.0.0:
|
||||
version "8.0.0"
|
||||
resolved "https://registry.yarnpkg.com/download/-/download-8.0.0.tgz#afc0b309730811731aae9f5371c9f46be73e51b1"
|
||||
integrity sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA==
|
||||
|
@ -1551,7 +1551,7 @@ isurl@^1.0.0-alpha5:
|
|||
has-to-string-tag-x "^1.2.0"
|
||||
is-object "^1.0.1"
|
||||
|
||||
joi@^17.6.0:
|
||||
joi@17.6.0:
|
||||
version "17.6.0"
|
||||
resolved "https://registry.yarnpkg.com/joi/-/joi-17.6.0.tgz#0bb54f2f006c09a96e75ce687957bd04290054b2"
|
||||
integrity sha512-OX5dG6DTbcr/kbMFj0KGYxuew69HPcAE3K/sZpEV2nP6e/j/C0HV+HNiBPCASxdx5T7DMoa0s8UeHWMnb6n2zw==
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/client",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"license": "MPL-2.0",
|
||||
"module": "dist/budibase-client.js",
|
||||
"main": "dist/budibase-client.js",
|
||||
|
@ -19,9 +19,9 @@
|
|||
"dev:builder": "rollup -cw"
|
||||
},
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "1.3.12-alpha.3",
|
||||
"@budibase/frontend-core": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/bbui": "^1.3.14",
|
||||
"@budibase/frontend-core": "^1.3.14",
|
||||
"@budibase/string-templates": "^1.3.14",
|
||||
"@spectrum-css/button": "^3.0.3",
|
||||
"@spectrum-css/card": "^3.0.3",
|
||||
"@spectrum-css/divider": "^1.0.3",
|
||||
|
|
|
@ -125,7 +125,9 @@
|
|||
// Empty components are those which accept children but do not have any.
|
||||
// Empty states can be shown for these components, but can be disabled
|
||||
// in the component manifest.
|
||||
$: empty = interactive && !children.length && hasChildren
|
||||
$: empty =
|
||||
(interactive && !children.length && hasChildren) ||
|
||||
hasMissingRequiredSettings
|
||||
$: emptyState = empty && showEmptyState
|
||||
|
||||
// Enrich component settings
|
||||
|
|
|
@ -2,18 +2,16 @@
|
|||
import { getContext } from "svelte"
|
||||
import { builderStore } from "stores"
|
||||
|
||||
const { styleable } = getContext("sdk")
|
||||
const component = getContext("component")
|
||||
|
||||
$: requiredSetting = $component.missingRequiredSettings?.[0]
|
||||
</script>
|
||||
|
||||
{#if $builderStore.inBuilder && requiredSetting}
|
||||
<div use:styleable={$component.styles}>
|
||||
<div class="component-placeholder">
|
||||
<span>
|
||||
Add the <mark>{requiredSetting.label}</mark> setting to start using your
|
||||
component -
|
||||
Add the <mark>{requiredSetting.label}</mark> setting to start using your component
|
||||
-
|
||||
</span>
|
||||
<span
|
||||
class="spectrum-Link"
|
||||
|
@ -24,7 +22,6 @@
|
|||
Show me
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<script>
|
||||
import { getContext } from "svelte"
|
||||
import { ProgressCircle, Pagination } from "@budibase/bbui"
|
||||
import Placeholder from "./Placeholder.svelte"
|
||||
import { fetchData, LuceneUtils } from "@budibase/frontend-core"
|
||||
|
||||
export let dataSource
|
||||
|
@ -132,12 +131,8 @@
|
|||
<div class="loading">
|
||||
<ProgressCircle />
|
||||
</div>
|
||||
{:else}
|
||||
{#if $component.emptyState}
|
||||
<Placeholder />
|
||||
{:else}
|
||||
<slot />
|
||||
{/if}
|
||||
{#if paginate && $fetch.supportsPagination}
|
||||
<div class="pagination">
|
||||
<Pagination
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@budibase/frontend-core",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase frontend core libraries used in builder and client",
|
||||
"author": "Budibase",
|
||||
"license": "MPL-2.0",
|
||||
"svelte": "src/index.js",
|
||||
"dependencies": {
|
||||
"@budibase/bbui": "1.3.12-alpha.3",
|
||||
"@budibase/bbui": "^1.3.14",
|
||||
"lodash": "^4.17.21",
|
||||
"svelte": "^3.46.2"
|
||||
}
|
||||
|
|
|
@ -80,6 +80,19 @@ const cleanupQuery = query => {
|
|||
return query
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a numeric prefix on field names designed to give fields uniqueness
|
||||
*/
|
||||
const removeKeyNumbering = key => {
|
||||
if (typeof key === "string" && key.match(/\d[0-9]*:/g) != null) {
|
||||
const parts = key.split(":")
|
||||
parts.shift()
|
||||
return parts.join(":")
|
||||
} else {
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a lucene JSON query from the filter structure generated in the builder
|
||||
* @param filter the builder filter structure
|
||||
|
@ -194,7 +207,7 @@ export const runLuceneQuery = (docs, query) => {
|
|||
const filters = Object.entries(query[type] || {})
|
||||
for (let i = 0; i < filters.length; i++) {
|
||||
const [key, testValue] = filters[i]
|
||||
const docValue = Helpers.deepGet(doc, key)
|
||||
const docValue = Helpers.deepGet(doc, removeKeyNumbering(key))
|
||||
if (failFn(docValue, testValue)) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/server",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase Web Server",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -77,11 +77,11 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@apidevtools/swagger-parser": "10.0.3",
|
||||
"@budibase/backend-core": "1.3.12-alpha.3",
|
||||
"@budibase/client": "1.3.12-alpha.3",
|
||||
"@budibase/pro": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/types": "1.3.12-alpha.3",
|
||||
"@budibase/backend-core": "^1.3.14",
|
||||
"@budibase/client": "^1.3.14",
|
||||
"@budibase/pro": "1.3.13",
|
||||
"@budibase/string-templates": "^1.3.14",
|
||||
"@budibase/types": "^1.3.14",
|
||||
"@bull-board/api": "3.7.0",
|
||||
"@bull-board/koa": "3.9.4",
|
||||
"@elastic/elasticsearch": "7.10.0",
|
||||
|
@ -95,7 +95,7 @@
|
|||
"bcryptjs": "2.4.3",
|
||||
"bull": "4.8.5",
|
||||
"chmodr": "1.2.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"chokidar": "3.5.3",
|
||||
"csvtojson": "2.0.10",
|
||||
"curlconverter": "3.21.0",
|
||||
"dotenv": "8.2.0",
|
||||
|
@ -141,7 +141,7 @@
|
|||
"snowflake-promise": "^4.5.0",
|
||||
"svelte": "3.49.0",
|
||||
"swagger-parser": "10.0.3",
|
||||
"tar": "^6.1.11",
|
||||
"tar": "6.1.11",
|
||||
"to-json-schema": "0.2.5",
|
||||
"uuid": "3.3.2",
|
||||
"validate.js": "0.13.1",
|
||||
|
|
|
@ -553,11 +553,7 @@ export const sync = async (ctx: any, next: any) => {
|
|||
})
|
||||
let error
|
||||
try {
|
||||
await replication.replicate({
|
||||
filter: function (doc: any) {
|
||||
return doc._id !== DocumentType.APP_METADATA
|
||||
},
|
||||
})
|
||||
await replication.replicate(replication.appReplicateOpts())
|
||||
} catch (err) {
|
||||
error = err
|
||||
} finally {
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
const { streamBackup } = require("../../utilities/fileSystem")
|
||||
const { events, context } = require("@budibase/backend-core")
|
||||
const { DocumentType } = require("../../db/utils")
|
||||
const { isQsTrue } = require("../../utilities")
|
||||
|
||||
exports.exportAppDump = async function (ctx) {
|
||||
let { appId, excludeRows } = ctx.query
|
||||
const appName = decodeURI(ctx.query.appname)
|
||||
excludeRows = excludeRows === "true"
|
||||
excludeRows = isQsTrue(excludeRows)
|
||||
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`
|
||||
ctx.attachment(backupIdentifier)
|
||||
ctx.body = await streamBackup(appId, excludeRows)
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
getAppId,
|
||||
getAppDB,
|
||||
getProdAppDB,
|
||||
getDevAppDB,
|
||||
} from "@budibase/backend-core/context"
|
||||
import { quotas } from "@budibase/pro"
|
||||
import { events } from "@budibase/backend-core"
|
||||
|
@ -110,17 +111,29 @@ async function deployApp(deployment: any) {
|
|||
target: productionAppId,
|
||||
}
|
||||
replication = new Replication(config)
|
||||
|
||||
const devDb = getDevAppDB()
|
||||
console.log("Compacting development DB")
|
||||
await devDb.compact()
|
||||
console.log("Replication object created")
|
||||
await replication.replicate()
|
||||
await replication.replicate(replication.appReplicateOpts())
|
||||
console.log("replication complete.. replacing app meta doc")
|
||||
// app metadata is excluded as it is likely to be in conflict
|
||||
// replicate the app metadata document manually
|
||||
const db = getProdAppDB()
|
||||
const appDoc = await db.get(DocumentType.APP_METADATA)
|
||||
const appDoc = await devDb.get(DocumentType.APP_METADATA)
|
||||
try {
|
||||
const prodAppDoc = await db.get(DocumentType.APP_METADATA)
|
||||
appDoc._rev = prodAppDoc._rev
|
||||
} catch (err) {
|
||||
delete appDoc._rev
|
||||
}
|
||||
|
||||
// switch to production app ID
|
||||
deployment.appUrl = appDoc.url
|
||||
|
||||
appDoc.appId = productionAppId
|
||||
appDoc.instance._id = productionAppId
|
||||
// remove automation errors if they exist
|
||||
delete appDoc.automationErrors
|
||||
await db.put(appDoc)
|
||||
await appCache.invalidateAppMetadata(productionAppId)
|
||||
console.log("New app doc written successfully.")
|
||||
|
|
|
@ -534,7 +534,7 @@ module External {
|
|||
})
|
||||
// this is the response from knex if no rows found
|
||||
const rows = !response[0].read ? response : []
|
||||
const storeTo = isMany ? field.throughFrom || linkPrimaryKey : manyKey
|
||||
const storeTo = isMany ? field.throughFrom || linkPrimaryKey : fieldName
|
||||
related[storeTo] = { rows, isMany, tableId }
|
||||
}
|
||||
return related
|
||||
|
|
|
@ -56,7 +56,7 @@ router
|
|||
authorized(PermissionTypes.TABLE, PermissionLevels.WRITE),
|
||||
controller.deleteObjects
|
||||
)
|
||||
.get("/preview", authorized(BUILDER), controller.serveBuilderPreview)
|
||||
.get("/app/preview", authorized(BUILDER), controller.serveBuilderPreview)
|
||||
.get("/:appId/:path*", controller.serveApp)
|
||||
.get("/app/:appUrl/:path*", controller.serveApp)
|
||||
.post(
|
||||
|
|
|
@ -294,7 +294,7 @@ describe("/queries", () => {
|
|||
"url": "string",
|
||||
"value": "string"
|
||||
})
|
||||
expect(res.body.rows[0].url).toContain("doctype html")
|
||||
expect(res.body.rows[0].url).toContain("doctype%20html")
|
||||
})
|
||||
|
||||
it("check that it automatically retries on fail with cached dynamics", async () => {
|
||||
|
@ -379,7 +379,7 @@ describe("/queries", () => {
|
|||
"queryHdr": userDetails.firstName,
|
||||
"secondHdr" : "1234"
|
||||
})
|
||||
expect(res.body.rows[0].url).toEqual("http://www.google.com?email=" + userDetails.email)
|
||||
expect(res.body.rows[0].url).toEqual("http://www.google.com?email=" + userDetails.email.replace("@", "%40"))
|
||||
})
|
||||
|
||||
it("should bind the current user to query parameters", async () => {
|
||||
|
@ -396,7 +396,7 @@ describe("/queries", () => {
|
|||
"testParam" : "1234"
|
||||
})
|
||||
|
||||
expect(res.body.rows[0].url).toEqual("http://www.google.com?test=" + userDetails.email +
|
||||
expect(res.body.rows[0].url).toEqual("http://www.google.com?test=" + userDetails.email.replace("@", "%40") +
|
||||
"&testName=" + userDetails.firstName + "&testParam=1234")
|
||||
})
|
||||
|
||||
|
|
|
@ -150,14 +150,14 @@ describe("/static", () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe("/preview", () => {
|
||||
describe("/app/preview", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it("should serve the builder preview", async () => {
|
||||
const headers = config.defaultHeaders()
|
||||
const res = await request.get(`/preview`).set(headers).expect(200)
|
||||
const res = await request.get(`/app/preview`).set(headers).expect(200)
|
||||
|
||||
expect(res.body.appId).toBe(config.appId)
|
||||
expect(res.body.builderPreview).toBe(true)
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
const { processEvent } = require("./utils")
|
||||
const { queue, shutdown } = require("./bullboard")
|
||||
const { TRIGGER_DEFINITIONS } = require("./triggers")
|
||||
const { TRIGGER_DEFINITIONS, rebootTrigger } = require("./triggers")
|
||||
const { ACTION_DEFINITIONS } = require("./actions")
|
||||
|
||||
/**
|
||||
* This module is built purely to kick off the worker farm and manage the inputs/outputs
|
||||
*/
|
||||
exports.init = function () {
|
||||
exports.init = async function () {
|
||||
// this promise will not complete
|
||||
return queue.process(async job => {
|
||||
const promise = queue.process(async job => {
|
||||
await processEvent(job)
|
||||
})
|
||||
// on init we need to trigger any reboot automations
|
||||
await rebootTrigger()
|
||||
return promise
|
||||
}
|
||||
|
||||
exports.getQueues = () => {
|
||||
|
|
|
@ -9,6 +9,7 @@ const { checkTestFlag } = require("../utilities/redis")
|
|||
const utils = require("./utils")
|
||||
const env = require("../environment")
|
||||
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context")
|
||||
const { getAllApps } = require("@budibase/backend-core/db")
|
||||
|
||||
const TRIGGER_DEFINITIONS = definitions
|
||||
const JOB_OPTS = {
|
||||
|
@ -16,21 +17,24 @@ const JOB_OPTS = {
|
|||
removeOnFail: true,
|
||||
}
|
||||
|
||||
async function getAllAutomations() {
|
||||
const db = getAppDB()
|
||||
let automations = await db.allDocs(
|
||||
getAutomationParams(null, { include_docs: true })
|
||||
)
|
||||
return automations.rows.map(row => row.doc)
|
||||
}
|
||||
|
||||
async function queueRelevantRowAutomations(event, eventType) {
|
||||
if (event.appId == null) {
|
||||
throw `No appId specified for ${eventType} - check event emitters.`
|
||||
}
|
||||
|
||||
doInAppContext(event.appId, async () => {
|
||||
const db = getAppDB()
|
||||
let automations = await db.allDocs(
|
||||
getAutomationParams(null, { include_docs: true })
|
||||
)
|
||||
let automations = await getAllAutomations()
|
||||
|
||||
// filter down to the correct event type
|
||||
automations = automations.rows
|
||||
.map(automation => automation.doc)
|
||||
.filter(automation => {
|
||||
automations = automations.filter(automation => {
|
||||
const trigger = automation.definition.trigger
|
||||
return trigger && trigger.event === eventType
|
||||
})
|
||||
|
@ -110,4 +114,34 @@ exports.externalTrigger = async function (
|
|||
}
|
||||
}
|
||||
|
||||
exports.rebootTrigger = async () => {
|
||||
// reboot cron option is only available on the main thread at
|
||||
// startup and only usable in self host
|
||||
if (env.isInThread() || !env.SELF_HOSTED) {
|
||||
return
|
||||
}
|
||||
// iterate through all production apps, find the reboot crons
|
||||
// and trigger events for them
|
||||
const appIds = await getAllApps({ dev: false, idsOnly: true })
|
||||
for (let prodAppId of appIds) {
|
||||
await doInAppContext(prodAppId, async () => {
|
||||
let automations = await getAllAutomations()
|
||||
let rebootEvents = []
|
||||
for (let automation of automations) {
|
||||
if (utils.isRebootTrigger(automation)) {
|
||||
const job = {
|
||||
automation,
|
||||
event: {
|
||||
appId: prodAppId,
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
}
|
||||
rebootEvents.push(queue.add(job, JOB_OPTS))
|
||||
}
|
||||
}
|
||||
await Promise.all(rebootEvents)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
exports.TRIGGER_DEFINITIONS = TRIGGER_DEFINITIONS
|
||||
|
|
|
@ -17,6 +17,7 @@ import { tenancy } from "@budibase/backend-core"
|
|||
import { quotas } from "@budibase/pro"
|
||||
import { Automation } from "@budibase/types"
|
||||
|
||||
const REBOOT_CRON = "@reboot"
|
||||
const WH_STEP_ID = definitions.WEBHOOK.stepId
|
||||
const CRON_STEP_ID = definitions.CRON.stepId
|
||||
const Runner = new Thread(ThreadType.AUTOMATION)
|
||||
|
@ -109,22 +110,33 @@ export async function clearMetadata() {
|
|||
await db.bulkDocs(automationMetadata)
|
||||
}
|
||||
|
||||
/**
|
||||
* This function handles checking of any cron jobs that need to be enabled/updated.
|
||||
* @param {string} appId The ID of the app in which we are checking for webhooks
|
||||
* @param {object|undefined} automation The automation object to be updated.
|
||||
*/
|
||||
export async function enableCronTrigger(appId: any, automation: any) {
|
||||
const trigger = automation ? automation.definition.trigger : null
|
||||
function isCronTrigger(auto: any) {
|
||||
export function isCronTrigger(auto: Automation) {
|
||||
return (
|
||||
auto &&
|
||||
auto.definition.trigger &&
|
||||
auto.definition.trigger.stepId === CRON_STEP_ID
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function isRebootTrigger(auto: Automation) {
|
||||
const trigger = auto ? auto.definition.trigger : null
|
||||
return isCronTrigger(auto) && trigger?.inputs.cron === REBOOT_CRON
|
||||
}
|
||||
|
||||
/**
|
||||
* This function handles checking of any cron jobs that need to be enabled/updated.
|
||||
* @param {string} appId The ID of the app in which we are checking for webhooks
|
||||
* @param {object|undefined} automation The automation object to be updated.
|
||||
*/
|
||||
export async function enableCronTrigger(appId: any, automation: Automation) {
|
||||
const trigger = automation ? automation.definition.trigger : null
|
||||
|
||||
// need to create cron job
|
||||
if (isCronTrigger(automation) && trigger?.inputs.cron) {
|
||||
if (
|
||||
isCronTrigger(automation) &&
|
||||
!isRebootTrigger(automation) &&
|
||||
trigger?.inputs.cron
|
||||
) {
|
||||
// make a job id rather than letting Bull decide, makes it easier to handle on way out
|
||||
const jobId = `${appId}_cron_${newid()}`
|
||||
const job: any = await queue.add(
|
||||
|
|
|
@ -34,6 +34,7 @@ export interface RestConfig {
|
|||
defaultHeaders: {
|
||||
[key: string]: any
|
||||
}
|
||||
legacyHttpParser: boolean
|
||||
authConfigs: AuthConfig[]
|
||||
staticVariables: {
|
||||
[key: string]: string
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
BearerAuthConfig,
|
||||
} from "../definitions/datasource"
|
||||
import { get } from "lodash"
|
||||
import qs from "querystring"
|
||||
const fetch = require("node-fetch")
|
||||
const { formatBytes } = require("../utilities")
|
||||
const { performance } = require("perf_hooks")
|
||||
|
@ -75,6 +76,12 @@ const SCHEMA: Integration = {
|
|||
required: false,
|
||||
default: {},
|
||||
},
|
||||
legacyHttpParser: {
|
||||
display: "Legacy HTTP Support",
|
||||
type: DatasourceFieldType.BOOLEAN,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
query: {
|
||||
create: {
|
||||
|
@ -211,7 +218,8 @@ class RestIntegration implements IntegrationBase {
|
|||
}
|
||||
}
|
||||
|
||||
const main = `${path}?${queryString}`
|
||||
// make sure the query string is fully encoded
|
||||
const main = `${path}?${qs.encode(qs.decode(queryString))}`
|
||||
let complete = main
|
||||
if (this.config.url && !main.startsWith("http")) {
|
||||
complete = !this.config.url ? main : `${this.config.url}/${main}`
|
||||
|
@ -373,6 +381,11 @@ class RestIntegration implements IntegrationBase {
|
|||
paginationValues
|
||||
)
|
||||
|
||||
if (this.config.legacyHttpParser) {
|
||||
// https://github.com/nodejs/node/issues/43798
|
||||
input.extraHttpOptions = { insecureHTTPParser: true }
|
||||
}
|
||||
|
||||
this.startTimeMs = performance.now()
|
||||
const url = this.getUrl(path, queryString, pagination, paginationValues)
|
||||
const response = await fetch(url, input)
|
||||
|
|
|
@ -51,7 +51,7 @@ describe("REST Integration", () => {
|
|||
name: "test",
|
||||
}),
|
||||
}
|
||||
const response = await config.integration.create(query)
|
||||
await config.integration.create(query)
|
||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, {
|
||||
method: "POST",
|
||||
body: '{"name":"test"}',
|
||||
|
@ -299,7 +299,7 @@ describe("REST Integration", () => {
|
|||
}
|
||||
await config.integration.read(query)
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}&`,
|
||||
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}`,
|
||||
{
|
||||
headers: {},
|
||||
method: "GET",
|
||||
|
@ -426,7 +426,7 @@ describe("REST Integration", () => {
|
|||
}
|
||||
const res = await config.integration.read(query)
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}&`,
|
||||
`${BASE_URL}/api?${pageParam}=${pageValue}&${sizeParam}=${sizeValue}`,
|
||||
{
|
||||
headers: {},
|
||||
method: "GET",
|
||||
|
@ -536,5 +536,40 @@ describe("REST Integration", () => {
|
|||
expect(sentData.get(sizeParam)).toEqual(sizeValue.toString())
|
||||
expect(res.pagination.cursor).toEqual(123)
|
||||
})
|
||||
|
||||
it("should encode query string correctly", async () => {
|
||||
const query = {
|
||||
path: "api",
|
||||
queryString: "test=1 2",
|
||||
headers: HEADERS,
|
||||
bodyType: "json",
|
||||
requestBody: JSON.stringify({
|
||||
name: "test",
|
||||
}),
|
||||
}
|
||||
await config.integration.create(query)
|
||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1%202`, {
|
||||
method: "POST",
|
||||
body: '{"name":"test"}',
|
||||
headers: HEADERS,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("Configuration options", () => {
|
||||
it("Attaches insecureHttpParams when legacy HTTP Parser option is set", async () => {
|
||||
config = new TestConfiguration({
|
||||
url: BASE_URL,
|
||||
legacyHttpParser: true,
|
||||
})
|
||||
await config.integration.read({})
|
||||
expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/?`, {
|
||||
method: "GET",
|
||||
headers: {},
|
||||
extraHttpOptions: {
|
||||
insecureHTTPParser: true,
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -458,6 +458,9 @@ class Orchestrator {
|
|||
|
||||
export function execute(input: AutomationEvent, callback: WorkerCallback) {
|
||||
const appId = input.data.event.appId
|
||||
if (!appId) {
|
||||
throw new Error("Unable to execute, event doesn't contain app ID.")
|
||||
}
|
||||
doInAppContext(appId, async () => {
|
||||
const automationOrchestrator = new Orchestrator(
|
||||
input.data.automation,
|
||||
|
@ -475,6 +478,9 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) {
|
|||
|
||||
export const removeStalled = async (input: AutomationEvent) => {
|
||||
const appId = input.data.event.appId
|
||||
if (!appId) {
|
||||
throw new Error("Unable to execute, event doesn't contain app ID.")
|
||||
}
|
||||
await doInAppContext(appId, async () => {
|
||||
const automationOrchestrator = new Orchestrator(
|
||||
input.data.automation,
|
||||
|
|
|
@ -136,13 +136,13 @@ exports.defineFilter = excludeRows => {
|
|||
* data or user relationships.
|
||||
* @param {string} appId The app to backup
|
||||
* @param {object} config Config to send to export DB
|
||||
* @param {boolean} includeRows Flag to state whether the export should include data.
|
||||
* @param {boolean} excludeRows Flag to state whether the export should include data.
|
||||
* @returns {*} either a string or a stream of the backup
|
||||
*/
|
||||
const backupAppData = async (appId, config, includeRows) => {
|
||||
const backupAppData = async (appId, config, excludeRows) => {
|
||||
return await exports.exportDB(appId, {
|
||||
...config,
|
||||
filter: exports.defineFilter(includeRows),
|
||||
filter: exports.defineFilter(excludeRows),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -159,11 +159,11 @@ exports.performBackup = async (appId, backupName) => {
|
|||
/**
|
||||
* Streams a backup of the database state for an app
|
||||
* @param {string} appId The ID of the app which is to be backed up.
|
||||
* @param {boolean} includeRows Flag to state whether the export should include data.
|
||||
* @param {boolean} excludeRows Flag to state whether the export should include data.
|
||||
* @returns {*} a readable stream of the backup which is written in real time
|
||||
*/
|
||||
exports.streamBackup = async (appId, includeRows) => {
|
||||
return await backupAppData(appId, { stream: true }, includeRows)
|
||||
exports.streamBackup = async (appId, excludeRows) => {
|
||||
return await backupAppData(appId, { stream: true }, excludeRows)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -162,3 +162,11 @@ exports.convertBookmark = bookmark => {
|
|||
}
|
||||
return bookmark
|
||||
}
|
||||
|
||||
exports.isQsTrue = param => {
|
||||
if (typeof param === "string") {
|
||||
return param.toLowerCase() === "true"
|
||||
} else {
|
||||
return param === true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ exports.processDates = (table, rows) => {
|
|||
if (schema.type !== FieldTypes.DATETIME) {
|
||||
continue
|
||||
}
|
||||
if (!schema.ignoreTimezones) {
|
||||
if (!schema.timeOnly && !schema.ignoreTimezones) {
|
||||
datesWithTZ.push(column)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ exports.getUniqueRows = async appIds => {
|
|||
// ensure uniqueness on a per app pair basis
|
||||
// this can't be done on all rows because app import results in
|
||||
// duplicate row ids across apps
|
||||
uniqueRows = uniqueRows.concat(...new Set(appRows))
|
||||
// the array pre-concat is important to avoid stack overflow
|
||||
uniqueRows = uniqueRows.concat([...new Set(appRows)])
|
||||
}
|
||||
|
||||
return uniqueRows
|
||||
|
|
|
@ -1094,12 +1094,12 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/backend-core@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.3.tgz#baf7ea0590db9e49db08e4e05b7d374a2ed05f20"
|
||||
integrity sha512-8xkaJX2kA2n7LKNXJ9SSyQnvOYRPDxiZ6BKDEPNoOa0WjYZ/htCnUJxgjdnSSzSojqfdDf8eqxa+pGXA87ZU6Q==
|
||||
"@budibase/backend-core@1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.13.tgz#62341d7eb2daba955069b4b54d1e7ef6ade62598"
|
||||
integrity sha512-ib+ojvO8Yw5wCoHkE6Gc09D5EZiQL72g/KVEs0y2oRD92VGnv9VGpY3dA1A1UIRdi8wELDz20LrDaV/4lFbmfg==
|
||||
dependencies:
|
||||
"@budibase/types" "1.3.12-alpha.3"
|
||||
"@budibase/types" "^1.3.13"
|
||||
"@shopify/jest-koa-mocks" "5.0.1"
|
||||
"@techpass/passport-openidconnect" "0.3.2"
|
||||
aws-sdk "2.1030.0"
|
||||
|
@ -1179,13 +1179,13 @@
|
|||
svelte-flatpickr "^3.2.3"
|
||||
svelte-portal "^1.0.0"
|
||||
|
||||
"@budibase/pro@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.3.tgz#30dce4ba54aa7c19b60d6faf2852e3402c81ee50"
|
||||
integrity sha512-qDddYE6XNbiNIpADUIhXWvgBjJMNxWhHdCpS7Qoci2tmoS4ofLlh5C8qKJuddg3RaLkWIQmII/p/ZnZ0uQ3E9A==
|
||||
"@budibase/pro@1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.13.tgz#2833898c04b041716f712ba95599da46d07e2d1d"
|
||||
integrity sha512-l9AkPCCmOtX9htB7rT+cisgcihVXI4b5wsPzDwHKYfAj1rSRa/0FA+m6/V6D5FzwHAILY3//YOZmgPavL9gvMw==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "1.3.12-alpha.3"
|
||||
"@budibase/types" "1.3.12-alpha.3"
|
||||
"@budibase/backend-core" "1.3.13"
|
||||
"@budibase/types" "1.3.13"
|
||||
"@koa/router" "8.0.8"
|
||||
joi "17.6.0"
|
||||
node-fetch "^2.6.1"
|
||||
|
@ -1208,10 +1208,10 @@
|
|||
svelte-apexcharts "^1.0.2"
|
||||
svelte-flatpickr "^3.1.0"
|
||||
|
||||
"@budibase/types@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.3.tgz#26c5f168281f5ead4a108af2918ce9810d92d239"
|
||||
integrity sha512-dvs+KWlu+DdaVKAA6vU2qTZJmS4ACIllBSSjDeG0sGOBkIlGJSi5aC6zvkPXpaaZlbDQpDwao/9xNP+Ub8wj1g==
|
||||
"@budibase/types@1.3.13", "@budibase/types@^1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.13.tgz#d71986f4785311322636231589ca5e1d29e87985"
|
||||
integrity sha512-iqBjB3wart+rjQ8q/QbZU5JEljixVzzDwZu3i9rFCWbHAUH+GVeuP4CehdLlDRhCjoecFw+UxA6SuhCwdLi+yQ==
|
||||
|
||||
"@bull-board/api@3.7.0":
|
||||
version "3.7.0"
|
||||
|
@ -4515,7 +4515,7 @@ chmodr@1.2.0:
|
|||
resolved "https://registry.yarnpkg.com/chmodr/-/chmodr-1.2.0.tgz#720e96caa09b7f1cdbb01529b7d0ab6bc5e118b9"
|
||||
integrity sha512-Y5uI7Iq/Az6HgJEL6pdw7THVd7jbVOTPwsmcPOBjQL8e3N+pz872kzK5QxYGEy21iRys+iHWV0UZQXDFJo1hyA==
|
||||
|
||||
chokidar@^3.5.2, chokidar@^3.5.3:
|
||||
chokidar@3.5.3, chokidar@^3.5.2:
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
|
||||
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
|
||||
|
@ -13463,7 +13463,7 @@ tar-stream@^2.1.4:
|
|||
inherits "^2.0.3"
|
||||
readable-stream "^3.1.1"
|
||||
|
||||
tar@^6.1.11:
|
||||
tar@6.1.11, tar@^6.1.11:
|
||||
version "6.1.11"
|
||||
resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621"
|
||||
integrity sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/string-templates",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "src/index.cjs",
|
||||
"module": "dist/bundle.mjs",
|
||||
|
|
|
@ -272,6 +272,14 @@ describe("test the string helpers", () => {
|
|||
)
|
||||
expect(output).toBe("Hi!")
|
||||
})
|
||||
|
||||
it("should allow use of the ellipsis helper", async () => {
|
||||
const output = await processString(
|
||||
"{{ ellipsis \"adfasdfasdfasf\" 7 }}",
|
||||
{},
|
||||
)
|
||||
expect(output).toBe("adfasdf…")
|
||||
})
|
||||
})
|
||||
|
||||
describe("test the comparison helpers", () => {
|
||||
|
|
|
@ -568,15 +568,6 @@
|
|||
magic-string "^0.25.7"
|
||||
resolve "^1.17.0"
|
||||
|
||||
"@rollup/plugin-inject@^4.0.0":
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@rollup/plugin-inject/-/plugin-inject-4.0.4.tgz#fbeee66e9a700782c4f65c8b0edbafe58678fbc2"
|
||||
integrity sha512-4pbcU4J/nS+zuHk+c+OL3WtmEQhqxlZ9uqfjQMQDOHOPld7PsCd8k5LWs8h5wjwJN7MgnAn768F2sDxEP4eNFQ==
|
||||
dependencies:
|
||||
"@rollup/pluginutils" "^3.1.0"
|
||||
estree-walker "^2.0.1"
|
||||
magic-string "^0.25.7"
|
||||
|
||||
"@rollup/plugin-json@^4.1.0":
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-4.1.0.tgz#54e09867ae6963c593844d8bd7a9c718294496f3"
|
||||
|
@ -3796,13 +3787,6 @@ rollup-plugin-node-resolve@^5.2.0:
|
|||
resolve "^1.11.1"
|
||||
rollup-pluginutils "^2.8.1"
|
||||
|
||||
rollup-plugin-polyfill-node@^0.10.2:
|
||||
version "0.10.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-polyfill-node/-/rollup-plugin-polyfill-node-0.10.2.tgz#b2128646851fcb9475ddfd5bc22ca1a8c568738d"
|
||||
integrity sha512-5GMywXiLiuQP6ZzED/LO/Q0HyDi2W6b8VN+Zd3oB0opIjyRs494Me2ZMaqKWDNbGiW4jvvzl6L2n4zRgxS9cSQ==
|
||||
dependencies:
|
||||
"@rollup/plugin-inject" "^4.0.0"
|
||||
|
||||
rollup-plugin-terser@^7.0.2:
|
||||
version "7.0.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@budibase/types",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase types",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
|
@ -25,6 +25,10 @@ export interface AutomationStep {
|
|||
export interface AutomationTrigger {
|
||||
id: string
|
||||
stepId: string
|
||||
inputs: {
|
||||
[key: string]: any
|
||||
}
|
||||
cronJobId?: string
|
||||
}
|
||||
|
||||
export enum AutomationStatus {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@budibase/worker",
|
||||
"email": "hi@budibase.com",
|
||||
"version": "1.3.12-alpha.3",
|
||||
"version": "1.3.14",
|
||||
"description": "Budibase background service",
|
||||
"main": "src/index.ts",
|
||||
"repository": {
|
||||
|
@ -35,10 +35,10 @@
|
|||
"author": "Budibase",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@budibase/backend-core": "1.3.12-alpha.3",
|
||||
"@budibase/pro": "1.3.12-alpha.3",
|
||||
"@budibase/string-templates": "1.3.12-alpha.3",
|
||||
"@budibase/types": "1.3.12-alpha.3",
|
||||
"@budibase/backend-core": "^1.3.14",
|
||||
"@budibase/pro": "1.3.13",
|
||||
"@budibase/string-templates": "^1.3.14",
|
||||
"@budibase/types": "^1.3.14",
|
||||
"@koa/router": "8.0.8",
|
||||
"@sentry/node": "6.17.7",
|
||||
"@techpass/passport-openidconnect": "0.3.2",
|
||||
|
|
|
@ -291,12 +291,12 @@
|
|||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@budibase/backend-core@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.3.tgz#baf7ea0590db9e49db08e4e05b7d374a2ed05f20"
|
||||
integrity sha512-8xkaJX2kA2n7LKNXJ9SSyQnvOYRPDxiZ6BKDEPNoOa0WjYZ/htCnUJxgjdnSSzSojqfdDf8eqxa+pGXA87ZU6Q==
|
||||
"@budibase/backend-core@1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.13.tgz#62341d7eb2daba955069b4b54d1e7ef6ade62598"
|
||||
integrity sha512-ib+ojvO8Yw5wCoHkE6Gc09D5EZiQL72g/KVEs0y2oRD92VGnv9VGpY3dA1A1UIRdi8wELDz20LrDaV/4lFbmfg==
|
||||
dependencies:
|
||||
"@budibase/types" "1.3.12-alpha.3"
|
||||
"@budibase/types" "^1.3.13"
|
||||
"@shopify/jest-koa-mocks" "5.0.1"
|
||||
"@techpass/passport-openidconnect" "0.3.2"
|
||||
aws-sdk "2.1030.0"
|
||||
|
@ -326,21 +326,21 @@
|
|||
uuid "8.3.2"
|
||||
zlib "1.0.5"
|
||||
|
||||
"@budibase/pro@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.3.tgz#30dce4ba54aa7c19b60d6faf2852e3402c81ee50"
|
||||
integrity sha512-qDddYE6XNbiNIpADUIhXWvgBjJMNxWhHdCpS7Qoci2tmoS4ofLlh5C8qKJuddg3RaLkWIQmII/p/ZnZ0uQ3E9A==
|
||||
"@budibase/pro@1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.13.tgz#2833898c04b041716f712ba95599da46d07e2d1d"
|
||||
integrity sha512-l9AkPCCmOtX9htB7rT+cisgcihVXI4b5wsPzDwHKYfAj1rSRa/0FA+m6/V6D5FzwHAILY3//YOZmgPavL9gvMw==
|
||||
dependencies:
|
||||
"@budibase/backend-core" "1.3.12-alpha.3"
|
||||
"@budibase/types" "1.3.12-alpha.3"
|
||||
"@budibase/backend-core" "1.3.13"
|
||||
"@budibase/types" "1.3.13"
|
||||
"@koa/router" "8.0.8"
|
||||
joi "17.6.0"
|
||||
node-fetch "^2.6.1"
|
||||
|
||||
"@budibase/types@1.3.12-alpha.3":
|
||||
version "1.3.12-alpha.3"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.3.tgz#26c5f168281f5ead4a108af2918ce9810d92d239"
|
||||
integrity sha512-dvs+KWlu+DdaVKAA6vU2qTZJmS4ACIllBSSjDeG0sGOBkIlGJSi5aC6zvkPXpaaZlbDQpDwao/9xNP+Ub8wj1g==
|
||||
"@budibase/types@1.3.13", "@budibase/types@^1.3.13":
|
||||
version "1.3.13"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.13.tgz#d71986f4785311322636231589ca5e1d29e87985"
|
||||
integrity sha512-iqBjB3wart+rjQ8q/QbZU5JEljixVzzDwZu3i9rFCWbHAUH+GVeuP4CehdLlDRhCjoecFw+UxA6SuhCwdLi+yQ==
|
||||
|
||||
"@cspotcode/source-map-consumer@0.8.0":
|
||||
version "0.8.0"
|
||||
|
|
Loading…
Reference in New Issue