Merge branch 'develop' of github.com:Budibase/budibase into feature/map-actions
This commit is contained in:
commit
44bc4f4f43
|
@ -63,6 +63,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git config user.name "Budibase Helm Bot"
|
git config user.name "Budibase Helm Bot"
|
||||||
git config user.email "<>"
|
git config user.email "<>"
|
||||||
|
git reset --hard
|
||||||
git pull
|
git pull
|
||||||
helm package charts/budibase
|
helm package charts/budibase
|
||||||
git checkout gh-pages
|
git checkout gh-pages
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/backend-core",
|
"name": "@budibase/backend-core",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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",
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { getSession, updateSessionTTL } = require("../security/sessions")
|
||||||
const { buildMatcherRegex, matches } = require("./matchers")
|
const { buildMatcherRegex, matches } = require("./matchers")
|
||||||
const env = require("../environment")
|
const env = require("../environment")
|
||||||
const { SEPARATOR, ViewNames, queryGlobalView } = require("../../db")
|
const { SEPARATOR, ViewNames, queryGlobalView } = require("../../db")
|
||||||
const { getGlobalDB } = require("../tenancy")
|
const { getGlobalDB, doInTenant } = require("../tenancy")
|
||||||
const { decrypt } = require("../security/encryption")
|
const { decrypt } = require("../security/encryption")
|
||||||
|
|
||||||
function finalise(
|
function finalise(
|
||||||
|
@ -25,20 +25,25 @@ async function checkApiKey(apiKey, populateUser) {
|
||||||
}
|
}
|
||||||
const decrypted = decrypt(apiKey)
|
const decrypted = decrypt(apiKey)
|
||||||
const tenantId = decrypted.split(SEPARATOR)[0]
|
const tenantId = decrypted.split(SEPARATOR)[0]
|
||||||
const db = getGlobalDB(tenantId)
|
return doInTenant(tenantId, async () => {
|
||||||
// api key is encrypted in the database
|
const db = getGlobalDB()
|
||||||
const userId = await queryGlobalView(
|
// api key is encrypted in the database
|
||||||
ViewNames.BY_API_KEY,
|
const userId = await queryGlobalView(
|
||||||
{
|
ViewNames.BY_API_KEY,
|
||||||
key: apiKey,
|
{
|
||||||
},
|
key: apiKey,
|
||||||
db
|
},
|
||||||
)
|
db
|
||||||
if (userId) {
|
)
|
||||||
return { valid: true, user: await getUser(userId, tenantId, populateUser) }
|
if (userId) {
|
||||||
} else {
|
return {
|
||||||
throw "Invalid API key"
|
valid: true,
|
||||||
}
|
user: await getUser(userId, tenantId, populateUser),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw "Invalid API key"
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ exports.getRedisOptions = (clustered = false) => {
|
||||||
let redisProtocolUrl
|
let redisProtocolUrl
|
||||||
|
|
||||||
// fully qualified redis URL
|
// fully qualified redis URL
|
||||||
if (/rediss?/.test(REDIS_URL)) {
|
if (/rediss?:\/\//.test(REDIS_URL)) {
|
||||||
redisProtocolUrl = REDIS_URL
|
redisProtocolUrl = REDIS_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"@budibase/string-templates": "^1.0.91-alpha.0",
|
||||||
"@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",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/builder",
|
"name": "@budibase/builder",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -65,10 +65,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/bbui": "^1.0.84-alpha.0",
|
"@budibase/bbui": "^1.0.91-alpha.0",
|
||||||
"@budibase/client": "^1.0.84-alpha.0",
|
"@budibase/client": "^1.0.91-alpha.0",
|
||||||
"@budibase/frontend-core": "^1.0.84-alpha.0",
|
"@budibase/frontend-core": "^1.0.91-alpha.0",
|
||||||
"@budibase/string-templates": "^1.0.84-alpha.0",
|
"@budibase/string-templates": "^1.0.91-alpha.0",
|
||||||
"@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",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/cli",
|
"name": "@budibase/cli",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"@budibase/bbui": "^1.0.91-alpha.0",
|
||||||
"@budibase/frontend-core": "^1.0.84-alpha.0",
|
"@budibase/frontend-core": "^1.0.91-alpha.0",
|
||||||
"@budibase/string-templates": "^1.0.84-alpha.0",
|
"@budibase/string-templates": "^1.0.91-alpha.0",
|
||||||
"@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")
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/frontend-core",
|
"name": "@budibase/frontend-core",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"@budibase/bbui": "^1.0.91-alpha.0",
|
||||||
"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()
|
||||||
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/server",
|
"name": "@budibase/server",
|
||||||
"email": "hi@budibase.com",
|
"email": "hi@budibase.com",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"@budibase/backend-core": "^1.0.91-alpha.0",
|
||||||
"@budibase/client": "^1.0.84-alpha.0",
|
"@budibase/client": "^1.0.91-alpha.0",
|
||||||
"@budibase/string-templates": "^1.0.84-alpha.0",
|
"@budibase/string-templates": "^1.0.91-alpha.0",
|
||||||
"@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"
|
||||||
|
@ -31,16 +32,24 @@ function getApiLimitPerSecond(): number {
|
||||||
|
|
||||||
if (!env.isTest()) {
|
if (!env.isTest()) {
|
||||||
const REDIS_OPTS = getRedisOptions()
|
const REDIS_OPTS = getRedisOptions()
|
||||||
RateLimit.defaultOptions({
|
let options
|
||||||
store: new Stores.Redis({
|
if (REDIS_OPTS.redisProtocolUrl) {
|
||||||
// @ts-ignore
|
// fully qualified redis URL
|
||||||
|
options = {
|
||||||
|
url: REDIS_OPTS.redisProtocolUrl,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options = {
|
||||||
socket: {
|
socket: {
|
||||||
host: REDIS_OPTS.host,
|
host: REDIS_OPTS.host,
|
||||||
port: REDIS_OPTS.port,
|
port: REDIS_OPTS.port,
|
||||||
},
|
},
|
||||||
password: REDIS_OPTS.opts.password,
|
password: REDIS_OPTS.opts.password,
|
||||||
database: 1,
|
database: 1,
|
||||||
}),
|
}
|
||||||
|
}
|
||||||
|
RateLimit.defaultOptions({
|
||||||
|
store: new Stores.Redis(options),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// rate limiting, allows for 2 requests per second
|
// rate limiting, allows for 2 requests per second
|
||||||
|
@ -93,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)
|
||||||
|
|
|
@ -8,5 +8,6 @@ export interface DatasourcePlus extends IntegrationBase {
|
||||||
// if the datasource supports the use of bindings directly (to protect against SQL injection)
|
// if the datasource supports the use of bindings directly (to protect against SQL injection)
|
||||||
// this returns the format of the identifier
|
// this returns the format of the identifier
|
||||||
getBindingIdentifier(): string
|
getBindingIdentifier(): string
|
||||||
|
getStringConcat(parts: string[]): string
|
||||||
buildSchema(datasourceId: string, entities: Record<string, Table>): any
|
buildSchema(datasourceId: string, entities: Record<string, Table>): any
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,10 @@ module GoogleSheetsModule {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStringConcat(parts: string[]) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull the spreadsheet ID out from a valid google sheets URL
|
* Pull the spreadsheet ID out from a valid google sheets URL
|
||||||
* @param spreadsheetId - the URL or standard spreadsheetId of the google sheet
|
* @param spreadsheetId - the URL or standard spreadsheetId of the google sheet
|
||||||
|
|
|
@ -126,7 +126,11 @@ module MSSQLModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
getBindingIdentifier(): string {
|
getBindingIdentifier(): string {
|
||||||
return `(@p${this.index++})`
|
return `@p${this.index++}`
|
||||||
|
}
|
||||||
|
|
||||||
|
getStringConcat(parts: string[]): string {
|
||||||
|
return `concat(${parts.join(", ")})`
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
|
|
|
@ -99,6 +99,10 @@ module MySQLModule {
|
||||||
return "?"
|
return "?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStringConcat(parts: string[]): string {
|
||||||
|
return `concat(${parts.join(", ")})`
|
||||||
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
this.client = await mysql.createConnection(this.config)
|
this.client = await mysql.createConnection(this.config)
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,6 +179,10 @@ module OracleModule {
|
||||||
return `:${this.index++}`
|
return `:${this.index++}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStringConcat(parts: string[]): string {
|
||||||
|
return parts.join(" || ")
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map the flat tabular columns and constraints data into a nested object
|
* Map the flat tabular columns and constraints data into a nested object
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -148,6 +148,10 @@ module PostgresModule {
|
||||||
return `$${this.index++}`
|
return `$${this.index++}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getStringConcat(parts: string[]): string {
|
||||||
|
return parts.join(" || ")
|
||||||
|
}
|
||||||
|
|
||||||
async internalQuery(query: SqlQuery) {
|
async internalQuery(query: SqlQuery) {
|
||||||
const client = this.client
|
const client = this.client
|
||||||
this.index = 1
|
this.index = 1
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,7 +37,20 @@ class QueryRunner {
|
||||||
for (let binding of bindings) {
|
for (let binding of bindings) {
|
||||||
let variable = integration.getBindingIdentifier()
|
let variable = integration.getBindingIdentifier()
|
||||||
variables.push(binding)
|
variables.push(binding)
|
||||||
sql = sql.replace(binding, variable)
|
// check if the variable was used as part of a string concat e.g. 'Hello {{binding}}'
|
||||||
|
const charConstRegex = new RegExp(`'[^']*${binding}[^']*'`)
|
||||||
|
const charConstMatch = sql.match(charConstRegex)
|
||||||
|
if (charConstMatch) {
|
||||||
|
let [part1, part2] = charConstMatch[0].split(binding)
|
||||||
|
part1 = `'${part1.substring(1)}'`
|
||||||
|
part2 = `'${part2.substring(0, part2.length - 1)}'`
|
||||||
|
sql = sql.replace(
|
||||||
|
charConstMatch[0],
|
||||||
|
integration.getStringConcat([part1, variable, part2])
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
sql = sql.replace(binding, variable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// replicate the knex structure
|
// replicate the knex structure
|
||||||
fields.sql = sql
|
fields.sql = sql
|
||||||
|
|
|
@ -995,10 +995,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@budibase/backend-core@^1.0.82":
|
"@budibase/backend-core@^1.0.84":
|
||||||
version "1.0.82"
|
version "1.0.84"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.82.tgz#9197da1dd0252c32957f6ec9a60bde489b4e87eb"
|
resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.84.tgz#9fb01669129838419c57f1723e9274cb4bb9dfd5"
|
||||||
integrity sha512-ObQ9Ik8rEQ6bWP1JZI+6GGD3T+JqyQEPIWBvLTOdYWefHaPkjrvi6CK6+UUQuZtMXQHDv2hyu+FolV/+EbzK9w==
|
integrity sha512-8hqRxSHO8A46f/hyzcqCdlku05yXBVEea1/FJdkoEDoCPhbuv04VHQ/f/dwkWctQ/oL8fm8MHpCA4ApyO7bnJA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@techpass/passport-openidconnect" "^0.3.0"
|
"@techpass/passport-openidconnect" "^0.3.0"
|
||||||
aws-sdk "^2.901.0"
|
aws-sdk "^2.901.0"
|
||||||
|
@ -1068,13 +1068,13 @@
|
||||||
svelte-flatpickr "^3.2.3"
|
svelte-flatpickr "^3.2.3"
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
|
|
||||||
"@budibase/bbui@^1.0.82":
|
"@budibase/bbui@^1.0.84":
|
||||||
version "1.0.82"
|
version "1.0.84"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.82.tgz#d84796d08dcaac6051a7306d24feb774882d2599"
|
resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-1.0.84.tgz#8bf2f3d93aaf71ae353f93b10cb34e06c99d8176"
|
||||||
integrity sha512-i566tYEp3dTWMq/KON3HP3q1QwWfCK010j1Gb8Od2MPZDC7Yqv9KogS5CEhJnCkmaytI2tn2R0rIg8f9nK2FSw==
|
integrity sha512-GO2qXq5wJ00YCdgl93fP1y9eLwAbX0fpt9WVqNYWcgUzAMkeQAOPr7S0ud05GwLZPo736exxqh6RzSwo5H73sg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
"@adobe/spectrum-css-workflow-icons" "^1.2.1"
|
||||||
"@budibase/string-templates" "^1.0.82"
|
"@budibase/string-templates" "^1.0.84"
|
||||||
"@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"
|
||||||
|
@ -1120,14 +1120,14 @@
|
||||||
svelte-flatpickr "^3.2.3"
|
svelte-flatpickr "^3.2.3"
|
||||||
svelte-portal "^1.0.0"
|
svelte-portal "^1.0.0"
|
||||||
|
|
||||||
"@budibase/client@^1.0.82":
|
"@budibase/client@^1.0.84":
|
||||||
version "1.0.82"
|
version "1.0.84"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.82.tgz#0f74753686ace1b41c33cde87a395f0e9560d569"
|
resolved "https://registry.yarnpkg.com/@budibase/client/-/client-1.0.84.tgz#7d29cd03a3611fb580ced1bb911b45e73a8c7832"
|
||||||
integrity sha512-WTiQSpPKcjvrZvJjVrW5qGYzx3D6/n5PUyuLzZHKrMWDd2Z1mfSQLED+tuiv7BOgVy27YUfqwLLCve/SMXL1tw==
|
integrity sha512-sZC3/7KQXPHS/jDyeTiPKK8Ri81JgtgInIfEvpd45V5jeg5kNo0L1m37xZgQEzQCqSqr47veM6WN7Kl3WYZr0g==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/bbui" "^1.0.82"
|
"@budibase/bbui" "^1.0.84"
|
||||||
"@budibase/frontend-core" "^1.0.82"
|
"@budibase/frontend-core" "^1.0.84"
|
||||||
"@budibase/string-templates" "^1.0.82"
|
"@budibase/string-templates" "^1.0.84"
|
||||||
"@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"
|
||||||
|
@ -1147,12 +1147,12 @@
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
svelte-spa-router "^3.0.5"
|
svelte-spa-router "^3.0.5"
|
||||||
|
|
||||||
"@budibase/frontend-core@^1.0.82":
|
"@budibase/frontend-core@^1.0.84":
|
||||||
version "1.0.82"
|
version "1.0.84"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/frontend-core/-/frontend-core-1.0.82.tgz#118953d7a6b9d4f4e9954fb0f20a51b2fc2fccd7"
|
resolved "https://registry.yarnpkg.com/@budibase/frontend-core/-/frontend-core-1.0.84.tgz#d21594ddb521b79e2ac1b5322903887268f8a9aa"
|
||||||
integrity sha512-WwUuKl47sz5use36d/qoj7zTuBwb6OlYLla7FRpCoALOoQiU9SVUVu/tFTsC9K0v9v7Gwb86qXoamzovIMzG7A==
|
integrity sha512-v6vTIVq8p+1ytnCWckYUqzzJ4Ylo6DF4C/pi2x5UrZxZuU7tQPMYGktHGQOouosHoGoZXsnPXJooeFHy43j0OQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/bbui" "^1.0.82"
|
"@budibase/bbui" "^1.0.84"
|
||||||
lodash "^4.17.21"
|
lodash "^4.17.21"
|
||||||
svelte "^3.46.2"
|
svelte "^3.46.2"
|
||||||
|
|
||||||
|
@ -1199,10 +1199,10 @@
|
||||||
svelte-apexcharts "^1.0.2"
|
svelte-apexcharts "^1.0.2"
|
||||||
svelte-flatpickr "^3.1.0"
|
svelte-flatpickr "^3.1.0"
|
||||||
|
|
||||||
"@budibase/string-templates@^1.0.82":
|
"@budibase/string-templates@^1.0.84":
|
||||||
version "1.0.82"
|
version "1.0.84"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.82.tgz#562e862d0eac279b72135cb34996ee347edabafd"
|
resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-1.0.84.tgz#66669e9898ed20c6be2c46a5eb19d55003eb6bcb"
|
||||||
integrity sha512-6/zPqAJhQ4ZVMatzi3Fu4ht0KLDnEEoPFdjOqHjZEK2B3OoIHy0ZkRPf6g5dSYvv2QujATEYAJvzhemVSLMd6g==
|
integrity sha512-6Tv/TfGkmr3uBwNdZ3eKAPKwdsRTZbuQ+02puH+EcJK2leCerINo1SpAHf1BOmjQJynKeslKpSkUiisRVerMEg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/handlebars-helpers" "^0.11.8"
|
"@budibase/handlebars-helpers" "^0.11.8"
|
||||||
dayjs "^1.10.4"
|
dayjs "^1.10.4"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@budibase/string-templates",
|
"name": "@budibase/string-templates",
|
||||||
"version": "1.0.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"version": "1.0.91-alpha.0",
|
||||||
"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.84-alpha.0",
|
"@budibase/backend-core": "^1.0.91-alpha.0",
|
||||||
"@budibase/string-templates": "^1.0.84-alpha.0",
|
"@budibase/string-templates": "^1.0.91-alpha.0",
|
||||||
"@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",
|
||||||
|
|
|
@ -85,7 +85,12 @@ exports.setInitInfo = ctx => {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getInitInfo = ctx => {
|
exports.getInitInfo = ctx => {
|
||||||
ctx.body = getCookie(ctx, Cookies.Init) || {}
|
try {
|
||||||
|
ctx.body = getCookie(ctx, Cookies.Init) || {}
|
||||||
|
} catch (err) {
|
||||||
|
clearCookie(ctx, Cookies.Init)
|
||||||
|
ctx.body = {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue