diff --git a/packages/builder/src/database/RecordView.svelte b/packages/builder/src/database/RecordView.svelte
index 3b7a26d4da..c29aa9a4c4 100644
--- a/packages/builder/src/database/RecordView.svelte
+++ b/packages/builder/src/database/RecordView.svelte
@@ -99,7 +99,7 @@
{#if !record.isSingle}
-
+
{/if}
{record.nodeKey()}
diff --git a/packages/cli/.vscode/launch.json b/packages/cli/.vscode/launch.json
index 248dbf5906..79f98b6553 100644
--- a/packages/cli/.vscode/launch.json
+++ b/packages/cli/.vscode/launch.json
@@ -9,7 +9,7 @@
"request": "launch",
"name": "init",
"program": "${workspaceFolder}\\bin\\budi",
- "args": ["init"],
+ "args": ["init", "--config", "dev"],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/sandbox"
},
diff --git a/packages/cli/bin/budi b/packages/cli/bin/budi
index 13abb024e1..2a5702c383 100644
--- a/packages/cli/bin/budi
+++ b/packages/cli/bin/budi
@@ -1,3 +1,3 @@
#!/usr/bin/env node
-require('../src/cli')();
\ No newline at end of file
+require("../src/cli")()
diff --git a/packages/cli/src/commands/init/initHandler.js b/packages/cli/src/commands/init/initHandler.js
index 6e85ccb0cd..2230445bb1 100644
--- a/packages/cli/src/commands/init/initHandler.js
+++ b/packages/cli/src/commands/init/initHandler.js
@@ -51,8 +51,7 @@ const prompts = async opts => {
mask: "*",
})
- if (password !== passwordConfirm)
- throw new Exception("Passwords do not match!")
+ if (password !== passwordConfirm) throw new Error("Passwords do not match!")
opts.password = password
}
diff --git a/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json b/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json
index a5ad995c5d..5ad5b50289 100644
--- a/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json
+++ b/packages/cli/src/commands/new/appPackageTemplate/pages/main/page.json
@@ -9,7 +9,7 @@
"_id": 0,
"_styles": {
"layout": {},
- "positions": {}
+ "position": {}
},
"_code": ""
},
diff --git a/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json b/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json
index e490482bff..cdc84dc9e2 100644
--- a/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json
+++ b/packages/cli/src/commands/new/appPackageTemplate/pages/unauthenticated/page.json
@@ -9,7 +9,7 @@
"_id": 1,
"_styles": {
"layout": {},
- "positions": {}
+ "position": {}
},
"_code": ""
},
diff --git a/packages/client/scripts/publishDev.js b/packages/client/scripts/publishDev.js
index 167f49e993..f91f52dd2b 100644
--- a/packages/client/scripts/publishDev.js
+++ b/packages/client/scripts/publishDev.js
@@ -1,6 +1,7 @@
const { readdir, stat, copyFile } = require("fs-extra")
const { constants } = require("fs")
const { join, basename } = require("path")
+const serverConfig = require("../../server/config")()
const packagesFolder = ".."
@@ -9,7 +10,11 @@ const jsMapFile = dir => join(dir, "budibase-client.js.map")
const sourceJs = jsFile("dist")
const sourceJsMap = jsMapFile("dist")
-const appPackages = join(packagesFolder, "server", "appPackages")
+const appPackages = join(
+ packagesFolder,
+ "server",
+ serverConfig.latestPackagesFolder
+)
const publicMain = appName => join(appPackages, appName, "public", "main")
const publicUnauth = appName =>
@@ -34,10 +39,11 @@ const nodeModules = appName =>
const copySourceJsMap = copySource(sourceJsMap)
for (let app of apps) {
+ if (app === ".data") continue
if (!(await stat(join(appPackages, app))).isDirectory()) continue
- await copySourceJs(nodeModules(app))
- await copySourceJsMap(nodeModules(app))
+ //await copySourceJs(nodeModules(app))
+ //await copySourceJsMap(nodeModules(app))
await copySourceJs(publicMain(app))
await copySourceJsMap(publicMain(app))
diff --git a/packages/client/src/createApp.js b/packages/client/src/createApp.js
index 053d1c4df0..6e63c6dee5 100644
--- a/packages/client/src/createApp.js
+++ b/packages/client/src/createApp.js
@@ -14,8 +14,7 @@ export const createApp = (
frontendDefinition,
backendDefinition,
user,
- uiFunctions,
- screens
+ uiFunctions
) => {
const coreApi = createCoreApi(backendDefinition, user)
backendDefinition.hierarchy = coreApi.templateApi.constructHierarchy(
@@ -74,7 +73,7 @@ export const createApp = (
currentUrl = url
}
- routeTo = screenRouter(screens, onScreenSelected)
+ routeTo = screenRouter(frontendDefinition.screens, onScreenSelected)
routeTo(currentUrl || window.location.pathname)
}
diff --git a/packages/client/src/index.js b/packages/client/src/index.js
index 9a1c1b0ff2..a5644c9f49 100644
--- a/packages/client/src/index.js
+++ b/packages/client/src/index.js
@@ -2,20 +2,17 @@ import { createApp } from "./createApp"
import { trimSlash } from "./common/trimSlash"
import { builtins, builtinLibName } from "./render/builtinComponents"
-export const loadBudibase = async ({
- componentLibraries,
- page,
- screens,
- window,
- localStorage,
- uiFunctions,
-}) => {
- const backendDefinition = window["##BUDIBASE_BACKEND_DEFINITION##"]
- const frontendDefinition = window["##BUDIBASE_FRONTEND_DEFINITION##"]
- const uiFunctionsFromWindow = window["##BUDIBASE_FRONTEND_FUNCTIONS##"]
- uiFunctions = uiFunctionsFromWindow || uiFunctions
+export const loadBudibase = async (opts) => {
- const userFromStorage = localStorage.getItem("budibase:user")
+ let componentLibraries = opts && opts.componentLibraries
+ const _window = (opts && opts.window) || window
+ const _localStorage = (opts && opts.localStorage) || localStorage
+
+ const backendDefinition = _window["##BUDIBASE_BACKEND_DEFINITION##"]
+ const frontendDefinition = _window["##BUDIBASE_FRONTEND_DEFINITION##"]
+ const uiFunctions = _window["##BUDIBASE_FRONTEND_FUNCTIONS##"]
+
+ const userFromStorage = _localStorage.getItem("budibase:user")
const user = userFromStorage
? JSON.parse(userFromStorage)
@@ -43,32 +40,23 @@ export const loadBudibase = async ({
}
}
- componentLibraries[builtinLibName] = builtins(window)
-
- if (!page) {
- page = frontendDefinition.page
- }
-
- if (!screens) {
- screens = frontendDefinition.screens
- }
+ componentLibraries[builtinLibName] = builtins(_window)
const { initialisePage, screenStore, pageStore, routeTo, rootNode } = createApp(
- window.document,
+ _window.document,
componentLibraries,
frontendDefinition,
backendDefinition,
user,
- uiFunctions || {},
- screens
+ uiFunctions || {}
)
- const route = window.location
- ? window.location.pathname.replace(rootPath, "")
+ const route = _window.location
+ ? _window.location.pathname.replace(rootPath, "")
: "";
return {
- rootNode: initialisePage(page, window.document.body, route),
+ rootNode: initialisePage(frontendDefinition.page, _window.document.body, route),
screenStore,
pageStore,
routeTo,
diff --git a/packages/client/tests/testAppDef.js b/packages/client/tests/testAppDef.js
index 510eb80e84..f90211c866 100644
--- a/packages/client/tests/testAppDef.js
+++ b/packages/client/tests/testAppDef.js
@@ -10,17 +10,35 @@ export const load = async (page, screens = [], url = "/") => {
autoAssignIds(s.props)
}
setAppDef(dom.window, page, screens)
+ addWindowGlobals(dom.window, page, screens, uiFunctions, {
+ hierarchy: {},
+ actions: [],
+ triggers: [],
+ })
const app = await loadBudibase({
componentLibraries: allLibs(dom.window),
window: dom.window,
localStorage: createLocalStorage(),
- page,
- screens,
- uiFunctions,
})
return { dom, app }
}
+const addWindowGlobals = (
+ window,
+ page,
+ screens,
+ uiFunctions,
+ appDefinition
+) => {
+ window["##BUDIBASE_BACKEND_DEFINITION##"] = appDefinition
+ window["##BUDIBASE_FRONTEND_DEFINITION##"] = {
+ page,
+ screens,
+ appRootPath: "",
+ }
+ window["##BUDIBASE_FRONTEND_FUNCTIONS##"] = uiFunctions
+}
+
export const makePage = props => ({ props })
export const makeScreen = (route, props) => ({ props, route })
diff --git a/packages/datastores/datastores/local.js b/packages/datastores/datastores/local.js
index 245ae1796e..7986011851 100644
--- a/packages/datastores/datastores/local.js
+++ b/packages/datastores/datastores/local.js
@@ -1,26 +1,28 @@
-const { promisify } = require("util")
-const fs = require("fs")
+const {
+ access,
+ mkdir,
+ remove,
+ unlink,
+ readdir,
+ rename,
+ stat,
+ readFile,
+ writeFile,
+} = require("fs-extra")
const { join } = require("path")
+const { createReadStream, createWriteStream } = require("fs")
-const readFile = promisify(fs.readFile)
-const writeFile = (path, content, overwrite) =>
- promisify(fs.writeFile)(path, content, {
+const _writeFile = (path, content, overwrite) =>
+ writeFile(path, content, {
encoding: "utf8",
flag: overwrite ? "w" : "wx",
})
-const access = promisify(fs.access)
-const mkdir = promisify(fs.mkdir)
-const rmdir = promisify(fs.rmdir)
-const unlink = promisify(fs.unlink)
-const readdir = promisify(fs.readdir)
-const rename = promisify(fs.rename)
-const stat = promisify(fs.stat)
const updateFile = root => async (path, file) =>
- await writeFile(join(root, path), file, true)
+ await _writeFile(join(root, path), file, true)
const createFile = root => async (path, file) =>
- await writeFile(join(root, path), file, false)
+ await _writeFile(join(root, path), file, false)
const loadFile = root => async path => await readFile(join(root, path), "utf8")
@@ -39,14 +41,14 @@ const deleteFile = root => async path => await unlink(join(root, path))
module.exports.deleteFile = deleteFile
-const deleteFolder = root => async path => await rmdir(join(root, path))
+const deleteFolder = root => async path => await remove(join(root, path))
const readableFileStream = root => async path =>
- fs.createReadStream(join(root, path))
+ createReadStream(join(root, path))
const writableFileStream = root => path =>
new Promise((resolve, reject) => {
- const stream = fs.createWriteStream(join(root, path), "utf8")
+ const stream = createWriteStream(join(root, path), "utf8")
stream.on("open", () => resolve(stream))
stream.on("error", reject)
})
@@ -72,7 +74,8 @@ const getDatastoreConfig = rootConfig => (applicationId, instanceId) =>
join(rootConfig.rootPath, datastoreFolder(applicationId, instanceId))
const getMasterDbRootConfig = rootConfig => () => rootConfig.rootPath
-const getInstanceDbRootConfig = rootConfig => (applicationId, instanceId) =>
+// eslint-disable-next-line no-unused-vars
+const getInstanceDbRootConfig = rootConfig => (_applicationId, _instanceId) =>
rootConfig.rootPath
const getDbRootConfig = (rootConfig, applicationId, instanceId) =>
applicationId === "master"
diff --git a/packages/datastores/package.json b/packages/datastores/package.json
index 11e87f509d..7a279706d4 100644
--- a/packages/datastores/package.json
+++ b/packages/datastores/package.json
@@ -29,6 +29,7 @@
"@babel/preset-env": "^7.1.0",
"@budibase/core": "^0.0.16",
"es6-promisify": "^6.0.1",
+ "fs-extra": "^8.1.0",
"lodash": "^4.17.13",
"p-limit": "^2.0.0",
"papaparse": "^4.6.1",
diff --git a/packages/datastores/yarn.lock b/packages/datastores/yarn.lock
index 0ad08160b8..14fcc2ccb8 100644
--- a/packages/datastores/yarn.lock
+++ b/packages/datastores/yarn.lock
@@ -573,6 +573,23 @@
lodash "^4.17.10"
to-fast-properties "^2.0.0"
+"@budibase/core@^0.0.16":
+ version "0.0.16"
+ resolved "https://registry.yarnpkg.com/@budibase/core/-/core-0.0.16.tgz#efff16876f906b2aa59803c3312ec7593664b623"
+ integrity sha512-DvzfurHHp9KkSjkvbGbKsVczR5ne38bMLRA2hHEJxAmC0Tshld06cEq7HMy2BmPb6kaC1URYHlFs/gPhW2cSFQ==
+ dependencies:
+ "@nx-js/compiler-util" "^2.0.0"
+ date-fns "^1.29.0"
+ lodash "^4.17.13"
+ lunr "^2.3.5"
+ safe-buffer "^5.1.2"
+ shortid "^2.2.8"
+
+"@nx-js/compiler-util@^2.0.0":
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/@nx-js/compiler-util/-/compiler-util-2.0.0.tgz#c74c12165fa2f017a292bb79af007e8fce0af297"
+ integrity sha512-AxSQbwj9zqt8DYPZ6LwZdytqnwfiOEdcFdq4l8sdjkZmU2clTht7RDLCI8xvkp7KqgcNaOGlTeCM55TULWruyQ==
+
"@types/body-parser@*":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.17.0.tgz#9f5c9d9bd04bb54be32d5eb9fc0d8c974e6cf58c"
@@ -894,6 +911,11 @@ core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
+date-fns@^1.29.0:
+ version "1.30.1"
+ resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
+ integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
+
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
@@ -1059,6 +1081,15 @@ fragment-cache@^0.2.1:
dependencies:
map-cache "^0.2.2"
+fs-extra@^8.1.0:
+ version "8.1.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
+ integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
+ dependencies:
+ graceful-fs "^4.2.0"
+ jsonfile "^4.0.0"
+ universalify "^0.1.0"
+
fs-minipass@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.5.tgz#06c277218454ec288df77ada54a03b8702aacb9d"
@@ -1123,6 +1154,11 @@ graceful-fs@^4.1.11:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
+graceful-fs@^4.1.6, graceful-fs@^4.2.0:
+ version "4.2.3"
+ resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
+ integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
+
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
@@ -1349,6 +1385,13 @@ json5@^0.5.0:
version "0.5.1"
resolved "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz#1eade7acc012034ad84e2396767ead9fa5495821"
+jsonfile@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
+ integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
+ optionalDependencies:
+ graceful-fs "^4.1.6"
+
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
@@ -1395,6 +1438,11 @@ loose-envify@^1.0.0:
dependencies:
js-tokens "^3.0.0 || ^4.0.0"
+lunr@^2.3.5:
+ version "2.3.8"
+ resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072"
+ integrity sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==
+
make-dir@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
@@ -1508,6 +1556,11 @@ nan@^2.9.2:
version "2.11.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766"
+nanoid@^2.1.0:
+ version "2.1.11"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280"
+ integrity sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==
+
nanomatch@^1.2.9:
version "1.2.13"
resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119"
@@ -1893,6 +1946,13 @@ set-value@^2.0.0:
is-plain-object "^2.0.3"
split-string "^3.0.1"
+shortid@^2.2.8:
+ version "2.2.15"
+ resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.15.tgz#2b902eaa93a69b11120373cd42a1f1fe4437c122"
+ integrity sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==
+ dependencies:
+ nanoid "^2.1.0"
+
signal-exit@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
@@ -2094,6 +2154,11 @@ union-value@^1.0.0:
is-extendable "^0.1.1"
set-value "^0.4.3"
+universalify@^0.1.0:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
+ integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
+
unset-value@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559"
diff --git a/packages/server/appPackages/_master/appDefinition.json b/packages/server/appPackages/_master/appDefinition.json
index c34f30e870..4978489cf0 100644
--- a/packages/server/appPackages/_master/appDefinition.json
+++ b/packages/server/appPackages/_master/appDefinition.json
@@ -504,243 +504,24 @@
"condition": "context.record.type === \"user\" && context.record.createdByMaster === true"
}
],
- "actions": {
- "initialise_instance": {
+ "actions": [
+ {
"name": "initialise_instance",
"behaviourSource": "main",
"behaviourName": "initialiseInstance",
"initialOptions": {}
},
- "create_user": {
+ {
"name": "create_user",
"behaviourSource": "main",
"behaviourName": "createNewUser",
"initialOptions": {}
},
- "set_default_version": {
+ {
"name": "set_default_version",
"behaviourSource": "main",
"behaviourName": "setDefaultVersion",
"initialOptions": {}
}
- },
- "props": {
- "main": {
- "_component": "@budibase/standard-components/stackpanel",
- "direction": "horizontal",
- "children": [
- {
- "_component": "children#array_element#",
- "control": {
- "_component": "@budibase/standard-components/panel",
- "text": "Create New",
- "component": {
- "_component": ""
- },
- "containerClass": "",
- "background": "",
- "border": "1px solid black",
- "borderRadius": "2px",
- "font": "",
- "color": "",
- "padding": "10px",
- "margin": "20px",
- "hoverColor": "",
- "hoverBackground": "gainsboro",
- "height": "100px",
- "width": "100px",
- "onClick": [
- {
- "##eventHandlerType": "Get New Record",
- "parameters": {
- "collectionKey": "/applications",
- "childRecordType": "application",
- "statePath": "currentApplication"
- }
- }
- ],
- "display": "inline"
- }
- }
- ],
- "width": "auto",
- "height": "auto",
- "containerClass": "",
- "itemContainerClass": "",
- "data": {
- "##bbstate": "allApplications",
- "##bbsource": "store"
- },
- "dataItemComponent": {
- "_component": "@budibase/standard-components/panel",
- "text": "",
- "component": {
- "_component": "@budibase/standard-components/stackpanel",
- "direction": "horizontal",
- "children": [
- {
- "_component": "children#array_element#",
- "control": {
- "_component": "@budibase/standard-components/text",
- "value": "",
- "containerClass": "",
- "font": "",
- "color": "",
- "textAlign": "inline",
- "verticalAlign": "inline",
- "display": "inline"
- }
- }
- ],
- "width": "auto",
- "height": "auto",
- "containerClass": "",
- "itemContainerClass": "",
- "data": {
- "##bbstate": ""
- },
- "dataItemComponent": {
- "_component": ""
- },
- "onLoad": []
- },
- "containerClass": "",
- "background": "",
- "border": "1px solid dimgray",
- "borderRadius": "2px",
- "font": "",
- "color": "black",
- "padding": "10px",
- "margin": "20px",
- "hoverColor": "",
- "hoverBackground": "",
- "height": "",
- "width": "",
- "onClick": [
- {
- "##eventHandlerType": "Load Record",
- "parameters": {
- "recordKey": {
- "##bbstate": "key",
- "##bbsource": "context"
- },
- "statePath": "currentApp"
- }
- }
- ],
- "display": "inline"
- },
- "onLoad": [
- {
- "##eventHandlerType": "List Records",
- "parameters": {
- "indexKey": "/all_applications",
- "statePath": "allApplications"
- }
- }
- ],
- "component": {
- "_component": "@budibase/standard-components/stackpanel",
- "direction": "horizontal",
- "children": [
- {
- "_component": "#children#array_element",
- "control": {
- "_component": "@budibase/standard-components/text",
- "value": "",
- "containerClass": "",
- "font": "",
- "color": "",
- "textAlign": "inline",
- "verticalAlign": "inline",
- "display": "inline"
- }
- }
- ],
- "width": "auto",
- "height": "auto",
- "containerClass": "",
- "itemContainerClass": "",
- "data": {
- "##bbstate": "allApplications",
- "##bbsource": "store"
- },
- "dataItemComponent": {
- "_component": "apps/Application List Item",
- "text": {
- "##bbstate": "name",
- "##bbstatefallback": "My App Name",
- "##bbsource": "context"
- },
- "component": {
- "_component": "@budibase/standard-components/stackpanel",
- "direction": "horizontal",
- "children": [
- {
- "_component": "#children#array_element",
- "control": {
- "_component": "@budibase/standard-components/text",
- "value": "",
- "containerClass": "",
- "font": "",
- "color": "",
- "textAlign": "inline",
- "verticalAlign": "inline",
- "display": "inline"
- }
- }
- ],
- "width": "auto",
- "height": "auto",
- "containerClass": "",
- "itemContainerClass": "",
- "data": {
- "##bbstate": "allApplications",
- "##bbsource": "store"
- },
- "dataItemComponent": {
- "_component": ""
- },
- "onLoad": []
- },
- "containerClass": "",
- "background": "",
- "border": "1px solid dimgray",
- "borderRadius": "2px",
- "font": "",
- "color": "black",
- "padding": "10px",
- "margin": "20px",
- "hoverColor": "",
- "hoverBackground": "",
- "height": "",
- "width": "",
- "onClick": [
- {
- "##eventHandlerType": "Load Record",
- "parameters": {
- "recordKey": {
- "##bbstate": "key",
- "##bbsource": "context"
- },
- "statePath": "currentApplication"
- }
- }
- ],
- "display": ""
- },
- "onLoad": []
- }
- },
- "unauthenticated": {
- "_component": "@budibase/standard-components/login",
- "logo": "_shared/budibase-logo.png",
- "loginRedirect": "",
- "usernameLabel": "Username",
- "passwordLabel": "Password",
- "loginButtonLabel": "Login",
- "buttonClass": "",
- "inputClass": ""
- }
- }
+ ]
}
diff --git a/packages/server/appPackages/_master/main.js b/packages/server/appPackages/_master/main.js
index da06af2d34..29f626cd4c 100644
--- a/packages/server/appPackages/_master/main.js
+++ b/packages/server/appPackages/_master/main.js
@@ -1,7 +1,7 @@
const { tmpdir } = require("os")
const { join } = require("path")
const uuid = require("uuid/v1")
-const { take, takeRight, last } = require("lodash/fp")
+const { take } = require("lodash/fp")
const { splitKey, $, joinKey } = require("@budibase/core").common
const {
unzipTarGzPackageToRuntime,
diff --git a/packages/server/appPackages/testApp/appDefinition.json b/packages/server/appPackages/testApp/appDefinition.json
index 7d0624c8e4..9a9a9fb79f 100644
--- a/packages/server/appPackages/testApp/appDefinition.json
+++ b/packages/server/appPackages/testApp/appDefinition.json
@@ -73,14 +73,14 @@
"condition": ""
}
],
- "actions": {
- "output_to_file": {
+ "actions": [
+ {
"name": "output_to_file",
"behaviourSource": "main",
"behaviourName": "outputToFile",
"initialOptions": {}
}
- },
+ ],
"props": {
"main": {
"_component": "some_component"
diff --git a/packages/server/tests/testApp.js b/packages/server/tests/testApp.js
index 1fd0319a5e..b17c9111c9 100644
--- a/packages/server/tests/testApp.js
+++ b/packages/server/tests/testApp.js
@@ -22,12 +22,12 @@ const extraMasterPlugins = {
}
const customizeMaster = appDefinition => {
- appDefinition.actions.outputToFile = {
+ appDefinition.actions.push({
name: "outputToFile",
behaviourSource: "test_plugins",
behaviourName: "outputToFile",
initialOptions: {},
- }
+ })
appDefinition.triggers.push({
actionName: "outputToFile",
diff --git a/packages/server/utilities/builder/buildPage.js b/packages/server/utilities/builder/buildPage.js
index dca0f0f65a..2438bbc3fd 100644
--- a/packages/server/utilities/builder/buildPage.js
+++ b/packages/server/utilities/builder/buildPage.js
@@ -18,6 +18,8 @@ const publicPath = require("./publicPath")
module.exports = async (config, appname, pageName, pkg) => {
const appPath = appPackageFolder(config, appname)
+ pkg.screens = pkg.screens || []
+
await convertCssToFiles(publicPath(appPath, pageName), pkg)
await buildIndexHtml(config, appname, pageName, appPath, pkg)
@@ -133,7 +135,7 @@ const buildFrontendAppDefinition = async (config, appname, pageName, pkg) => {
await writeFile(
filename,
- `window['##BUDIBASE_FRONTEND_DEINITION##'] = ${clientUiDefinition};
+ `window['##BUDIBASE_FRONTEND_DEFINITION##'] = ${clientUiDefinition};
window['##BUDIBASE_FRONTEND_FUNCTIONS##'] = ${pkg.uiFunctions}`
)
}
diff --git a/packages/server/utilities/builder/convertCssToFiles.js b/packages/server/utilities/builder/convertCssToFiles.js
index e80d009ec2..0e7095e603 100644
--- a/packages/server/utilities/builder/convertCssToFiles.js
+++ b/packages/server/utilities/builder/convertCssToFiles.js
@@ -7,7 +7,7 @@ module.exports.convertCssToFiles = async (publicPagePath, pkg) => {
await ensureDir(cssDir)
await emptyDir(cssDir)
- for (let screen of pkg.screens) {
+ for (let screen of pkg.screens || []) {
if (!screen._css) continue
if (screen._css.trim().length === 0) {
delete screen._css
diff --git a/packages/server/utilities/builder/saveBackend.js b/packages/server/utilities/builder/saveBackend.js
index c5d6e92c82..3426cf56e2 100644
--- a/packages/server/utilities/builder/saveBackend.js
+++ b/packages/server/utilities/builder/saveBackend.js
@@ -22,7 +22,7 @@ module.exports = async (config, appname, appDefinition, accessLevels) => {
const appDefString = JSON.stringify(appDefinition)
await writeFile(
filename,
- `window['##BUDIBASE_FRONTEND_DEINITION##'] = ${appDefString};`
+ `window['##BUDIBASE_BACKEND_DEFINITION##'] = ${appDefString};`
)
}
}
diff --git a/packages/server/utilities/injectedPlugins/index.js b/packages/server/utilities/injectedPlugins/index.js
index eb4ec65b79..76e967227d 100644
--- a/packages/server/utilities/injectedPlugins/index.js
+++ b/packages/server/utilities/injectedPlugins/index.js
@@ -40,24 +40,24 @@ const createTriggers = appPackage => {
const createActions = appPackage => {
const appDef = appPackage.appDefinition
- appDef.actions.createUser = {
+ appDef.actions.push({
name: "createUser",
behaviourSource: "_injected",
behaviourName: "createUser",
initialOptions: {},
- }
- appDef.actions.enableUser = {
+ })
+ appDef.actions.push({
name: "enableUser",
behaviourSource: "_injected",
behaviourName: "enableUser",
initialOptions: {},
- }
- appDef.actions.disableUser = {
+ })
+ appDef.actions.push({
name: "disableUser",
behaviourSource: "_injected",
behaviourName: "disableUser",
initialOptions: {},
- }
+ })
}
const constructPlugin = async (masterAppInternal, appName, instanceKey) => {
diff --git a/packages/server/utilities/masterAppInternal.js b/packages/server/utilities/masterAppInternal.js
index b2305b086f..3e291718e8 100644
--- a/packages/server/utilities/masterAppInternal.js
+++ b/packages/server/utilities/masterAppInternal.js
@@ -88,9 +88,7 @@ module.exports = async context => {
const createAppUser = async (appname, instance, user, password) => {
if (isMaster(appname)) {
- throw new Exception(
- "This method is for creating app users - not on master!"
- )
+ throw new Error("This method is for creating app users - not on master!")
}
const versionId = determineVersionId(instance.version)