diff --git a/README.md b/README.md index 7d11ea570f..aa368d29fd 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,14 @@ Budibase is made to scale. With Budibase, you can self-host on your own infrastr ## 🏁 Get started - + -Deploy Budibase self-Hosted in your existing infrastructure, using Docker, Kubernetes, and Digital Ocean. +Deploy Budibase self-hosted in your existing infrastructure, using Docker, Kubernetes, and Digital Ocean. Or use Budibase Cloud if you don't need to self-host, and would like to get started quickly. -### [Get started with Budibase](https://budibase.com) +### [Get started with self-hosting Budibase](https://docs.budibase.com/self-hosting/self-host) + +### [Get started with Budibase Cloud](https://budibase.com)

diff --git a/lerna.json b/lerna.json index 52e0179237..21b2cc06d9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 25fa53a9e9..c2a1a80e01 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/backend-core/src/db/utils.js b/packages/backend-core/src/db/utils.js index 2800cf43c2..f5ea2f8486 100644 --- a/packages/backend-core/src/db/utils.js +++ b/packages/backend-core/src/db/utils.js @@ -222,6 +222,7 @@ exports.getAllDbs = async () => { /** * Lots of different points in the system need to find the full list of apps, this will * enumerate the entire CouchDB cluster and get the list of databases (every app). + * * @return {Promise} returns the app information document stored in each app database. */ exports.getAllApps = async ({ dev, all, idsOnly } = {}) => { diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 0e9e2e29e7..6d96b5c6fa 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.49-alpha.6", + "version": "1.0.49-alpha.8", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 790e6a5b93..b835707d08 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "license": "GPL-3.0", "private": true, "scripts": { @@ -64,11 +64,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.49-alpha.6", - "@budibase/client": "^1.0.49-alpha.6", - "@budibase/colorpicker": "1.1.2", - "@budibase/frontend-core": "^1.0.49-alpha.6", - "@budibase/string-templates": "^1.0.49-alpha.6", + "@budibase/bbui": "^1.0.49-alpha.8", + "@budibase/client": "^1.0.49-alpha.8", + "@budibase/frontend-core": "^1.0.49-alpha.8", + "@budibase/string-templates": "^1.0.49-alpha.8", "@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 40d2203f2e..11302905e4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "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 4b99ed6ae8..55967aa041 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "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.49-alpha.6", - "@budibase/frontend-core": "^1.0.49-alpha.6", - "@budibase/string-templates": "^1.0.49-alpha.6", + "@budibase/bbui": "^1.0.49-alpha.8", + "@budibase/frontend-core": "^1.0.49-alpha.8", + "@budibase/string-templates": "^1.0.49-alpha.8", "regexparam": "^1.3.0", "rollup-plugin-polyfill-node": "^0.8.0", "shortid": "^2.2.15", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 01d6768a34..391840752b 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "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.49-alpha.6", + "@budibase/bbui": "^1.0.49-alpha.8", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 3cc3880010..50295acd8f 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.49-alpha.6", + "version": "1.0.49-alpha.8", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -70,9 +70,9 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.49-alpha.6", - "@budibase/client": "^1.0.49-alpha.6", - "@budibase/string-templates": "^1.0.49-alpha.6", + "@budibase/backend-core": "^1.0.49-alpha.8", + "@budibase/client": "^1.0.49-alpha.8", + "@budibase/string-templates": "^1.0.49-alpha.8", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/server/src/api/controllers/row/external.js b/packages/server/src/api/controllers/row/external.js index 0bd57d256f..66a1e30ca6 100644 --- a/packages/server/src/api/controllers/row/external.js +++ b/packages/server/src/api/controllers/row/external.js @@ -31,23 +31,21 @@ async function handleRequest(operation, tableId, opts = {}) { exports.handleRequest = handleRequest exports.patch = async ctx => { - const appId = ctx.appId const inputs = ctx.request.body const tableId = ctx.params.tableId const id = breakRowIdField(inputs._id) // don't save the ID to db delete inputs._id - return handleRequest(appId, DataSourceOperation.UPDATE, tableId, { + return handleRequest(DataSourceOperation.UPDATE, tableId, { id, row: inputs, }) } exports.save = async ctx => { - const appId = ctx.appId const inputs = ctx.request.body const tableId = ctx.params.tableId - return handleRequest(appId, DataSourceOperation.CREATE, tableId, { + return handleRequest(DataSourceOperation.CREATE, tableId, { row: inputs, }) } @@ -61,49 +59,35 @@ exports.fetchView = async ctx => { } exports.fetch = async ctx => { - const appId = ctx.appId const tableId = ctx.params.tableId - return handleRequest(appId, DataSourceOperation.READ, tableId) + return handleRequest(DataSourceOperation.READ, tableId) } exports.find = async ctx => { - const appId = ctx.appId const id = ctx.params.rowId const tableId = ctx.params.tableId - const response = await handleRequest( - appId, - DataSourceOperation.READ, - tableId, - { - id, - } - ) + const response = await handleRequest(DataSourceOperation.READ, tableId, { + id, + }) return response ? response[0] : response } exports.destroy = async ctx => { - const appId = ctx.appId const tableId = ctx.params.tableId const id = ctx.request.body._id - const { row } = await handleRequest( - appId, - DataSourceOperation.DELETE, - tableId, - { - id, - } - ) + const { row } = await handleRequest(DataSourceOperation.DELETE, tableId, { + id, + }) return { response: { ok: true }, row } } exports.bulkDestroy = async ctx => { - const appId = ctx.appId const { rows } = ctx.request.body const tableId = ctx.params.tableId let promises = [] for (let row of rows) { promises.push( - handleRequest(appId, DataSourceOperation.DELETE, tableId, { + handleRequest(DataSourceOperation.DELETE, tableId, { id: breakRowIdField(row._id), }) ) @@ -113,7 +97,6 @@ exports.bulkDestroy = async ctx => { } exports.search = async ctx => { - const appId = ctx.appId const tableId = ctx.params.tableId const { paginate, query, ...params } = ctx.request.body let { bookmark, limit } = params @@ -143,26 +126,21 @@ exports.search = async ctx => { [params.sort]: direction, } } - const rows = await handleRequest(appId, DataSourceOperation.READ, tableId, { + const rows = await handleRequest(DataSourceOperation.READ, tableId, { filters: query, sort, paginate: paginateObj, }) let hasNextPage = false if (paginate && rows.length === limit) { - const nextRows = await handleRequest( - appId, - DataSourceOperation.READ, - tableId, - { - filters: query, - sort, - paginate: { - limit: 1, - page: bookmark * limit + 1, - }, - } - ) + const nextRows = await handleRequest(DataSourceOperation.READ, tableId, { + filters: query, + sort, + paginate: { + limit: 1, + page: bookmark * limit + 1, + }, + }) hasNextPage = nextRows.length > 0 } // need wrapper object for bookmarks etc when paginating @@ -175,7 +153,6 @@ exports.validate = async () => { } exports.fetchEnrichedRow = async ctx => { - const appId = ctx.appId const id = ctx.params.rowId const tableId = ctx.params.tableId const { datasourceId, tableName } = breakExternalTableId(tableId) @@ -185,15 +162,10 @@ exports.fetchEnrichedRow = async ctx => { ctx.throw(400, "Datasource has not been configured for plus API.") } const tables = datasource.entities - const response = await handleRequest( - appId, - DataSourceOperation.READ, - tableId, - { - id, - datasource, - } - ) + const response = await handleRequest(DataSourceOperation.READ, tableId, { + id, + datasource, + }) const table = tables[tableName] const row = response[0] // this seems like a lot of work, but basically we need to dig deeper for the enrich @@ -212,7 +184,6 @@ exports.fetchEnrichedRow = async ctx => { // don't support composite keys right now const linkedIds = links.map(link => breakRowIdField(link._id)[0]) row[fieldName] = await handleRequest( - appId, DataSourceOperation.READ, linkedTableId, { diff --git a/packages/server/src/migrations/functions/usageQuotas/syncApps.ts b/packages/server/src/migrations/functions/usageQuotas/syncApps.ts index e8559a3af9..aec5541053 100644 --- a/packages/server/src/migrations/functions/usageQuotas/syncApps.ts +++ b/packages/server/src/migrations/functions/usageQuotas/syncApps.ts @@ -1,12 +1,11 @@ -// @ts-ignore import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy" -// @ts-ignore import { getAllApps } from "@budibase/backend-core/db" import { getUsageQuotaDoc } from "../../../utilities/usageQuota" export const run = async () => { const db = getGlobalDB() // get app count + // @ts-ignore const devApps = await getAllApps({ dev: true }) const appCount = devApps ? devApps.length : 0 diff --git a/packages/server/src/migrations/functions/usageQuotas/syncRows.ts b/packages/server/src/migrations/functions/usageQuotas/syncRows.ts index b4323135c9..2766a7c0d1 100644 --- a/packages/server/src/migrations/functions/usageQuotas/syncRows.ts +++ b/packages/server/src/migrations/functions/usageQuotas/syncRows.ts @@ -1,6 +1,4 @@ -// @ts-ignore import { getGlobalDB, getTenantId } from "@budibase/backend-core/tenancy" -// @ts-ignore import { getAllApps } from "@budibase/backend-core/db" import { getUsageQuotaDoc } from "../../../utilities/usageQuota" import { getUniqueRows } from "../../../utilities/usageQuota/rows" @@ -8,7 +6,9 @@ import { getUniqueRows } from "../../../utilities/usageQuota/rows" export const run = async () => { const db = getGlobalDB() // get all rows in all apps + // @ts-ignore const allApps = await getAllApps({ all: true }) + // @ts-ignore const appIds = allApps ? allApps.map((app: { appId: any }) => app.appId) : [] const rows = await getUniqueRows(appIds) const rowCount = rows ? rows.length : 0 diff --git a/packages/server/src/module.d.ts b/packages/server/src/module.d.ts new file mode 100644 index 0000000000..b7850efff3 --- /dev/null +++ b/packages/server/src/module.d.ts @@ -0,0 +1,3 @@ +declare module "@budibase/backend-core" +declare module "@budibase/backend-core/tenancy" +declare module "@budibase/backend-core/db" diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 6a5ba315a1..c5c1c5a840 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -12,7 +12,8 @@ "incremental": true }, "include": [ - "./src/**/*" + "./src/**/*", + "./src/module.d.ts" ], "exclude": [ "node_modules", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index fc67a9c253..2247899b24 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.49-alpha.6", + "version": "1.0.49-alpha.8", "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 cd2aa9863c..e03eab38c2 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.49-alpha.6", + "version": "1.0.49-alpha.8", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -34,8 +34,8 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.49-alpha.6", - "@budibase/string-templates": "^1.0.49-alpha.6", + "@budibase/backend-core": "^1.0.49-alpha.8", + "@budibase/string-templates": "^1.0.49-alpha.8", "@koa/router": "^8.0.0", "@sentry/node": "^6.0.0", "@techpass/passport-openidconnect": "^0.3.0",