Merge branch 'master' into bug/sev3/edit-column-modal-state

This commit is contained in:
Mel O'Hagan 2022-10-12 10:23:17 +01:00
commit 91ec23faf2
25 changed files with 155 additions and 125 deletions

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/backend-core",
"version": "2.0.22",
"version": "2.0.29",
"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": "^2.0.22",
"@budibase/types": "^2.0.29",
"@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0",

View File

@ -214,6 +214,34 @@ export = class RedisWrapper {
}
}
async bulkGet(keys: string[]) {
const db = this._db
if (keys.length === 0) {
return {}
}
const prefixedKeys = keys.map(key => addDbPrefix(db, key))
let response = await this.getClient().mget(prefixedKeys)
if (Array.isArray(response)) {
let final: any = {}
let count = 0
for (let result of response) {
if (result) {
let parsed
try {
parsed = JSON.parse(result)
} catch (err) {
parsed = result
}
final[keys[count]] = parsed
}
count++
}
return final
} else {
throw new Error(`Invalid response: ${response}`)
}
}
async store(key: string, value: any, expirySeconds: number | null = null) {
const db = this._db
if (typeof value === "object") {

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "2.0.22",
"version": "2.0.29",
"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": "^2.0.22",
"@budibase/string-templates": "^2.0.29",
"@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": "2.0.22",
"version": "2.0.29",
"license": "GPL-3.0",
"private": true,
"scripts": {
@ -71,10 +71,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^2.0.22",
"@budibase/client": "^2.0.22",
"@budibase/frontend-core": "^2.0.22",
"@budibase/string-templates": "^2.0.22",
"@budibase/bbui": "^2.0.29",
"@budibase/client": "^2.0.29",
"@budibase/frontend-core": "^2.0.29",
"@budibase/string-templates": "^2.0.29",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View File

@ -17,12 +17,21 @@
$: selectedRoleId = selectedRole._id
$: otherRoles = editableRoles.filter(role => role._id !== selectedRoleId)
$: isCreating = selectedRoleId == null || selectedRoleId === ""
$: hasUniqueRoleName = !otherRoles
?.map(role => role.name)
?.includes(selectedRole.name)
$: valid =
selectedRole.name &&
selectedRole.inherits &&
selectedRole.permissionId &&
!builtInRoles.includes(selectedRole.name)
$: shouldDisableRoleInput =
builtInRoles.includes(selectedRole.name) &&
selectedRole.name?.toLowerCase() === selectedRoleId?.toLowerCase()
const fetchBasePermissions = async () => {
try {
basePermissions = await API.getBasePermissions()
@ -99,7 +108,7 @@
title="Edit Roles"
confirmText={isCreating ? "Create" : "Save"}
onConfirm={saveRole}
disabled={!valid}
disabled={!valid || !hasUniqueRoleName}
>
{#if errors.length}
<ErrorsBox {errors} />
@ -119,15 +128,16 @@
<Input
label="Name"
bind:value={selectedRole.name}
disabled={builtInRoles.includes(selectedRole.name)}
disabled={shouldDisableRoleInput}
error={!hasUniqueRoleName ? "Select a unique role name." : null}
/>
<Select
label="Inherits Role"
bind:value={selectedRole.inherits}
options={otherRoles}
options={selectedRole._id === "BASIC" ? $roles : otherRoles}
getOptionValue={role => role._id}
getOptionLabel={role => role.name}
disabled={builtInRoles.includes(selectedRole.name)}
disabled={shouldDisableRoleInput}
/>
<Select
label="Base Permissions"
@ -135,11 +145,11 @@
options={basePermissions}
getOptionValue={x => x._id}
getOptionLabel={x => x.name}
disabled={builtInRoles.includes(selectedRole.name)}
disabled={shouldDisableRoleInput}
/>
{/if}
<div slot="footer">
{#if !isCreating}
{#if !isCreating && !builtInRoles.includes(selectedRole.name)}
<Button warning on:click={deleteRole}>Delete</Button>
{/if}
</div>

View File

@ -209,27 +209,29 @@
{:else}
<Body size="S"><i>No tables found.</i></Body>
{/if}
<Divider />
<div class="query-header">
<Heading size="S">Relationships</Heading>
<Button primary on:click={() => openRelationshipModal()}>
Define relationship
</Button>
</div>
<Body>
Tell budibase how your tables are related to get even more smart features.
</Body>
{#if relationshipInfo && relationshipInfo.length > 0}
<Table
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
schema={relationshipSchema}
data={relationshipInfo}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
/>
{:else}
<Body size="S"><i>No relationships configured.</i></Body>
{#if integration.relationships !== false}
<Divider />
<div class="query-header">
<Heading size="S">Relationships</Heading>
<Button primary on:click={() => openRelationshipModal()}>
Define relationship
</Button>
</div>
<Body>
Tell budibase how your tables are related to get even more smart features.
</Body>
{#if relationshipInfo && relationshipInfo.length > 0}
<Table
on:click={({ detail }) => openRelationshipModal(detail.from, detail.to)}
schema={relationshipSchema}
data={relationshipInfo}
allowEditColumns={false}
allowEditRows={false}
allowSelectRows={false}
/>
{:else}
<Body size="S"><i>No relationships configured.</i></Body>
{/if}
{/if}
<style>

View File

@ -156,8 +156,8 @@
page={$usersFetch.pageNumber + 1}
hasPrevPage={$usersFetch.hasPrevPage}
hasNextPage={$usersFetch.hasNextPage}
goToPrevPage={$usersFetch.loading ? null : fetch.prevPage}
goToNextPage={$usersFetch.loading ? null : fetch.nextPage}
goToPrevPage={$usersFetch.loading ? null : usersFetch.prevPage}
goToNextPage={$usersFetch.loading ? null : usersFetch.nextPage}
/>
</div>
</div>

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "2.0.22",
"version": "2.0.29",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {
@ -26,9 +26,9 @@
"outputPath": "build"
},
"dependencies": {
"@budibase/backend-core": "^2.0.22",
"@budibase/string-templates": "^2.0.22",
"@budibase/types": "^2.0.22",
"@budibase/backend-core": "^2.0.29",
"@budibase/string-templates": "^2.0.29",
"@budibase/types": "^2.0.29",
"axios": "0.21.2",
"chalk": "4.1.0",
"cli-progress": "3.11.2",

View File

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

View File

@ -47,6 +47,9 @@ const createBuilderStore = () => {
duplicateComponent: id => {
dispatchEvent("duplicate-component", { id })
},
deleteComponent: id => {
dispatchEvent("delete-component", { id })
},
notifyLoaded: () => {
dispatchEvent("preview-loaded")
},

View File

@ -1,12 +1,12 @@
{
"name": "@budibase/frontend-core",
"version": "2.0.22",
"version": "2.0.29",
"description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase",
"license": "MPL-2.0",
"svelte": "src/index.js",
"dependencies": {
"@budibase/bbui": "^2.0.22",
"@budibase/bbui": "^2.0.29",
"lodash": "^4.17.21",
"svelte": "^3.46.2"
}

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/sdk",
"version": "2.0.22",
"version": "2.0.29",
"description": "Budibase Public API SDK",
"author": "Budibase",
"license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "2.0.22",
"version": "2.0.29",
"description": "Budibase Web Server",
"main": "src/index.ts",
"repository": {
@ -77,11 +77,11 @@
"license": "GPL-3.0",
"dependencies": {
"@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "^2.0.22",
"@budibase/client": "^2.0.22",
"@budibase/pro": "2.0.22",
"@budibase/string-templates": "^2.0.22",
"@budibase/types": "^2.0.22",
"@budibase/backend-core": "^2.0.29",
"@budibase/client": "^2.0.29",
"@budibase/pro": "2.0.29",
"@budibase/string-templates": "^2.0.29",
"@budibase/types": "^2.0.29",
"@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0",

View File

@ -32,7 +32,7 @@ const {
import { USERS_TABLE_SCHEMA } from "../../constants"
import { removeAppFromUserRoles } from "../../utilities/workerRequests"
import { clientLibraryPath, stringToReadStream } from "../../utilities"
import { getAllLocks } from "../../utilities/redis"
import { getLocksById } from "../../utilities/redis"
import {
updateClientLibrary,
backupClientLibrary,
@ -45,11 +45,10 @@ import { cleanupAutomations } from "../../automations/utils"
import { context } from "@budibase/backend-core"
import { checkAppMetadata } from "../../automations/logging"
import { getUniqueRows } from "../../utilities/usageQuota/rows"
import { quotas } from "@budibase/pro"
import { quotas, groups } from "@budibase/pro"
import { errors, events, migrations } from "@budibase/backend-core"
import { App, Layout, Screen, MigrationType } from "@budibase/types"
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
import { groups } from "@budibase/pro"
import { enrichPluginURLs } from "../../utilities/plugins"
const URL_REGEX_SLASH = /\/|\\/g
@ -172,16 +171,16 @@ export const fetch = async (ctx: any) => {
const all = ctx.query && ctx.query.status === AppStatus.ALL
const apps = await getAllApps({ dev, all })
const appIds = apps
.filter((app: any) => app.status === "development")
.map((app: any) => app.appId)
// get the locks for all the dev apps
if (dev || all) {
const locks = await getAllLocks()
const locks = await getLocksById(appIds)
for (let app of apps) {
if (app.status !== "development") {
continue
}
const lock = locks.find((lock: any) => lock.appId === app.appId)
const lock = locks[app.appId]
if (lock) {
app.lockedBy = lock.user
app.lockedBy = lock
} else {
// make sure its definitely not present
delete app.lockedBy

View File

@ -1,17 +1,9 @@
const { getDefinitions } = require("../../integrations")
const { SourceName } = require("@budibase/types")
const googlesheets = require("../../integrations/googlesheets")
const { featureFlags } = require("@budibase/backend-core")
exports.fetch = async function (ctx) {
ctx.status = 200
const defs = await getDefinitions()
// for google sheets integration google verification
if (featureFlags.isEnabled(featureFlags.TenantFeatureFlag.GOOGLE_SHEETS)) {
defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema
}
ctx.body = defs
}

View File

@ -1,7 +1,7 @@
jest.mock("../../../utilities/redis", () => ({
init: jest.fn(),
getAllLocks: () => {
return []
getLocksById: () => {
return {}
},
doesUserHaveLock: () => {
return true

View File

@ -33,6 +33,7 @@ const DEFINITIONS: { [key: string]: Integration } = {
[SourceName.ARANGODB]: arangodb.schema,
[SourceName.REST]: rest.schema,
[SourceName.FIRESTORE]: firebase.schema,
[SourceName.GOOGLE_SHEETS]: googlesheets.schema,
[SourceName.REDIS]: redis.schema,
[SourceName.SNOWFLAKE]: snowflake.schema,
}
@ -66,10 +67,6 @@ if (
INTEGRATIONS[SourceName.ORACLE] = oracle.integration
}
if (environment.SELF_HOSTED) {
DEFINITIONS[SourceName.GOOGLE_SHEETS] = googlesheets.schema
}
module.exports = {
getDefinitions: async () => {
const pluginSchemas: { [key: string]: Integration } = {}

View File

@ -34,12 +34,8 @@ exports.doesUserHaveLock = async (devAppId, user) => {
return expected === userId
}
exports.getAllLocks = async () => {
const locks = await devAppClient.scan()
return locks.map(lock => ({
appId: lock.key,
user: lock.value,
}))
exports.getLocksById = async appIds => {
return await devAppClient.bulkGet(appIds)
}
exports.updateLock = async (devAppId, user) => {

View File

@ -7,14 +7,17 @@ const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
exports.getFullUser = async (ctx, userId) => {
const global = await getGlobalUser(userId)
let metadata = {}
// always prefer the user metadata _id and _rev
delete global._id
delete global._rev
try {
// this will throw an error if the db doesn't exist, or there is no appId
const db = getAppDB()
metadata = await db.get(userId)
} catch (err) {
// it is fine if there is no user metadata, just remove global db info
delete global._id
delete global._rev
// it is fine if there is no user metadata yet
}
delete metadata.csrfToken
return {

View File

@ -1094,12 +1094,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.22.tgz#857c6928c08e1a0307afac4e605e360f3ce91c97"
integrity sha512-X6n/UdOR+AnBVfmLy7YUT1uDGy8VPEz5em0jjVRPflxnJcZ5x59YXLBTROkK6PqWsgqheCkrP1Jev7rxCVCTow==
"@budibase/backend-core@2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.29.tgz#d5856d49d8cc64790961631dfe0fface7f7be4e4"
integrity sha512-05mnl6YcucWrO1X6bVBYG6r7Yig/fIHbokLRfEvFFrZNe/EcRB3iLeOG1+2190dv5TbO/jhabS3kcrbDs54HHw==
dependencies:
"@budibase/types" "^2.0.22"
"@budibase/types" "^2.0.29"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -1180,13 +1180,13 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
"@budibase/pro@2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.22.tgz#950c541a4eb858ca41e31e691bcbd388cc2523d6"
integrity sha512-4GepvO+fjuAyKH/e6m751x/UMCOPBIx+OXZ63AS8NfHvXYhxPxODsYC+rK0zuDvYEmtVNJnTYSLLmiYKXfSShw==
"@budibase/pro@2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.29.tgz#169055bc39894f90341226fbff4a1601418d0b42"
integrity sha512-ELBoQ7/MXlgatCJNvTNXgF7DK02pfYx5Yy1s/2BJr4iGe26+5Q65ztiC7Jp+d/owese+f5kqKJRNuU1KINUfjQ==
dependencies:
"@budibase/backend-core" "2.0.22"
"@budibase/types" "2.0.22"
"@budibase/backend-core" "2.0.29"
"@budibase/types" "2.0.29"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
@ -1209,10 +1209,10 @@
svelte-apexcharts "^1.0.2"
svelte-flatpickr "^3.1.0"
"@budibase/types@2.0.22", "@budibase/types@^2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.22.tgz#c17d518294f1d53ad3251e659b5bd689f50914b0"
integrity sha512-qtNFWYbbdGQzmelkBO/22Xc1nug7m8C5D+ugwItV6J+qYJqcFAUPxjfTILYfICDDGiF3g9waA6+Y/JnFn9ujZg==
"@budibase/types@2.0.29", "@budibase/types@^2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.29.tgz#8b27f695aded7ad7523c4943deb556eadfb66c3c"
integrity sha512-wwpHgDwKff2UhNmKAdrzIxmDQ/crY77AZdFyWNpPvrHYIetyh2Kp5ikEKyZlYHTEpS2IPDE8EKn4coDeu+mGlQ==
"@bull-board/api@3.7.0":
version "3.7.0"

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@budibase/types",
"version": "2.0.22",
"version": "2.0.29",
"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": "2.0.22",
"version": "2.0.29",
"description": "Budibase background service",
"main": "src/index.ts",
"repository": {
@ -36,10 +36,10 @@
"author": "Budibase",
"license": "GPL-3.0",
"dependencies": {
"@budibase/backend-core": "^2.0.22",
"@budibase/pro": "2.0.22",
"@budibase/string-templates": "^2.0.22",
"@budibase/types": "^2.0.22",
"@budibase/backend-core": "^2.0.29",
"@budibase/pro": "2.0.29",
"@budibase/string-templates": "^2.0.29",
"@budibase/types": "^2.0.29",
"@koa/router": "8.0.8",
"@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2",

View File

@ -291,12 +291,12 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
"@budibase/backend-core@2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.22.tgz#857c6928c08e1a0307afac4e605e360f3ce91c97"
integrity sha512-X6n/UdOR+AnBVfmLy7YUT1uDGy8VPEz5em0jjVRPflxnJcZ5x59YXLBTROkK6PqWsgqheCkrP1Jev7rxCVCTow==
"@budibase/backend-core@2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.29.tgz#d5856d49d8cc64790961631dfe0fface7f7be4e4"
integrity sha512-05mnl6YcucWrO1X6bVBYG6r7Yig/fIHbokLRfEvFFrZNe/EcRB3iLeOG1+2190dv5TbO/jhabS3kcrbDs54HHw==
dependencies:
"@budibase/types" "^2.0.22"
"@budibase/types" "^2.0.29"
"@shopify/jest-koa-mocks" "5.0.1"
"@techpass/passport-openidconnect" "0.3.2"
aws-sdk "2.1030.0"
@ -327,21 +327,21 @@
uuid "8.3.2"
zlib "1.0.5"
"@budibase/pro@2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.22.tgz#950c541a4eb858ca41e31e691bcbd388cc2523d6"
integrity sha512-4GepvO+fjuAyKH/e6m751x/UMCOPBIx+OXZ63AS8NfHvXYhxPxODsYC+rK0zuDvYEmtVNJnTYSLLmiYKXfSShw==
"@budibase/pro@2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.29.tgz#169055bc39894f90341226fbff4a1601418d0b42"
integrity sha512-ELBoQ7/MXlgatCJNvTNXgF7DK02pfYx5Yy1s/2BJr4iGe26+5Q65ztiC7Jp+d/owese+f5kqKJRNuU1KINUfjQ==
dependencies:
"@budibase/backend-core" "2.0.22"
"@budibase/types" "2.0.22"
"@budibase/backend-core" "2.0.29"
"@budibase/types" "2.0.29"
"@koa/router" "8.0.8"
joi "17.6.0"
node-fetch "^2.6.1"
"@budibase/types@2.0.22", "@budibase/types@^2.0.22":
version "2.0.22"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.22.tgz#c17d518294f1d53ad3251e659b5bd689f50914b0"
integrity sha512-qtNFWYbbdGQzmelkBO/22Xc1nug7m8C5D+ugwItV6J+qYJqcFAUPxjfTILYfICDDGiF3g9waA6+Y/JnFn9ujZg==
"@budibase/types@2.0.29", "@budibase/types@^2.0.29":
version "2.0.29"
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.29.tgz#8b27f695aded7ad7523c4943deb556eadfb66c3c"
integrity sha512-wwpHgDwKff2UhNmKAdrzIxmDQ/crY77AZdFyWNpPvrHYIetyh2Kp5ikEKyZlYHTEpS2IPDE8EKn4coDeu+mGlQ==
"@cspotcode/source-map-consumer@0.8.0":
version "0.8.0"