Add AllMatchValue function and related updates across multiple files (#10990)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-07-21 20:51:02 +05:00
committed by GitHub
parent 92eaefcc4d
commit c36dd74fef
21 changed files with 57 additions and 1 deletions
@@ -85,6 +85,7 @@ import { FieldChangedRollback, ToDoCancellRollback, ToDoCloseRollback } from './
import {
Absolute,
Add,
AllMatchValue,
All,
Append,
Ceil,
@@ -819,6 +820,7 @@ export default async () => ({
EmptyValue,
ExecutionInitiator,
ExecutionStarted,
AllMatchValue,
FirstMatchValue,
Filter,
StringFromNumber,
@@ -63,6 +63,26 @@ export async function FirstMatchValue (
}
}
export async function AllMatchValue (
value: any[],
props: Record<string, any>,
control: ProcessControl
): Promise<any[] | undefined> {
if (value == null) {
return
}
if (!Array.isArray(value)) return value
const { _class, ...otherProps } = props
if (_class == null) return
if (value.length === 0) return
if (typeof value[0] === 'string') {
const docs = await control.client.findAll(_class, { _id: { $in: value } })
return matchQuery(docs, otherProps, core.class.Doc, control.client.getHierarchy(), true).map((p) => p._id)
} else if (typeof value[0] === 'object') {
return matchQuery(value, otherProps, core.class.Doc, control.client.getHierarchy(), true)
}
}
// #endregion
// #region Array