mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-13 05:07:43 +02:00
EmptyValue process function (#10756)
* EmptyValue process function Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix formatting Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> --------- Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -94,6 +94,7 @@ import {
|
||||
DayFromDate,
|
||||
Divide,
|
||||
EmptyArray,
|
||||
EmptyValue,
|
||||
ExecutionInitiator,
|
||||
ExecutionStarted,
|
||||
Filter,
|
||||
@@ -680,6 +681,7 @@ export default async () => ({
|
||||
RemoveFirst,
|
||||
RemoveLast,
|
||||
EmptyArray,
|
||||
EmptyValue,
|
||||
ExecutionInitiator,
|
||||
ExecutionStarted,
|
||||
FirstMatchValue,
|
||||
|
||||
@@ -463,6 +463,10 @@ export async function CurrentDate (): Promise<Timestamp> {
|
||||
return Date.now()
|
||||
}
|
||||
|
||||
export function EmptyValue (): null {
|
||||
return null
|
||||
}
|
||||
|
||||
export function EmptyArray (): any[] {
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -247,12 +247,12 @@ async function getFunctionValue (
|
||||
const funcImpl = control.client.getHierarchy().as(transform, serverProcess.mixin.FuncImpl)
|
||||
const f = await getResource(funcImpl.func)
|
||||
const val = await f(res, {}, control, execution)
|
||||
if (val == null) {
|
||||
if (val == null && context.func !== process.function.EmptyValue) {
|
||||
throw processError(process.error.EmptyFunctionResult, {}, { func: func.label })
|
||||
}
|
||||
return val
|
||||
}
|
||||
if (res == null) {
|
||||
if (res == null && context.func !== process.function.EmptyValue) {
|
||||
throw processError(process.error.EmptyFunctionResult, {}, { func: func.label })
|
||||
}
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user