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 5057994b45
14 changed files with 70 additions and 43 deletions

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.1.7",
"version": "1.1.8",
"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.1.7",
"@budibase/types": "^1.1.8",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",
"bcrypt": "5.0.1",

View File

@ -11,7 +11,7 @@ export enum AutomationViewModes {
}
export enum ViewNames {
USER_BY_EMAIL = "by_email",
USER_BY_EMAIL = "by_email2",
BY_API_KEY = "by_api_key",
USER_BY_BUILDERS = "by_builders",
LINK = "by_link",
@ -19,6 +19,13 @@ export enum ViewNames {
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 {
USER = "us",
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 DESIGN_DB = "_design/database"
function DesignDoc() {
return {
_id: "_design/database",
_id: DESIGN_DB,
// view collation information, read before writing any complex views:
// https://docs.couchdb.org/en/master/ddocs/views/collation.html#collation-specification
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()
let designDoc
try {
designDoc = await db.get("_design/database")
designDoc = await db.get(DESIGN_DB)
} catch (err) {
// no design doc, make one
designDoc = DesignDoc()
@ -22,7 +44,7 @@ exports.createUserEmailView = async () => {
const view = {
// if using variables in a map function need to inject them before use
map: `function(doc) {
if (doc._id.startsWith("${DocumentTypes.USER}")) {
if (doc._id.startsWith("${DocumentTypes.USER}${SEPARATOR}")) {
emit(doc.email.toLowerCase(), doc._id)
}
}`,
@ -81,7 +103,7 @@ exports.createUserBuildersView = async () => {
exports.queryGlobalView = async (viewName, params, db = null) => {
const CreateFuncByName = {
[ViewNames.USER_BY_EMAIL]: exports.createUserEmailView,
[ViewNames.USER_BY_EMAIL]: exports.createNewUserEmailView,
[ViewNames.BY_API_KEY]: exports.createApiKeyView,
[ViewNames.USER_BY_BUILDERS]: exports.createUserBuildersView,
}
@ -98,6 +120,7 @@ exports.queryGlobalView = async (viewName, params, db = null) => {
} catch (err) {
if (err != null && err.name === "not_found") {
const createFunc = CreateFuncByName[viewName]
await removeDeprecated(db, viewName)
await createFunc()
return exports.queryGlobalView(viewName, params)
} else {

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "1.1.7",
"version": "1.1.8",
"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.1.7",
"@budibase/string-templates": "^1.1.8",
"@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "1.1.7",
"version": "1.1.8",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -69,10 +69,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^1.1.7",
"@budibase/client": "^1.1.7",
"@budibase/frontend-core": "^1.1.7",
"@budibase/string-templates": "^1.1.7",
"@budibase/bbui": "^1.1.8",
"@budibase/client": "^1.1.8",
"@budibase/frontend-core": "^1.1.8",
"@budibase/string-templates": "^1.1.8",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "1.1.7",
"version": "1.1.8",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "1.1.7",
"version": "1.1.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.1.7",
"@budibase/frontend-core": "^1.1.7",
"@budibase/string-templates": "^1.1.7",
"@budibase/bbui": "^1.1.8",
"@budibase/frontend-core": "^1.1.8",
"@budibase/string-templates": "^1.1.8",
"@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "1.1.7",
"version": "1.1.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.1.7",
"@budibase/bbui": "^1.1.8",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.1.7",
"version": "1.1.8",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -77,10 +77,10 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "^1.1.7",
"@budibase/client": "^1.1.7",
"@budibase/pro": "1.1.7",
"@budibase/string-templates": "^1.1.7",
"@budibase/backend-core": "^1.1.8",
"@budibase/client": "^1.1.8",
"@budibase/pro": "1.1.8",
"@budibase/string-templates": "^1.1.8",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",
@ -151,7 +151,7 @@
"@babel/core": "7.17.4",
"@babel/preset-env": "7.16.11",
"@budibase/standard-components": "^0.9.139",
"@budibase/types": "^1.1.7",
"@budibase/types": "^1.1.8",
"@jest/test-sequencer": "24.9.0",
"@types/apidoc": "0.50.0",
"@types/bson": "4.2.0",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "1.1.7",
"version": "1.1.8",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "1.1.7",
"version": "1.1.8",
"description": "Budibase types",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "1.1.7",
"version": "1.1.8",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -35,9 +35,9 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "^1.1.7",
"@budibase/pro": "1.1.7",
"@budibase/string-templates": "^1.1.7",
"@budibase/backend-core": "^1.1.8",
"@budibase/pro": "1.1.8",
"@budibase/string-templates": "^1.1.8",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",
@ -67,7 +67,7 @@
"server-destroy": "1.0.1"
},
"devDependencies": {
"@budibase/types": "^1.1.7",
"@budibase/types": "^1.1.8",
"@types/jest": "26.0.23",
"@types/koa": "2.13.4",
"@types/koa-router": "7.4.4",