Add min and max transformation functions (#10782)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-04-19 02:29:55 +05:00
committed by GitHub
parent db97de7c63
commit b9657d53d1
25 changed files with 155 additions and 13 deletions
@@ -105,6 +105,8 @@ import {
Insert,
LastValue,
LowerCase,
Max,
Min,
Modulo,
MonthFromDate,
Multiply,
@@ -696,7 +698,9 @@ export default async () => ({
YearFromDate,
MonthFromDate,
DayFromDate,
DateDifference
DateDifference,
Min,
Max
},
rollbacks: {
ToDoCloseRollback,
@@ -425,6 +425,40 @@ export function Floor (value: number): number {
return value
}
export async function Min (
value: number,
props: Record<string, any>,
control: ProcessControl,
execution: Execution
): Promise<number> {
const context = parseContext(props.value)
if (context !== undefined) {
const val = await getContextValue(props.value, control, execution)
if (typeof val !== 'number') return value
return Math.min(value, val)
} else if (typeof value === 'number' && typeof props.value === 'number') {
return Math.min(value, props.value)
}
return value
}
export async function Max (
value: number,
props: Record<string, any>,
control: ProcessControl,
execution: Execution
): Promise<number> {
const context = parseContext(props.value)
if (context !== undefined) {
const val = await getContextValue(props.value, control, execution)
if (typeof val !== 'number') return value
return Math.max(value, val)
} else if (typeof value === 'number' && typeof props.value === 'number') {
return Math.max(value, props.value)
}
return value
}
// #endregion
// #region Func