Merge branch 'develop' of github.com:Budibase/budibase into feature/formula-filtering
This commit is contained in:
commit
fc80b6a30b
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -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.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.45",
|
"@budibase/bbui": "^1.0.46-alpha.2",
|
||||||
"@budibase/client": "^1.0.45",
|
"@budibase/client": "^1.0.46-alpha.2",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^1.0.45",
|
"@budibase/string-templates": "^1.0.46-alpha.2",
|
||||||
"@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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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.45",
|
"@budibase/bbui": "^1.0.46-alpha.2",
|
||||||
"@budibase/standard-components": "^0.9.139",
|
"@budibase/standard-components": "^0.9.139",
|
||||||
"@budibase/string-templates": "^1.0.45",
|
"@budibase/string-templates": "^1.0.46-alpha.2",
|
||||||
"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"
|
||||||
|
|
|
@ -110,12 +110,6 @@ export default class DataFetch {
|
||||||
*/
|
*/
|
||||||
async getInitialData() {
|
async getInitialData() {
|
||||||
const { datasource, filter, sortColumn, paginate } = this.options
|
const { datasource, filter, sortColumn, paginate } = this.options
|
||||||
const tableId = datasource?.tableId
|
|
||||||
|
|
||||||
// Ensure table ID exists
|
|
||||||
if (!tableId) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch datasource definition and determine feature flags
|
// Fetch datasource definition and determine feature flags
|
||||||
const definition = await this.constructor.getDefinition(datasource)
|
const definition = await this.constructor.getDefinition(datasource)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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/backend-core": "^1.0.45",
|
"@budibase/backend-core": "^1.0.46-alpha.2",
|
||||||
"@budibase/client": "^1.0.45",
|
"@budibase/client": "^1.0.46-alpha.2",
|
||||||
"@budibase/string-templates": "^1.0.45",
|
"@budibase/string-templates": "^1.0.46-alpha.2",
|
||||||
"@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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const { atob } = require("../utilities")
|
const { atob } = require("../utilities")
|
||||||
const { cloneDeep } = require("lodash/fp")
|
const { cloneDeep } = require("lodash/fp")
|
||||||
|
const { LITERAL_MARKER } = require("../helpers/constants")
|
||||||
|
|
||||||
// The method of executing JS scripts depends on the bundle being built.
|
// The method of executing JS scripts depends on the bundle being built.
|
||||||
// This setter is used in the entrypoint (either index.cjs or index.mjs).
|
// This setter is used in the entrypoint (either index.cjs or index.mjs).
|
||||||
|
@ -46,8 +47,9 @@ module.exports.processJS = (handlebars, context) => {
|
||||||
$: path => getContextValue(path, cloneDeep(context)),
|
$: path => getContextValue(path, cloneDeep(context)),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a sandbox with out context and run the JS
|
// Create a sandbox with our context and run the JS
|
||||||
return runJS(js, sandboxContext)
|
const res = { data: runJS(js, sandboxContext) }
|
||||||
|
return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}`
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return "Error while executing JS"
|
return "Error while executing JS"
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,11 @@ module.exports.processors = [
|
||||||
return value === "true"
|
return value === "true"
|
||||||
case "object":
|
case "object":
|
||||||
return JSON.parse(value)
|
return JSON.parse(value)
|
||||||
|
case "js_result":
|
||||||
|
// We use the literal helper to process the result of JS expressions
|
||||||
|
// as we want to be able to return any types.
|
||||||
|
// We wrap the value in an abject to be able to use undefined properly.
|
||||||
|
return JSON.parse(value).data
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -7,7 +7,7 @@ const processJS = (js, context) => {
|
||||||
describe("Test the JavaScript helper", () => {
|
describe("Test the JavaScript helper", () => {
|
||||||
it("should execute a simple expression", () => {
|
it("should execute a simple expression", () => {
|
||||||
const output = processJS(`return 1 + 2`)
|
const output = processJS(`return 1 + 2`)
|
||||||
expect(output).toBe("3")
|
expect(output).toBe(3)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should be able to use primitive bindings", () => {
|
it("should be able to use primitive bindings", () => {
|
||||||
|
@ -50,6 +50,52 @@ describe("Test the JavaScript helper", () => {
|
||||||
expect(output).toBe("shazbat")
|
expect(output).toBe("shazbat")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should be able to return an object", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: {
|
||||||
|
bar: {
|
||||||
|
baz: "shazbat",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
expect(output.bar.baz).toBe("shazbat")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should be able to return an array", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: ["a", "b", "c"],
|
||||||
|
})
|
||||||
|
expect(output[2]).toBe("c")
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should be able to return null", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: null,
|
||||||
|
})
|
||||||
|
expect(output).toBe(null)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should be able to return undefined", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: undefined,
|
||||||
|
})
|
||||||
|
expect(output).toBe(undefined)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should be able to return 0", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: 0,
|
||||||
|
})
|
||||||
|
expect(output).toBe(0)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should be able to return an empty string", () => {
|
||||||
|
const output = processJS(`return $("foo")`, {
|
||||||
|
foo: "",
|
||||||
|
})
|
||||||
|
expect(output).toBe("")
|
||||||
|
})
|
||||||
|
|
||||||
it("should be able to use a deep array binding", () => {
|
it("should be able to use a deep array binding", () => {
|
||||||
const output = processJS(`return $("foo.0.bar")`, {
|
const output = processJS(`return $("foo.0.bar")`, {
|
||||||
foo: [
|
foo: [
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.45",
|
"version": "1.0.46-alpha.2",
|
||||||
"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/backend-core": "^1.0.45",
|
"@budibase/backend-core": "^1.0.46-alpha.2",
|
||||||
"@budibase/string-templates": "^1.0.45",
|
"@budibase/string-templates": "^1.0.46-alpha.2",
|
||||||
"@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",
|
||||||
|
|
Loading…
Reference in New Issue