From accdfd9b9eacc51a7abf7b3a7438709d8b9a71bb Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 30 Aug 2022 10:49:19 +0100 Subject: [PATCH 001/127] add plugins ui --- packages/bbui/src/Modal/ModalContent.svelte | 5 +- .../src/pages/builder/portal/_layout.svelte | 2 + .../plugins/_components/AddPluginModal.svelte | 122 ++++++++++++++++++ .../plugins/_components/PluginRow.svelte | 81 ++++++++++++ .../portal/manage/plugins/index.svelte | 94 ++++++++++++++ packages/builder/src/stores/portal/index.js | 1 + packages/builder/src/stores/portal/plugins.js | 47 +++++++ packages/frontend-core/src/api/plugins.js | 17 ++- packages/server/src/api/controllers/plugin.ts | 14 +- packages/server/src/api/routes/plugin.ts | 4 +- 10 files changed, 377 insertions(+), 10 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte create mode 100644 packages/builder/src/pages/builder/portal/manage/plugins/index.svelte create mode 100644 packages/builder/src/stores/portal/plugins.js diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index 6d609d6f1b..4c70f2390a 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -24,7 +24,7 @@ export let secondaryAction = undefined export let secondaryButtonWarning = false export let dataCy = null - + export let buttonCta = true const { hide, cancel } = getContext(Context.Modal) let loading = false $: confirmDisabled = disabled || loading @@ -93,7 +93,6 @@ class="spectrum-ButtonGroup spectrum-Dialog-buttonGroup spectrum-Dialog-buttonGroup--noFooter" > - {#if showSecondaryButton && secondaryButtonText && secondaryAction}
+
+
+
+ @@ -61,7 +98,7 @@
- +
{#each authOptions[sourceValue] as option} {#if option === "Upload"} @@ -82,7 +119,7 @@ {:else}
- +
{/if} {/each} diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index 6a1d7cc2cb..531ac1c396 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -17,6 +17,41 @@ export function createPluginsStore() { }) } + async function createPlugin(type, source, name, url, auth) { + let pluginData = { + type, + source, + name, + url, + } + + switch (source) { + case "github": + pluginData.githubToken = auth + break + case "url": + pluginData.header = auth + break + case "npm": + pluginData.npmToken = auth + break + } + + let resp = await API.createPlugin(pluginData) + console.log(resp) + // TODO_RIC + // let newPlugin = resp.plugins[0] + // update(state => { + // const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id) + // if (currentIdx >= 0) { + // state.splice(currentIdx, 1, newPlugin) + // } else { + // state.push(newPlugin) + // } + // return state + // }) + } + async function uploadPlugin(file, source) { let data = new FormData() data.append("file", file) @@ -35,6 +70,7 @@ export function createPluginsStore() { return { subscribe, load, + createPlugin, deletePlugin, uploadPlugin, } diff --git a/packages/frontend-core/src/api/plugins.js b/packages/frontend-core/src/api/plugins.js index 108e1b50a7..484cf763bb 100644 --- a/packages/frontend-core/src/api/plugins.js +++ b/packages/frontend-core/src/api/plugins.js @@ -11,6 +11,16 @@ export const buildPluginEndpoints = API => ({ }) }, + /** + * Creates a plugin from URL, Github or NPM + */ + createPlugin: async data => { + return await API.post({ + url: `/api/plugin`, + body: data, + }) + }, + /** * Gets a list of all plugins */ diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index e8a2dd1746..b6d3d31354 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -1,5 +1,9 @@ import { ObjectStoreBuckets } from "../../constants" -import { extractPluginTarball } from "../../utilities/fileSystem" +import { + extractPluginTarball, + npmPlugin, + getPluginMetadata, +} from "../../utilities/fileSystem" import { getGlobalDB } from "@budibase/backend-core/tenancy" import { generatePluginID, getPluginParams } from "../../db/utils" import { uploadDirectory } from "@budibase/backend-core/objectStore" @@ -39,10 +43,48 @@ export async function upload(ctx: any) { } } catch (err: any) { const errMsg = err?.message ? err?.message : err + ctx.throw(400, `Failed to import plugin: ${errMsg}`) } } +export async function create(ctx: any) { + const { type, source, name, url, header, githubToken, npmToken } = + ctx.request.body + let metadata + let directory + + switch (source) { + case "npm": + // const { metadata: metadataNpm, directory: directoryNpm } = await npmPlugin(url, name) + // metadata = metadataNpm + // directory = directoryNpm + + console.log(22222, await getPluginMetadata(await npmPlugin(url, name))) + break + case "github": + console.log("github") + break + case "url": + console.log("url") + break + } + + // try { + // const doc = storePlugin(metadata, directory, source) + // + // ctx.body = { + // message: "Plugin uploaded successfully", + // plugins: doc, + // } + // } catch (err: any) { + // const errMsg = err?.message ? err?.message : err + // + // ctx.throw(400, `Failed to import plugin: ${errMsg}`) + // } + ctx.status = 200 +} + export async function fetch(ctx: any) { ctx.body = await getPlugins() } @@ -54,9 +96,12 @@ export async function destroy(ctx: any) { ctx.status = 200 } -export async function processPlugin(plugin: FileType, source?: string) { +export async function storePlugin( + metadata: any, + directory: any, + source?: string +) { const db = getGlobalDB() - const { metadata, directory } = await extractPluginTarball(plugin) const version = metadata.package.version, name = metadata.package.name, description = metadata.package.description @@ -99,3 +144,8 @@ export async function processPlugin(plugin: FileType, source?: string) { _rev: response.rev, } } + +export async function processPlugin(plugin: FileType, source?: string) { + const { metadata, directory } = await extractPluginTarball(plugin) + return await storePlugin(metadata, directory, source) +} diff --git a/packages/server/src/api/routes/plugin.ts b/packages/server/src/api/routes/plugin.ts index 1ca49cf300..2508115a29 100644 --- a/packages/server/src/api/routes/plugin.ts +++ b/packages/server/src/api/routes/plugin.ts @@ -7,6 +7,7 @@ const router = new Router() router .post("/api/plugin/upload/:source", authorized(BUILDER), controller.upload) + .post("/api/plugin", authorized(BUILDER), controller.create) .get("/api/plugin", authorized(BUILDER), controller.fetch) .delete( "/api/plugin/:pluginId/:pluginRev", diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 821e905fbc..9c70edf8a6 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -1,6 +1,9 @@ const { budibaseTempDir } = require("../budibaseDir") const fs = require("fs") const { join } = require("path") +// const { promisify } = require("util") +// const exec = promisify(require("child_process").exec) +// const streamPipeline = promisify(require("stream")) const uuid = require("uuid/v4") const { doWithDB, @@ -29,6 +32,7 @@ const MemoryStream = require("memorystream") const { getAppId } = require("@budibase/backend-core/context") const tar = require("tar") const fetch = require("node-fetch") +// const fileType = require("file-type") const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") @@ -326,11 +330,11 @@ exports.cleanup = appIds => { } } -exports.extractPluginTarball = async file => { - if (!file.name.endsWith(".tar.gz")) { +const extractPluginTarball = async (file, ext = ".tar.gz") => { + if (!file.name.endsWith(ext)) { throw new Error("Plugin must be compressed into a gzipped tarball.") } - const path = join(budibaseTempDir(), file.name.split(".tar.gz")[0]) + const path = join(budibaseTempDir(), file.name.split(ext)[0]) // remove old tmp directories automatically - don't combine if (fs.existsSync(path)) { fs.rmSync(path, { recursive: true, force: true }) @@ -340,6 +344,63 @@ exports.extractPluginTarball = async file => { file: file.path, C: path, }) + + return await getPluginMetadata(path) +} +exports.extractPluginTarball = extractPluginTarball + +exports.npmPlugin = async (url, name = "") => { + let npmTarball = url + let filename = name + let path = join(budibaseTempDir(), name) + + if (!npmTarball.includes(".tgz")) { + const npmPackageURl = url.replace( + "https://www.npmjs.com/package/", + "https://registry.npmjs.org/" + ) + const response = await fetch(npmPackageURl) + if (response.status === 200) { + let npmDetails = await response.json() + filename = npmDetails.name + path = join(budibaseTempDir(), filename) + const npmVersion = npmDetails["dist-tags"].latest + npmTarball = npmDetails.versions[npmVersion].dist.tarball + } else { + throw "Cannot get package details" + } + } + + try { + if (fs.existsSync(path)) { + fs.rmSync(path, { recursive: true, force: true }) + } + fs.mkdirSync(path) + + const response = await fetch(npmTarball) + if (!response.ok) + throw new Error(`Loading NPM plugin failed ${response.statusText}`) + + // const dest = fs.createWriteStream(`${path}/${filename}.tgz`) + await response.body.pipe( + await tar.x({ + strip: 1, + C: path, + }) + ) + + // const readStream = fs.createReadStream(`${path}/${filename}.tgz`) + // readStream.pipe( + + // ) + } catch (e) { + throw `Cannot store package locally: ${e.message}` + } + + return path +} + +const getPluginMetadata = async path => { let metadata = {} try { const pkg = fs.readFileSync(join(path, "package.json"), "utf8") @@ -349,8 +410,10 @@ exports.extractPluginTarball = async file => { } catch (err) { throw new Error("Unable to process schema.json/package.json in plugin.") } + return { metadata, directory: path } } +exports.getPluginMetadata = getPluginMetadata exports.getDatasourcePlugin = async (name, url, hash) => { if (!fs.existsSync(DATASOURCE_PATH)) { From ac33190ff0c4104d1214f0856acc6ad657d184e7 Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Wed, 31 Aug 2022 16:09:47 +0100 Subject: [PATCH 004/127] uploading npm and url plugins --- .../plugins/_components/AddPluginModal.svelte | 16 ++---- packages/builder/src/stores/portal/plugins.js | 11 ++--- packages/server/src/api/controllers/plugin.ts | 45 ++++++++--------- .../server/src/utilities/fileSystem/index.js | 49 +++++++++++-------- 4 files changed, 60 insertions(+), 61 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte index e45655d20d..1fce6746ad 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte @@ -11,10 +11,10 @@ import { plugins } from "stores/portal" let authOptions = { - NPM: ["NPM Token", "URL"], + NPM: ["URL"], Github: ["Github Token", "URL"], - URL: ["Header", "URL"], - File: ["Path", "Header"], + URL: ["Headers", "URL"], + File: ["Path", "Headers"], Upload: ["Upload"], } let file @@ -50,17 +50,11 @@ source, nameValue, url, - dynamicValues["Header"] + dynamicValues["Headers"] ) break case "npm": - await plugins.createPlugin( - typeValue, - source, - nameValue, - url, - dynamicValues["NPM Token"] - ) + await plugins.createPlugin(typeValue, source, nameValue, url) break } } diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index 531ac1c396..4e3d952fe3 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -17,7 +17,7 @@ export function createPluginsStore() { }) } - async function createPlugin(type, source, name, url, auth) { + async function createPlugin(type, source, name, url, auth = null) { let pluginData = { type, source, @@ -26,19 +26,16 @@ export function createPluginsStore() { } switch (source) { - case "github": - pluginData.githubToken = auth - break case "url": - pluginData.header = auth + pluginData.headers = auth break case "npm": pluginData.npmToken = auth break } - let resp = await API.createPlugin(pluginData) - console.log(resp) + let res = await API.createPlugin(pluginData) + console.log("RESP", res) // TODO_RIC // let newPlugin = resp.plugins[0] // update(state => { diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index b6d3d31354..dc70ea8b62 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -1,8 +1,8 @@ import { ObjectStoreBuckets } from "../../constants" import { extractPluginTarball, - npmPlugin, - getPluginMetadata, + createNpmPlugin, + createUrlPlugin, } from "../../utilities/fileSystem" import { getGlobalDB } from "@budibase/backend-core/tenancy" import { generatePluginID, getPluginParams } from "../../db/utils" @@ -49,39 +49,40 @@ export async function upload(ctx: any) { } export async function create(ctx: any) { - const { type, source, name, url, header, githubToken, npmToken } = - ctx.request.body + const { type, source, name, url, headers, githubToken } = ctx.request.body let metadata let directory switch (source) { case "npm": - // const { metadata: metadataNpm, directory: directoryNpm } = await npmPlugin(url, name) - // metadata = metadataNpm - // directory = directoryNpm - - console.log(22222, await getPluginMetadata(await npmPlugin(url, name))) + const { metadata: metadataNpm, directory: directoryNpm } = + await createNpmPlugin(url, name) + metadata = metadataNpm + directory = directoryNpm break case "github": console.log("github") break case "url": - console.log("url") + const { metadata: metadataUrl, directory: directoryUrl } = + await createUrlPlugin(url, name, headers) + metadata = metadataUrl + directory = directoryUrl break } - // try { - // const doc = storePlugin(metadata, directory, source) - // - // ctx.body = { - // message: "Plugin uploaded successfully", - // plugins: doc, - // } - // } catch (err: any) { - // const errMsg = err?.message ? err?.message : err - // - // ctx.throw(400, `Failed to import plugin: ${errMsg}`) - // } + try { + const doc = storePlugin(metadata, directory, source) + + ctx.body = { + message: "Plugin uploaded successfully", + plugins: doc, + } + } catch (err: any) { + const errMsg = err?.message ? err?.message : err + + ctx.throw(400, `Failed to import plugin: ${errMsg}`) + } ctx.status = 200 } diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 9c70edf8a6..710e3c0294 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -1,9 +1,8 @@ const { budibaseTempDir } = require("../budibaseDir") const fs = require("fs") const { join } = require("path") -// const { promisify } = require("util") -// const exec = promisify(require("child_process").exec) -// const streamPipeline = promisify(require("stream")) +const { promisify } = require("util") +const streamPipeline = promisify(require("stream").pipeline) const uuid = require("uuid/v4") const { doWithDB, @@ -32,7 +31,6 @@ const MemoryStream = require("memorystream") const { getAppId } = require("@budibase/backend-core/context") const tar = require("tar") const fetch = require("node-fetch") -// const fileType = require("file-type") const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") @@ -349,10 +347,9 @@ const extractPluginTarball = async (file, ext = ".tar.gz") => { } exports.extractPluginTarball = extractPluginTarball -exports.npmPlugin = async (url, name = "") => { +exports.createNpmPlugin = async (url, name = "") => { let npmTarball = url - let filename = name - let path = join(budibaseTempDir(), name) + let pluginName = name if (!npmTarball.includes(".tgz")) { const npmPackageURl = url.replace( @@ -362,8 +359,7 @@ exports.npmPlugin = async (url, name = "") => { const response = await fetch(npmPackageURl) if (response.status === 200) { let npmDetails = await response.json() - filename = npmDetails.name - path = join(budibaseTempDir(), filename) + pluginName = npmDetails.name const npmVersion = npmDetails["dist-tags"].latest npmTarball = npmDetails.versions[npmVersion].dist.tarball } else { @@ -371,36 +367,47 @@ exports.npmPlugin = async (url, name = "") => { } } + return await downloadUnzipPlugin(pluginName, npmTarball) +} + +exports.createUrlPlugin = async (url, name = "", headers = {}) => { + if (!url.includes(".tgz") && !url.includes(".tar.gz")) { + throw new Error("Plugin must be compressed into a gzipped tarball.") + } + + return await downloadUnzipPlugin(name, url, headers) +} + +const downloadUnzipPlugin = async (name, url, headers = {}) => { + console.log(name, url, headers) + const path = join(budibaseTempDir(), name) try { + // Remove first if exists if (fs.existsSync(path)) { fs.rmSync(path, { recursive: true, force: true }) } fs.mkdirSync(path) - const response = await fetch(npmTarball) + const response = await fetch(url, { headers }) if (!response.ok) throw new Error(`Loading NPM plugin failed ${response.statusText}`) - // const dest = fs.createWriteStream(`${path}/${filename}.tgz`) - await response.body.pipe( - await tar.x({ + await streamPipeline( + response.body, + tar.x({ strip: 1, C: path, }) ) - - // const readStream = fs.createReadStream(`${path}/${filename}.tgz`) - // readStream.pipe( - - // ) + return await getPluginMetadata(path) } catch (e) { - throw `Cannot store package locally: ${e.message}` + throw `Cannot store plugin locally: ${e.message}` } - - return path } +exports.downloadUnzipPlugin = downloadUnzipPlugin const getPluginMetadata = async path => { + console.log(path) let metadata = {} try { const pkg = fs.readFileSync(join(path, "package.json"), "utf8") From 1c67772973d4faadbc8c2c552d601c11ea52acef Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Wed, 31 Aug 2022 17:53:00 +0100 Subject: [PATCH 005/127] plugins npm and url working --- packages/builder/src/stores/portal/plugins.js | 22 +++++++++---------- packages/server/src/api/controllers/plugin.ts | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index 4e3d952fe3..a498bf663a 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -36,17 +36,17 @@ export function createPluginsStore() { let res = await API.createPlugin(pluginData) console.log("RESP", res) - // TODO_RIC - // let newPlugin = resp.plugins[0] - // update(state => { - // const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id) - // if (currentIdx >= 0) { - // state.splice(currentIdx, 1, newPlugin) - // } else { - // state.push(newPlugin) - // } - // return state - // }) + + let newPlugin = res.plugins[0] + update(state => { + const currentIdx = state.findIndex(plugin => plugin._id === newPlugin._id) + if (currentIdx >= 0) { + state.splice(currentIdx, 1, newPlugin) + } else { + state.push(newPlugin) + } + return state + }) } async function uploadPlugin(file, source) { diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index dc70ea8b62..26caf38806 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -72,11 +72,11 @@ export async function create(ctx: any) { } try { - const doc = storePlugin(metadata, directory, source) + const doc = await storePlugin(metadata, directory, source) ctx.body = { message: "Plugin uploaded successfully", - plugins: doc, + plugins: [doc], } } catch (err: any) { const errMsg = err?.message ? err?.message : err From 4de090b4c661708826909582466b819b16e74136 Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Thu, 1 Sep 2022 20:04:45 +0100 Subject: [PATCH 006/127] create plugin github public and private --- packages/builder/src/stores/portal/plugins.js | 4 +- packages/server/src/api/controllers/plugin.ts | 6 +- .../server/src/utilities/fileSystem/index.js | 65 ++++++++++++++++++- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index a498bf663a..821934307d 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -32,10 +32,12 @@ export function createPluginsStore() { case "npm": pluginData.npmToken = auth break + case "github": + pluginData.githubToken = auth + break } let res = await API.createPlugin(pluginData) - console.log("RESP", res) let newPlugin = res.plugins[0] update(state => { diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index 26caf38806..1159b08dce 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -3,6 +3,7 @@ import { extractPluginTarball, createNpmPlugin, createUrlPlugin, + createGithubPlugin, } from "../../utilities/fileSystem" import { getGlobalDB } from "@budibase/backend-core/tenancy" import { generatePluginID, getPluginParams } from "../../db/utils" @@ -61,7 +62,10 @@ export async function create(ctx: any) { directory = directoryNpm break case "github": - console.log("github") + const { metadata: metadataGithub, directory: directoryGithub } = + await createGithubPlugin(ctx, url, name, githubToken) + metadata = metadataGithub + directory = directoryGithub break case "url": const { metadata: metadataUrl, directory: directoryUrl } = diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index 710e3c0294..d8c201a380 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -31,6 +31,7 @@ const MemoryStream = require("memorystream") const { getAppId } = require("@budibase/backend-core/context") const tar = require("tar") const fetch = require("node-fetch") +const { NodeVM } = require("vm2") const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") @@ -378,8 +379,69 @@ exports.createUrlPlugin = async (url, name = "", headers = {}) => { return await downloadUnzipPlugin(name, url, headers) } +exports.createGithubPlugin = async (ctx, url, name = "", token = "") => { + let githubRepositoryUrl + let githubUrl + + if (url.includes(".git")) { + githubRepositoryUrl = token + ? url.replace("https://", `https://${token}@`) + : url + githubUrl = url.replace(".git", "") + } else { + githubRepositoryUrl = token + ? `${url}.git`.replace("https://", `https://${token}@`) + : `${url}.git` + githubUrl = url + } + + const githubApiUrl = githubUrl.replace( + "https://github.com/", + "https://api.github.com/repos/" + ) + const headers = token ? { Authorization: `Bearer ${token}` } : {} + try { + const pluginRaw = await fetch(githubApiUrl, { headers }) + if (pluginRaw.status !== 200) { + throw `Repository not found` + } + + let pluginDetails = await pluginRaw.json() + const pluginName = pluginDetails.name || name + + const path = join(budibaseTempDir(), pluginName) + // Remove first if exists + if (fs.existsSync(path)) { + fs.rmSync(path, { recursive: true, force: true }) + } + fs.mkdirSync(path) + + const script = ` +module.exports = async () => { + const child_process = require('child_process') + child_process.execSync(\`git clone ${githubRepositoryUrl} ${join( + budibaseTempDir(), + pluginName + )}\`); +} +` + const scriptRunner = new NodeVM({ + require: { + external: true, + builtin: ["child_process"], + root: "./", + }, + }).run(script) + + await scriptRunner() + + return await getPluginMetadata(path) + } catch (e) { + throw e.message + } +} + const downloadUnzipPlugin = async (name, url, headers = {}) => { - console.log(name, url, headers) const path = join(budibaseTempDir(), name) try { // Remove first if exists @@ -407,7 +469,6 @@ const downloadUnzipPlugin = async (name, url, headers = {}) => { exports.downloadUnzipPlugin = downloadUnzipPlugin const getPluginMetadata = async path => { - console.log(path) let metadata = {} try { const pkg = fs.readFileSync(join(path, "package.json"), "utf8") From 2b342a60fcbb30a0ae4dc1bb3bd8d83b7ba85ef0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 2 Sep 2022 18:35:06 +0100 Subject: [PATCH 007/127] improvements to redis connector - multi line pipelines and lowercase commands --- packages/server/src/integrations/redis.ts | 20 ++++++++++++++----- .../src/integrations/tests/redis.spec.js | 19 ++++++++++++++++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/packages/server/src/integrations/redis.ts b/packages/server/src/integrations/redis.ts index e8aa13560c..6764e20dca 100644 --- a/packages/server/src/integrations/redis.ts +++ b/packages/server/src/integrations/redis.ts @@ -132,12 +132,22 @@ module RedisModule { async command(query: { json: string }) { return this.redisContext(async () => { - const commands = query.json.trim().split(" ") - const pipeline = this.client.pipeline([commands]) - const result = await pipeline.exec() - return { - response: result[0][1], + // commands split line by line + const commands = query.json.trim().split("\n") + let pipelineCommands = [] + + // process each command separately + for (let command of commands) { + const tokenised = command.trim().split(" ") + // Pipeline only accepts lower case commands + tokenised[0] = tokenised[0].toLowerCase() + pipelineCommands.push(tokenised) } + + const pipeline = this.client.pipeline(pipelineCommands) + const result = await pipeline.exec() + + return result.map((output: string | string[]) => output[1]) }) } } diff --git a/packages/server/src/integrations/tests/redis.spec.js b/packages/server/src/integrations/tests/redis.spec.js index 219584bdb2..2483ccc382 100644 --- a/packages/server/src/integrations/tests/redis.spec.js +++ b/packages/server/src/integrations/tests/redis.spec.js @@ -46,7 +46,7 @@ describe("Redis Integration", () => { expect(await config.redis.get(body.key)).toEqual(null) }) - it("calls the command method with the correct params", async () => { + it("calls the pipeline method with the correct params", async () => { const body = { json: "KEYS *" } @@ -55,6 +55,21 @@ describe("Redis Integration", () => { config.integration.client.pipeline = jest.fn(() => ({ exec: jest.fn(() => [[]]) })) await config.integration.command(body) - expect(config.integration.client.pipeline).toHaveBeenCalledWith([["KEYS", "*"]]) + expect(config.integration.client.pipeline).toHaveBeenCalledWith([["keys", "*"]]) + }) + + it("calls the pipeline method with several separated commands when there are newlines", async () => { + const body = { + json: 'SET foo "bar"\nGET foo' + } + + // ioredis-mock doesn't support pipelines + config.integration.client.pipeline = jest.fn(() => ({ exec: jest.fn(() => [[]]) })) + + await config.integration.command(body) + expect(config.integration.client.pipeline).toHaveBeenCalledWith([ + ["set", 'foo', '"bar"'], + ["get", 'foo'] + ]) }) }) \ No newline at end of file From 60c337fe95d591ebeef5f46887898c4743279e6c Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Fri, 2 Sep 2022 19:16:13 +0100 Subject: [PATCH 008/127] delete plugin through modal confirmation --- .../_components/DeletePluginModal.svelte | 31 +++++++++++++++++++ .../plugins/_components/PluginRow.svelte | 16 +++++++--- .../portal/manage/plugins/index.svelte | 16 +++++++++- 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte new file mode 100644 index 0000000000..3907c1a0a2 --- /dev/null +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte @@ -0,0 +1,31 @@ + + + + + Are you sure you want to delete {plugin?.name} + + diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte index 3a92a699e6..9c166b8b1b 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte @@ -1,6 +1,8 @@
@@ -41,9 +51,7 @@ - plugins.deletePlugin(plugin._id, plugin._rev)} - icon="Delete">Delete remove(plugin)} icon="Delete">Delete editGroup(plugin)} icon="Edit">Edit diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte index 61227786b0..489333b095 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte @@ -13,9 +13,12 @@ import { plugins } from "stores/portal" import PluginRow from "./_components/PluginRow.svelte" import AddPluginModal from "./_components/AddPluginModal.svelte" + import DeletePluginModal from "./_components/DeletePluginModal.svelte" let modal + let deleteModal let searchTerm = "" + let removePlugin let filterOptions = [ { label: "All Plugins", value: "all" }, @@ -31,6 +34,14 @@ .filter(plugin => plugin?.name?.toLowerCase().includes(searchTerm.toLowerCase()) ) + + const deletePlugin = evt => { + const { detail } = evt + + deleteModal.show() + removePlugin = detail + } + onMount(async () => { await plugins.load() }) @@ -66,7 +77,7 @@ {#if $plugins} {#each filteredPlugins as plugin} - + {/each} {/if} @@ -75,6 +86,9 @@ + + + From bc1586761d4f5173b5e1f80abba64c8b61151ef0 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 5 Sep 2022 09:46:54 +0100 Subject: [PATCH 013/127] Fix auto user creation for OIDC auth --- packages/worker/src/sdk/users/users.ts | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/worker/src/sdk/users/users.ts b/packages/worker/src/sdk/users/users.ts index 0ea16bf670..a8944b936a 100644 --- a/packages/worker/src/sdk/users/users.ts +++ b/packages/worker/src/sdk/users/users.ts @@ -189,23 +189,34 @@ export const save = async ( const tenantId = tenancy.getTenantId() const db = tenancy.getGlobalDB() let { email, _id } = user + if (!email && !_id) { + throw new Error("_id or email is required") + } let dbUser: User | undefined if (_id) { // try to get existing user from db - dbUser = (await db.get(_id)) as User - if (email && dbUser.email !== email) { - throw "Email address cannot be changed" + try { + dbUser = (await db.get(_id)) as User + if (email && dbUser.email !== email) { + throw "Email address cannot be changed" + } + email = dbUser.email + } catch (e: any) { + if (e.status === 404) { + // do nothing, save this new user with the id specified - required for SSO auth + } else { + throw e + } } - email = dbUser.email - } else if (email) { + } + + if (!dbUser && email) { // no id was specified - load from email instead dbUser = await usersCore.getGlobalUserByEmail(email) if (dbUser && dbUser._id !== _id) { throw `Unavailable` } - } else { - throw new Error("_id or email is required") } await validateUniqueUser(email, tenantId) From c03ac3f23243c544e5cd50950df19680609bfa04 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 5 Sep 2022 09:09:43 +0100 Subject: [PATCH 014/127] Configurable api rate limit through nginx --- hosting/docker-compose.yaml | 1 + hosting/nginx.prod.conf.hbs | 2 +- hosting/proxy/Dockerfile | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index 7d3e6960dc..c55ca34547 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -78,6 +78,7 @@ services: image: budibase/proxy environment: - PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10 + - PROXY_RATE_LIMIT_API_PER_SECOND=20 depends_on: - minio-service - worker-service diff --git a/hosting/nginx.prod.conf.hbs b/hosting/nginx.prod.conf.hbs index 5ecea67c42..0ff986d0a7 100644 --- a/hosting/nginx.prod.conf.hbs +++ b/hosting/nginx.prod.conf.hbs @@ -11,7 +11,7 @@ events { http { # rate limiting limit_req_status 429; - limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=20r/s; + limit_req_zone $binary_remote_addr zone=ratelimit:10m rate=${PROXY_RATE_LIMIT_API_PER_SECOND}r/s; limit_req_zone $binary_remote_addr zone=webhooks:10m rate=${PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND}r/s; include /etc/nginx/mime.types; diff --git a/hosting/proxy/Dockerfile b/hosting/proxy/Dockerfile index d9b33e3e9a..298762aaf1 100644 --- a/hosting/proxy/Dockerfile +++ b/hosting/proxy/Dockerfile @@ -10,4 +10,5 @@ COPY .generated-nginx.prod.conf /etc/nginx/templates/nginx.conf.template COPY error.html /usr/share/nginx/html/error.html # Default environment -ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10 \ No newline at end of file +ENV PROXY_RATE_LIMIT_WEBHOOKS_PER_SECOND=10 +ENV PROXY_RATE_LIMIT_API_PER_SECOND=20 \ No newline at end of file From 79d2ea0c607f745fbb8a0d7d264b216acb277e06 Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Mon, 5 Sep 2022 10:13:55 +0100 Subject: [PATCH 015/127] cleaning minio folder when deleting plugin --- packages/server/src/api/controllers/plugin.ts | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index 337df0fc9e..8ec898d67d 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -4,11 +4,14 @@ import { createNpmPlugin, createUrlPlugin, createGithubPlugin, - loadJSFile + loadJSFile, } from "../../utilities/fileSystem" import { getGlobalDB } from "@budibase/backend-core/tenancy" import { generatePluginID, getPluginParams } from "../../db/utils" -import { uploadDirectory } from "@budibase/backend-core/objectStore" +import { + uploadDirectory, + deleteFolder, +} from "@budibase/backend-core/objectStore" import { PluginType, FileType } from "@budibase/types" import env from "../../environment" @@ -98,7 +101,20 @@ export async function fetch(ctx: any) { export async function destroy(ctx: any) { const db = getGlobalDB() - await db.remove(ctx.params.pluginId, ctx.params.pluginRev) + const { pluginId, pluginRev } = ctx.params + + try { + const plugin = await db.get(pluginId) + const bucketPath = `${plugin.name}/` + await deleteFolder(ObjectStoreBuckets.PLUGINS, bucketPath) + + await db.remove(pluginId, pluginRev) + } catch (err: any) { + const errMsg = err?.message ? err?.message : err + + ctx.throw(400, `Failed to delete plugin: ${errMsg}`) + } + ctx.message = `Plugin ${ctx.params.pluginId} deleted.` ctx.status = 200 } From c83967042e0203f4f50ff661e6888778e11e6aa4 Mon Sep 17 00:00:00 2001 From: NEOLPAR Date: Mon, 5 Sep 2022 10:28:09 +0100 Subject: [PATCH 016/127] random name in case it is needed --- packages/server/src/api/controllers/plugin.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index 8ec898d67d..254a008781 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -55,9 +55,11 @@ export async function upload(ctx: any) { } export async function create(ctx: any) { - const { type, source, name, url, headers, githubToken } = ctx.request.body + const { type, source, url, headers, githubToken } = ctx.request.body let metadata let directory + // Generating random name as a backup and needed for url + let name = "PLUGIN_" + Math.floor(100000 + Math.random() * 900000) switch (source) { case "npm": From 43893d9fe4e9517b138ba6f3ac2600b140a8b208 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 5 Sep 2022 11:27:43 +0100 Subject: [PATCH 017/127] remove name selection from UI --- packages/bbui/src/Modal/ModalContent.svelte | 2 +- .../plugins/_components/AddPluginModal.svelte | 1 + .../manage/plugins/_components/PluginRow.svelte | 14 ++++---------- packages/builder/src/stores/portal/plugins.js | 3 +-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index 4c70f2390a..d946268da6 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -88,7 +88,7 @@
- {#if showCancelButton || showConfirmButton} + {#if showCancelButton || showConfirmButton || $$slots.footer}
diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte index 7149136dec..2ccc9283e9 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte @@ -92,6 +92,7 @@ { if (!e.detail || e.detail.length === 0) { diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte index 0eabad111a..30fddb2f76 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte @@ -8,9 +8,9 @@ Label, Input, } from "@budibase/bbui" - import { plugins } from "stores/portal" export let plugin + export let deletePlugin let detailsModal @@ -74,17 +74,11 @@
diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index 821934307d..9d558561b6 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -17,11 +17,10 @@ export function createPluginsStore() { }) } - async function createPlugin(type, source, name, url, auth = null) { + async function createPlugin(type, source, url, auth = null) { let pluginData = { type, source, - name, url, } From e3ac6893b3d1b008fb89373c1b8759475f22aabd Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 5 Sep 2022 10:40:03 +0000 Subject: [PATCH 018/127] v1.3.5 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 4 ++-- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lerna.json b/lerna.json index bffcb4a06c..9e1ede8e2d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.3.4", + "version": "1.3.5", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index a338fc950d..6e5e8ab92a 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.3.4", + "version": "1.3.5", "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.3.4", + "@budibase/types": "^1.3.5", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 68aaf95155..b5a4e35683 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.3.4", + "version": "1.3.5", "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.3.4", + "@budibase/string-templates": "^1.3.5", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 046fbda883..007d8aae6b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.3.4", + "version": "1.3.5", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.3.4", - "@budibase/client": "^1.3.4", - "@budibase/frontend-core": "^1.3.4", - "@budibase/string-templates": "^1.3.4", + "@budibase/bbui": "^1.3.5", + "@budibase/client": "^1.3.5", + "@budibase/frontend-core": "^1.3.5", + "@budibase/string-templates": "^1.3.5", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 8a8962820f..a86c0b04f9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.3.4", + "version": "1.3.5", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.3.4", + "@budibase/backend-core": "^1.3.5", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 317f84b1c5..5f930aee94 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.3.4", + "version": "1.3.5", "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.3.4", - "@budibase/frontend-core": "^1.3.4", - "@budibase/string-templates": "^1.3.4", + "@budibase/bbui": "^1.3.5", + "@budibase/frontend-core": "^1.3.5", + "@budibase/string-templates": "^1.3.5", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 2b268900bf..65729b54ed 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.3.4", + "version": "1.3.5", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.3.4", + "@budibase/bbui": "^1.3.5", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index a104c56c9c..06fc5dd0be 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.3.4", + "version": "1.3.5", "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": "^1.3.4", - "@budibase/client": "^1.3.4", + "@budibase/backend-core": "^1.3.5", + "@budibase/client": "^1.3.5", "@budibase/pro": "1.3.4", - "@budibase/string-templates": "^1.3.4", - "@budibase/types": "^1.3.4", + "@budibase/string-templates": "^1.3.5", + "@budibase/types": "^1.3.5", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 28d68cdd09..126ad55d19 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.3.4", + "version": "1.3.5", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 920c394d0d..38c8754f91 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.3.4", + "version": "1.3.5", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 0c89053da1..869e296438 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.3.4", + "version": "1.3.5", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.3.4", + "@budibase/backend-core": "^1.3.5", "@budibase/pro": "1.3.4", - "@budibase/string-templates": "^1.3.4", - "@budibase/types": "^1.3.4", + "@budibase/string-templates": "^1.3.5", + "@budibase/types": "^1.3.5", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From e8e4d605e956d9c764460f0f305c1ee9a63dd2b7 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 5 Sep 2022 10:43:12 +0000 Subject: [PATCH 019/127] Update pro version to 1.3.5 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 06fc5dd0be..6dbb7e0d5b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.3.5", "@budibase/client": "^1.3.5", - "@budibase/pro": "1.3.4", + "@budibase/pro": "1.3.5", "@budibase/string-templates": "^1.3.5", "@budibase/types": "^1.3.5", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index bd258ea6d6..38754c99e4 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -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@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.4.tgz#91de405d2eff963cabe58b286b73711239ffea52" - integrity sha512-csKHVM9H+7s26k0h+kQm1u6qz7A5/TgOUCSyuysR9aUak5rb5klC2/84AUlpRS4RJWQ37/X0QpovbrakAdXzsw== +"@budibase/backend-core@1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.5.tgz#67f437bfe19f7c8db03f2d64a78be561cd827df5" + integrity sha512-hhEIb1rTOQxE3aj6O2UqklHWd0dcGUBdeoNJrtmWmwSUkqjk+WBZ9WZgzeVUUtSgTUFCjMe7aup6QV+NpEteWg== dependencies: - "@budibase/types" "^1.3.4" + "@budibase/types" "^1.3.5" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1178,13 +1178,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.4.tgz#f21c23dcac5dce23d33fb09bc769447a960fc481" - integrity sha512-jOMRYu+7R8Dpn2l1BdwiaXkxQZb78jFEZIF2XJYUBSjKscgAZGgU+OyYYozRWQip563hTU3eZcqAtQKgfchEZg== +"@budibase/pro@1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.5.tgz#e828f5f5bbb8db69388df32fa6e7fb4de999a49b" + integrity sha512-3Pn1IW6R6DZ9J+6n2R/F0m357vjrnm/lonXpb6JcpWwSPLI5KtPIVSrKQaRxsSqc76355HSCoryGKorQIRq2Lg== dependencies: - "@budibase/backend-core" "1.3.4" - "@budibase/types" "1.3.4" + "@budibase/backend-core" "1.3.5" + "@budibase/types" "1.3.5" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1207,10 +1207,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.3.4", "@budibase/types@^1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.4.tgz#25f087b024e843eb372e50c81f8f925fb39f1dfd" - integrity sha512-ndyWs8yeCS7cpZjApDB1HhY6UUM2SRBUgAMCZOZaWABG9JHeCbx7x0e/pA2SZjswdMXqS5WmnEd3br5wuvUzJw== +"@budibase/types@1.3.5", "@budibase/types@^1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.5.tgz#55cb770527085ab573f15ef0e7b28b9cae2d76ba" + integrity sha512-SSqe8ojEbSNzQHTw2OeXmVWimb/C9Hclcxif0NCCPsan2btx84yMZLO+A3GXanTqzmvSz4ZbkS7/33xwDiOHIA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 869e296438..45fb2336a2 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.3.5", - "@budibase/pro": "1.3.4", + "@budibase/pro": "1.3.5", "@budibase/string-templates": "^1.3.5", "@budibase/types": "^1.3.5", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index e7e258efe6..8f339d2ab1 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -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@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.4.tgz#91de405d2eff963cabe58b286b73711239ffea52" - integrity sha512-csKHVM9H+7s26k0h+kQm1u6qz7A5/TgOUCSyuysR9aUak5rb5klC2/84AUlpRS4RJWQ37/X0QpovbrakAdXzsw== +"@budibase/backend-core@1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.5.tgz#67f437bfe19f7c8db03f2d64a78be561cd827df5" + integrity sha512-hhEIb1rTOQxE3aj6O2UqklHWd0dcGUBdeoNJrtmWmwSUkqjk+WBZ9WZgzeVUUtSgTUFCjMe7aup6QV+NpEteWg== dependencies: - "@budibase/types" "^1.3.4" + "@budibase/types" "^1.3.5" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -325,21 +325,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.4.tgz#f21c23dcac5dce23d33fb09bc769447a960fc481" - integrity sha512-jOMRYu+7R8Dpn2l1BdwiaXkxQZb78jFEZIF2XJYUBSjKscgAZGgU+OyYYozRWQip563hTU3eZcqAtQKgfchEZg== +"@budibase/pro@1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.5.tgz#e828f5f5bbb8db69388df32fa6e7fb4de999a49b" + integrity sha512-3Pn1IW6R6DZ9J+6n2R/F0m357vjrnm/lonXpb6JcpWwSPLI5KtPIVSrKQaRxsSqc76355HSCoryGKorQIRq2Lg== dependencies: - "@budibase/backend-core" "1.3.4" - "@budibase/types" "1.3.4" + "@budibase/backend-core" "1.3.5" + "@budibase/types" "1.3.5" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.3.4", "@budibase/types@^1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.4.tgz#25f087b024e843eb372e50c81f8f925fb39f1dfd" - integrity sha512-ndyWs8yeCS7cpZjApDB1HhY6UUM2SRBUgAMCZOZaWABG9JHeCbx7x0e/pA2SZjswdMXqS5WmnEd3br5wuvUzJw== +"@budibase/types@1.3.5", "@budibase/types@^1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.5.tgz#55cb770527085ab573f15ef0e7b28b9cae2d76ba" + integrity sha512-SSqe8ojEbSNzQHTw2OeXmVWimb/C9Hclcxif0NCCPsan2btx84yMZLO+A3GXanTqzmvSz4ZbkS7/33xwDiOHIA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 8e49ad5e24ddbcd32da0e062e71014d493f3d0a2 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 5 Sep 2022 12:28:01 +0100 Subject: [PATCH 020/127] Prevent default browser events from firing when using keyboard shortcuts --- .../_components/navigation/ComponentKeyHandler.svelte | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte index 467d9a5a2f..77147d0f9a 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/components/[componentId]/_components/navigation/ComponentKeyHandler.svelte @@ -54,7 +54,7 @@ }, } - const handleKeyAction = async (component, key, ctrlKey = false) => { + const handleKeyAction = async (event, component, key, ctrlKey = false) => { if (!component || !key) { return false } @@ -70,6 +70,9 @@ const handler = keyHandlers[key] if (!handler) { return false + } else if (event) { + event.preventDefault() + event.stopPropagation() } return handler(component) } catch (error) { @@ -89,14 +92,14 @@ return } // Key events are always for the selected component - return handleKeyAction($selectedComponent, e.key, e.ctrlKey || e.metaKey) + return handleKeyAction(e, $selectedComponent, e.key, e.ctrlKey || e.metaKey) } const handleComponentMenu = async e => { // Menu events can be for any component const { id, key, ctrlKey } = e.detail const component = findComponent($selectedScreen.props, id) - return await handleKeyAction(component, key, ctrlKey) + return await handleKeyAction(null, component, key, ctrlKey) } onMount(() => { From e1e4f2cc874b0f28c6a7063ae3f3c90a9e84fe2c Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 5 Sep 2022 13:07:27 +0100 Subject: [PATCH 021/127] Fixing backend-core build, as raised in #7603. --- packages/backend-core/package.json | 2 +- packages/backend-core/tsconfig.build.json | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index a338fc950d..ce3dd11a7c 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -60,7 +60,7 @@ ] }, "devDependencies": { - "@shopify/jest-koa-mocks": "3.1.5", + "@shopify/jest-koa-mocks": "^5.0.1", "@types/jest": "27.5.1", "@types/koa": "2.0.52", "@types/lodash": "4.14.180", diff --git a/packages/backend-core/tsconfig.build.json b/packages/backend-core/tsconfig.build.json index 40ffe6b827..acf93df89e 100644 --- a/packages/backend-core/tsconfig.build.json +++ b/packages/backend-core/tsconfig.build.json @@ -20,6 +20,8 @@ "package.json" ], "exclude": [ + "scripts", + "tests", "node_modules", "dist", "**/*.spec.ts", From b3eb26dfd886763893b704dd9cb709e0d7816e14 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 5 Sep 2022 13:26:35 +0100 Subject: [PATCH 022/127] Pinning. --- packages/backend-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index ce3dd11a7c..01be6a2bcd 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -60,7 +60,7 @@ ] }, "devDependencies": { - "@shopify/jest-koa-mocks": "^5.0.1", + "@shopify/jest-koa-mocks": "5.0.1", "@types/jest": "27.5.1", "@types/koa": "2.0.52", "@types/lodash": "4.14.180", From c45973034826df2b7c2c9ff3877afe4083beb8da Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Mon, 5 Sep 2022 13:48:37 +0100 Subject: [PATCH 023/127] Cypress: Smoke Build: Test Changes createComponents - Updated how the test gets nav-items from the side nav bar commands - Updating maximum timeout value for cy.visit instances (this seems specific to the CI runs) - Updated createUser command to ensure better timing between the create user modals --- .../integration/createComponents.spec.js | 14 +++++------ packages/builder/cypress/support/commands.js | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/packages/builder/cypress/integration/createComponents.spec.js b/packages/builder/cypress/integration/createComponents.spec.js index 649a77e442..e39ce4a4a8 100644 --- a/packages/builder/cypress/integration/createComponents.spec.js +++ b/packages/builder/cypress/integration/createComponents.spec.js @@ -20,7 +20,7 @@ filterTests(["all"], () => { //Use the tree to delete a selected component const deleteSelectedComponent = () => { cy.get( - ".nav-items-container .nav-item.selected .actions > div > .icon" + ".nav-item.selected .actions > div > .icon" ).click({ force: true, }) @@ -91,7 +91,7 @@ filterTests(["all"], () => { cy.searchAndAddComponent("Paragraph").then(componentId => { cy.get("[data-cy=setting-_instanceName] input").type(componentId).blur() cy.get( - ".nav-items-container .nav-item.selected .actions > div > .icon" + ".nav-item.selected .actions > div > .icon" ).click({ force: true, }) @@ -145,7 +145,7 @@ filterTests(["all"], () => { return testFieldFocusOnCreate(label) }) .then(() => { - cy.get(".nav-items-container .nav-item") + cy.get(".nav-item") .contains(formId) .click({ force: true }) deleteSelectedComponent() @@ -195,7 +195,7 @@ filterTests(["all"], () => { return testFocusOnCreate(label) }) .then(() => { - cy.get(".nav-items-container .nav-item") + cy.get(".nav-item") .contains(providerId) .click({ force: true }) deleteSelectedComponent() @@ -218,7 +218,7 @@ filterTests(["all"], () => { .find(".component-placeholder") .should("not.exist") cy.getComponent(imageId).find(`img[alt=${imageId}]`).should("exist") - cy.get(".nav-items-container .nav-item") + cy.get(".nav-item") .contains(imageId) .click({ force: true }) deleteSelectedComponent() @@ -242,7 +242,7 @@ filterTests(["all"], () => { cy.getComponent(markdownId) .find(".editor-preview-full h1") .contains("Hi") - cy.get(".nav-items-container .nav-item") + cy.get(".nav-item") .contains(markdownId) .click({ force: true }) deleteSelectedComponent() @@ -265,7 +265,7 @@ filterTests(["all"], () => { .find(".component-placeholder") .should("not.exist") cy.getComponent(iconId).find("i.ri-save-fill").should("exist") - cy.get(".nav-items-container .nav-item") + cy.get(".nav-item") .contains(iconId) .click({ force: true }) deleteSelectedComponent() diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index d4b0ec80e8..394d5e9af2 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -4,7 +4,7 @@ Cypress.on("uncaught:exception", () => { // ACCOUNTS & USERS Cypress.Commands.add("login", (email, password) => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.url() .should("include", "/builder/") .then(url => { @@ -33,7 +33,7 @@ Cypress.Commands.add("login", (email, password) => { }) Cypress.Commands.add("logOut", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 2000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.get(".user-dropdown .avatar > .icon").click({ force: true }) cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { cy.get("li[data-cy='user-logout']").click({ force: true }) @@ -43,7 +43,7 @@ Cypress.Commands.add("logOut", () => { Cypress.Commands.add("logoutNoAppGrid", () => { // Logs user out when app grid is not present - cy.visit(`${Cypress.config().baseUrl}/builder`) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.get(".avatar > .icon").click({ force: true }) cy.get(".spectrum-Popover[data-cy='user-menu']").within(() => { cy.get(".spectrum-Menu-item").contains("Log out").click({ force: true }) @@ -68,11 +68,14 @@ Cypress.Commands.add("createUser", (email, permission) => { .click({ force: true }) }) } - // Add user and wait for modal to change - cy.get(".spectrum-Button").contains("Add user").click({ force: true }) + // Add user + cy.get(".spectrum-Button").contains("Add users").click({ force: true }) cy.get(".spectrum-ActionButton").contains("Add email").should("not.exist") }) // Onboarding modal + cy.get(".spectrum-Dialog-grid", { timeout: 5000 }).contains( + "Choose your onboarding" + ) cy.get(".spectrum-Dialog-grid").within(() => { cy.get(".onboarding-type").eq(1).click() cy.get(".spectrum-Button").contains("Done").click({ force: true }) @@ -163,7 +166,7 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => { const shouldCreateDefaultTable = typeof addDefaultTable != "boolean" ? true : addDefaultTable - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.url({ timeout: 30000 }).should("include", "/apps") cy.get(`[data-cy="create-app-btn"]`, { timeout: 5000 }).click({ force: true }) @@ -197,7 +200,7 @@ Cypress.Commands.add("createApp", (name, addDefaultTable) => { }) Cypress.Commands.add("deleteApp", name => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.wait(2000) cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) .its("body") @@ -254,7 +257,7 @@ Cypress.Commands.add("deleteApp", name => { }) Cypress.Commands.add("deleteAllApps", () => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.wait(500) cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`, { timeout: 5000, @@ -351,7 +354,7 @@ Cypress.Commands.add("alterAppVersion", (appId, version) => { }) Cypress.Commands.add("importApp", (exportFilePath, name) => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.request(`${Cypress.config().baseUrl}/api/applications?status=all`) .its("body") @@ -386,7 +389,7 @@ Cypress.Commands.add("importApp", (exportFilePath, name) => { // Filters visible with 1 or more Cypress.Commands.add("searchForApplication", appName => { - cy.visit(`${Cypress.config().baseUrl}/builder`) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.wait(2000) // No app filter functionality if only 1 app exists @@ -409,7 +412,7 @@ Cypress.Commands.add("searchForApplication", appName => { // Assumes there are no others Cypress.Commands.add("applicationInAppTable", appName => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 30000 }) cy.get(".appTable", { timeout: 5000 }).within(() => { cy.get(".title").contains(appName).should("exist") }) From 7f250766639becde009208a86470e6b68fe436d5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 5 Sep 2022 14:06:35 +0100 Subject: [PATCH 024/127] Updating backend-core lockfile. --- packages/backend-core/yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/yarn.lock b/packages/backend-core/yarn.lock index 9f71691f44..22c17a9444 100644 --- a/packages/backend-core/yarn.lock +++ b/packages/backend-core/yarn.lock @@ -543,13 +543,13 @@ semver "^7.3.5" tar "^6.1.11" -"@shopify/jest-koa-mocks@3.1.5": - version "3.1.5" - resolved "https://registry.yarnpkg.com/@shopify/jest-koa-mocks/-/jest-koa-mocks-3.1.5.tgz#11f77ccfbcaf35cf5ee2c6108a286e61e6bea084" - integrity sha512-gQ3/7ELerv00TWO37AGFX5mT9CsFCS+3/UbKMuoIlKEU0QH2OX8BV9WBf/EKw7adCDNlxss0lqV6J8kf5pgr4A== +"@shopify/jest-koa-mocks@5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@shopify/jest-koa-mocks/-/jest-koa-mocks-5.0.1.tgz#fba490b6b7985fbb571eb9974897d396a3642e94" + integrity sha512-4YskS9q8+TEHNoyopmuoy2XyhInyqeOl7CF5ShJs19sm6m0EA/jGGvgf/osv2PeTfuf42/L2G9CzWUSg49yTSg== dependencies: koa "^2.13.4" - node-mocks-http "^1.5.8" + node-mocks-http "^1.11.0" "@sideway/address@^4.1.3": version "4.1.4" @@ -3914,7 +3914,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-mocks-http@^1.5.8: +node-mocks-http@^1.11.0: version "1.11.0" resolved "https://registry.yarnpkg.com/node-mocks-http/-/node-mocks-http-1.11.0.tgz#defc0febf6b935f08245397d47534a8de592996e" integrity sha512-jS/WzSOcKbOeGrcgKbenZeNhxUNnP36Yw11+hL4TTxQXErGfqYZ+MaYNNvhaTiGIJlzNSqgQkk9j8dSu1YWSuw== From 6f9f6b54acf28819286ce19e48823b1cd96cea92 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 5 Sep 2022 13:19:34 +0000 Subject: [PATCH 025/127] v1.3.6 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 4 ++-- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lerna.json b/lerna.json index 9e1ede8e2d..721ceba47f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.3.5", + "version": "1.3.6", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index e9e242369e..dbfecf37bd 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.3.5", + "version": "1.3.6", "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.3.5", + "@budibase/types": "^1.3.6", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index b5a4e35683..a23285b479 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.3.5", + "version": "1.3.6", "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.3.5", + "@budibase/string-templates": "^1.3.6", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 007d8aae6b..78cfa9c4c6 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.3.5", + "version": "1.3.6", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.3.5", - "@budibase/client": "^1.3.5", - "@budibase/frontend-core": "^1.3.5", - "@budibase/string-templates": "^1.3.5", + "@budibase/bbui": "^1.3.6", + "@budibase/client": "^1.3.6", + "@budibase/frontend-core": "^1.3.6", + "@budibase/string-templates": "^1.3.6", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index a86c0b04f9..ea1938256c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.3.5", + "version": "1.3.6", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.3.5", + "@budibase/backend-core": "^1.3.6", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 5f930aee94..05a6a81770 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.3.5", + "version": "1.3.6", "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.3.5", - "@budibase/frontend-core": "^1.3.5", - "@budibase/string-templates": "^1.3.5", + "@budibase/bbui": "^1.3.6", + "@budibase/frontend-core": "^1.3.6", + "@budibase/string-templates": "^1.3.6", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 65729b54ed..0dfe6b190c 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.3.5", + "version": "1.3.6", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.3.5", + "@budibase/bbui": "^1.3.6", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 6dbb7e0d5b..2b0c0eb6f1 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.3.5", + "version": "1.3.6", "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": "^1.3.5", - "@budibase/client": "^1.3.5", + "@budibase/backend-core": "^1.3.6", + "@budibase/client": "^1.3.6", "@budibase/pro": "1.3.5", - "@budibase/string-templates": "^1.3.5", - "@budibase/types": "^1.3.5", + "@budibase/string-templates": "^1.3.6", + "@budibase/types": "^1.3.6", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 126ad55d19..817c442e01 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.3.5", + "version": "1.3.6", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 38c8754f91..a5684d2502 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.3.5", + "version": "1.3.6", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 45fb2336a2..35994a67f7 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.3.5", + "version": "1.3.6", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.3.5", + "@budibase/backend-core": "^1.3.6", "@budibase/pro": "1.3.5", - "@budibase/string-templates": "^1.3.5", - "@budibase/types": "^1.3.5", + "@budibase/string-templates": "^1.3.6", + "@budibase/types": "^1.3.6", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 3150d86710f859d2535b25d538498f5a810c61e6 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 5 Sep 2022 13:22:34 +0000 Subject: [PATCH 026/127] Update pro version to 1.3.6 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 2b0c0eb6f1..392a1d8b93 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.3.6", "@budibase/client": "^1.3.6", - "@budibase/pro": "1.3.5", + "@budibase/pro": "1.3.6", "@budibase/string-templates": "^1.3.6", "@budibase/types": "^1.3.6", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 38754c99e4..f91e3a5442 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -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@1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.5.tgz#67f437bfe19f7c8db03f2d64a78be561cd827df5" - integrity sha512-hhEIb1rTOQxE3aj6O2UqklHWd0dcGUBdeoNJrtmWmwSUkqjk+WBZ9WZgzeVUUtSgTUFCjMe7aup6QV+NpEteWg== +"@budibase/backend-core@1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.6.tgz#340b55a71eba228d44c8dd6107e28872a6f432d6" + integrity sha512-WIGseaoUrUWpqlbKadNuusQa1y9Ucm34AVei6oWRK1czJtLddaEt2zaMlD/qikcBB6XBJE3UML0Z82EvvdZPBQ== dependencies: - "@budibase/types" "^1.3.5" + "@budibase/types" "^1.3.6" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1178,13 +1178,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.5.tgz#e828f5f5bbb8db69388df32fa6e7fb4de999a49b" - integrity sha512-3Pn1IW6R6DZ9J+6n2R/F0m357vjrnm/lonXpb6JcpWwSPLI5KtPIVSrKQaRxsSqc76355HSCoryGKorQIRq2Lg== +"@budibase/pro@1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.6.tgz#2ac68b341401003a25619c36137a1960b97ac01d" + integrity sha512-5QFkeR/6DdvXdIgufmqACIEEGvqXlinQrXVV45C0n95gKEXvRybv5eiWR9OO7UyYeJzQOv0PTY8O7ZtOSQrdwg== dependencies: - "@budibase/backend-core" "1.3.5" - "@budibase/types" "1.3.5" + "@budibase/backend-core" "1.3.6" + "@budibase/types" "1.3.6" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1207,10 +1207,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.3.5", "@budibase/types@^1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.5.tgz#55cb770527085ab573f15ef0e7b28b9cae2d76ba" - integrity sha512-SSqe8ojEbSNzQHTw2OeXmVWimb/C9Hclcxif0NCCPsan2btx84yMZLO+A3GXanTqzmvSz4ZbkS7/33xwDiOHIA== +"@budibase/types@1.3.6", "@budibase/types@^1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.6.tgz#b2c8b2cfd7ef37c7803c07499887dfc0a716c2dc" + integrity sha512-gu+G9E04Bumc0oRdXjjKj+FgPGDj/r38iLx7yiHfWIFwaXqn+Lvmljb20nfYTVF49LDVz2jowzACRzVX4rq6kA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 35994a67f7..9c3a03a675 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.3.6", - "@budibase/pro": "1.3.5", + "@budibase/pro": "1.3.6", "@budibase/string-templates": "^1.3.6", "@budibase/types": "^1.3.6", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 8f339d2ab1..9647129caf 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -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@1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.5.tgz#67f437bfe19f7c8db03f2d64a78be561cd827df5" - integrity sha512-hhEIb1rTOQxE3aj6O2UqklHWd0dcGUBdeoNJrtmWmwSUkqjk+WBZ9WZgzeVUUtSgTUFCjMe7aup6QV+NpEteWg== +"@budibase/backend-core@1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.6.tgz#340b55a71eba228d44c8dd6107e28872a6f432d6" + integrity sha512-WIGseaoUrUWpqlbKadNuusQa1y9Ucm34AVei6oWRK1czJtLddaEt2zaMlD/qikcBB6XBJE3UML0Z82EvvdZPBQ== dependencies: - "@budibase/types" "^1.3.5" + "@budibase/types" "^1.3.6" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -325,21 +325,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.5.tgz#e828f5f5bbb8db69388df32fa6e7fb4de999a49b" - integrity sha512-3Pn1IW6R6DZ9J+6n2R/F0m357vjrnm/lonXpb6JcpWwSPLI5KtPIVSrKQaRxsSqc76355HSCoryGKorQIRq2Lg== +"@budibase/pro@1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.6.tgz#2ac68b341401003a25619c36137a1960b97ac01d" + integrity sha512-5QFkeR/6DdvXdIgufmqACIEEGvqXlinQrXVV45C0n95gKEXvRybv5eiWR9OO7UyYeJzQOv0PTY8O7ZtOSQrdwg== dependencies: - "@budibase/backend-core" "1.3.5" - "@budibase/types" "1.3.5" + "@budibase/backend-core" "1.3.6" + "@budibase/types" "1.3.6" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.3.5", "@budibase/types@^1.3.5": - version "1.3.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.5.tgz#55cb770527085ab573f15ef0e7b28b9cae2d76ba" - integrity sha512-SSqe8ojEbSNzQHTw2OeXmVWimb/C9Hclcxif0NCCPsan2btx84yMZLO+A3GXanTqzmvSz4ZbkS7/33xwDiOHIA== +"@budibase/types@1.3.6", "@budibase/types@^1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.6.tgz#b2c8b2cfd7ef37c7803c07499887dfc0a716c2dc" + integrity sha512-gu+G9E04Bumc0oRdXjjKj+FgPGDj/r38iLx7yiHfWIFwaXqn+Lvmljb20nfYTVF49LDVz2jowzACRzVX4rq6kA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From bad727cc95fb56962489ac53198e44ca784c93d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9F?= Date: Wed, 23 Feb 2022 16:26:09 +0100 Subject: [PATCH 027/127] allow specifying resources on app, worker, proxy deployments --- charts/budibase/templates/app-service-deployment.yaml | 5 ++++- charts/budibase/templates/proxy-service-deployment.yaml | 5 ++++- charts/budibase/templates/worker-service-deployment.yaml | 5 ++++- charts/budibase/values.yaml | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 74b98ac008..422097e699 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -158,7 +158,10 @@ spec: name: bbapps ports: - containerPort: {{ .Values.services.apps.port }} - resources: {} + {{ with .Values.services.apps.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/budibase/templates/proxy-service-deployment.yaml b/charts/budibase/templates/proxy-service-deployment.yaml index 505a46f1e8..5588022032 100644 --- a/charts/budibase/templates/proxy-service-deployment.yaml +++ b/charts/budibase/templates/proxy-service-deployment.yaml @@ -30,7 +30,10 @@ spec: name: proxy-service ports: - containerPort: {{ .Values.services.proxy.port }} - resources: {} + {{ with .Values.services.proxy.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} volumeMounts: {{- with .Values.affinity }} affinity: diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 083231eeff..902e9ac03d 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -151,7 +151,10 @@ spec: name: bbworker ports: - containerPort: {{ .Values.services.worker.port }} - resources: {} + {{ with .Values.services.worker.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 9b5e76d0d7..0ebf625abd 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -125,16 +125,19 @@ services: proxy: port: 10000 replicaCount: 1 + resources: {} apps: port: 4002 replicaCount: 1 logLevel: info + resources: {} # nodeDebug: "" # set the value of NODE_DEBUG worker: port: 4003 replicaCount: 1 + resources: {} couchdb: enabled: true From 3295c14679bbd84b7e9cfdf20c970368d0372dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9F?= Date: Mon, 29 Aug 2022 13:51:08 +0200 Subject: [PATCH 028/127] allow specifying resources on minio, redis deployments --- charts/budibase/templates/minio-service-deployment.yaml | 5 ++++- charts/budibase/templates/redis-service-deployment.yaml | 5 ++++- charts/budibase/values.yaml | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/budibase/templates/minio-service-deployment.yaml b/charts/budibase/templates/minio-service-deployment.yaml index 103f9e3ed2..144dbe539a 100644 --- a/charts/budibase/templates/minio-service-deployment.yaml +++ b/charts/budibase/templates/minio-service-deployment.yaml @@ -56,7 +56,10 @@ spec: name: minio-service ports: - containerPort: {{ .Values.services.objectStore.port }} - resources: {} + {{ with .Values.services.objectStore.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} volumeMounts: - mountPath: /data name: minio-data diff --git a/charts/budibase/templates/redis-service-deployment.yaml b/charts/budibase/templates/redis-service-deployment.yaml index 6e09346cad..d94e4d70f8 100644 --- a/charts/budibase/templates/redis-service-deployment.yaml +++ b/charts/budibase/templates/redis-service-deployment.yaml @@ -35,7 +35,10 @@ spec: name: redis-service ports: - containerPort: {{ .Values.services.redis.port }} - resources: {} + {{ with .Values.services.redis.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} volumeMounts: - mountPath: /data name: redis-data diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 0ebf625abd..950a2f838e 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -164,6 +164,7 @@ services: ## If undefined (the default) or set to null, no storageClassName spec is ## set, choosing the default provisioner. storageClass: "" + resources: {} objectStore: minio: true @@ -180,6 +181,7 @@ services: ## If undefined (the default) or set to null, no storageClassName spec is ## set, choosing the default provisioner. storageClass: "" + resources: {} # Override values in couchDB subchart couchdb: From cfd757d712f03146cabab5f02a766626e7cff601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9F?= Date: Mon, 29 Aug 2022 13:52:45 +0200 Subject: [PATCH 029/127] allow specifying resources on couchdb-backup deployment --- charts/budibase/templates/couchdb-backup.yaml | 5 ++++- charts/budibase/values.yaml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/budibase/templates/couchdb-backup.yaml b/charts/budibase/templates/couchdb-backup.yaml index ae062475ce..68e5eab617 100644 --- a/charts/budibase/templates/couchdb-backup.yaml +++ b/charts/budibase/templates/couchdb-backup.yaml @@ -38,7 +38,10 @@ spec: image: redgeoff/replicate-couchdb-cluster imagePullPolicy: Always name: couchdb-backup - resources: {} + {{ with .Values.services.couchdb.backup.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{ end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 950a2f838e..14c18205df 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -151,6 +151,7 @@ services: target: "" # backup interval in seconds interval: "" + resources: {} redis: enabled: true # disable if using external redis From 3ce96f4236d5635eb470ba8741144aa8591a2ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9F?= Date: Mon, 29 Aug 2022 13:54:21 +0200 Subject: [PATCH 030/127] remove unused value from chart defaults --- charts/budibase/values.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 14c18205df..a15504d58c 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -60,19 +60,6 @@ ingress: port: number: 10000 -resources: - {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - autoscaling: enabled: false minReplicas: 1 From 4a5d1b97c898d59c943bd6c477be807e0c5e5029 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 5 Sep 2022 14:39:19 +0100 Subject: [PATCH 031/127] improve responsiveness of plugins ui --- .../plugins/_components/PluginRow.svelte | 27 +++++++++++++------ packages/server/src/api/controllers/plugin.ts | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte index 30fddb2f76..848611c248 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/PluginRow.svelte @@ -12,6 +12,11 @@ export let plugin export let deletePlugin + let icon = + plugin.schema.type === "component" + ? plugin.schema.schema.icon || "Book" + : plugin.schema.schema.icon || "Beaker" + let detailsModal @@ -19,7 +24,7 @@
- +
-
+
+ + +
+ +
-
+
-
+
-
+
-
+
@@ -88,7 +99,7 @@ diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index a3d62ca6e3..9703b30cb7 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -50,11 +50,11 @@ export function createPluginsStore() { }) } - async function uploadPlugin(file, source) { + async function uploadPlugin(file, source, updatePlugin) { let data = new FormData() data.append("file", file) data.append("source", source) - + data.append("update", updatePlugin) let resp = await API.uploadPlugin(data) let newPlugin = resp.plugins[0] update(state => { diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index ce35d2fad5..a84a077b33 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -39,7 +39,11 @@ export async function upload(ctx: any) { let docs = [] // can do single or multiple plugins for (let plugin of plugins) { - const doc = await processPlugin(plugin, ctx.request.body.source) + const doc = await processPlugin( + plugin, + ctx.request.body.source, + ctx.request.body.update + ) docs.push(doc) } ctx.body = { @@ -128,7 +132,8 @@ export async function destroy(ctx: any) { export async function storePlugin( metadata: any, directory: any, - source?: string + source?: string, + update?: boolean ) { const db = getGlobalDB() const version = metadata.package.version, @@ -167,6 +172,9 @@ export async function storePlugin( const existing = await db.get(pluginId) rev = existing._rev } catch (err) { + if (update) { + throw new Error("Unable to update. Plugin does not exist") + } rev = undefined } let doc = { @@ -185,6 +193,7 @@ export async function storePlugin( source, } } + const response = await db.put(doc) return { ...doc, @@ -192,11 +201,15 @@ export async function storePlugin( } } -export async function processPlugin(plugin: FileType, source?: string) { +export async function processPlugin( + plugin: FileType, + source?: string, + update?: boolean +) { if (!env.SELF_HOSTED) { throw new Error("Plugins not supported outside of self-host.") } const { metadata, directory } = await uploadedFilePlugin(plugin) - return await storePlugin(metadata, directory, source) + return await storePlugin(metadata, directory, source, update) } From 524669082e217d108b5c4a1586de74cb6f9d7a5f Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 7 Sep 2022 13:52:05 +0100 Subject: [PATCH 079/127] Update createDatasourceScreen Adding a manual wait this time go better determine the timing issue occurring against the CI runs --- packages/builder/cypress/support/commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index bb26e53d80..a07a22188f 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -642,6 +642,7 @@ Cypress.Commands.add( cy.intercept("**/api/datasources").as("autoScreens") cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.wait("@autoScreens") + cy.wait(5000) }) cy.get("[data-cy='autogenerated-screens']").should("not.exist") cy.get("[data-cy='data-source-modal']", { timeout: 10000 }).within(() => { From 76870217376710fa1a8bf554fdfcc5f446dbde6c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 7 Sep 2022 13:27:13 +0000 Subject: [PATCH 080/127] v1.3.12-alpha.2 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lerna.json b/lerna.json index efbd4520e1..a74e653725 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 0b58e3497e..5f3414bab9 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "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.3.12-alpha.1", + "@budibase/types": "1.3.12-alpha.2", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index ee0b00a2b5..95fb5c855b 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "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.3.12-alpha.1", + "@budibase/string-templates": "1.3.12-alpha.2", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index c596412bc7..3d7e34b8d7 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.3.12-alpha.1", - "@budibase/client": "1.3.12-alpha.1", - "@budibase/frontend-core": "1.3.12-alpha.1", - "@budibase/string-templates": "1.3.12-alpha.1", + "@budibase/bbui": "1.3.12-alpha.2", + "@budibase/client": "1.3.12-alpha.2", + "@budibase/frontend-core": "1.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.2", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index cef8ddfd72..3c11d7d624 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.3.12-alpha.1", - "@budibase/string-templates": "^1.3.12-alpha.1", - "@budibase/types": "^1.3.12-alpha.1", + "@budibase/backend-core": "1.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.2", + "@budibase/types": "1.3.12-alpha.2", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 139ee20c9c..1df066dbdb 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "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.3.12-alpha.1", - "@budibase/frontend-core": "1.3.12-alpha.1", - "@budibase/string-templates": "1.3.12-alpha.1", + "@budibase/bbui": "1.3.12-alpha.2", + "@budibase/frontend-core": "1.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.2", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index e3a888a4e4..b686e3cea5 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "1.3.12-alpha.1", + "@budibase/bbui": "1.3.12-alpha.2", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 127945266f..5c0b41c805 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "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": "1.3.12-alpha.1", - "@budibase/client": "1.3.12-alpha.1", + "@budibase/backend-core": "1.3.12-alpha.2", + "@budibase/client": "1.3.12-alpha.2", "@budibase/pro": "1.3.12-alpha.1", - "@budibase/string-templates": "1.3.12-alpha.1", - "@budibase/types": "1.3.12-alpha.1", + "@budibase/string-templates": "1.3.12-alpha.2", + "@budibase/types": "1.3.12-alpha.2", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index fa20295974..3c2e35aba6 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 6af650da47..c5164852ed 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index d0f391ed41..1547f24b30 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.3.12-alpha.1", + "version": "1.3.12-alpha.2", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "1.3.12-alpha.1", + "@budibase/backend-core": "1.3.12-alpha.2", "@budibase/pro": "1.3.12-alpha.1", - "@budibase/string-templates": "1.3.12-alpha.1", - "@budibase/types": "1.3.12-alpha.1", + "@budibase/string-templates": "1.3.12-alpha.2", + "@budibase/types": "1.3.12-alpha.2", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From b0ed4970fc5537c933887b560f569eb9925b2f8c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 7 Sep 2022 13:30:26 +0000 Subject: [PATCH 081/127] Update pro version to 1.3.12-alpha.2 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 5c0b41c805..c72c68817d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "1.3.12-alpha.2", "@budibase/client": "1.3.12-alpha.2", - "@budibase/pro": "1.3.12-alpha.1", + "@budibase/pro": "1.3.12-alpha.2", "@budibase/string-templates": "1.3.12-alpha.2", "@budibase/types": "1.3.12-alpha.2", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index ff811617dc..2a3db0f037 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -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@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.1.tgz#a38f36610a4880b5f8c18192d82244a431c28a86" - integrity sha512-V1rtNBMob3BJjOGeMyvro2tqYoC85TSIO8wyJf1c4DRpPN0rW3s6MjSmVItqtZlbrcnHmxKFr4PDFDIBJaHnbg== +"@budibase/backend-core@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.2.tgz#cab9edd5bde68c245c1b01e29bdd1468cfb10031" + integrity sha512-8NEGk71xnctP9xHGhC9Y5Dy3ilBE8HAW6WtWueOv7SZupa6Y5x0hdtzaJJY1/6oEqnhW/eGYXvPQpffOtfpgYg== dependencies: - "@budibase/types" "1.3.12-alpha.1" + "@budibase/types" "1.3.12-alpha.2" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1179,13 +1179,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.1.tgz#5161f3c646e275fd7f9a72abf817fb407cfd6efe" - integrity sha512-lzsZeZuUGqs8eRsCB3T7yBo4yS7z7L3N2qW9Pzh7/VBwFv4NdQH56tniXCf3oFfxsQ+6xH++vklfRxddID/Dfg== +"@budibase/pro@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.2.tgz#d49accc3c6258e4a258ed60046aa8756f2993895" + integrity sha512-gu/nKTKtHIhqeLrvQfB1z6sIEePWN3453TtVldPgDdl4luVcax4RhktWAw4/Bxyn/NyU80rNjcmBTlMh59Hj0A== dependencies: - "@budibase/backend-core" "1.3.12-alpha.1" - "@budibase/types" "1.3.12-alpha.1" + "@budibase/backend-core" "1.3.12-alpha.2" + "@budibase/types" "1.3.12-alpha.2" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1208,10 +1208,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.1.tgz#18fda1652a757479be45fe096235af1b966ca49c" - integrity sha512-dNP+9zRKX7cYjwL+0/zdlYnMGMUWSyw3Vi+YmWNdXVcQnMXsc9gSbODBQMNv4YNqXBBC+0xgo/A5wRqWhZFL6g== +"@budibase/types@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.2.tgz#e95c6d963000c5b561e8c3007df02ae8fd2a4869" + integrity sha512-pyw10xOPb78deK3aZzhpYuXMGBVrUzAb7Z5AANzDFvi4ggInY6c2GGjrzL/PfHy3DeLZkYnPDxkvaF6GNF6Txw== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 1547f24b30..85b7e4be7e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "1.3.12-alpha.2", - "@budibase/pro": "1.3.12-alpha.1", + "@budibase/pro": "1.3.12-alpha.2", "@budibase/string-templates": "1.3.12-alpha.2", "@budibase/types": "1.3.12-alpha.2", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 431c655d1f..52ab196d8f 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -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@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.1.tgz#a38f36610a4880b5f8c18192d82244a431c28a86" - integrity sha512-V1rtNBMob3BJjOGeMyvro2tqYoC85TSIO8wyJf1c4DRpPN0rW3s6MjSmVItqtZlbrcnHmxKFr4PDFDIBJaHnbg== +"@budibase/backend-core@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.2.tgz#cab9edd5bde68c245c1b01e29bdd1468cfb10031" + integrity sha512-8NEGk71xnctP9xHGhC9Y5Dy3ilBE8HAW6WtWueOv7SZupa6Y5x0hdtzaJJY1/6oEqnhW/eGYXvPQpffOtfpgYg== dependencies: - "@budibase/types" "1.3.12-alpha.1" + "@budibase/types" "1.3.12-alpha.2" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -326,21 +326,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.1.tgz#5161f3c646e275fd7f9a72abf817fb407cfd6efe" - integrity sha512-lzsZeZuUGqs8eRsCB3T7yBo4yS7z7L3N2qW9Pzh7/VBwFv4NdQH56tniXCf3oFfxsQ+6xH++vklfRxddID/Dfg== +"@budibase/pro@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.2.tgz#d49accc3c6258e4a258ed60046aa8756f2993895" + integrity sha512-gu/nKTKtHIhqeLrvQfB1z6sIEePWN3453TtVldPgDdl4luVcax4RhktWAw4/Bxyn/NyU80rNjcmBTlMh59Hj0A== dependencies: - "@budibase/backend-core" "1.3.12-alpha.1" - "@budibase/types" "1.3.12-alpha.1" + "@budibase/backend-core" "1.3.12-alpha.2" + "@budibase/types" "1.3.12-alpha.2" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.3.12-alpha.1": - version "1.3.12-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.1.tgz#18fda1652a757479be45fe096235af1b966ca49c" - integrity sha512-dNP+9zRKX7cYjwL+0/zdlYnMGMUWSyw3Vi+YmWNdXVcQnMXsc9gSbODBQMNv4YNqXBBC+0xgo/A5wRqWhZFL6g== +"@budibase/types@1.3.12-alpha.2": + version "1.3.12-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.2.tgz#e95c6d963000c5b561e8c3007df02ae8fd2a4869" + integrity sha512-pyw10xOPb78deK3aZzhpYuXMGBVrUzAb7Z5AANzDFvi4ggInY6c2GGjrzL/PfHy3DeLZkYnPDxkvaF6GNF6Txw== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From ae3463fc7b3e4a887d3621cf7fe2ebf0bbb100bd Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 7 Sep 2022 15:42:45 +0100 Subject: [PATCH 082/127] Oracle + datasource Wizard Test skips Skipping tests for Oracle & datasourceWizard Both are covered during general regressions There are timing issues associated with the CI Smoke run This will help reduce the smoke build run time The oracle test file was only covering a basic check of invalid configuration (Not essential for the smoke run) --- .../cypress/integration/datasources/datasourceWizard.spec.js | 2 +- packages/builder/cypress/integration/datasources/oracle.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js b/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js index 14653d8286..837a433951 100644 --- a/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js +++ b/packages/builder/cypress/integration/datasources/datasourceWizard.spec.js @@ -1,7 +1,7 @@ import filterTests from "../../support/filterTests" filterTests(['all'], () => { - context("Datasource Wizard", () => { + xcontext("Datasource Wizard", () => { if (Cypress.env("TEST_ENV")) { before(() => { cy.login() diff --git a/packages/builder/cypress/integration/datasources/oracle.spec.js b/packages/builder/cypress/integration/datasources/oracle.spec.js index 92a5737ff9..5d92d6b217 100644 --- a/packages/builder/cypress/integration/datasources/oracle.spec.js +++ b/packages/builder/cypress/integration/datasources/oracle.spec.js @@ -1,7 +1,7 @@ import filterTests from "../../support/filterTests" filterTests(["all"], () => { - context("Oracle Datasource Testing", () => { + xcontext("Oracle Datasource Testing", () => { if (Cypress.env("TEST_ENV")) { before(() => { cy.login() From 1e75e7c1e3f37d67972d06b6aae505f755683f8d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 7 Sep 2022 16:08:29 +0100 Subject: [PATCH 083/127] remove verify and fix deletion bug --- packages/bbui/src/Modal/ModalContent.svelte | 3 +- .../plugins/_components/AddPluginModal.svelte | 49 ++-------------- .../_components/DeletePluginModal.svelte | 5 +- .../plugins/_components/PluginRow.svelte | 58 +------------------ packages/builder/src/stores/portal/plugins.js | 3 +- packages/server/src/api/controllers/plugin.ts | 20 ++----- 6 files changed, 15 insertions(+), 123 deletions(-) diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index d946268da6..25fac63ec8 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -24,7 +24,6 @@ export let secondaryAction = undefined export let secondaryButtonWarning = false export let dataCy = null - export let buttonCta = true const { hide, cancel } = getContext(Context.Modal) let loading = false $: confirmDisabled = disabled || loading @@ -113,7 +112,7 @@
{/if} {/each} - -
-
- -
-
- {#if verificationSuccessful} - Verification Successful - {:else} - Verify your source - {/if} -
-
diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index 9703b30cb7..28f9bfc42d 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -50,11 +50,10 @@ export function createPluginsStore() { }) } - async function uploadPlugin(file, source, updatePlugin) { + async function uploadPlugin(file, source) { let data = new FormData() data.append("file", file) data.append("source", source) - data.append("update", updatePlugin) let resp = await API.uploadPlugin(data) let newPlugin = resp.plugins[0] update(state => { diff --git a/packages/server/src/api/controllers/plugin.ts b/packages/server/src/api/controllers/plugin.ts index a84a077b33..cb4d592812 100644 --- a/packages/server/src/api/controllers/plugin.ts +++ b/packages/server/src/api/controllers/plugin.ts @@ -39,11 +39,7 @@ export async function upload(ctx: any) { let docs = [] // can do single or multiple plugins for (let plugin of plugins) { - const doc = await processPlugin( - plugin, - ctx.request.body.source, - ctx.request.body.update - ) + const doc = await processPlugin(plugin, ctx.request.body.source) docs.push(doc) } ctx.body = { @@ -132,8 +128,7 @@ export async function destroy(ctx: any) { export async function storePlugin( metadata: any, directory: any, - source?: string, - update?: boolean + source?: string ) { const db = getGlobalDB() const version = metadata.package.version, @@ -172,9 +167,6 @@ export async function storePlugin( const existing = await db.get(pluginId) rev = existing._rev } catch (err) { - if (update) { - throw new Error("Unable to update. Plugin does not exist") - } rev = undefined } let doc = { @@ -201,15 +193,11 @@ export async function storePlugin( } } -export async function processPlugin( - plugin: FileType, - source?: string, - update?: boolean -) { +export async function processPlugin(plugin: FileType, source?: string) { if (!env.SELF_HOSTED) { throw new Error("Plugins not supported outside of self-host.") } const { metadata, directory } = await uploadedFilePlugin(plugin) - return await storePlugin(metadata, directory, source, update) + return await storePlugin(metadata, directory, source) } From ae578a3a01f5f2b190daa56f90836f3fe674d4e5 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 7 Sep 2022 15:10:29 +0000 Subject: [PATCH 084/127] v1.3.12-alpha.3 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lerna.json b/lerna.json index a74e653725..bee30cbc57 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 5f3414bab9..3f5cb33241 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "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.3.12-alpha.2", + "@budibase/types": "1.3.12-alpha.3", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 95fb5c855b..c9e35848f3 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "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.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.3", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 3d7e34b8d7..fb5a3d2244 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "1.3.12-alpha.2", - "@budibase/client": "1.3.12-alpha.2", - "@budibase/frontend-core": "1.3.12-alpha.2", - "@budibase/string-templates": "1.3.12-alpha.2", + "@budibase/bbui": "1.3.12-alpha.3", + "@budibase/client": "1.3.12-alpha.3", + "@budibase/frontend-core": "1.3.12-alpha.3", + "@budibase/string-templates": "1.3.12-alpha.3", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 3c11d7d624..497933ea76 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "1.3.12-alpha.2", - "@budibase/string-templates": "1.3.12-alpha.2", - "@budibase/types": "1.3.12-alpha.2", + "@budibase/backend-core": "1.3.12-alpha.3", + "@budibase/string-templates": "1.3.12-alpha.3", + "@budibase/types": "1.3.12-alpha.3", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 1df066dbdb..9166a8ead2 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "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.3.12-alpha.2", - "@budibase/frontend-core": "1.3.12-alpha.2", - "@budibase/string-templates": "1.3.12-alpha.2", + "@budibase/bbui": "1.3.12-alpha.3", + "@budibase/frontend-core": "1.3.12-alpha.3", + "@budibase/string-templates": "1.3.12-alpha.3", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index b686e3cea5..823a6a7458 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "1.3.12-alpha.2", + "@budibase/bbui": "1.3.12-alpha.3", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index c72c68817d..8524eebe27 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "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": "1.3.12-alpha.2", - "@budibase/client": "1.3.12-alpha.2", + "@budibase/backend-core": "1.3.12-alpha.3", + "@budibase/client": "1.3.12-alpha.3", "@budibase/pro": "1.3.12-alpha.2", - "@budibase/string-templates": "1.3.12-alpha.2", - "@budibase/types": "1.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.3", + "@budibase/types": "1.3.12-alpha.3", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 3c2e35aba6..da6ace54e7 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index c5164852ed..84f7431d7d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 85b7e4be7e..e5a5968084 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.3.12-alpha.2", + "version": "1.3.12-alpha.3", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "1.3.12-alpha.2", + "@budibase/backend-core": "1.3.12-alpha.3", "@budibase/pro": "1.3.12-alpha.2", - "@budibase/string-templates": "1.3.12-alpha.2", - "@budibase/types": "1.3.12-alpha.2", + "@budibase/string-templates": "1.3.12-alpha.3", + "@budibase/types": "1.3.12-alpha.3", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From c737168718ca4d3599afec93fb5748b17f93786a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 7 Sep 2022 15:13:50 +0000 Subject: [PATCH 085/127] Update pro version to 1.3.12-alpha.3 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 8524eebe27..896d920045 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "1.3.12-alpha.3", "@budibase/client": "1.3.12-alpha.3", - "@budibase/pro": "1.3.12-alpha.2", + "@budibase/pro": "1.3.12-alpha.3", "@budibase/string-templates": "1.3.12-alpha.3", "@budibase/types": "1.3.12-alpha.3", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 2a3db0f037..d89a21f0d3 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -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@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.2.tgz#cab9edd5bde68c245c1b01e29bdd1468cfb10031" - integrity sha512-8NEGk71xnctP9xHGhC9Y5Dy3ilBE8HAW6WtWueOv7SZupa6Y5x0hdtzaJJY1/6oEqnhW/eGYXvPQpffOtfpgYg== +"@budibase/backend-core@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.3.tgz#baf7ea0590db9e49db08e4e05b7d374a2ed05f20" + integrity sha512-8xkaJX2kA2n7LKNXJ9SSyQnvOYRPDxiZ6BKDEPNoOa0WjYZ/htCnUJxgjdnSSzSojqfdDf8eqxa+pGXA87ZU6Q== dependencies: - "@budibase/types" "1.3.12-alpha.2" + "@budibase/types" "1.3.12-alpha.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1179,13 +1179,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.2.tgz#d49accc3c6258e4a258ed60046aa8756f2993895" - integrity sha512-gu/nKTKtHIhqeLrvQfB1z6sIEePWN3453TtVldPgDdl4luVcax4RhktWAw4/Bxyn/NyU80rNjcmBTlMh59Hj0A== +"@budibase/pro@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.3.tgz#30dce4ba54aa7c19b60d6faf2852e3402c81ee50" + integrity sha512-qDddYE6XNbiNIpADUIhXWvgBjJMNxWhHdCpS7Qoci2tmoS4ofLlh5C8qKJuddg3RaLkWIQmII/p/ZnZ0uQ3E9A== dependencies: - "@budibase/backend-core" "1.3.12-alpha.2" - "@budibase/types" "1.3.12-alpha.2" + "@budibase/backend-core" "1.3.12-alpha.3" + "@budibase/types" "1.3.12-alpha.3" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1208,10 +1208,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.2.tgz#e95c6d963000c5b561e8c3007df02ae8fd2a4869" - integrity sha512-pyw10xOPb78deK3aZzhpYuXMGBVrUzAb7Z5AANzDFvi4ggInY6c2GGjrzL/PfHy3DeLZkYnPDxkvaF6GNF6Txw== +"@budibase/types@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.3.tgz#26c5f168281f5ead4a108af2918ce9810d92d239" + integrity sha512-dvs+KWlu+DdaVKAA6vU2qTZJmS4ACIllBSSjDeG0sGOBkIlGJSi5aC6zvkPXpaaZlbDQpDwao/9xNP+Ub8wj1g== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index e5a5968084..79754d4ee0 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "1.3.12-alpha.3", - "@budibase/pro": "1.3.12-alpha.2", + "@budibase/pro": "1.3.12-alpha.3", "@budibase/string-templates": "1.3.12-alpha.3", "@budibase/types": "1.3.12-alpha.3", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 52ab196d8f..02d5bc0e3a 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -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@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.2.tgz#cab9edd5bde68c245c1b01e29bdd1468cfb10031" - integrity sha512-8NEGk71xnctP9xHGhC9Y5Dy3ilBE8HAW6WtWueOv7SZupa6Y5x0hdtzaJJY1/6oEqnhW/eGYXvPQpffOtfpgYg== +"@budibase/backend-core@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.3.12-alpha.3.tgz#baf7ea0590db9e49db08e4e05b7d374a2ed05f20" + integrity sha512-8xkaJX2kA2n7LKNXJ9SSyQnvOYRPDxiZ6BKDEPNoOa0WjYZ/htCnUJxgjdnSSzSojqfdDf8eqxa+pGXA87ZU6Q== dependencies: - "@budibase/types" "1.3.12-alpha.2" + "@budibase/types" "1.3.12-alpha.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -326,21 +326,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.2.tgz#d49accc3c6258e4a258ed60046aa8756f2993895" - integrity sha512-gu/nKTKtHIhqeLrvQfB1z6sIEePWN3453TtVldPgDdl4luVcax4RhktWAw4/Bxyn/NyU80rNjcmBTlMh59Hj0A== +"@budibase/pro@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.3.12-alpha.3.tgz#30dce4ba54aa7c19b60d6faf2852e3402c81ee50" + integrity sha512-qDddYE6XNbiNIpADUIhXWvgBjJMNxWhHdCpS7Qoci2tmoS4ofLlh5C8qKJuddg3RaLkWIQmII/p/ZnZ0uQ3E9A== dependencies: - "@budibase/backend-core" "1.3.12-alpha.2" - "@budibase/types" "1.3.12-alpha.2" + "@budibase/backend-core" "1.3.12-alpha.3" + "@budibase/types" "1.3.12-alpha.3" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@1.3.12-alpha.2": - version "1.3.12-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.2.tgz#e95c6d963000c5b561e8c3007df02ae8fd2a4869" - integrity sha512-pyw10xOPb78deK3aZzhpYuXMGBVrUzAb7Z5AANzDFvi4ggInY6c2GGjrzL/PfHy3DeLZkYnPDxkvaF6GNF6Txw== +"@budibase/types@1.3.12-alpha.3": + version "1.3.12-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.3.12-alpha.3.tgz#26c5f168281f5ead4a108af2918ce9810d92d239" + integrity sha512-dvs+KWlu+DdaVKAA6vU2qTZJmS4ACIllBSSjDeG0sGOBkIlGJSi5aC6zvkPXpaaZlbDQpDwao/9xNP+Ub8wj1g== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From dcada36111d373d2c13bbfddc3f399adfa4bb632 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 17:05:17 +0100 Subject: [PATCH 086/127] Fix for #7431 - reboot didn't work at all previously which is why apps couldn't be published with it enabled, this is now a self host only feature, I've removed the ability to enable a reboot cron in the Cloud and it will not run the lookup/execution. --- packages/backend-core/src/db/utils.ts | 11 +++- .../automation/SetupPanel/CronBuilder.svelte | 16 ++++-- .../src/api/controllers/deploy/index.ts | 2 +- packages/server/src/automations/index.js | 9 ++-- packages/server/src/automations/triggers.js | 54 +++++++++++++++---- packages/server/src/automations/utils.ts | 30 +++++++---- packages/server/src/threads/automation.ts | 6 +++ .../types/src/documents/app/automation.ts | 4 ++ 8 files changed, 103 insertions(+), 29 deletions(-) diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts index 321ebd7f58..4926a60150 100644 --- a/packages/backend-core/src/db/utils.ts +++ b/packages/backend-core/src/db/utils.ts @@ -254,7 +254,16 @@ export async function getAllApps({ dev, all, idsOnly, efficient }: any = {}) { return false }) if (idsOnly) { - return appDbNames + const devAppIds = appDbNames.filter(appId => isDevAppID(appId)) + const prodAppIds = appDbNames.filter(appId => !isDevAppID(appId)) + switch (dev) { + case true: + return devAppIds + case false: + return prodAppIds + default: + return appDbNames + } } const appPromises = appDbNames.map((app: any) => // skip setup otherwise databases could be re-created diff --git a/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte index 93b8394b49..f2da863424 100644 --- a/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte +++ b/packages/builder/src/components/automation/SetupPanel/CronBuilder.svelte @@ -1,6 +1,7 @@
diff --git a/packages/server/src/api/controllers/deploy/index.ts b/packages/server/src/api/controllers/deploy/index.ts index 86718294de..2ac6c8a15c 100644 --- a/packages/server/src/api/controllers/deploy/index.ts +++ b/packages/server/src/api/controllers/deploy/index.ts @@ -125,7 +125,7 @@ async function deployApp(deployment: any) { const prodAppDoc = await db.get(DocumentType.APP_METADATA) appDoc._rev = prodAppDoc._rev } catch (err) { - // ignore the error - doesn't exist + delete appDoc._rev } // switch to production app ID diff --git a/packages/server/src/automations/index.js b/packages/server/src/automations/index.js index 9c23e35d1c..2baa868890 100644 --- a/packages/server/src/automations/index.js +++ b/packages/server/src/automations/index.js @@ -1,16 +1,19 @@ const { processEvent } = require("./utils") const { queue, shutdown } = require("./bullboard") -const { TRIGGER_DEFINITIONS } = require("./triggers") +const { TRIGGER_DEFINITIONS, rebootTrigger } = require("./triggers") const { ACTION_DEFINITIONS } = require("./actions") /** * This module is built purely to kick off the worker farm and manage the inputs/outputs */ -exports.init = function () { +exports.init = async function () { // this promise will not complete - return queue.process(async job => { + const promise = queue.process(async job => { await processEvent(job) }) + // on init we need to trigger any reboot automations + await rebootTrigger() + return promise } exports.getQueues = () => { diff --git a/packages/server/src/automations/triggers.js b/packages/server/src/automations/triggers.js index 216f24be02..395390113a 100644 --- a/packages/server/src/automations/triggers.js +++ b/packages/server/src/automations/triggers.js @@ -9,6 +9,7 @@ const { checkTestFlag } = require("../utilities/redis") const utils = require("./utils") const env = require("../environment") const { doInAppContext, getAppDB } = require("@budibase/backend-core/context") +const { getAllApps } = require("@budibase/backend-core/db") const TRIGGER_DEFINITIONS = definitions const JOB_OPTS = { @@ -16,24 +17,27 @@ const JOB_OPTS = { removeOnFail: true, } +async function getAllAutomations() { + const db = getAppDB() + let automations = await db.allDocs( + getAutomationParams(null, { include_docs: true }) + ) + return automations.rows.map(row => row.doc) +} + async function queueRelevantRowAutomations(event, eventType) { if (event.appId == null) { throw `No appId specified for ${eventType} - check event emitters.` } doInAppContext(event.appId, async () => { - const db = getAppDB() - let automations = await db.allDocs( - getAutomationParams(null, { include_docs: true }) - ) + let automations = await getAllAutomations() // filter down to the correct event type - automations = automations.rows - .map(automation => automation.doc) - .filter(automation => { - const trigger = automation.definition.trigger - return trigger && trigger.event === eventType - }) + automations = automations.filter(automation => { + const trigger = automation.definition.trigger + return trigger && trigger.event === eventType + }) for (let automation of automations) { let automationDef = automation.definition @@ -110,4 +114,34 @@ exports.externalTrigger = async function ( } } +exports.rebootTrigger = async () => { + // reboot cron option is only available on the main thread at + // startup and only usable in self host + if (env.isInThread() || !env.SELF_HOSTED) { + return + } + // iterate through all production apps, find the reboot crons + // and trigger events for them + const appIds = await getAllApps({ dev: false, idsOnly: true }) + for (let prodAppId of appIds) { + await doInAppContext(prodAppId, async () => { + let automations = await getAllAutomations() + let rebootEvents = [] + for (let automation of automations) { + if (utils.isRebootTrigger(automation)) { + const job = { + automation, + event: { + appId: prodAppId, + timestamp: Date.now(), + }, + } + rebootEvents.push(queue.add(job, JOB_OPTS)) + } + } + await Promise.all(rebootEvents) + }) + } +} + exports.TRIGGER_DEFINITIONS = TRIGGER_DEFINITIONS diff --git a/packages/server/src/automations/utils.ts b/packages/server/src/automations/utils.ts index e0979ac0d9..3093f147dc 100644 --- a/packages/server/src/automations/utils.ts +++ b/packages/server/src/automations/utils.ts @@ -17,6 +17,7 @@ import { tenancy } from "@budibase/backend-core" import { quotas } from "@budibase/pro" import { Automation } from "@budibase/types" +const REBOOT_CRON = "@reboot" const WH_STEP_ID = definitions.WEBHOOK.stepId const CRON_STEP_ID = definitions.CRON.stepId const Runner = new Thread(ThreadType.AUTOMATION) @@ -109,22 +110,33 @@ export async function clearMetadata() { await db.bulkDocs(automationMetadata) } +export function isCronTrigger(auto: Automation) { + return ( + auto && + auto.definition.trigger && + auto.definition.trigger.stepId === CRON_STEP_ID + ) +} + +export function isRebootTrigger(auto: Automation) { + const trigger = auto ? auto.definition.trigger : null + return isCronTrigger(auto) && trigger?.inputs.cron === REBOOT_CRON +} + /** * This function handles checking of any cron jobs that need to be enabled/updated. * @param {string} appId The ID of the app in which we are checking for webhooks * @param {object|undefined} automation The automation object to be updated. */ -export async function enableCronTrigger(appId: any, automation: any) { +export async function enableCronTrigger(appId: any, automation: Automation) { const trigger = automation ? automation.definition.trigger : null - function isCronTrigger(auto: any) { - return ( - auto && - auto.definition.trigger && - auto.definition.trigger.stepId === CRON_STEP_ID - ) - } + // need to create cron job - if (isCronTrigger(automation) && trigger?.inputs.cron) { + if ( + isCronTrigger(automation) && + !isRebootTrigger(automation) && + trigger?.inputs.cron + ) { // make a job id rather than letting Bull decide, makes it easier to handle on way out const jobId = `${appId}_cron_${newid()}` const job: any = await queue.add( diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index 3136155869..f64552a92f 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -458,6 +458,9 @@ class Orchestrator { export function execute(input: AutomationEvent, callback: WorkerCallback) { const appId = input.data.event.appId + if (!appId) { + throw new Error("Unable to execute, event doesn't contain app ID.") + } doInAppContext(appId, async () => { const automationOrchestrator = new Orchestrator( input.data.automation, @@ -475,6 +478,9 @@ export function execute(input: AutomationEvent, callback: WorkerCallback) { export const removeStalled = async (input: AutomationEvent) => { const appId = input.data.event.appId + if (!appId) { + throw new Error("Unable to execute, event doesn't contain app ID.") + } await doInAppContext(appId, async () => { const automationOrchestrator = new Orchestrator( input.data.automation, diff --git a/packages/types/src/documents/app/automation.ts b/packages/types/src/documents/app/automation.ts index 50562461e4..a038e73d11 100644 --- a/packages/types/src/documents/app/automation.ts +++ b/packages/types/src/documents/app/automation.ts @@ -25,6 +25,10 @@ export interface AutomationStep { export interface AutomationTrigger { id: string stepId: string + inputs: { + [key: string]: any + } + cronJobId?: string } export enum AutomationStatus { From 6cebd08aeceb7856ddc7cccb852fe6a8a8464a49 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 17:31:15 +0100 Subject: [PATCH 087/127] Encoding query string URI parameters for REST requests - #7683. --- packages/builder/src/helpers/data/utils.js | 2 +- packages/server/src/integrations/rest.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/helpers/data/utils.js b/packages/builder/src/helpers/data/utils.js index 647c2be33e..cd6a8cf481 100644 --- a/packages/builder/src/helpers/data/utils.js +++ b/packages/builder/src/helpers/data/utils.js @@ -46,7 +46,7 @@ export function buildQueryString(obj) { if (str !== "") { str += "&" } - str += `${key}=${value || ""}` + str += `${key}=${encodeURIComponent(value || "")}` } } return str diff --git a/packages/server/src/integrations/rest.ts b/packages/server/src/integrations/rest.ts index 284d2a921a..59eb1e9941 100644 --- a/packages/server/src/integrations/rest.ts +++ b/packages/server/src/integrations/rest.ts @@ -215,7 +215,7 @@ module RestModule { } } - const main = `${path}?${queryString}` + const main = `${path}?${encodeURIComponent(queryString)}` let complete = main if (this.config.url && !main.startsWith("http")) { complete = !this.config.url ? main : `${this.config.url}/${main}` From 758514a0188bc43d53a2e7b8f3a8959bbb91c46f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 17:45:14 +0100 Subject: [PATCH 088/127] Adding onTop attribute to tabs which allows setting the z-index for the container - #7679. --- packages/bbui/src/Tabs/Tabs.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/bbui/src/Tabs/Tabs.svelte b/packages/bbui/src/Tabs/Tabs.svelte index 74edc9cd02..7184aedbaf 100644 --- a/packages/bbui/src/Tabs/Tabs.svelte +++ b/packages/bbui/src/Tabs/Tabs.svelte @@ -10,6 +10,7 @@ export let noHorizPadding = false export let quiet = false export let emphasized = false + export let onTop = false export let size = "M" let thisSelected = undefined @@ -75,6 +76,7 @@ bind:this={container} class:spectrum-Tabs--quiet={quiet} class:noHorizPadding + class:onTop class:spectrum-Tabs--vertical={vertical} class:spectrum-Tabs--horizontal={!vertical} class="spectrum-Tabs spectrum-Tabs--size{size}" @@ -122,4 +124,7 @@ .noPadding { margin: 0; } + .onTop { + z-index: 100; + } From e783d667a5e06279d8ff7024383155325cf2f932 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 7 Sep 2022 17:49:29 +0100 Subject: [PATCH 089/127] fix build --- .../portal/manage/plugins/_components/AddPluginModal.svelte | 6 +++--- packages/server/src/api/controllers/plugin/utils.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte index f45eea9dc9..3520c18991 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte @@ -3,14 +3,14 @@ import { plugins } from "stores/portal" let authOptions = { + URL: ["Headers", "URL"], NPM: ["URL"], Github: ["Github Token", "URL"], - URL: ["Headers", "URL"], "File Upload": ["File Upload"], } let file - let sourceValue = "NPM" - let typeValue = "Datasource" + let sourceValue = "URL" + let typeValue = "Component" let dynamicValues = {} let validation diff --git a/packages/server/src/api/controllers/plugin/utils.js b/packages/server/src/api/controllers/plugin/utils.js index 86f8754a7a..df76ebc121 100644 --- a/packages/server/src/api/controllers/plugin/utils.js +++ b/packages/server/src/api/controllers/plugin/utils.js @@ -1,4 +1,3 @@ -import fetch from "node-fetch" import { createTempFolder, getPluginMetadata, @@ -8,6 +7,7 @@ import { deleteFolderFileSystem, } from "../../../utilities/fileSystem" import { join } from "path" +const fetch = require("node-fetch") export const uploadedFilePlugin = async file => { if (!file.name.endsWith(".tar.gz")) { From 673c3759345bf83a9fe32241baada8d25b4c2397 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 17:57:02 +0100 Subject: [PATCH 090/127] Fixing an issue with external tables containing time only fields. --- packages/server/src/utilities/rowProcessor/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/utilities/rowProcessor/utils.js b/packages/server/src/utilities/rowProcessor/utils.js index c80dae497c..d659cb6822 100644 --- a/packages/server/src/utilities/rowProcessor/utils.js +++ b/packages/server/src/utilities/rowProcessor/utils.js @@ -76,7 +76,7 @@ exports.processDates = (table, rows) => { if (schema.type !== FieldTypes.DATETIME) { continue } - if (!schema.ignoreTimezones) { + if (!schema.timeOnly && !schema.ignoreTimezones) { datesWithTZ.push(column) } } From 0e9dfc92275e543d43de4784e753d5b756f1e9e4 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 7 Sep 2022 18:11:17 +0100 Subject: [PATCH 091/127] fix build again --- packages/server/src/api/controllers/plugin/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/plugin/utils.js b/packages/server/src/api/controllers/plugin/utils.js index df76ebc121..e15a72789e 100644 --- a/packages/server/src/api/controllers/plugin/utils.js +++ b/packages/server/src/api/controllers/plugin/utils.js @@ -1,12 +1,12 @@ -import { +const { createTempFolder, getPluginMetadata, findFileRec, downloadTarballDirect, extractTarball, deleteFolderFileSystem, -} from "../../../utilities/fileSystem" -import { join } from "path" +} = require("../../../utilities/fileSystem") +const join = require("path") const fetch = require("node-fetch") export const uploadedFilePlugin = async file => { From c8468c39ea580222d8ad70040d58b24d6df64bb3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 18:30:17 +0100 Subject: [PATCH 092/127] Fixing #6980 - fixing choice of relational foreign key field name when working with fields named differently to the primary key. --- packages/server/src/api/controllers/row/ExternalRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index a1aecdb0f2..dd5778b9d9 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -534,7 +534,7 @@ module External { }) // this is the response from knex if no rows found const rows = !response[0].read ? response : [] - const storeTo = isMany ? field.throughFrom || linkPrimaryKey : manyKey + const storeTo = isMany ? field.throughFrom || linkPrimaryKey : fieldName related[storeTo] = { rows, isMany, tableId } } return related From c61a4df998c9fae069bda4db955fac4a4e51551a Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Sep 2022 19:15:05 +0100 Subject: [PATCH 093/127] Updating params in the REST interface so that they can be used in and out of the URL - meaning that updating in one place affects the other. Reduces a bit of the confusing UX around this - discussed in #7683. --- .../bindings/DrawerBindableInput.svelte | 10 ++- .../integration/KeyValueBuilder.svelte | 9 ++- .../rest/[query]/index.svelte | 66 +++++++++++++------ 3 files changed, 62 insertions(+), 23 deletions(-) diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index b8d418c62b..22d322985d 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -23,6 +23,7 @@ const dispatch = createEventDispatcher() let bindingDrawer let valid = true + let currentVal = value $: readableValue = runtimeToReadableBinding(bindings, value) $: tempValue = readableValue @@ -30,11 +31,17 @@ const saveBinding = () => { onChange(tempValue) + onBlur() bindingDrawer.hide() } const onChange = value => { - dispatch("change", readableToRuntimeBinding(bindings, value)) + currentVal = readableToRuntimeBinding(bindings, value) + dispatch("change", currentVal) + } + + const onBlur = () => { + dispatch("blur", currentVal) } @@ -45,6 +52,7 @@ readonly={isJS} value={isJS ? "(JavaScript function)" : readableValue} on:change={event => onChange(event.detail)} + on:blur={onBlur} {placeholder} {updateOnChange} /> diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 4ffb380aa4..28db6b61c6 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -107,7 +107,7 @@ placeholder={keyPlaceholder} readonly={readOnly} bind:value={field.name} - on:change={changed} + on:blur={changed} /> {#if options} +
@@ -123,8 +115,8 @@ Platform Here you can set up general platform settings. -
-
+
+
- + {infoMessage(source)} {#each authOptions[source] as option} - {#if option === "File Upload"} + {#if option.name === PluginSource.FILE}
- + {:else}
- - +
+ + {#if option.optional} + + {/if} +
+ {#if option.name === "Headers"} + + {:else} + + {/if}
{/if} {/each} diff --git a/packages/builder/src/stores/portal/plugins.js b/packages/builder/src/stores/portal/plugins.js index bfdec9ae6b..8997e8f49d 100644 --- a/packages/builder/src/stores/portal/plugins.js +++ b/packages/builder/src/stores/portal/plugins.js @@ -1,5 +1,6 @@ import { writable } from "svelte/store" import { API } from "api" +import { PluginSource } from "constants" export function createPluginsStore() { const { subscribe, set, update } = writable([]) @@ -24,13 +25,10 @@ export function createPluginsStore() { } switch (source) { - case "url": + case PluginSource.URL: pluginData.headers = auth break - case "npm": - pluginData.npmToken = auth - break - case "github": + case PluginSource.GITHUB: pluginData.githubToken = auth break } diff --git a/packages/server/src/api/controllers/plugin/file.ts b/packages/server/src/api/controllers/plugin/file.ts new file mode 100644 index 0000000000..3b21f08387 --- /dev/null +++ b/packages/server/src/api/controllers/plugin/file.ts @@ -0,0 +1,15 @@ +import { + createTempFolder, + getPluginMetadata, + extractTarball, +} from "../../../utilities/fileSystem" + +export async function fileUpload(file: { name: string; path: string }) { + if (!file.name.endsWith(".tar.gz")) { + throw new Error("Plugin must be compressed into a gzipped tarball.") + } + const path = createTempFolder(file.name.split(".tar.gz")[0]) + await extractTarball(file.path, path) + + return await getPluginMetadata(path) +} diff --git a/packages/server/src/api/controllers/plugin/github.ts b/packages/server/src/api/controllers/plugin/github.ts new file mode 100644 index 0000000000..cbd16f2386 --- /dev/null +++ b/packages/server/src/api/controllers/plugin/github.ts @@ -0,0 +1,75 @@ +import { getPluginMetadata } from "../../../utilities/fileSystem" +import fetch from "node-fetch" +import { downloadUnzipTarball } from "./utils" + +export async function request( + url: string, + headers: { [key: string]: string }, + err: string +) { + const response = await fetch(url, { headers }) + if (response.status >= 300) { + const respErr = await response.text() + throw new Error(`Error: ${err} - ${respErr}`) + } + return response.json() +} + +export async function githubUpload(url: string, name = "", token = "") { + let githubUrl = url + + if (!githubUrl.includes("https://github.com/")) { + throw new Error("The plugin origin must be from Github") + } + + if (url.includes(".git")) { + githubUrl = url.replace(".git", "") + } + + const githubApiUrl = githubUrl.replace( + "https://github.com/", + "https://api.github.com/repos/" + ) + const headers: any = token ? { Authorization: `Bearer ${token}` } : {} + const pluginDetails = await request( + githubApiUrl, + headers, + "Repository not found" + ) + const pluginName = pluginDetails.name || name + const pluginLatestReleaseUrl = pluginDetails?.["releases_url"] + ? pluginDetails?.["releases_url"].replace("{/id}", "/latest") + : undefined + if (!pluginLatestReleaseUrl) { + throw new Error("Github release not found") + } + + const pluginReleaseDetails = await request( + pluginLatestReleaseUrl, + headers, + "Github latest release not found" + ) + const pluginReleaseTarballAsset = pluginReleaseDetails?.assets?.find( + (x: any) => x?.["content_type"] === "application/gzip" + ) + const pluginLastReleaseTarballUrl = + pluginReleaseTarballAsset?.["browser_download_url"] + if (!pluginLastReleaseTarballUrl) { + throw new Error("Github latest release url not found") + } + + try { + const path = await downloadUnzipTarball( + pluginLastReleaseTarballUrl, + pluginName, + headers + ) + return await getPluginMetadata(path) + } catch (err: any) { + let errMsg = err?.message || err + if (errMsg === "unexpected response Not Found") { + errMsg = "Github release tarball not found" + } + throw new Error(errMsg) + } +} diff --git a/packages/server/src/api/controllers/plugin/index.ts b/packages/server/src/api/controllers/plugin/index.ts index 3f3914f5ef..18a64d23a5 100644 --- a/packages/server/src/api/controllers/plugin/index.ts +++ b/packages/server/src/api/controllers/plugin/index.ts @@ -1,11 +1,6 @@ import { ObjectStoreBuckets } from "../../../constants" import { loadJSFile } from "../../../utilities/fileSystem" -import { - uploadedNpmPlugin, - uploadedUrlPlugin, - uploadedGithubPlugin, - uploadedFilePlugin, -} from "./utils" +import { npmUpload, urlUpload, githubUpload, fileUpload } from "./uploaders" import { getGlobalDB } from "@budibase/backend-core/tenancy" import { validate } from "@budibase/backend-core/plugins" import { generatePluginID, getPluginParams } from "../../../db/utils" @@ -70,20 +65,20 @@ export async function create(ctx: any) { switch (source) { case PluginSource.NPM: const { metadata: metadataNpm, directory: directoryNpm } = - await uploadedNpmPlugin(url, name) + await npmUpload(url, name) metadata = metadataNpm directory = directoryNpm break case PluginSource.GITHUB: const { metadata: metadataGithub, directory: directoryGithub } = - await uploadedGithubPlugin(ctx, url, name, githubToken) + await githubUpload(url, name, githubToken) metadata = metadataGithub directory = directoryGithub break case PluginSource.URL: - const headersObj = JSON.parse(headers || null) || {} + const headersObj = headers || {} const { metadata: metadataUrl, directory: directoryUrl } = - await uploadedUrlPlugin(url, name, headersObj) + await urlUpload(url, name, headersObj) metadata = metadataUrl directory = directoryUrl break @@ -202,6 +197,6 @@ export async function processPlugin(plugin: FileType, source?: string) { throw new Error("Plugins not supported outside of self-host.") } - const { metadata, directory } = await uploadedFilePlugin(plugin) + const { metadata, directory } = await fileUpload(plugin) return await storePlugin(metadata, directory, source) } diff --git a/packages/server/src/api/controllers/plugin/npm.ts b/packages/server/src/api/controllers/plugin/npm.ts new file mode 100644 index 0000000000..9463fad44a --- /dev/null +++ b/packages/server/src/api/controllers/plugin/npm.ts @@ -0,0 +1,56 @@ +import { + getPluginMetadata, + findFileRec, + extractTarball, + deleteFolderFileSystem, +} from "../../../utilities/fileSystem" +import fetch from "node-fetch" +import { join } from "path" +import { downloadUnzipTarball } from "./utils" + +export async function npmUpload(url: string, name: string, headers = {}) { + let npmTarballUrl = url + let pluginName = name + + if ( + !npmTarballUrl.includes("https://www.npmjs.com") && + !npmTarballUrl.includes("https://registry.npmjs.org") + ) { + throw new Error("The plugin origin must be from NPM") + } + + if (!npmTarballUrl.includes(".tgz")) { + const npmPackageURl = url.replace( + "https://www.npmjs.com/package/", + "https://registry.npmjs.org/" + ) + const response = await fetch(npmPackageURl) + if (response.status !== 200) { + throw new Error("NPM Package not found") + } + + let npmDetails = await response.json() + pluginName = npmDetails.name + const npmVersion = npmDetails["dist-tags"].latest + npmTarballUrl = npmDetails?.versions?.[npmVersion]?.dist?.tarball + + if (!npmTarballUrl) { + throw new Error("NPM tarball url not found") + } + } + + const path = await downloadUnzipTarball(npmTarballUrl, pluginName, headers) + const tarballPluginFile = findFileRec(path, ".tar.gz") + if (!tarballPluginFile) { + throw new Error("Tarball plugin file not found") + } + + try { + await extractTarball(tarballPluginFile, path) + deleteFolderFileSystem(join(path, "package")) + } catch (err: any) { + throw new Error(err) + } + + return await getPluginMetadata(path) +} diff --git a/packages/server/src/api/controllers/plugin/uploaders.ts b/packages/server/src/api/controllers/plugin/uploaders.ts new file mode 100644 index 0000000000..90b3ab2e64 --- /dev/null +++ b/packages/server/src/api/controllers/plugin/uploaders.ts @@ -0,0 +1,4 @@ +export { fileUpload } from "./file" +export { githubUpload } from "./github" +export { npmUpload } from "./npm" +export { urlUpload } from "./url" diff --git a/packages/server/src/api/controllers/plugin/url.ts b/packages/server/src/api/controllers/plugin/url.ts new file mode 100644 index 0000000000..489631e114 --- /dev/null +++ b/packages/server/src/api/controllers/plugin/url.ts @@ -0,0 +1,12 @@ +import { downloadUnzipTarball } from "./utils" +import { getPluginMetadata } from "../../../utilities/fileSystem" + +export async function urlUpload(url: string, name = "", headers = {}) { + if (!url.includes(".tar.gz")) { + throw new Error("Plugin must be compressed into a gzipped tarball.") + } + + const path = await downloadUnzipTarball(url, name, headers) + + return await getPluginMetadata(path) +} diff --git a/packages/server/src/api/controllers/plugin/utils.js b/packages/server/src/api/controllers/plugin/utils.js deleted file mode 100644 index 37d8ad6c3d..0000000000 --- a/packages/server/src/api/controllers/plugin/utils.js +++ /dev/null @@ -1,153 +0,0 @@ -const { - createTempFolder, - getPluginMetadata, - findFileRec, - downloadTarballDirect, - extractTarball, - deleteFolderFileSystem, -} = require("../../../utilities/fileSystem") -const { join } = require("path") -const fetch = require("node-fetch") - -exports.uploadedFilePlugin = async file => { - if (!file.name.endsWith(".tar.gz")) { - throw new Error("Plugin must be compressed into a gzipped tarball.") - } - const path = createTempFolder(file.name.split(".tar.gz")[0]) - await extractTarball(file.path, path) - - return await getPluginMetadata(path) -} - -exports.uploadedNpmPlugin = async (url, name, headers = {}) => { - let npmTarballUrl = url - let pluginName = name - - if ( - !npmTarballUrl.includes("https://www.npmjs.com") && - !npmTarballUrl.includes("https://registry.npmjs.org") - ) { - throw new Error("The plugin origin must be from NPM") - } - - if (!npmTarballUrl.includes(".tgz")) { - const npmPackageURl = url.replace( - "https://www.npmjs.com/package/", - "https://registry.npmjs.org/" - ) - const response = await fetch(npmPackageURl) - if (response.status !== 200) { - throw new Error("NPM Package not found") - } - - let npmDetails = await response.json() - pluginName = npmDetails.name - const npmVersion = npmDetails["dist-tags"].latest - npmTarballUrl = npmDetails?.versions?.[npmVersion]?.dist?.tarball - - if (!npmTarballUrl) { - throw new Error("NPM tarball url not found") - } - } - - const path = await downloadUnzipTarball(npmTarballUrl, pluginName, headers) - const tarballPluginFile = findFileRec(path, ".tar.gz") - if (!tarballPluginFile) { - throw new Error("Tarball plugin file not found") - } - - try { - await extractTarball(tarballPluginFile, path) - deleteFolderFileSystem(join(path, "package")) - } catch (err) { - throw new Error(err) - } - - return await getPluginMetadata(path) -} - -exports.uploadedUrlPlugin = async (url, name = "", headers = {}) => { - if (!url.includes(".tar.gz")) { - throw new Error("Plugin must be compressed into a gzipped tarball.") - } - - const path = await downloadUnzipTarball(url, name, headers) - - return await getPluginMetadata(path) -} - -exports.uploadedGithubPlugin = async (ctx, url, name = "", token = "") => { - let githubUrl = url - - if (!githubUrl.includes("https://github.com/")) { - throw new Error("The plugin origin must be from Github") - } - - if (url.includes(".git")) { - githubUrl = url.replace(".git", "") - } - - const githubApiUrl = githubUrl.replace( - "https://github.com/", - "https://api.github.com/repos/" - ) - const headers = token ? { Authorization: `Bearer ${token}` } : {} - try { - const pluginRaw = await fetch(githubApiUrl, { headers }) - if (pluginRaw.status !== 200) { - throw new Error(`Repository not found`) - } - - let pluginDetails = await pluginRaw.json() - const pluginName = pluginDetails.name || name - - const pluginLatestReleaseUrl = pluginDetails?.["releases_url"] - ? pluginDetails?.["releases_url"].replace("{/id}", "/latest") - : undefined - if (!pluginLatestReleaseUrl) { - throw new Error("Github release not found") - } - - const pluginReleaseRaw = await fetch(pluginLatestReleaseUrl, { headers }) - if (pluginReleaseRaw.status !== 200) { - throw new Error("Github latest release not found") - } - const pluginReleaseDetails = await pluginReleaseRaw.json() - const pluginReleaseTarballAsset = pluginReleaseDetails?.assets?.find( - x => x?.content_type === "application/gzip" - ) - const pluginLastReleaseTarballUrl = - pluginReleaseTarballAsset?.browser_download_url - if (!pluginLastReleaseTarballUrl) { - throw new Error("Github latest release url not found") - } - - const path = await downloadUnzipTarball( - pluginLastReleaseTarballUrl, - pluginName, - headers - ) - - return await getPluginMetadata(path) - } catch (err) { - let errMsg = err?.message || err - - if (errMsg === "unexpected response Not Found") { - errMsg = "Github release tarbal not found" - } - - throw new Error(errMsg) - } -} - -const downloadUnzipTarball = async (url, name, headers = {}) => { - try { - const path = createTempFolder(name) - - await downloadTarballDirect(url, path, headers) - - return path - } catch (e) { - throw new Error(e.message) - } -} diff --git a/packages/server/src/api/controllers/plugin/utils.ts b/packages/server/src/api/controllers/plugin/utils.ts new file mode 100644 index 0000000000..0e92fbb987 --- /dev/null +++ b/packages/server/src/api/controllers/plugin/utils.ts @@ -0,0 +1,19 @@ +import { + createTempFolder, + downloadTarballDirect, +} from "../../../utilities/fileSystem" + +export async function downloadUnzipTarball( + url: string, + name: string, + headers = {} +) { + try { + const path = createTempFolder(name) + await downloadTarballDirect(url, path, headers) + + return path + } catch (e: any) { + throw new Error(e.message) + } +} From 6fae59a608e1c3182d3521412f31b8990b8cf9ff Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 12 Sep 2022 19:47:27 +0100 Subject: [PATCH 126/127] Update plugin description text --- .../portal/manage/plugins/_components/AddPluginModal.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte index 7df0ca2a8d..9e88cdacb8 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/AddPluginModal.svelte @@ -35,13 +35,13 @@ function infoMessage(optionName) { switch (optionName) { case PluginSource.URL: - return "Please specify a URL which directs to a built plugin TAR archive, you can provide headers if authentication is required." + return "Please specify a URL which directs to a built plugin TAR archive. You can provide headers if authentication is required." case PluginSource.NPM: return "Please specify the URL to a public NPM package which contains the built version of the plugin you wish to install." case PluginSource.GITHUB: return "Please specify the URL to a Github repository which contains built plugin releases. If this is a private repo you can provide a token to access it." case PluginSource.FILE: - return "Please provide a built plugin TAR archive, you can build a plugin locally using the Budibase CLI." + return "Please provide a built plugin TAR archive. You can build a plugin locally using the Budibase CLI." } } From bdcf717305c0a775f7ba281202385fe8ebab27ae Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 12 Sep 2022 19:50:04 +0100 Subject: [PATCH 127/127] Fix plugin rows not being keyed properly, causing incorrect notifications --- .../portal/manage/plugins/_components/DeletePluginModal.svelte | 2 +- .../src/pages/builder/portal/manage/plugins/index.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte index aed51e949e..6b09e7b276 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/_components/DeletePluginModal.svelte @@ -10,7 +10,7 @@ async function deletePlugin() { try { await plugins.deletePlugin(plugin._id) - notifications.success(`Plugin ${plugin?.name} deleted.`) + notifications.success(`Plugin ${plugin?.name} deleted`) dispatch("deleted") } catch (error) { const msg = error?.message ? error.message : JSON.stringify(error) diff --git a/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte b/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte index 2602f4a034..5d73447710 100644 --- a/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/plugins/index.svelte @@ -67,7 +67,7 @@
{#if filteredPlugins?.length} - {#each filteredPlugins as plugin} + {#each filteredPlugins as plugin (plugin._id)} {/each}