1
0
Fork 0
mirror of synced 2024-09-30 00:57:16 +13:00

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

This commit is contained in:
Martin McKeaveney 2022-06-29 09:50:14 +01:00
commit a5113f12c4
14 changed files with 84 additions and 34 deletions

View file

@ -1,5 +1,5 @@
{ {
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll" "test:watch": "jest --watchAll"
}, },
"dependencies": { "dependencies": {
"@budibase/types": "^1.0.212-alpha.4", "@budibase/types": "^1.0.212-alpha.5",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0", "aws-sdk": "2.1030.0",
"bcrypt": "5.0.1", "bcrypt": "5.0.1",

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.212-alpha.4", "version": "1.0.212-alpha.5",
"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",
@ -38,7 +38,7 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1", "@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "^1.0.212-alpha.4", "@budibase/string-templates": "^1.0.212-alpha.5",
"@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2", "@spectrum-css/avatar": "^3.0.2",

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -69,10 +69,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.212-alpha.4", "@budibase/bbui": "^1.0.212-alpha.5",
"@budibase/client": "^1.0.212-alpha.4", "@budibase/client": "^1.0.212-alpha.5",
"@budibase/frontend-core": "^1.0.212-alpha.4", "@budibase/frontend-core": "^1.0.212-alpha.5",
"@budibase/string-templates": "^1.0.212-alpha.4", "@budibase/string-templates": "^1.0.212-alpha.5",
"@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.212-alpha.4", "version": "1.0.212-alpha.5",
"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.212-alpha.4", "version": "1.0.212-alpha.5",
"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.212-alpha.4", "@budibase/bbui": "^1.0.212-alpha.5",
"@budibase/frontend-core": "^1.0.212-alpha.4", "@budibase/frontend-core": "^1.0.212-alpha.5",
"@budibase/string-templates": "^1.0.212-alpha.4", "@budibase/string-templates": "^1.0.212-alpha.5",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View file

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.0.212-alpha.4", "@budibase/bbui": "^1.0.212-alpha.5",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View file

@ -42,6 +42,10 @@ export const OperatorOptions = {
value: "notEqual", value: "notEqual",
label: "Does Not Contain", label: "Does Not Contain",
}, },
In: {
value: "oneOf",
label: "Is in",
},
} }
// Cookie names // Cookie names

View file

@ -14,6 +14,7 @@ export const getValidOperatorsForType = type => {
Op.Like, Op.Like,
Op.Empty, Op.Empty,
Op.NotEmpty, Op.NotEmpty,
Op.In,
] ]
const numOps = [ const numOps = [
Op.Equals, Op.Equals,
@ -22,6 +23,7 @@ export const getValidOperatorsForType = type => {
Op.LessThan, Op.LessThan,
Op.Empty, Op.Empty,
Op.NotEmpty, Op.NotEmpty,
Op.In,
] ]
if (type === "string") { if (type === "string") {
return stringOps return stringOps
@ -91,6 +93,7 @@ export const buildLuceneQuery = filter => {
notEmpty: {}, notEmpty: {},
contains: {}, contains: {},
notContains: {}, notContains: {},
oneOf: {},
} }
if (Array.isArray(filter)) { if (Array.isArray(filter)) {
filter.forEach(expression => { filter.forEach(expression => {
@ -99,8 +102,12 @@ export const buildLuceneQuery = filter => {
if (type === "datetime" && value) { if (type === "datetime" && value) {
value = new Date(value).toISOString() value = new Date(value).toISOString()
} }
if (type === "number") { if (type === "number" && !Array.isArray(value)) {
value = parseFloat(value) if (operator === "oneOf") {
value = value.split(",").map(item => parseFloat(item))
} else {
value = parseFloat(value)
}
} }
if (type === "boolean") { if (type === "boolean") {
value = `${value}`?.toLowerCase() === "true" value = `${value}`?.toLowerCase() === "true"
@ -139,7 +146,6 @@ export const buildLuceneQuery = filter => {
} }
}) })
} }
return query return query
} }
@ -211,6 +217,17 @@ export const runLuceneQuery = (docs, query) => {
return docValue == null || docValue === "" return docValue == null || docValue === ""
}) })
// Process an includes match (fails if the value is not included)
const oneOf = match("oneOf", (docValue, testValue) => {
if (typeof testValue === "string") {
testValue = testValue.split(",")
if (typeof docValue === "number") {
testValue = testValue.map(item => parseFloat(item))
}
}
return !testValue?.includes(docValue)
})
// Match a document against all criteria // Match a document against all criteria
const docMatch = doc => { const docMatch = doc => {
return ( return (
@ -220,7 +237,8 @@ export const runLuceneQuery = (docs, query) => {
equalMatch(doc) && equalMatch(doc) &&
notEqualMatch(doc) && notEqualMatch(doc) &&
emptyMatch(doc) && emptyMatch(doc) &&
notEmptyMatch(doc) notEmptyMatch(doc) &&
oneOf(doc)
) )
} }

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -77,11 +77,11 @@
"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.212-alpha.4", "@budibase/backend-core": "^1.0.212-alpha.5",
"@budibase/client": "^1.0.212-alpha.4", "@budibase/client": "^1.0.212-alpha.5",
"@budibase/pro": "1.0.212-alpha.4", "@budibase/pro": "1.0.212-alpha.5",
"@budibase/string-templates": "^1.0.212-alpha.4", "@budibase/string-templates": "^1.0.212-alpha.5",
"@budibase/types": "^1.0.212-alpha.4", "@budibase/types": "^1.0.212-alpha.5",
"@bull-board/api": "3.7.0", "@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4", "@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View file

@ -17,6 +17,7 @@ class QueryBuilder {
notEqual: {}, notEqual: {},
empty: {}, empty: {},
notEmpty: {}, notEmpty: {},
oneOf: {},
...base, ...base,
} }
this.limit = 50 this.limit = 50
@ -112,6 +113,11 @@ class QueryBuilder {
return this return this
} }
addOneOf(key, value) {
this.query.oneOf[key] = value
return this
}
/** /**
* Preprocesses a value before going into a lucene search. * Preprocesses a value before going into a lucene search.
* Transforms strings to lowercase and wraps strings and bools in quotes. * Transforms strings to lowercase and wraps strings and bools in quotes.
@ -220,6 +226,28 @@ class QueryBuilder {
if (this.query.notEmpty) { if (this.query.notEmpty) {
build(this.query.notEmpty, key => `${key}:["" TO *]`) build(this.query.notEmpty, key => `${key}:["" TO *]`)
} }
if (this.query.oneOf) {
build(this.query.oneOf, (key, value) => {
if (!Array.isArray(value)) {
if (typeof value === "string") {
value = value.split(",")
} else {
return ""
}
}
let orStatement = `${builder.preprocess(
value[0],
allPreProcessingOpts
)}`
for (let i = 1; i < value.length; i++) {
orStatement += ` OR ${builder.preprocess(
value[i],
allPreProcessingOpts
)}`
}
return `${key}:(${orStatement})`
})
}
return query return query
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"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,6 +1,6 @@
{ {
"name": "@budibase/types", "name": "@budibase/types",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"description": "Budibase types", "description": "Budibase types",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View file

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.0.212-alpha.4", "version": "1.0.212-alpha.5",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -34,10 +34,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "^1.0.212-alpha.4", "@budibase/backend-core": "^1.0.212-alpha.5",
"@budibase/pro": "1.0.212-alpha.4", "@budibase/pro": "1.0.212-alpha.5",
"@budibase/string-templates": "^1.0.212-alpha.4", "@budibase/string-templates": "^1.0.212-alpha.5",
"@budibase/types": "^1.0.212-alpha.4", "@budibase/types": "^1.0.212-alpha.5",
"@koa/router": "8.0.8", "@koa/router": "8.0.8",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",