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

This commit is contained in:
mike12345567 2021-12-15 16:25:32 +00:00
commit 65f4b91e8b
20 changed files with 111 additions and 44 deletions

View File

@ -12,6 +12,12 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: 14.x
- run: yarn
- run: yarn bootstrap
- name: 'Get Previous tag' - name: 'Get Previous tag'
id: previoustag id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1" uses: "WyriHaximus/github-action-get-previous-tag@v1"

View File

@ -11,8 +11,8 @@ sources:
- https://github.com/Budibase/budibase - https://github.com/Budibase/budibase
- https://budibase.com - https://budibase.com
type: application type: application
version: 0.2.6 version: 1.0.0
appVersion: 1.0.10 appVersion: 1.0.20
dependencies: dependencies:
- name: couchdb - name: couchdb
version: 3.3.4 version: 3.3.4

View File

@ -1,5 +1,5 @@
{ {
"version": "1.0.19-alpha.3", "version": "1.0.22",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/auth", "name": "@budibase/auth",
"version": "1.0.19-alpha.3", "version": "1.0.22",
"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": "1.0.19-alpha.3", "version": "1.0.22",
"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",

View File

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

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "1.0.19-alpha.3", "version": "1.0.22",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "1.0.19-alpha.3", "version": "1.0.22",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.19-alpha.3", "@budibase/bbui": "^1.0.22",
"@budibase/standard-components": "^0.9.139", "@budibase/standard-components": "^0.9.139",
"@budibase/string-templates": "^1.0.19-alpha.3", "@budibase/string-templates": "^1.0.22",
"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,8 +1,9 @@
<script> <script>
import { setContext, getContext } from "svelte" import { setContext, getContext, onMount } from "svelte"
import Router, { querystring } from "svelte-spa-router" import Router, { querystring } from "svelte-spa-router"
import { routeStore } from "stores" import { routeStore, stateStore } from "stores"
import Screen from "./Screen.svelte" import Screen from "./Screen.svelte"
import { get } from "svelte/store"
const { styleable } = getContext("sdk") const { styleable } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -17,15 +18,17 @@
} }
// Keep query params up to date // Keep query params up to date
$: { $: routeStore.actions.setQueryParams(parseQueryString($querystring))
const parseQueryString = query => {
let queryParams = {} let queryParams = {}
if ($querystring) { if (query) {
const urlSearchParams = new URLSearchParams($querystring) const urlSearchParams = new URLSearchParams(query)
for (const [key, value] of urlSearchParams) { for (const [key, value] of urlSearchParams) {
queryParams[key] = value queryParams[key] = value
} }
} }
routeStore.actions.setQueryParams(queryParams) return queryParams
} }
const getRouterConfig = routes => { const getRouterConfig = routes => {
@ -42,6 +45,19 @@
const onRouteLoading = ({ detail }) => { const onRouteLoading = ({ detail }) => {
routeStore.actions.setActiveRoute(detail.route) routeStore.actions.setActiveRoute(detail.route)
} }
// Initialise state store from query string on initial load
onMount(() => {
const queryParams = parseQueryString(get(querystring))
if (queryParams.state) {
try {
const state = JSON.parse(atob(queryParams.state))
stateStore.actions.initialise(state)
} catch (error) {
// Swallow error and do nothing
}
}
})
</script> </script>
{#key config.id} {#key config.id}

View File

@ -4,6 +4,7 @@
dataSourceStore, dataSourceStore,
notificationStore, notificationStore,
routeStore, routeStore,
stateStore,
} from "stores" } from "stores"
import { Modal, ModalContent, ActionButton } from "@budibase/bbui" import { Modal, ModalContent, ActionButton } from "@budibase/bbui"
import { onDestroy } from "svelte" import { onDestroy } from "svelte"
@ -12,12 +13,13 @@
NOTIFICATION: "notification", NOTIFICATION: "notification",
CLOSE_SCREEN_MODAL: "close-screen-modal", CLOSE_SCREEN_MODAL: "close-screen-modal",
INVALIDATE_DATASOURCE: "invalidate-datasource", INVALIDATE_DATASOURCE: "invalidate-datasource",
UPDATE_STATE: "update-state",
} }
let iframe let iframe
let listenersAttached = false let listenersAttached = false
const invalidateDataSource = event => { const proxyInvalidation = event => {
const { dataSourceId } = event.detail const { dataSourceId } = event.detail
dataSourceStore.actions.invalidateDataSource(dataSourceId) dataSourceStore.actions.invalidateDataSource(dataSourceId)
} }
@ -27,14 +29,28 @@
notificationStore.actions.send(message, type, icon) notificationStore.actions.send(message, type, icon)
} }
const proxyStateUpdate = event => {
const { type, key, value, persist } = event.detail
if (type === "set") {
stateStore.actions.setValue(key, value, persist)
} else if (type === "delete") {
stateStore.actions.deleteValue(key)
}
}
function receiveMessage(message) { function receiveMessage(message) {
const handlers = { const handlers = {
[MessageTypes.NOTIFICATION]: () => { [MessageTypes.NOTIFICATION]: () => {
proxyNotification(message.data) proxyNotification(message.data)
}, },
[MessageTypes.CLOSE_SCREEN_MODAL]: peekStore.actions.hidePeek, [MessageTypes.CLOSE_SCREEN_MODAL]: () => {
peekStore.actions.hidePeek()
},
[MessageTypes.INVALIDATE_DATASOURCE]: () => { [MessageTypes.INVALIDATE_DATASOURCE]: () => {
invalidateDataSource(message.data) proxyInvalidation(message.data)
},
[MessageTypes.UPDATE_STATE]: () => {
proxyStateUpdate(message.data)
}, },
} }

View File

@ -1,6 +1,7 @@
import { writable, get } from "svelte/store" import { writable, get } from "svelte/store"
import { fetchTableDefinition } from "../api" import { fetchTableDefinition } from "../api"
import { FieldTypes } from "../constants" import { FieldTypes } from "../constants"
import { routeStore } from "./routes"
export const createDataSourceStore = () => { export const createDataSourceStore = () => {
const store = writable([]) const store = writable([])
@ -60,10 +61,12 @@ export const createDataSourceStore = () => {
// Emit this as a window event, so parent screens which are iframing us in // Emit this as a window event, so parent screens which are iframing us in
// can also invalidate the same datasource // can also invalidate the same datasource
window.parent.postMessage({ if (get(routeStore).queryParams?.peek) {
type: "close-screen-modal", window.parent.postMessage({
detail: { dataSourceId }, type: "invalidate-datasource",
}) detail: { dataSourceId },
})
}
let invalidations = [dataSourceId] let invalidations = [dataSourceId]

View File

@ -1,4 +1,5 @@
import { writable } from "svelte/store" import { writable, get } from "svelte/store"
import { stateStore } from "./state.js"
const initialState = { const initialState = {
showPeek: false, showPeek: false,
@ -14,7 +15,10 @@ const createPeekStore = () => {
let href = url let href = url
let external = !url.startsWith("/") let external = !url.startsWith("/")
if (!external) { if (!external) {
href = `${window.location.href.split("#")[0]}#${url}?peek=true` const state = get(stateStore)
const serialised = encodeURIComponent(btoa(JSON.stringify(state)))
const query = `peek=true&state=${serialised}`
href = `${window.location.href.split("#")[0]}#${url}?${query}`
} }
store.set({ store.set({
showPeek: true, showPeek: true,

View File

@ -1,9 +1,9 @@
import { writable, get, derived } from "svelte/store" import { writable, get, derived } from "svelte/store"
import { localStorageStore } from "builder/src/builderStore/store/localStorage" import { localStorageStore } from "builder/src/builderStore/store/localStorage"
import { appStore } from "./app"
const createStateStore = () => { const createStateStore = () => {
const localStorageKey = `${get(appStore).appId}.state` const appId = window["##BUDIBASE_APP_ID##"] || "app"
const localStorageKey = `${appId}.state`
const persistentStore = localStorageStore(localStorageKey, {}) const persistentStore = localStorageStore(localStorageKey, {})
// Initialise the temp store to mirror the persistent store // Initialise the temp store to mirror the persistent store
@ -34,6 +34,9 @@ const createStateStore = () => {
}) })
} }
// Initialises the temporary state store with a certain value
const initialise = tempStore.set
// Derive the combination of both persisted and non persisted stores // Derive the combination of both persisted and non persisted stores
const store = derived( const store = derived(
[tempStore, persistentStore], [tempStore, persistentStore],
@ -47,7 +50,7 @@ const createStateStore = () => {
return { return {
subscribe: store.subscribe, subscribe: store.subscribe,
actions: { setValue, deleteValue }, actions: { setValue, deleteValue, initialise },
} }
} }

View File

@ -116,6 +116,15 @@ const updateStateHandler = action => {
} else if (type === "delete") { } else if (type === "delete") {
stateStore.actions.deleteValue(key) stateStore.actions.deleteValue(key)
} }
// Emit this as an event so that parent windows which are iframing us in
// can also update their state
if (get(routeStore).queryParams?.peek) {
window.parent.postMessage({
type: "update-state",
detail: { type, key, value, persist },
})
}
} }
const handlerMap = { const handlerMap = {

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.0.19-alpha.3", "version": "1.0.22",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -70,9 +70,9 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "^10.0.3", "@apidevtools/swagger-parser": "^10.0.3",
"@budibase/auth": "^1.0.19-alpha.3", "@budibase/auth": "^1.0.22",
"@budibase/client": "^1.0.19-alpha.3", "@budibase/client": "^1.0.22",
"@budibase/string-templates": "^1.0.19-alpha.3", "@budibase/string-templates": "^1.0.22",
"@bull-board/api": "^3.7.0", "@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0", "@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View File

@ -1,6 +1,5 @@
// when thread starts, make sure it is recorded require("./utils").threadSetup()
const env = require("../environment") const env = require("../environment")
env.setInThread()
const actions = require("../automations/actions") const actions = require("../automations/actions")
const automationUtils = require("../automations/automationUtils") const automationUtils = require("../automations/automationUtils")
const AutomationEmitter = require("../events/AutomationEmitter") const AutomationEmitter = require("../events/AutomationEmitter")

View File

@ -1,6 +1,4 @@
// when thread starts, make sure it is recorded require("./utils").threadSetup()
const env = require("../environment")
env.setInThread()
const ScriptRunner = require("../utilities/scriptRunner") const ScriptRunner = require("../utilities/scriptRunner")
const { integrations } = require("../integrations") const { integrations } = require("../integrations")

View File

@ -0,0 +1,13 @@
const env = require("../environment")
const CouchDB = require("../db")
const { init } = require("@budibase/auth")
exports.threadSetup = () => {
// don't run this if not threading
if (env.isTest() || env.DISABLE_THREADING) {
return
}
// when thread starts, make sure it is recorded
env.setInThread()
init(CouchDB)
}

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "1.0.19-alpha.3", "version": "1.0.22",
"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": "1.0.19-alpha.3", "version": "1.0.22",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.js", "main": "src/index.js",
"repository": { "repository": {
@ -29,8 +29,8 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/auth": "^1.0.19-alpha.3", "@budibase/auth": "^1.0.22",
"@budibase/string-templates": "^1.0.19-alpha.3", "@budibase/string-templates": "^1.0.22",
"@koa/router": "^8.0.0", "@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0", "@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0", "@techpass/passport-openidconnect": "^0.3.0",