diff --git a/hosting/docker-compose.dev.yaml b/hosting/docker-compose.dev.yaml index 3b99ef796c..eaced64e06 100644 --- a/hosting/docker-compose.dev.yaml +++ b/hosting/docker-compose.dev.yaml @@ -14,7 +14,6 @@ services: environment: MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} - MINIO_BROWSER: "off" command: server /data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] diff --git a/lerna.json b/lerna.json index 5f06e73f5e..605266be51 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.39", + "version": "0.9.42", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 7faa482e84..888390cb00 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.39", + "version": "0.9.42", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 018a5f5d15..4769e55fa9 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": "0.9.39", + "version": "0.9.42", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 32975defa9..85e2884a8b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.39", + "version": "0.9.42", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.39", - "@budibase/client": "^0.9.39", + "@budibase/bbui": "^0.9.42", + "@budibase/client": "^0.9.42", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.39", + "@budibase/string-templates": "^0.9.42", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 0b2f6b54db..0b3bb30160 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.39", + "version": "0.9.42", "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 65c318c211..d4c1e68683 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.39", + "version": "0.9.42", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,13 +18,13 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/string-templates": "^0.9.39", + "@budibase/string-templates": "^0.9.42", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.39", + "@budibase/standard-components": "^0.9.42", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "fs-extra": "^8.1.0", diff --git a/packages/server/package.json b/packages/server/package.json index 56f55ada88..8a64da4811 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.39", + "version": "0.9.42", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.39", - "@budibase/client": "^0.9.39", - "@budibase/string-templates": "^0.9.39", + "@budibase/auth": "^0.9.42", + "@budibase/client": "^0.9.42", + "@budibase/string-templates": "^0.9.42", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -110,7 +110,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.39", + "@budibase/standard-components": "^0.9.42", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index f248d1957a..5d21b01129 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -82,7 +82,7 @@ exports.query = async function (ctx) { exports.plus = async function (ctx) { const db = new CouchDB(ctx.appId) - const PlusConnector = plusIntegrations[ctx.request.body.source] + const PlusConnector = plusIntegrations[ctx.request.body.source].integration const connector = new PlusConnector(ctx.request.body) await connector.init() diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 64cfb122f7..92306259b6 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -71,7 +71,7 @@ exports.uploadFile = async function (ctx) { return prepareUpload({ file, - s3Key: `assets/${ctx.appId}/attachments/${processedFileName}`, + s3Key: `${ctx.appId}/attachments/${processedFileName}`, bucket: ObjectStoreBuckets.APPS, }) }) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index ce7d76100b..60796e56f1 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -385,7 +385,7 @@ describe("/rows", () => { name: "test", description: "test", attachment: [{ - key: `${config.getAppId()}/attachment/test/thing.csv`, + key: `${config.getAppId()}/attachments/test/thing.csv`, }], tableId: table._id, }) @@ -393,7 +393,7 @@ describe("/rows", () => { await setup.switchToSelfHosted(async () => { const enriched = await outputProcessing(config.getAppId(), table, [row]) expect(enriched[0].attachment[0].url).toBe( - `/prod-budi-app-assets/${config.getAppId()}/attachment/test/thing.csv` + `/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv` ) }) }) diff --git a/packages/server/src/integrations/index.js b/packages/server/src/integrations/index.js index 4999f0c867..6916987960 100644 --- a/packages/server/src/integrations/index.js +++ b/packages/server/src/integrations/index.js @@ -9,6 +9,8 @@ const airtable = require("./airtable") const mysql = require("./mysql") const arangodb = require("./arangodb") const rest = require("./rest") +// Plus +const postgresPlus = require("../integrations/plus/postgres") const DEFINITIONS = { POSTGRES: postgres.schema, @@ -22,6 +24,7 @@ const DEFINITIONS = { MYSQL: mysql.schema, ARANGODB: arangodb.schema, REST: rest.schema, + POSTGRES_PLUS: postgresPlus.schema, } const INTEGRATIONS = { diff --git a/packages/server/src/integrations/plus/postgres.js b/packages/server/src/integrations/plus/postgres.js index 2606195ff3..87be332019 100644 --- a/packages/server/src/integrations/plus/postgres.js +++ b/packages/server/src/integrations/plus/postgres.js @@ -1,5 +1,6 @@ const { Pool } = require("pg") const { FieldTypes } = require("../../constants") +const { FIELD_TYPES } = require("../Integration") const TYPE_MAP = { text: FieldTypes.LONGFORM, @@ -13,6 +14,44 @@ const TYPE_MAP = { boolean: FieldTypes.BOOLEAN, } +const SCHEMA = { + friendlyName: "PostgreSQL", + description: + "PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.", + datasource: { + host: { + type: FIELD_TYPES.STRING, + default: "localhost", + required: true, + }, + port: { + type: FIELD_TYPES.NUMBER, + required: true, + default: 5432, + }, + database: { + type: FIELD_TYPES.STRING, + default: "postgres", + required: true, + }, + user: { + type: FIELD_TYPES.STRING, + default: "root", + required: true, + }, + password: { + type: FIELD_TYPES.PASSWORD, + default: "root", + required: true, + }, + ssl: { + type: FIELD_TYPES.BOOLEAN, + default: false, + required: false, + }, + }, +} + class PostgresPlus { static pool COLUMNS_SQL = @@ -52,4 +91,7 @@ class PostgresPlus { } } -module.exports = PostgresPlus +module.exports = { + schema: SCHEMA, + integration: PostgresPlus, +} diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 8e88318439..0ea1ebce03 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.39", + "version": "0.9.42", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.39", + "@budibase/bbui": "^0.9.42", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", diff --git a/packages/standard-components/src/lucene.js b/packages/standard-components/src/lucene.js index fbeaecbdd7..8cbd1ea0fe 100644 --- a/packages/standard-components/src/lucene.js +++ b/packages/standard-components/src/lucene.js @@ -13,7 +13,9 @@ export const buildLuceneQuery = filter => { notEmpty: {}, } if (Array.isArray(filter)) { - filter.forEach(({ operator, field, type, value }) => { + // Build up proper range filters + filter.forEach(expression => { + const { operator, field, type, value } = expression if (operator.startsWith("range")) { if (!query.range[field]) { query.range[field] = { @@ -33,10 +35,24 @@ export const buildLuceneQuery = filter => { query.range[field].high = value } } else if (query[operator]) { - query[operator][field] = value + if (type === "boolean") { + // Transform boolean filters to cope with null. + // "equals false" needs to be "not equals true" + // "not equals false" needs to be "equals true" + if (operator === "equal" && value === "false") { + query.notEqual[field] = "true" + } else if (operator === "notEqual" && value === "false") { + query.equal[field] = "true" + } else { + query[operator][field] = value + } + } else { + query[operator][field] = value + } } }) } + return query } diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index f604c36da3..b1dc7e9a25 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.39", + "version": "0.9.42", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 2c124f7280..db15ad4f6b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.39", + "version": "0.9.42", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.39", - "@budibase/string-templates": "^0.9.39", + "@budibase/auth": "^0.9.42", + "@budibase/string-templates": "^0.9.42", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 2458e1b23c..ad726440bd 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -287,10 +287,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/auth@^0.9.36": - version "0.9.36" - resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.36.tgz#8111890390fb57a513ea1fc0b209db474460ea59" - integrity sha512-pGDd3d5/MwEDrSQI7NZNfekXlywuxjKNOfQHi5+5cbpje3DdWxRu2ILpvYj0TdmIk8K3vd4TsZLL0APVaB/mhg== +"@budibase/auth@^0.9.38": + version "0.9.38" + resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.38.tgz#196f2f20f8df09e07804877965ada6bd7a9e7e72" + integrity sha512-ww1gfjjmSvmzNFZY8Omy9tzuzFsStLzHR6t54hinOVcL3Bu8T/xBAqSyEvyCkZNbfTHis7V8QmTzugRxhuyHoQ== dependencies: aws-sdk "^2.901.0" bcryptjs "^2.4.3" @@ -340,10 +340,10 @@ to-gfm-code-block "^0.1.1" year "^0.2.1" -"@budibase/string-templates@^0.9.36": - version "0.9.36" - resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.36.tgz#a8391d01fec9587b8b0873f6bdc402a6d8375e8a" - integrity sha512-OtuwJZkwgGD/pu0I0duCqiC4djGhc3olMvROq9JHIs6jm7qWLRxud53S1TdgHFFZPdEsuUGHGLRlZrIZaPujQw== +"@budibase/string-templates@^0.9.38": + version "0.9.38" + resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.38.tgz#8fec7b18654b2e42e388a774a515c6f8617b56e9" + integrity sha512-38n+zf8L1s24rbSnk9/18In7xxz/zLeI0Yn6OUn079Nqz7MCgdhnYg/TTYAORzm7WYFwnAF1pXStWqTrsZk+lg== dependencies: "@budibase/handlebars-helpers" "^0.11.3" dayjs "^1.10.4"