Merge branch 'master' of github.com:Budibase/budibase into fix/memory-leak

This commit is contained in:
mike12345567 2022-07-14 18:53:58 +01:00
commit c0b3ad155e
14 changed files with 70 additions and 43 deletions

View File

@ -1,11 +1,8 @@
name: Deploy Budibase Single Container Image to DockerHub name: Deploy Budibase Single Container Image to DockerHub
on: on:
push: workflow_dispatch:
branches:
- "omnibus-action"
- "develop"
- "master"
- "main"
env: env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref}} BASE_BRANCH: ${{ github.event.pull_request.base.ref}}
BRANCH: ${{ github.event.pull_request.head.ref }} BRANCH: ${{ github.event.pull_request.head.ref }}

View File

@ -1,5 +1,5 @@
{ {
"version": "1.1.7", "version": "1.1.8",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "1.1.7", "version": "1.1.8",
"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.1.7", "@budibase/types": "^1.1.8",
"@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

@ -11,7 +11,7 @@ export enum AutomationViewModes {
} }
export enum ViewNames { export enum ViewNames {
USER_BY_EMAIL = "by_email", USER_BY_EMAIL = "by_email2",
BY_API_KEY = "by_api_key", BY_API_KEY = "by_api_key",
USER_BY_BUILDERS = "by_builders", USER_BY_BUILDERS = "by_builders",
LINK = "by_link", LINK = "by_link",
@ -19,6 +19,13 @@ export enum ViewNames {
AUTOMATION_LOGS = "automation_logs", AUTOMATION_LOGS = "automation_logs",
} }
export const DeprecatedViews = {
[ViewNames.USER_BY_EMAIL]: [
// removed due to inaccuracy in view doc filter logic
"by_email",
],
}
export enum DocumentTypes { export enum DocumentTypes {
USER = "us", USER = "us",
WORKSPACE = "workspace", WORKSPACE = "workspace",

View File

@ -1,20 +1,42 @@
const { DocumentTypes, ViewNames } = require("./utils") const {
DocumentTypes,
ViewNames,
DeprecatedViews,
SEPARATOR,
} = require("./utils")
const { getGlobalDB } = require("../tenancy") const { getGlobalDB } = require("../tenancy")
const DESIGN_DB = "_design/database"
function DesignDoc() { function DesignDoc() {
return { return {
_id: "_design/database", _id: DESIGN_DB,
// view collation information, read before writing any complex views: // view collation information, read before writing any complex views:
// https://docs.couchdb.org/en/master/ddocs/views/collation.html#collation-specification // https://docs.couchdb.org/en/master/ddocs/views/collation.html#collation-specification
views: {}, views: {},
} }
} }
exports.createUserEmailView = async () => { async function removeDeprecated(db, viewName) {
if (!DeprecatedViews[viewName]) {
return
}
try {
const designDoc = await db.get(DESIGN_DB)
for (let deprecatedNames of DeprecatedViews[viewName]) {
delete designDoc.views[deprecatedNames]
}
await db.put(designDoc)
} catch (err) {
// doesn't exist, ignore
}
}
exports.createNewUserEmailView = async () => {
const db = getGlobalDB() const db = getGlobalDB()
let designDoc let designDoc
try { try {
designDoc = await db.get("_design/database") designDoc = await db.get(DESIGN_DB)
} catch (err) { } catch (err) {
// no design doc, make one // no design doc, make one
designDoc = DesignDoc() designDoc = DesignDoc()
@ -22,7 +44,7 @@ exports.createUserEmailView = async () => {
const view = { const view = {
// if using variables in a map function need to inject them before use // if using variables in a map function need to inject them before use
map: `function(doc) { map: `function(doc) {
if (doc._id.startsWith("${DocumentTypes.USER}")) { if (doc._id.startsWith("${DocumentTypes.USER}${SEPARATOR}")) {
emit(doc.email.toLowerCase(), doc._id) emit(doc.email.toLowerCase(), doc._id)
} }
}`, }`,
@ -81,7 +103,7 @@ exports.createUserBuildersView = async () => {
exports.queryGlobalView = async (viewName, params, db = null) => { exports.queryGlobalView = async (viewName, params, db = null) => {
const CreateFuncByName = { const CreateFuncByName = {
[ViewNames.USER_BY_EMAIL]: exports.createUserEmailView, [ViewNames.USER_BY_EMAIL]: exports.createNewUserEmailView,
[ViewNames.BY_API_KEY]: exports.createApiKeyView, [ViewNames.BY_API_KEY]: exports.createApiKeyView,
[ViewNames.USER_BY_BUILDERS]: exports.createUserBuildersView, [ViewNames.USER_BY_BUILDERS]: exports.createUserBuildersView,
} }
@ -98,6 +120,7 @@ exports.queryGlobalView = async (viewName, params, db = null) => {
} catch (err) { } catch (err) {
if (err != null && err.name === "not_found") { if (err != null && err.name === "not_found") {
const createFunc = CreateFuncByName[viewName] const createFunc = CreateFuncByName[viewName]
await removeDeprecated(db, viewName)
await createFunc() await createFunc()
return exports.queryGlobalView(viewName, params) return exports.queryGlobalView(viewName, params)
} else { } else {

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.1.7", "version": "1.1.8",
"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.1.7", "@budibase/string-templates": "^1.1.8",
"@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.1.7", "version": "1.1.8",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -69,10 +69,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "^1.1.7", "@budibase/bbui": "^1.1.8",
"@budibase/client": "^1.1.7", "@budibase/client": "^1.1.8",
"@budibase/frontend-core": "^1.1.7", "@budibase/frontend-core": "^1.1.8",
"@budibase/string-templates": "^1.1.7", "@budibase/string-templates": "^1.1.8",
"@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.1.7", "version": "1.1.8",
"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.1.7", "version": "1.1.8",
"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.1.7", "@budibase/bbui": "^1.1.8",
"@budibase/frontend-core": "^1.1.7", "@budibase/frontend-core": "^1.1.8",
"@budibase/string-templates": "^1.1.7", "@budibase/string-templates": "^1.1.8",
"@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.1.7", "version": "1.1.8",
"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.1.7", "@budibase/bbui": "^1.1.8",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "1.1.7", "version": "1.1.8",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -77,10 +77,10 @@
"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.1.7", "@budibase/backend-core": "^1.1.8",
"@budibase/client": "^1.1.7", "@budibase/client": "^1.1.8",
"@budibase/pro": "1.1.7", "@budibase/pro": "1.1.8",
"@budibase/string-templates": "^1.1.7", "@budibase/string-templates": "^1.1.8",
"@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",
@ -151,7 +151,7 @@
"@babel/core": "7.17.4", "@babel/core": "7.17.4",
"@babel/preset-env": "7.16.11", "@babel/preset-env": "7.16.11",
"@budibase/standard-components": "^0.9.139", "@budibase/standard-components": "^0.9.139",
"@budibase/types": "^1.1.7", "@budibase/types": "^1.1.8",
"@jest/test-sequencer": "24.9.0", "@jest/test-sequencer": "24.9.0",
"@types/apidoc": "0.50.0", "@types/apidoc": "0.50.0",
"@types/bson": "4.2.0", "@types/bson": "4.2.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "1.1.7", "version": "1.1.8",
"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.1.7", "version": "1.1.8",
"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.1.7", "version": "1.1.8",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -35,9 +35,9 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "^1.1.7", "@budibase/backend-core": "^1.1.8",
"@budibase/pro": "1.1.7", "@budibase/pro": "1.1.8",
"@budibase/string-templates": "^1.1.7", "@budibase/string-templates": "^1.1.8",
"@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",
@ -67,7 +67,7 @@
"server-destroy": "1.0.1" "server-destroy": "1.0.1"
}, },
"devDependencies": { "devDependencies": {
"@budibase/types": "^1.1.7", "@budibase/types": "^1.1.8",
"@types/jest": "26.0.23", "@types/jest": "26.0.23",
"@types/koa": "2.13.4", "@types/koa": "2.13.4",
"@types/koa-router": "7.4.4", "@types/koa-router": "7.4.4",