Merge branch 'develop' of github.com:Budibase/budibase into feature/real-rich-text

This commit is contained in:
Andrew Kingston 2022-02-07 12:13:29 +00:00
commit d78e6a5e59
17 changed files with 84 additions and 72 deletions

View File

@ -1,5 +1,5 @@
{
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"npmClient": "yarn",
"packages": [
"packages/*"

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"description": "Budibase backend core libraries used in server and worker",
"main": "src/index.js",
"author": "Budibase",

View File

@ -146,8 +146,9 @@ exports.getRole = async roleId => {
* Simple function to get all the roles based on the top level user role ID.
*/
async function getAllUserRoles(userRoleId) {
if (!userRoleId) {
return [BUILTIN_IDS.BASIC]
// admins have access to all roles
if (userRoleId === BUILTIN_IDS.ADMIN) {
return exports.getAllRoles()
}
let currentRole = await exports.getRole(userRoleId)
let roles = currentRole ? [currentRole] : []

View File

@ -256,7 +256,7 @@ exports.saveUser = async (
exports.platformLogout = async ({ ctx, userId, keepActiveSession }) => {
if (!ctx) throw new Error("Koa context must be supplied to logout.")
const currentSession = this.getCookie(ctx, Cookies.Auth)
const currentSession = exports.getCookie(ctx, Cookies.Auth)
let sessions = await getUserSessions(userId)
if (keepActiveSession) {
@ -265,8 +265,8 @@ exports.platformLogout = async ({ ctx, userId, keepActiveSession }) => {
)
} else {
// clear cookies
this.clearCookie(ctx, Cookies.Auth)
this.clearCookie(ctx, Cookies.CurrentApp)
exports.clearCookie(ctx, Cookies.Auth)
exports.clearCookie(ctx, Cookies.CurrentApp)
}
await invalidateSessions(

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"license": "MPL-2.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -66,10 +66,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^1.0.49-alpha.12",
"@budibase/client": "^1.0.49-alpha.12",
"@budibase/bbui": "^1.0.49-alpha.14",
"@budibase/client": "^1.0.49-alpha.14",
"@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^1.0.49-alpha.12",
"@budibase/string-templates": "^1.0.49-alpha.14",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -25,7 +25,7 @@
return base
}
const currentTable = $tables.list.find(table => table._id === ds.tableId)
return getFields(base, { allowLinks: currentTable.sql }).map(
return getFields(base, { allowLinks: currentTable?.sql }).map(
field => field.name
)
}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"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.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"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.12",
"@budibase/bbui": "^1.0.49-alpha.14",
"@budibase/standard-components": "^0.9.139",
"@budibase/string-templates": "^1.0.49-alpha.12",
"@budibase/string-templates": "^1.0.49-alpha.14",
"regexparam": "^1.3.0",
"rollup-plugin-polyfill-node": "^0.8.0",
"shortid": "^2.2.15",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"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.12",
"@budibase/client": "^1.0.49-alpha.12",
"@budibase/string-templates": "^1.0.49-alpha.12",
"@budibase/backend-core": "^1.0.49-alpha.14",
"@budibase/client": "^1.0.49-alpha.14",
"@budibase/string-templates": "^1.0.49-alpha.14",
"@bull-board/api": "^3.7.0",
"@bull-board/koa": "^3.7.0",
"@elastic/elasticsearch": "7.10.0",

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/mssql/server
FROM mcr.microsoft.com/mssql/server:2017-latest
ENV ACCEPT_EULA=Y
ENV SA_PASSWORD=Passw0rd

View File

@ -48,7 +48,20 @@ INSERT tasks
VALUES
('Processing', 1);
INSERT people
(name, age)
VALUES
('Bob', '30');
INSERT INTO people (name, age)
VALUES ('Bob', '30'),
('Bert', '10'),
('Jack', '12'),
('Mike', '31'),
('Dave', '44'),
('Jim', '43'),
('Kerry', '32'),
('Julie', '12'),
('Kim', '55'),
('Andy', '33'),
('John', '22'),
('Ruth', '66'),
('Robert', '88'),
('Bobert', '99'),
('Jan', '22'),
('Megan', '11');

View File

@ -16,7 +16,7 @@ const { clientLibraryPath } = require("../../../utilities")
const { upload } = require("../../../utilities/fileSystem")
const { attachmentsRelativeURL } = require("../../../utilities")
const { DocumentTypes } = require("../../../db/utils")
const { getAppDB } = require("@budibase/backend-core/context")
const { getAppDB, updateAppId } = require("@budibase/backend-core/context")
const AWS = require("aws-sdk")
const AWS_REGION = env.AWS_REGION ? env.AWS_REGION : "eu-west-1"
@ -49,11 +49,9 @@ async function getAppIdFromUrl(ctx) {
a => a.url && a.url.toLowerCase() === possibleAppUrl
)[0]
if (app && app.appId) {
return app.appId
} else {
return ctx.params.appId
}
const appId = app && app.appId ? app.appId : ctx.params.appId
updateAppId(appId)
return appId
}
exports.serveBuilder = async function (ctx) {

View File

@ -14,7 +14,7 @@ const {
dbExists,
} = require("@budibase/backend-core/db")
const { UserStatus } = require("@budibase/backend-core/constants")
const { getAppDB } = require("@budibase/backend-core/context")
const { getAppDB, doInAppContext } = require("@budibase/backend-core/context")
async function rawMetadata() {
const db = getAppDB()
@ -105,34 +105,36 @@ exports.syncUser = async function (ctx) {
if (!(await dbExists(appId))) {
continue
}
const db = getAppDB()
const metadataId = generateUserMetadataID(userId)
let metadata
try {
metadata = await db.get(metadataId)
} catch (err) {
if (deleting) {
continue
}
metadata = {
tableId: InternalTables.USER_METADATA,
}
}
// assign the roleId for the metadata doc
if (roleId) {
metadata.roleId = roleId
}
let combined = !deleting
? combineMetadataAndUser(user, metadata)
: {
...metadata,
status: UserStatus.INACTIVE,
metadata: BUILTIN_ROLE_IDS.PUBLIC,
await doInAppContext(appId, async () => {
const db = getAppDB()
const metadataId = generateUserMetadataID(userId)
let metadata
try {
metadata = await db.get(metadataId)
} catch (err) {
if (deleting) {
return
}
// if its null then there was no updates required
if (combined) {
await db.put(combined)
}
metadata = {
tableId: InternalTables.USER_METADATA,
}
}
// assign the roleId for the metadata doc
if (roleId) {
metadata.roleId = roleId
}
let combined = !deleting
? combineMetadataAndUser(user, metadata)
: {
...metadata,
status: UserStatus.INACTIVE,
metadata: BUILTIN_ROLE_IDS.PUBLIC,
}
// if its null then there was no updates required
if (combined) {
await db.put(combined)
}
})
}
}
ctx.body = {

View File

@ -166,15 +166,13 @@ class InternalBuilder {
addSorting(query: KnexQuery, json: QueryJson): KnexQuery {
let { sort, paginate } = json
if (!sort) {
return query
}
const table = json.meta?.table
for (let [key, value] of Object.entries(sort)) {
const direction = value === SortDirection.ASCENDING ? "asc" : "desc"
query = query.orderBy(`${table?.name}.${key}`, direction)
}
if (this.client === SqlClients.MS_SQL && !sort && paginate?.limit) {
if (sort) {
for (let [key, value] of Object.entries(sort)) {
const direction = value === SortDirection.ASCENDING ? "asc" : "desc"
query = query.orderBy(`${table?.name}.${key}`, direction)
}
} else if (this.client === SqlClients.MS_SQL && paginate?.limit) {
// @ts-ignore
query = query.orderBy(`${table?.name}.${table?.primary[0]}`)
}

View File

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

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "1.0.49-alpha.12",
"version": "1.0.49-alpha.14",
"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.12",
"@budibase/string-templates": "^1.0.49-alpha.12",
"@budibase/backend-core": "^1.0.49-alpha.14",
"@budibase/string-templates": "^1.0.49-alpha.14",
"@koa/router": "^8.0.0",
"@sentry/node": "^6.0.0",
"@techpass/passport-openidconnect": "^0.3.0",