Merge branch 'master' into set-up-dd-version-and-code-tracking
This commit is contained in:
commit
b1541817d4
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.13.42",
|
"version": "2.13.43",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a0b13270c36dd188e2a953d026b4560a1208008e
|
Subproject commit b47ad3f33177345b9a1685f5dbc10953c8c1c7cc
|
|
@ -12,14 +12,20 @@ import { getCachedSelf } from "../utilities/global"
|
||||||
import env from "../environment"
|
import env from "../environment"
|
||||||
import { isWebhookEndpoint } from "./utils"
|
import { isWebhookEndpoint } from "./utils"
|
||||||
import { UserCtx, ContextUser } from "@budibase/types"
|
import { UserCtx, ContextUser } from "@budibase/types"
|
||||||
|
import tracer from "dd-trace"
|
||||||
|
|
||||||
export default async (ctx: UserCtx, next: any) => {
|
export default async (ctx: UserCtx, next: any) => {
|
||||||
|
return tracer.trace("currentapp middleware", {}, async span => {
|
||||||
// try to get the appID from the request
|
// try to get the appID from the request
|
||||||
let requestAppId = await utils.getAppIdFromCtx(ctx)
|
let requestAppId = await utils.getAppIdFromCtx(ctx)
|
||||||
if (!requestAppId) {
|
if (!requestAppId) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestAppId) {
|
||||||
|
span?.addTags({ app_id: requestAppId })
|
||||||
|
}
|
||||||
|
|
||||||
// deny access to application preview
|
// deny access to application preview
|
||||||
if (!env.isTest()) {
|
if (!env.isTest()) {
|
||||||
if (
|
if (
|
||||||
|
@ -57,7 +63,9 @@ export default async (ctx: UserCtx, next: any) => {
|
||||||
roleId = roleHeader
|
roleId = roleHeader
|
||||||
|
|
||||||
// Delete admin and builder flags so that the specified role is honoured
|
// Delete admin and builder flags so that the specified role is honoured
|
||||||
ctx.user = users.removePortalUserPermissions(ctx.user) as ContextUser
|
ctx.user = users.removePortalUserPermissions(
|
||||||
|
ctx.user
|
||||||
|
) as ContextUser
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Swallow error and do nothing
|
// Swallow error and do nothing
|
||||||
|
@ -111,4 +119,5 @@ export default async (ctx: UserCtx, next: any) => {
|
||||||
|
|
||||||
return next()
|
return next()
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
Row,
|
Row,
|
||||||
Table,
|
Table,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
import tracer from "dd-trace"
|
||||||
|
|
||||||
interface FormulaOpts {
|
interface FormulaOpts {
|
||||||
dynamic?: boolean
|
dynamic?: boolean
|
||||||
|
@ -50,8 +51,10 @@ export function processFormulas<T extends Row | Row[]>(
|
||||||
inputRows: T,
|
inputRows: T,
|
||||||
{ dynamic, contextRows }: FormulaOpts = { dynamic: true }
|
{ dynamic, contextRows }: FormulaOpts = { dynamic: true }
|
||||||
): T {
|
): T {
|
||||||
|
return tracer.trace("processFormulas", {}, span => {
|
||||||
|
span?.addTags({ table_id: table._id })
|
||||||
const rows = Array.isArray(inputRows) ? inputRows : [inputRows]
|
const rows = Array.isArray(inputRows) ? inputRows : [inputRows]
|
||||||
if (rows)
|
if (rows) {
|
||||||
for (let [column, schema] of Object.entries(table.schema)) {
|
for (let [column, schema] of Object.entries(table.schema)) {
|
||||||
if (schema.type !== FieldTypes.FORMULA) {
|
if (schema.type !== FieldTypes.FORMULA) {
|
||||||
continue
|
continue
|
||||||
|
@ -70,13 +73,19 @@ export function processFormulas<T extends Row | Row[]>(
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
let row = rows[i]
|
let row = rows[i]
|
||||||
let context = contextRows ? contextRows[i] : row
|
let context = contextRows ? contextRows[i] : row
|
||||||
|
let formula = schema.formula
|
||||||
rows[i] = {
|
rows[i] = {
|
||||||
...row,
|
...row,
|
||||||
[column]: processStringSync(schema.formula, context),
|
[column]: tracer.trace("processStringSync", {}, span => {
|
||||||
|
span?.addTags({ column })
|
||||||
|
return processStringSync(formula, context)
|
||||||
|
}),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Array.isArray(inputRows) ? rows : rows[0]
|
return Array.isArray(inputRows) ? rows : rows[0]
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue