MCPcopy Index your code
hub / github.com/directus/directus / constructOperationTree

Function constructOperationTree

api/src/utils/construct-flow-tree.ts:18–37  ·  view source on GitHub ↗
(root: OperationRaw | null, operations: OperationRaw[])

Source from the content-addressed store, hash-verified

16}
17
18function constructOperationTree(root: OperationRaw | null, operations: OperationRaw[]): Operation | null {
19 if (root === null) {
20 return null;
21 }
22
23 const resolveOperation = root.resolve !== null ? operations.find((operation) => operation.id === root.resolve) : null;
24 const rejectOperation = root.reject !== null ? operations.find((operation) => operation.id === root.reject) : null;
25
26 if (resolveOperation === undefined || rejectOperation === undefined) {
27 throw new Error('Undefined reference in operations');
28 }
29
30 const operationTree: Operation = {
31 ...omit(root, 'flow'),
32 resolve: constructOperationTree(resolveOperation, operations),
33 reject: constructOperationTree(rejectOperation, operations),
34 };
35
36 return operationTree;
37}

Callers 1

constructFlowTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected