diff --git a/.github/workflows/release-develop.yml b/.github/workflows/release-develop.yml index 4502482b23..631308d945 100644 --- a/.github/workflows/release-develop.yml +++ b/.github/workflows/release-develop.yml @@ -21,7 +21,8 @@ env: # Posthog token used by ui at build time POSTHOG_TOKEN: phc_uDYOfnFt6wAbBAXkC6STjcrTpAFiWIhqgFcsC1UVO5F INTERCOM_TOKEN: ${{ secrets.INTERCOM_TOKEN }} - PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }} + PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + FEATURE_PREVIEW_URL: https://budirelease.live jobs: release: @@ -124,4 +125,4 @@ jobs: with: webhook-url: ${{ secrets.PROD_DEPLOY_WEBHOOK_URL }} content: "Release Env Deployment Complete: ${{ env.RELEASE_VERSION }} deployed to Budibase Release Env." - embed-title: ${{ env.RELEASE_VERSION }} \ No newline at end of file + embed-title: ${{ env.RELEASE_VERSION }} diff --git a/lerna.json b/lerna.json index 782fd6274f..e65ce20401 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index c68523fb71..3f36482120 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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.0.212-alpha.2", + "@budibase/types": "^1.0.212-alpha.6", "@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 3a9333be12..6bb51dda7b 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.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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.0.212-alpha.2", + "@budibase/string-templates": "^1.0.212-alpha.6", "@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 6a1dead631..404fd3b1cc 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.212-alpha.2", - "@budibase/client": "^1.0.212-alpha.2", - "@budibase/frontend-core": "^1.0.212-alpha.2", - "@budibase/string-templates": "^1.0.212-alpha.2", + "@budibase/bbui": "^1.0.212-alpha.6", + "@budibase/client": "^1.0.212-alpha.6", + "@budibase/frontend-core": "^1.0.212-alpha.6", + "@budibase/string-templates": "^1.0.212-alpha.6", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/vite.config.js b/packages/builder/vite.config.js index ff60efd960..56ffbf20f5 100644 --- a/packages/builder/vite.config.js +++ b/packages/builder/vite.config.js @@ -32,9 +32,6 @@ export default ({ mode }) => { process.env.INTERCOM_TOKEN ), "process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN), - "process.env.FEATURE_PREVIEW_URL": JSON.stringify( - process.env.FEATURE_PREVIEW_URL - ), }), ], optimizeDeps: { diff --git a/packages/cli/package.json b/packages/cli/package.json index e8cac7afc5..b33161f525 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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 47d37fbb02..6a1bba3146 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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.0.212-alpha.2", - "@budibase/frontend-core": "^1.0.212-alpha.2", - "@budibase/string-templates": "^1.0.212-alpha.2", + "@budibase/bbui": "^1.0.212-alpha.6", + "@budibase/frontend-core": "^1.0.212-alpha.6", + "@budibase/string-templates": "^1.0.212-alpha.6", "@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 61ad061a4e..30b4d6c44f 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.212-alpha.2", + "@budibase/bbui": "^1.0.212-alpha.6", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/frontend-core/src/api/other.js b/packages/frontend-core/src/api/other.js index e2cd7aac83..ac4b481395 100644 --- a/packages/frontend-core/src/api/other.js +++ b/packages/frontend-core/src/api/other.js @@ -60,7 +60,8 @@ export const buildOtherEndpoints = API => ({ */ checkBetaAccess: async email => { return await API.get({ - url: `${process.env.FEATURE_PREVIEW_URL}/api/beta/access?email=${email}`, + url: `/api/beta/access?email=${email}`, + external: true, }) }, }) diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 9ca47de23f..f69590f720 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -42,6 +42,10 @@ export const OperatorOptions = { value: "notEqual", label: "Does Not Contain", }, + In: { + value: "oneOf", + label: "Is in", + }, } // Cookie names diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index 8f59a2bd9d..1001ec26a8 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -14,6 +14,7 @@ export const getValidOperatorsForType = type => { Op.Like, Op.Empty, Op.NotEmpty, + Op.In, ] const numOps = [ Op.Equals, @@ -22,6 +23,7 @@ export const getValidOperatorsForType = type => { Op.LessThan, Op.Empty, Op.NotEmpty, + Op.In, ] if (type === "string") { return stringOps @@ -91,6 +93,7 @@ export const buildLuceneQuery = filter => { notEmpty: {}, contains: {}, notContains: {}, + oneOf: {}, } if (Array.isArray(filter)) { filter.forEach(expression => { @@ -99,8 +102,12 @@ export const buildLuceneQuery = filter => { if (type === "datetime" && value) { value = new Date(value).toISOString() } - if (type === "number") { - value = parseFloat(value) + if (type === "number" && !Array.isArray(value)) { + if (operator === "oneOf") { + value = value.split(",").map(item => parseFloat(item)) + } else { + value = parseFloat(value) + } } if (type === "boolean") { value = `${value}`?.toLowerCase() === "true" @@ -139,7 +146,6 @@ export const buildLuceneQuery = filter => { } }) } - return query } @@ -211,6 +217,17 @@ export const runLuceneQuery = (docs, query) => { 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 const docMatch = doc => { return ( @@ -220,7 +237,8 @@ export const runLuceneQuery = (docs, query) => { equalMatch(doc) && notEqualMatch(doc) && emptyMatch(doc) && - notEmptyMatch(doc) + notEmptyMatch(doc) && + oneOf(doc) ) } diff --git a/packages/server/package.json b/packages/server/package.json index 4d3a901998..d85aa28d04 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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.0.212-alpha.2", - "@budibase/client": "^1.0.212-alpha.2", - "@budibase/pro": "1.0.212-alpha.2", - "@budibase/string-templates": "^1.0.212-alpha.2", - "@budibase/types": "^1.0.212-alpha.2", + "@budibase/backend-core": "^1.0.212-alpha.6", + "@budibase/client": "^1.0.212-alpha.6", + "@budibase/pro": "1.0.212-alpha.6", + "@budibase/string-templates": "^1.0.212-alpha.6", + "@budibase/types": "^1.0.212-alpha.6", "@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/dev.js b/packages/server/src/api/controllers/dev.js index 0ed3934c6c..45ff0c293a 100644 --- a/packages/server/src/api/controllers/dev.js +++ b/packages/server/src/api/controllers/dev.js @@ -140,6 +140,23 @@ exports.getBudibaseVersion = async ctx => { // TODO: remove as part of beta program exports.checkBetaAccess = async ctx => { + // go to the cloud platform if running self hosted + if (env.SELF_HOSTED || !env.MULTI_TENANCY) { + let baseUrl = "" + if (env.ACCOUNT_PORTAL_URL) { + baseUrl = env.ACCOUNT_PORTAL_URL.replace("account.", "") + } else { + baseUrl = "https://budibase.app" + } + + const response = await fetch( + `${baseUrl}/api/beta/access?email=${ctx.query.email}` + ) + const json = await response.json() + ctx.body = json + return + } + const userToCheck = ctx.query.email const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364" const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15" @@ -163,6 +180,7 @@ exports.checkBetaAccess = async ctx => { } ctx.body = { access } } catch (err) { + console.error(err) ctx.body = { access: false } } } diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index d6c6860332..d262592d3b 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -17,6 +17,7 @@ class QueryBuilder { notEqual: {}, empty: {}, notEmpty: {}, + oneOf: {}, ...base, } this.limit = 50 @@ -112,6 +113,11 @@ class QueryBuilder { return this } + addOneOf(key, value) { + this.query.oneOf[key] = value + return this + } + /** * Preprocesses a value before going into a lucene search. * Transforms strings to lowercase and wraps strings and bools in quotes. @@ -220,6 +226,28 @@ class QueryBuilder { if (this.query.notEmpty) { 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 } diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 570ac0ddf2..bf7e7f4709 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -67,6 +67,7 @@ module.exports = { SALT_ROUNDS: process.env.SALT_ROUNDS, LOGGER: process.env.LOGGER, LOG_LEVEL: process.env.LOG_LEVEL, + ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, AUTOMATION_MAX_ITERATIONS: parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200, SENDGRID_API_KEY: process.env.SENDGRID_API_KEY, diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index f45f7de3f8..582f2d9a87 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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 4c4f6f95c0..d6f7b58ebd 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "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 d7003b24f7..f223c9f480 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.212-alpha.2", + "version": "1.0.212-alpha.6", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -34,10 +34,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.212-alpha.2", - "@budibase/pro": "1.0.212-alpha.2", - "@budibase/string-templates": "^1.0.212-alpha.2", - "@budibase/types": "^1.0.212-alpha.2", + "@budibase/backend-core": "^1.0.212-alpha.6", + "@budibase/pro": "1.0.212-alpha.6", + "@budibase/string-templates": "^1.0.212-alpha.6", + "@budibase/types": "^1.0.212-alpha.6", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2",