Merge branch 'master' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
42ad8adb97
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/auth",
|
"name": "@budibase/auth",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"description": "Authentication middlewares for budibase builder and apps",
|
"description": "Authentication middlewares for budibase builder and apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -3,10 +3,15 @@ const Replication = require("./Replication")
|
||||||
const { DEFAULT_TENANT_ID, Configs } = require("../constants")
|
const { DEFAULT_TENANT_ID, Configs } = require("../constants")
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
const { StaticDatabases, SEPARATOR, DocumentTypes } = require("./constants")
|
const { StaticDatabases, SEPARATOR, DocumentTypes } = require("./constants")
|
||||||
const { getTenantId, getTenantIDFromAppID } = require("../tenancy")
|
const {
|
||||||
|
getTenantId,
|
||||||
|
getTenantIDFromAppID,
|
||||||
|
getGlobalDBName,
|
||||||
|
} = require("../tenancy")
|
||||||
const fetch = require("node-fetch")
|
const fetch = require("node-fetch")
|
||||||
const { getCouch } = require("./index")
|
const { getCouch } = require("./index")
|
||||||
const { getAppMetadata } = require("../cache/appMetadata")
|
const { getAppMetadata } = require("../cache/appMetadata")
|
||||||
|
const { checkSlashesInUrl } = require("../helpers")
|
||||||
|
|
||||||
const NO_APP_ERROR = "No app provided"
|
const NO_APP_ERROR = "No app provided"
|
||||||
|
|
||||||
|
@ -194,6 +199,11 @@ exports.getCouchUrl = () => {
|
||||||
return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}`
|
return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.getStartEndKeyURL = (base, baseKey, tenantId = null) => {
|
||||||
|
const tenancy = tenantId ? `${SEPARATOR}${tenantId}` : ""
|
||||||
|
return `${base}?startkey="${baseKey}${tenancy}"&endkey="${baseKey}${tenancy}${UNICODE_MAX}"`
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing
|
* if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing
|
||||||
* when using Pouch it will use the pouchdb-all-dbs package.
|
* when using Pouch it will use the pouchdb-all-dbs package.
|
||||||
|
@ -203,12 +213,34 @@ exports.getAllDbs = async () => {
|
||||||
if (env.isTest()) {
|
if (env.isTest()) {
|
||||||
return getCouch().allDbs()
|
return getCouch().allDbs()
|
||||||
}
|
}
|
||||||
const response = await fetch(`${exports.getCouchUrl()}/_all_dbs`)
|
let dbs = []
|
||||||
if (response.status === 200) {
|
async function addDbs(url) {
|
||||||
return response.json()
|
const response = await fetch(checkSlashesInUrl(encodeURI(url)))
|
||||||
} else {
|
if (response.status === 200) {
|
||||||
throw "Cannot connect to CouchDB instance"
|
let json = await response.json()
|
||||||
|
dbs = dbs.concat(json)
|
||||||
|
} else {
|
||||||
|
throw "Cannot connect to CouchDB instance"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
let couchUrl = `${exports.getCouchUrl()}_all_dbs`
|
||||||
|
if (env.MULTI_TENANCY) {
|
||||||
|
let tenantId = getTenantId()
|
||||||
|
// get prod apps
|
||||||
|
await addDbs(
|
||||||
|
exports.getStartEndKeyURL(couchUrl, DocumentTypes.APP, tenantId)
|
||||||
|
)
|
||||||
|
// get dev apps
|
||||||
|
await addDbs(
|
||||||
|
exports.getStartEndKeyURL(couchUrl, DocumentTypes.APP_DEV, tenantId)
|
||||||
|
)
|
||||||
|
// add global db name
|
||||||
|
dbs.push(getGlobalDBName(tenantId))
|
||||||
|
} else {
|
||||||
|
// just get all DBs in self host
|
||||||
|
await addDbs(couchUrl)
|
||||||
|
}
|
||||||
|
return dbs
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -389,7 +421,7 @@ const getScopedFullConfig = async function (db, { type, user, workspace }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPlatformUrl = async settings => {
|
const getPlatformUrl = async settings => {
|
||||||
let platformUrl = env.PLATFORM_URL
|
let platformUrl = env.PLATFORM_URL || "http://localhost:10000"
|
||||||
|
|
||||||
if (!env.SELF_HOSTED && env.MULTI_TENANCY) {
|
if (!env.SELF_HOSTED && env.MULTI_TENANCY) {
|
||||||
// cloud and multi tenant - add the tenant to the default platform url
|
// cloud and multi tenant - add the tenant to the default platform url
|
||||||
|
@ -404,7 +436,7 @@ const getPlatformUrl = async settings => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return platformUrl ? platformUrl : "http://localhost:10000"
|
return platformUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getScopedConfig(db, params) {
|
async function getScopedConfig(db, params) {
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
/**
|
||||||
|
* Makes sure that a URL has the correct number of slashes, while maintaining the
|
||||||
|
* http(s):// double slashes.
|
||||||
|
* @param {string} url The URL to test and remove any extra double slashes.
|
||||||
|
* @return {string} The updated url.
|
||||||
|
*/
|
||||||
|
exports.checkSlashesInUrl = url => {
|
||||||
|
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
|
||||||
|
}
|
|
@ -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.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.13-alpha.1",
|
"@budibase/bbui": "^1.0.14",
|
||||||
"@budibase/client": "^1.0.13-alpha.1",
|
"@budibase/client": "^1.0.14",
|
||||||
"@budibase/colorpicker": "1.1.2",
|
"@budibase/colorpicker": "1.1.2",
|
||||||
"@budibase/string-templates": "^1.0.13-alpha.1",
|
"@budibase/string-templates": "^1.0.14",
|
||||||
"@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",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"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": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"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.0.13-alpha.1",
|
"@budibase/bbui": "^1.0.14",
|
||||||
"@budibase/standard-components": "^0.9.139",
|
"@budibase/standard-components": "^0.9.139",
|
||||||
"@budibase/string-templates": "^1.0.13-alpha.1",
|
"@budibase/string-templates": "^1.0.14",
|
||||||
"regexparam": "^1.3.0",
|
"regexparam": "^1.3.0",
|
||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"svelte-spa-router": "^3.0.5"
|
"svelte-spa-router": "^3.0.5"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -70,9 +70,9 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/swagger-parser": "^10.0.3",
|
"@apidevtools/swagger-parser": "^10.0.3",
|
||||||
"@budibase/auth": "^1.0.13-alpha.1",
|
"@budibase/auth": "^1.0.14",
|
||||||
"@budibase/client": "^1.0.13-alpha.1",
|
"@budibase/client": "^1.0.14",
|
||||||
"@budibase/string-templates": "^1.0.13-alpha.1",
|
"@budibase/string-templates": "^1.0.14",
|
||||||
"@bull-board/api": "^3.7.0",
|
"@bull-board/api": "^3.7.0",
|
||||||
"@bull-board/koa": "^3.7.0",
|
"@bull-board/koa": "^3.7.0",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"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",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.13-alpha.1",
|
"version": "1.0.14",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -29,8 +29,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/auth": "^1.0.13-alpha.1",
|
"@budibase/auth": "^1.0.14",
|
||||||
"@budibase/string-templates": "^1.0.13-alpha.1",
|
"@budibase/string-templates": "^1.0.14",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@sentry/node": "^6.0.0",
|
"@sentry/node": "^6.0.0",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
|
|
Loading…
Reference in New Issue