Merge branch 'master' of github.com:Budibase/budibase into develop
This commit is contained in:
commit
6dd5bd92b5
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Budibase backend core libraries used in server and worker",
|
"description": "Budibase backend core libraries used in server and worker",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/bbui",
|
"name": "@budibase/bbui",
|
||||||
"description": "A UI solution used in the different Budibase projects.",
|
"description": "A UI solution used in the different Budibase projects.",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"module": "dist/bbui.es.js",
|
"module": "dist/bbui.es.js",
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
"@adobe/spectrum-css-workflow-icons": "^1.2.1",
|
||||||
"@budibase/string-templates": "^1.0.89-alpha.0",
|
"@budibase/string-templates": "^1.0.90",
|
||||||
"@spectrum-css/actionbutton": "^1.0.1",
|
"@spectrum-css/actionbutton": "^1.0.1",
|
||||||
"@spectrum-css/actiongroup": "^1.0.1",
|
"@spectrum-css/actiongroup": "^1.0.1",
|
||||||
"@spectrum-css/avatar": "^3.0.2",
|
"@spectrum-css/avatar": "^3.0.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.89-alpha.0",
|
"@budibase/bbui": "^1.0.90",
|
||||||
"@budibase/client": "^1.0.89-alpha.0",
|
"@budibase/client": "^1.0.90",
|
||||||
"@budibase/frontend-core": "^1.0.89-alpha.0",
|
"@budibase/frontend-core": "^1.0.90",
|
||||||
"@budibase/string-templates": "^1.0.89-alpha.0",
|
"@budibase/string-templates": "^1.0.90",
|
||||||
"@sentry/browser": "5.19.1",
|
"@sentry/browser": "5.19.1",
|
||||||
"@spectrum-css/page": "^3.0.1",
|
"@spectrum-css/page": "^3.0.1",
|
||||||
"@spectrum-css/vars": "^3.0.1",
|
"@spectrum-css/vars": "^3.0.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
"description": "Budibase CLI, for developers, self hosting and migrations.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/client",
|
"name": "@budibase/client",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "dist/budibase-client.js",
|
"module": "dist/budibase-client.js",
|
||||||
"main": "dist/budibase-client.js",
|
"main": "dist/budibase-client.js",
|
||||||
|
@ -19,9 +19,9 @@
|
||||||
"dev:builder": "rollup -cw"
|
"dev:builder": "rollup -cw"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.89-alpha.0",
|
"@budibase/bbui": "^1.0.90",
|
||||||
"@budibase/frontend-core": "^1.0.89-alpha.0",
|
"@budibase/frontend-core": "^1.0.90",
|
||||||
"@budibase/string-templates": "^1.0.89-alpha.0",
|
"@budibase/string-templates": "^1.0.90",
|
||||||
"@spectrum-css/button": "^3.0.3",
|
"@spectrum-css/button": "^3.0.3",
|
||||||
"@spectrum-css/card": "^3.0.3",
|
"@spectrum-css/card": "^3.0.3",
|
||||||
"@spectrum-css/divider": "^1.0.3",
|
"@spectrum-css/divider": "^1.0.3",
|
||||||
|
|
|
@ -250,9 +250,9 @@ const exportDataHandler = async action => {
|
||||||
const data = await API.exportRows({
|
const data = await API.exportRows({
|
||||||
tableId: selection.tableId,
|
tableId: selection.tableId,
|
||||||
rows: selection.selectedRows,
|
rows: selection.selectedRows,
|
||||||
|
format: action.parameters.type,
|
||||||
})
|
})
|
||||||
|
download(data, `${selection.tableId}.${action.parameters.type}`)
|
||||||
download(JSON.stringify(data), `export.${action.parameters.type}`)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notificationStore.actions.error("There was an error exporting the data")
|
notificationStore.actions.error("There was an error exporting the data")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/frontend-core",
|
"name": "@budibase/frontend-core",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Budibase frontend core libraries used in builder and client",
|
"description": "Budibase frontend core libraries used in builder and client",
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"svelte": "src/index.js",
|
"svelte": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.89-alpha.0",
|
"@budibase/bbui": "^1.0.90",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"svelte": "^3.46.2"
|
"svelte": "^3.46.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,12 +66,15 @@ export const buildRowEndpoints = API => ({
|
||||||
* @param tableId the table ID to export the rows from
|
* @param tableId the table ID to export the rows from
|
||||||
* @param rows the array of rows to export
|
* @param rows the array of rows to export
|
||||||
*/
|
*/
|
||||||
exportRows: async ({ tableId, rows }) => {
|
exportRows: async ({ tableId, rows, format }) => {
|
||||||
return await API.post({
|
return await API.post({
|
||||||
url: `/api/${tableId}/rows/exportRows`,
|
url: `/api/${tableId}/rows/exportRows?format=${format}`,
|
||||||
body: {
|
body: {
|
||||||
rows,
|
rows,
|
||||||
},
|
},
|
||||||
|
parseResponse: async response => {
|
||||||
|
return await response.text()
|
||||||
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Budibase Web Server",
|
"description": "Budibase Web Server",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -71,9 +71,9 @@
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apidevtools/swagger-parser": "^10.0.3",
|
"@apidevtools/swagger-parser": "^10.0.3",
|
||||||
"@budibase/backend-core": "^1.0.89-alpha.0",
|
"@budibase/backend-core": "^1.0.90",
|
||||||
"@budibase/client": "^1.0.89-alpha.0",
|
"@budibase/client": "^1.0.90",
|
||||||
"@budibase/string-templates": "^1.0.89-alpha.0",
|
"@budibase/string-templates": "^1.0.90",
|
||||||
"@bull-board/api": "^3.7.0",
|
"@bull-board/api": "^3.7.0",
|
||||||
"@bull-board/koa": "^3.7.0",
|
"@bull-board/koa": "^3.7.0",
|
||||||
"@elastic/elasticsearch": "7.10.0",
|
"@elastic/elasticsearch": "7.10.0",
|
||||||
|
|
|
@ -10,6 +10,8 @@ const {
|
||||||
} = require("../../../integrations/utils")
|
} = require("../../../integrations/utils")
|
||||||
const ExternalRequest = require("./ExternalRequest")
|
const ExternalRequest = require("./ExternalRequest")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
|
const exporters = require("../view/exporters")
|
||||||
|
const { apiFileReturn } = require("../../../utilities/fileSystem")
|
||||||
|
|
||||||
async function handleRequest(operation, tableId, opts = {}) {
|
async function handleRequest(operation, tableId, opts = {}) {
|
||||||
// make sure the filters are cleaned up, no empty strings for equals, fuzzy or string
|
// make sure the filters are cleaned up, no empty strings for equals, fuzzy or string
|
||||||
|
@ -155,6 +157,7 @@ exports.validate = async () => {
|
||||||
exports.exportRows = async ctx => {
|
exports.exportRows = async ctx => {
|
||||||
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
|
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
|
||||||
const db = getAppDB()
|
const db = getAppDB()
|
||||||
|
let format = ctx.query.format
|
||||||
const datasource = await db.get(datasourceId)
|
const datasource = await db.get(datasourceId)
|
||||||
if (!datasource || !datasource.entities) {
|
if (!datasource || !datasource.entities) {
|
||||||
ctx.throw(400, "Datasource has not been configured for plus API.")
|
ctx.throw(400, "Datasource has not been configured for plus API.")
|
||||||
|
@ -164,13 +167,22 @@ exports.exportRows = async ctx => {
|
||||||
ctx.request.body = {
|
ctx.request.body = {
|
||||||
query: {
|
query: {
|
||||||
oneOf: {
|
oneOf: {
|
||||||
[table.primaryDisplay]: ctx.request.body.map(
|
[table.primaryDisplay]: ctx.request.body.rows.map(
|
||||||
id => breakRowIdField(id)[0]
|
id => breakRowIdField(id)[0]
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return exports.search(ctx)
|
|
||||||
|
let result = await exports.search(ctx)
|
||||||
|
|
||||||
|
let headers = Object.keys(result.rows[0])
|
||||||
|
const exporter = exporters[format]
|
||||||
|
const filename = `export.${format}`
|
||||||
|
|
||||||
|
// send down the file
|
||||||
|
ctx.attachment(filename)
|
||||||
|
return apiFileReturn(exporter(headers, result.rows))
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.fetchEnrichedRow = async ctx => {
|
exports.fetchEnrichedRow = async ctx => {
|
||||||
|
|
|
@ -27,6 +27,8 @@ const {
|
||||||
const { cloneDeep } = require("lodash/fp")
|
const { cloneDeep } = require("lodash/fp")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
const { finaliseRow, updateRelatedFormula } = require("./staticFormula")
|
const { finaliseRow, updateRelatedFormula } = require("./staticFormula")
|
||||||
|
const exporters = require("../view/exporters")
|
||||||
|
const { apiFileReturn } = require("../../../utilities/fileSystem")
|
||||||
|
|
||||||
const CALCULATION_TYPES = {
|
const CALCULATION_TYPES = {
|
||||||
SUM: "sum",
|
SUM: "sum",
|
||||||
|
@ -366,6 +368,7 @@ exports.exportRows = async ctx => {
|
||||||
const db = getAppDB()
|
const db = getAppDB()
|
||||||
const table = await db.get(ctx.params.tableId)
|
const table = await db.get(ctx.params.tableId)
|
||||||
const rowIds = ctx.request.body.rows
|
const rowIds = ctx.request.body.rows
|
||||||
|
let format = ctx.query.format
|
||||||
let response = (
|
let response = (
|
||||||
await db.allDocs({
|
await db.allDocs({
|
||||||
include_docs: true,
|
include_docs: true,
|
||||||
|
@ -375,7 +378,13 @@ exports.exportRows = async ctx => {
|
||||||
|
|
||||||
let rows = await outputProcessing(table, response)
|
let rows = await outputProcessing(table, response)
|
||||||
|
|
||||||
return rows
|
let headers = Object.keys(rows[0])
|
||||||
|
const exporter = exporters[format]
|
||||||
|
const filename = `export.${format}`
|
||||||
|
|
||||||
|
// send down the file
|
||||||
|
ctx.attachment(filename)
|
||||||
|
return apiFileReturn(exporter(headers, rows))
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.fetchEnrichedRow = async ctx => {
|
exports.fetchEnrichedRow = async ctx => {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import rowEndpoints from "./rows"
|
||||||
import userEndpoints from "./users"
|
import userEndpoints from "./users"
|
||||||
import usage from "../../../middleware/usageQuota"
|
import usage from "../../../middleware/usageQuota"
|
||||||
import authorized from "../../../middleware/authorized"
|
import authorized from "../../../middleware/authorized"
|
||||||
|
import publicApi from "../../../middleware/publicApi"
|
||||||
import { paramResource, paramSubResource } from "../../../middleware/resourceId"
|
import { paramResource, paramSubResource } from "../../../middleware/resourceId"
|
||||||
import { CtxFn } from "./utils/Endpoint"
|
import { CtxFn } from "./utils/Endpoint"
|
||||||
import mapperMiddleware from "./middleware/mapper"
|
import mapperMiddleware from "./middleware/mapper"
|
||||||
|
@ -101,6 +102,12 @@ function applyRoutes(
|
||||||
const paramMiddleware = subResource
|
const paramMiddleware = subResource
|
||||||
? paramSubResource(resource, subResource)
|
? paramSubResource(resource, subResource)
|
||||||
: paramResource(resource)
|
: paramResource(resource)
|
||||||
|
const publicApiMiddleware = publicApi({
|
||||||
|
requiresAppId:
|
||||||
|
permType !== PermissionTypes.APP && permType !== PermissionTypes.USER,
|
||||||
|
})
|
||||||
|
addMiddleware(endpoints.read, publicApiMiddleware)
|
||||||
|
addMiddleware(endpoints.write, publicApiMiddleware)
|
||||||
// add the parameter capture middleware
|
// add the parameter capture middleware
|
||||||
addMiddleware(endpoints.read, paramMiddleware)
|
addMiddleware(endpoints.read, paramMiddleware)
|
||||||
addMiddleware(endpoints.write, paramMiddleware)
|
addMiddleware(endpoints.write, paramMiddleware)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
const { Headers } = require("@budibase/backend-core/constants")
|
||||||
|
const { getAppId } = require("@budibase/backend-core/utils")
|
||||||
|
|
||||||
|
module.exports = function ({ requiresAppId } = {}) {
|
||||||
|
return async (ctx, next) => {
|
||||||
|
const appId = getAppId(ctx)
|
||||||
|
if (requiresAppId && !appId) {
|
||||||
|
ctx.throw(
|
||||||
|
400,
|
||||||
|
`Invalid app ID provided, please check the ${Headers.APP_ID} header.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!ctx.headers[Headers.API_KEY]) {
|
||||||
|
ctx.throw(
|
||||||
|
400,
|
||||||
|
`Invalid API key provided, please check the ${Headers.API_KEY} header.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return next()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "src/index.cjs",
|
"main": "src/index.cjs",
|
||||||
"module": "dist/bundle.mjs",
|
"module": "dist/bundle.mjs",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/worker",
|
"name": "@budibase/worker",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.89-alpha.0",
|
"version": "1.0.90",
|
||||||
"description": "Budibase background service",
|
"description": "Budibase background service",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
"author": "Budibase",
|
"author": "Budibase",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "^1.0.89-alpha.0",
|
"@budibase/backend-core": "^1.0.90",
|
||||||
"@budibase/string-templates": "^1.0.89-alpha.0",
|
"@budibase/string-templates": "^1.0.90",
|
||||||
"@koa/router": "^8.0.0",
|
"@koa/router": "^8.0.0",
|
||||||
"@sentry/node": "^6.0.0",
|
"@sentry/node": "^6.0.0",
|
||||||
"@techpass/passport-openidconnect": "^0.3.0",
|
"@techpass/passport-openidconnect": "^0.3.0",
|
||||||
|
|
Loading…
Reference in New Issue