diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs
index 9398b7e719..e08516c9d3 100644
--- a/hosting/nginx.dev.conf.hbs
+++ b/hosting/nginx.dev.conf.hbs
@@ -62,6 +62,10 @@ 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;
diff --git a/lerna.json b/lerna.json
index 1724a4ec0d..28379208fe 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"npmClient": "yarn",
"packages": [
"packages/*"
diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json
index c03de431df..b95a33703d 100644
--- a/packages/backend-core/package.json
+++ b/packages/backend-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"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.2.44-alpha.0",
+ "@budibase/types": "1.2.44-alpha.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",
"bcrypt": "5.0.1",
diff --git a/packages/bbui/package.json b/packages/bbui/package.json
index 63b8cd9845..99f58a045b 100644
--- a/packages/bbui/package.json
+++ b/packages/bbui/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"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.2.44-alpha.0",
+ "@budibase/string-templates": "1.2.44-alpha.1",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",
diff --git a/packages/builder/package.json b/packages/builder/package.json
index ccfa0fc27a..569a6c1614 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"license": "GPL-3.0",
"private": true,
"scripts": {
@@ -69,10 +69,10 @@
}
},
"dependencies": {
- "@budibase/bbui": "1.2.44-alpha.0",
- "@budibase/client": "1.2.44-alpha.0",
- "@budibase/frontend-core": "1.2.44-alpha.0",
- "@budibase/string-templates": "1.2.44-alpha.0",
+ "@budibase/bbui": "1.2.44-alpha.1",
+ "@budibase/client": "1.2.44-alpha.1",
+ "@budibase/frontend-core": "1.2.44-alpha.1",
+ "@budibase/string-templates": "1.2.44-alpha.1",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte
index 8e4e172a0d..9f81effd1d 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte
@@ -8,7 +8,6 @@
selectedLayout,
currentAsset,
} from "builderStore"
- import iframeTemplate from "./iframeTemplate"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import {
ProgressCircle,
@@ -40,12 +39,6 @@
BUDIBASE: "type",
}
- // Construct iframe template
- $: template = iframeTemplate.replace(
- /\{\{ CLIENT_LIB_PATH }}/,
- $store.clientLibPath
- )
-
const placeholderScreen = new Screen()
.name("Screen Placeholder")
.route("/")
@@ -298,7 +291,7 @@
-
-`
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 4ff8c21342..0be473c5fa 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
diff --git a/packages/client/package.json b/packages/client/package.json
index d5264fa2bc..b8e6301de5 100644
--- a/packages/client/package.json
+++ b/packages/client/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/client",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"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.2.44-alpha.0",
- "@budibase/frontend-core": "1.2.44-alpha.0",
- "@budibase/string-templates": "1.2.44-alpha.0",
+ "@budibase/bbui": "1.2.44-alpha.1",
+ "@budibase/frontend-core": "1.2.44-alpha.1",
+ "@budibase/string-templates": "1.2.44-alpha.1",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",
diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json
index 32c6ff8034..a08e6120c7 100644
--- a/packages/frontend-core/package.json
+++ b/packages/frontend-core/package.json
@@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
- "@budibase/bbui": "1.2.44-alpha.0",
+ "@budibase/bbui": "1.2.44-alpha.1",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}
diff --git a/packages/server/package.json b/packages/server/package.json
index ce1bbe2c10..c3a602459b 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"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.2.44-alpha.0",
- "@budibase/client": "1.2.44-alpha.0",
- "@budibase/pro": "1.2.44-alpha.0",
- "@budibase/string-templates": "1.2.44-alpha.0",
- "@budibase/types": "1.2.44-alpha.0",
+ "@budibase/backend-core": "1.2.44-alpha.1",
+ "@budibase/client": "1.2.44-alpha.1",
+ "@budibase/pro": "1.2.44-alpha.1",
+ "@budibase/string-templates": "1.2.44-alpha.1",
+ "@budibase/types": "1.2.44-alpha.1",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",
diff --git a/packages/server/src/api/controllers/static/index.ts b/packages/server/src/api/controllers/static/index.ts
index c4d51293b5..3b748a6591 100644
--- a/packages/server/src/api/controllers/static/index.ts
+++ b/packages/server/src/api/controllers/static/index.ts
@@ -128,6 +128,22 @@ export const serveApp = async function (ctx: any) {
}
}
+export const serveBuilderPreview = async function (ctx: any) {
+ const db = getAppDB({ skip_setup: true })
+ const appInfo = await db.get(DocumentType.APP_METADATA)
+
+ if (!env.isJest()) {
+ let appId = getAppId()
+ const previewHbs = loadHandlebarsFile(`${__dirname}/templates/preview.hbs`)
+ ctx.body = await processString(previewHbs, {
+ clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
+ })
+ } else {
+ // just return the app info for jest to assert on
+ ctx.body = { ...appInfo, builderPreview: true }
+ }
+}
+
export const serveClientLibrary = async function (ctx: any) {
return send(ctx, "budibase-client.js", {
root: join(NODE_MODULES_PATH, "@budibase", "client", "dist"),
diff --git a/packages/server/src/api/controllers/static/templates/preview.hbs b/packages/server/src/api/controllers/static/templates/preview.hbs
new file mode 100644
index 0000000000..28908df507
--- /dev/null
+++ b/packages/server/src/api/controllers/static/templates/preview.hbs
@@ -0,0 +1,103 @@
+
+
+ Budibase Builder Preview
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/server/src/api/routes/static.ts b/packages/server/src/api/routes/static.ts
index c94ff54708..9a53486689 100644
--- a/packages/server/src/api/routes/static.ts
+++ b/packages/server/src/api/routes/static.ts
@@ -56,6 +56,7 @@ router
authorized(PermissionTypes.TABLE, PermissionLevels.WRITE),
controller.deleteObjects
)
+ .get("/preview", authorized(BUILDER), controller.serveBuilderPreview)
.get("/:appId/:path*", controller.serveApp)
.get("/app/:appUrl/:path*", controller.serveApp)
.post(
diff --git a/packages/server/src/api/routes/tests/static.spec.js b/packages/server/src/api/routes/tests/static.spec.js
index 37176f5cf5..812b88329b 100644
--- a/packages/server/src/api/routes/tests/static.spec.js
+++ b/packages/server/src/api/routes/tests/static.spec.js
@@ -40,7 +40,6 @@ describe("/static", () => {
})
describe("/app", () => {
-
beforeEach(() => {
jest.clearAllMocks()
})
@@ -60,7 +59,7 @@ describe("/static", () => {
it("should serve the app by url", async () => {
const headers = config.defaultHeaders()
delete headers[constants.Headers.APP_ID]
-
+
const res = await request
.get(`/app${config.prodApp.url}`)
.set(headers)
@@ -82,7 +81,7 @@ describe("/static", () => {
describe("/attachments", () => {
describe("generateSignedUrls", () => {
let datasource
-
+
beforeEach(async () => {
datasource = await config.createDatasource({
datasource: {
@@ -93,7 +92,7 @@ describe("/static", () => {
},
})
})
-
+
it("should be able to generate a signed upload URL", async () => {
const bucket = "foo"
const key = "bar"
@@ -108,7 +107,7 @@ describe("/static", () => {
`https://${bucket}.s3.eu-west-1.amazonaws.com/${key}`
)
})
-
+
it("should handle an invalid datasource ID", async () => {
const res = await request
.post(`/api/attachments/foo/url`)
@@ -123,7 +122,7 @@ describe("/static", () => {
"The specified datasource could not be found"
)
})
-
+
it("should require a bucket parameter", async () => {
const res = await request
.post(`/api/attachments/${datasource._id}/url`)
@@ -136,7 +135,7 @@ describe("/static", () => {
.expect(400)
expect(res.body.message).toEqual("bucket and key values are required")
})
-
+
it("should require a key parameter", async () => {
const res = await request
.post(`/api/attachments/${datasource._id}/url`)
@@ -151,4 +150,17 @@ describe("/static", () => {
})
})
+ describe("/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)
+
+ expect(res.body.appId).toBe(config.appId)
+ expect(res.body.builderPreview).toBe(true)
+ })
+ })
})
diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock
index 0301c561e6..94fcf222a6 100644
--- a/packages/server/yarn.lock
+++ b/packages/server/yarn.lock
@@ -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.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.0.tgz#5fa2161c43e0686ab4b71a6e4a7689e19f28f050"
- integrity sha512-6d+lTxjHM5/awdlEqJojA3PybWYFEwo1UXg2WG8Rk4dB4s3v/1QAMdlbX7rSX2BZyojYwZFiPzellJpTH/44qg==
+"@budibase/backend-core@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.1.tgz#255c8550302ea0d4b10b231519e12021d008ad33"
+ integrity sha512-9ceN00ioBD5iUc2Wbcs9Pyvh5gaSfkg1v4Qn9QdRwAG36eo3XVK8kiYWF0q0hkzgcTViJw6xq/1jqMa2InKv6g==
dependencies:
- "@budibase/types" "1.2.44-alpha.0"
+ "@budibase/types" "1.2.44-alpha.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
bcrypt "5.0.1"
@@ -1178,13 +1178,13 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
-"@budibase/pro@1.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.0.tgz#7722dd571befe5663c27a36a4d63ec9ea96fa3e4"
- integrity sha512-pxlIkrntNhmXC7dcsCvJNxtUXPH2K8M5WyjpD4hdjbm5JbRhRilCR5fRciKKjMYa8pLupOd8P7K/qcB+C/qvsw==
+"@budibase/pro@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.1.tgz#d9e919b1df96f3d3d5cf37753721d41348279f59"
+ integrity sha512-KaclS4qv4+hWenvuVwF2HxcPWkrDyR7IVyLKLMVUqCnaMoXMvEOe9KuQ+lXLbsLIBsCsCFkzE/WHsdmoaGqa0g==
dependencies:
- "@budibase/backend-core" "1.2.44-alpha.0"
- "@budibase/types" "1.2.44-alpha.0"
+ "@budibase/backend-core" "1.2.44-alpha.1"
+ "@budibase/types" "1.2.44-alpha.1"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
@@ -1207,10 +1207,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
-"@budibase/types@1.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.0.tgz#350b51e961c5c3c25febe421c35e5f05e6cc6102"
- integrity sha512-gM4WM+BQa1UZeV4TKnhQndAwTgpYBXLePichuOw0kehTY5xu96dACtVfMDlHFIANdv701dDzi+Zr/T27sKpS4Q==
+"@budibase/types@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.1.tgz#6150d4494326438b46dd7354e5dd0fc7fdbfcc49"
+ integrity sha512-1eLGH5ym4oYbuRZRkD0slNqHlZ1EV0JHLkmoA47i7L/u8E8QRIyDIHyeZKC8ben33oQS4NX3IebD7zZ2JFhgcA==
"@bull-board/api@3.7.0":
version "3.7.0"
diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json
index f852a83337..b6d7806a51 100644
--- a/packages/string-templates/package.json
+++ b/packages/string-templates/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",
diff --git a/packages/types/package.json b/packages/types/package.json
index 4ea6839208..4be607158f 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@budibase/types",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",
diff --git a/packages/worker/package.json b/packages/worker/package.json
index 13a7c8c322..3983cc7732 100644
--- a/packages/worker/package.json
+++ b/packages/worker/package.json
@@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
- "version": "1.2.44-alpha.0",
+ "version": "1.2.44-alpha.1",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@@ -35,10 +35,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
- "@budibase/backend-core": "1.2.44-alpha.0",
- "@budibase/pro": "1.2.44-alpha.0",
- "@budibase/string-templates": "1.2.44-alpha.0",
- "@budibase/types": "1.2.44-alpha.0",
+ "@budibase/backend-core": "1.2.44-alpha.1",
+ "@budibase/pro": "1.2.44-alpha.1",
+ "@budibase/string-templates": "1.2.44-alpha.1",
+ "@budibase/types": "1.2.44-alpha.1",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",
diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock
index bc93b01feb..c1935eb87f 100644
--- a/packages/worker/yarn.lock
+++ b/packages/worker/yarn.lock
@@ -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.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.0.tgz#5fa2161c43e0686ab4b71a6e4a7689e19f28f050"
- integrity sha512-6d+lTxjHM5/awdlEqJojA3PybWYFEwo1UXg2WG8Rk4dB4s3v/1QAMdlbX7rSX2BZyojYwZFiPzellJpTH/44qg==
+"@budibase/backend-core@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.2.44-alpha.1.tgz#255c8550302ea0d4b10b231519e12021d008ad33"
+ integrity sha512-9ceN00ioBD5iUc2Wbcs9Pyvh5gaSfkg1v4Qn9QdRwAG36eo3XVK8kiYWF0q0hkzgcTViJw6xq/1jqMa2InKv6g==
dependencies:
- "@budibase/types" "1.2.44-alpha.0"
+ "@budibase/types" "1.2.44-alpha.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
bcrypt "5.0.1"
@@ -325,21 +325,21 @@
uuid "8.3.2"
zlib "1.0.5"
-"@budibase/pro@1.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.0.tgz#7722dd571befe5663c27a36a4d63ec9ea96fa3e4"
- integrity sha512-pxlIkrntNhmXC7dcsCvJNxtUXPH2K8M5WyjpD4hdjbm5JbRhRilCR5fRciKKjMYa8pLupOd8P7K/qcB+C/qvsw==
+"@budibase/pro@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.2.44-alpha.1.tgz#d9e919b1df96f3d3d5cf37753721d41348279f59"
+ integrity sha512-KaclS4qv4+hWenvuVwF2HxcPWkrDyR7IVyLKLMVUqCnaMoXMvEOe9KuQ+lXLbsLIBsCsCFkzE/WHsdmoaGqa0g==
dependencies:
- "@budibase/backend-core" "1.2.44-alpha.0"
- "@budibase/types" "1.2.44-alpha.0"
+ "@budibase/backend-core" "1.2.44-alpha.1"
+ "@budibase/types" "1.2.44-alpha.1"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
-"@budibase/types@1.2.44-alpha.0":
- version "1.2.44-alpha.0"
- resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.0.tgz#350b51e961c5c3c25febe421c35e5f05e6cc6102"
- integrity sha512-gM4WM+BQa1UZeV4TKnhQndAwTgpYBXLePichuOw0kehTY5xu96dACtVfMDlHFIANdv701dDzi+Zr/T27sKpS4Q==
+"@budibase/types@1.2.44-alpha.1":
+ version "1.2.44-alpha.1"
+ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.2.44-alpha.1.tgz#6150d4494326438b46dd7354e5dd0fc7fdbfcc49"
+ integrity sha512-1eLGH5ym4oYbuRZRkD0slNqHlZ1EV0JHLkmoA47i7L/u8E8QRIyDIHyeZKC8ben33oQS4NX3IebD7zZ2JFhgcA==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"