@openforis/arena-core 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAc,cAAc,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAgC,KAAK,EAAY,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAwD,QAAQ,EAAe,MAAM,eAAe,CAAA;AAC3G,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAe,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAc/D,MAAM,cAAc,GAAG,CAAC,MAAc,EAA0B,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAA;AAErF,MAAM,YAAY,GAAG,CAA4B,MAAwB,EAAsB,EAAE,CAC/F,CAAC,CAAC,MAA6B,EAAE,EAAE,CACjC,cAAc,CAAC,MAAM,CAAC;IACpB,CAAC,CAAC,MAAM,CAAC,MAAW,CAAC;IACrB,CAAC,CAAC,CAAC,MAAmB,EAAE,EAAE,CAAC,MAAM,CAAC,gCAAK,MAAM,KAAE,MAAM,GAAO,CAAC,CAAuB,CAAA;AAY1F,MAAM,sBAAsB,GAAG,CAA4B,MAI1D,EAAmC,EAAE;IACpC,MAAM,EAAE,MAAM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AC9E,CAAC,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;IAC5G,YAAY,EAAE,YAAY;IAC1B,QAAQ,EAAE,CAAC,IAAqB,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;CAChD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAC;IAChD,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAA4C,EAAW,EAAE,CAC9E,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,YAAY;IAC1B,QAAQ,EAAE,CAAC,IAAqB,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;CAChD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAW,EAAE;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,mBAAmB,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,sBAAsB,CAAA","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\ntype RecordParams = { record: ArenaRecord }\n\n/**\n * Record getter: takes the parameters first and the record as separate (curried) parameter: `getter(params)(record)`.\n * The deprecated form, with the record inside the parameters (`getter({ record, ...params })`), is still supported.\n */\ntype RecordGetter<P extends RecordParams, R> = {\n /** @deprecated Pass the record as separate parameter: `getter(params)(record)` */\n (params: P): R\n (params: Omit<P, 'record'>): (record: ArenaRecord) => R\n}\n\nconst isRecordParams = (params: object): params is RecordParams => 'record' in params\n\nconst recordGetter = <P extends RecordParams, R>(getter: (params: P) => R): RecordGetter<P, R> =>\n ((params: P | Omit<P, 'record'>) =>\n isRecordParams(params)\n ? getter(params as P)\n : (record: ArenaRecord) => getter({ ...params, record } as P)) as RecordGetter<P, R>\n\n/**\n * Record getter (with parameters object) that also supports the deprecated form with positional parameters:\n * `getter(arg1, arg2)(record)`.\n */\ntype PositionalRecordGetter<P, A extends unknown[], R> = {\n (params: P): (record: ArenaRecord) => R\n /** @deprecated Pass the parameters as an object: `getter({ ...params })(record)` */\n (...args: A): (record: ArenaRecord) => R\n}\n\nconst positionalRecordGetter = <P, A extends unknown[], R>(params: {\n getter: (params: P & RecordParams) => R\n isPositional: (firstArg: unknown) => boolean\n toParams: (...args: A) => NoInfer<P>\n}): PositionalRecordGetter<P, A, R> => {\n const { getter, isPositional, toParams } = params\n return ((...args: unknown[]) => {\n const getterParams = isPositional(args[0]) ? toParams(...(args as A)) : (args[0] as P)\n return (record: ArenaRecord) => getter({ ...getterParams, record })\n }) as PositionalRecordGetter<P, A, R>\n}\n\nconst isRecordNode = (arg: unknown): arg is ArenaRecordNode =>\n typeof arg === 'object' && arg !== null && 'uuid' in arg && 'nodeDefUuid' in arg\nconst isString = (arg: unknown): arg is string => typeof arg === 'string'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\nexport const getNodeByUuid = positionalRecordGetter({\n getter: ({ record, uuid }: RecordParams & { uuid: string }): ArenaRecordNode | undefined => record.nodes?.[uuid],\n isPositional: isString,\n toParams: (uuid: string) => ({ uuid }),\n})\n\nexport const getNodesByUuids = positionalRecordGetter({\n getter: ({ record, uuids }: RecordParams & { uuids: string[] }): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[],\n isPositional: Array.isArray,\n toParams: (uuids: string[]) => ({ uuids }),\n})\n\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid({ uuid: rootUuid })(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid?: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: childrenUuids })(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid?: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getChild = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid: string }): ArenaRecordNode => {\n const children = getChildren({ parentNode, childDefUuid })(record)\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n if (children.length === 1) {\n return children[0]\n }\n if (children.length > 1) {\n throw new SystemError('systemError.record.multipleNodesFound', errorParams)\n }\n throw new SystemError('systemError.record.childNotFound', errorParams)\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getParent = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode | undefined =>\n node.parentUuid ? getNodeByUuid({ uuid: node.parentUuid })(record) : undefined,\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getNodesByDefUuid = positionalRecordGetter({\n getter: ({ record, nodeDefUuid }: RecordParams & { nodeDefUuid: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n },\n isPositional: isString,\n toParams: (nodeDefUuid: string) => ({ nodeDefUuid }),\n})\n\nconst isNodeFlagTrue = (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n recordGetter((params: RecordParams & { node: ArenaRecordNode }): boolean => {\n const { record, node } = params\n const ancestorsAndSelf = getAncestorsAndSelf({ node })(record)\n for (let i = 0; i < ancestorsAndSelf.length - 1; i++) {\n const child = ancestorsAndSelf[i]\n const parent = ancestorsAndSelf[i + 1]\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n }\n return true\n })\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\nexport const getDependentCodeAttributes = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n throw new SystemError('record.nodesIndexNotInitialized')\n },\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getParentCodeAttribute =\n (params: { parentNode: ArenaRecordNode; nodeDef: NodeDefCode }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { parentNode, nodeDef } = params\n\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf({ node: parentNode })(record)\n for (const ancestor of ancestors) {\n const children = getChildren({ parentNode: ancestor, childDefUuid: parentCodeDefUuid })(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf = positionalRecordGetter({\n getter: ({\n record,\n node,\n visitor,\n }: RecordParams & { node: ArenaRecordNode; visitor: (node: ArenaRecordNode) => boolean | void }): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParent({ node: currentNode })(record)\n }\n },\n isPositional: isRecordNode,\n // deprecated form: the visit stops when stopIfFn returns true\n toParams: (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => void, stopIfFn?: () => boolean) => ({\n node,\n visitor: (visitedNode: ArenaRecordNode): boolean => {\n visitor(visitedNode)\n return !!stopIfFn?.()\n },\n }),\n})\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf({\n node,\n visitor: (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n },\n })(record)\n return result\n }\n\nexport const getAncestor = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; ancestorDefUuid: string }): ArenaRecordNode | undefined => {\n const { record, node, ancestorDefUuid } = params\n if (node.nodeDefUuid === ancestorDefUuid) return node\n\n let ancestor = getParent({ node })(record)\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParent({ node: ancestor })(record)\n }\n return ancestor\n }\n)\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode }): Array<ArenaRecordNode> => {\n const { record, node } = params\n const ancestors: Array<ArenaRecordNode> = []\n visitAncestorsAndSelf({\n node,\n visitor: (currentNode) => {\n ancestors.push(currentNode)\n },\n })(record)\n return ancestors\n }\n)\n\n// descendants\n\nexport const getDescendantsOrSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode[] => {\n const { record, node, nodeDefDescendant } = params\n\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(\n ...getChildren({ parentNode: currentAncestor, childDefUuid: currentDescendantDefUuid })(record)\n )\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n)\n\nexport const getDescendant = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode => {\n const { record, node, nodeDefDescendant } = params\n\n return getDescendantsOrSelf({ node, nodeDefDescendant })(record)[0]\n }\n)\n\nexport const isDescendantOf = (params: { node: ArenaRecordNode; ancestor: ArenaRecordNode }): boolean => {\n const { node, ancestor } = params\n return Nodes.getHierarchy(node).includes(ancestor.uuid)\n}\n\nexport const visitDescendantsAndSelf = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n visitor: (node: ArenaRecordNode) => boolean | void\n traverseMethod?: TraverseMethod\n }): void => {\n const { record, node, visitor, traverseMethod = TraverseMethod.bfs } = params\n\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren({ parentNode: visitedNode })(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n)\n\nexport const findDescendantOrSelf =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let found = undefined\n\n visitDescendantsAndSelf({\n node,\n visitor: (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n },\n })(record)\n return found\n }\n\nconst getClosestAncestorNode = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n dependentDef: NodeDef<NodeDefType, NodeDefProps>\n dependencyType: SurveyDependencyType\n }): ArenaRecordNode | undefined => {\n const { record, node, nodeDef, dependentDef, dependencyType } = params\n\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent({ node })(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor({ node, ancestorDefUuid: commonAncestorDefUuid })(record)\n }\n)\n\ntype EntityKeyNodesGetterParams = {\n survey: Survey\n cycle?: string\n record: ArenaRecord\n entity: ArenaRecordNode\n keyDefs?: NodeDef<NodeDefType, NodeDefProps>[]\n}\n\nexport const getEntityKeyNodesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): NodesMap => {\n const { survey, cycle, record, entity, keyDefs } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant({ node: entity, nodeDefDescendant: nodeDefKey })(record)\n acc[nodeDefKey.uuid] = nodeKey\n return acc\n }, {})\n})\n\nexport const getEntityKeyNodes = recordGetter(\n ({ record, ...otherParams }: EntityKeyNodesGetterParams): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(otherParams)(record))\n)\n\nexport const getEntityKeyValuesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): Dictionary<any> => {\n const { record, ...otherParams } = params\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(otherParams)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n})\n\nexport const getEntityKeyValues = recordGetter(({ record, ...otherParams }: EntityKeyNodesGetterParams): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(otherParams)(record))\n)\n\nexport const getEntitySiblings = recordGetter(\n (params: { record: ArenaRecord; entity: ArenaRecordNode; includeSelf?: boolean }) => {\n const { record, entity, includeSelf = false } = params\n const parentEntity = getParent({ node: entity })(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entity.nodeDefUuid })(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n)\n\nexport const getAttributeSiblings = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) => {\n const { record, node, nodeDef } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings({ entity: parentEntity })(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren({ parentNode: siblingEntity, childDefUuid: nodeDef.uuid })(record))\n return siblingsAcc\n }, [])\n }\n)\n\nexport const getNodeIndex = recordGetter((params: { record: ArenaRecord; node: ArenaRecordNode }) => {\n const { record, node } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren({ parentNode: parentEntity, childDefUuid: node.nodeDefUuid })(record)\n return siblings.indexOf(node)\n})\n\nexport const findEntityByKeyValues = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n entityDefUuid: string\n keyValuesByDefUuid: Dictionary<any>\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, record, parentEntity, entityDefUuid, keyValuesByDefUuid } = params\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entityDefUuid })(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid({ survey, entity: siblingEntity, keyDefs })(\n record\n )\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n)\n\nexport const findEntityWithSameKeysInAnotherRecord = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n entityUuid: string\n record: ArenaRecord\n recordOther: ArenaRecord\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, entityUuid, record, recordOther } = params\n const entity = getNodeByUuid({ uuid: entityUuid })(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf({ node: entity })(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid({ survey, entity: ancestor })(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues({\n survey,\n cycle,\n parentEntity: otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid,\n })(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n)\n\nexport const getDependentNodePointers = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n node: ArenaRecordNode\n dependencyType: SurveyDependencyType\n includeSelf?: boolean\n filterFn?: (nodePointer: NodePointer) => boolean\n }) => {\n const { survey, record, node, dependencyType, includeSelf = false, filterFn = null } = params\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode({ node, nodeDef, dependentDef, dependencyType })(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError('record.nodes.dependents.dependencyOnRootFound')\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf({\n node: commonAncestorNode,\n nodeDefDescendant: nodeDefDependentParent,\n })(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent({ node })(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n)\n\nexport const getAncestorCodePath = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n parentNode: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n }): string[] => {\n const { record, parentNode, nodeDef, survey } = params\n\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef })(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef: ancestorCodeDef })(record)\n }\n return codePaths\n }\n)\n\nexport const getCategoryItemUuid = recordGetter(\n (params: {\n survey: Survey\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n record: ArenaRecord\n parentNode: ArenaRecordNode\n code: string\n }): string | undefined => {\n const { survey, nodeDef, record, parentNode, code } = params\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath({ survey, parentNode, nodeDef })(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n)\n\nexport const isNodeFilledByUser = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !!findDescendantOrSelf({ node, predicate: (visitedNode) => Nodes.hasUserInputValue(visitedNode) })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isNodeEmpty = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !isNodeFilledByUser({ node })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty({ node: rootNode })(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
1
+ {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAc,cAAc,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAgC,KAAK,EAAY,MAAM,YAAY,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAwD,QAAQ,EAAe,MAAM,eAAe,CAAA;AAC3G,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAe,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAc/D,MAAM,cAAc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AC,CAAC,CAAC,CAAC,IAAI,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,mBAAmB,GAAA,CAAA;AAE1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,sBAAsB,CAAA","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport type RecordParams = { record: ArenaRecord }\n\n/**\n * Record getter: takes the parameters first and the record as separate (curried) parameter: `getter(params)(record)`.\n * The deprecated form, with the record inside the parameters (`getter({ record, ...params })`), is still supported.\n */\nexport type RecordGetter<P extends RecordParams, R> = {\n /** @deprecated Pass the record as separate parameter: `getter(params)(record)` */\n (params: P): R\n (params: Omit<P, 'record'>): (record: ArenaRecord) => R\n}\n\nconst isRecordParams = (params: object): params is RecordParams => 'record' in params\n\nconst recordGetter = <P extends RecordParams, R>(getter: (params: P) => R): RecordGetter<P, R> =>\n ((params: P | Omit<P, 'record'>) =>\n isRecordParams(params)\n ? getter(params as P)\n : (record: ArenaRecord) => getter({ ...params, record } as P)) as RecordGetter<P, R>\n\n/**\n * Record getter (with parameters object) that also supports the deprecated form with positional parameters:\n * `getter(arg1, arg2)(record)`.\n */\nexport type PositionalRecordGetter<P, A extends unknown[], R> = {\n (params: P): (record: ArenaRecord) => R\n /** @deprecated Pass the parameters as an object: `getter({ ...params })(record)` */\n (...args: A): (record: ArenaRecord) => R\n}\n\nconst positionalRecordGetter = <P, A extends unknown[], R>(params: {\n getter: (params: P & RecordParams) => R\n isPositional: (firstArg: unknown) => boolean\n toParams: (...args: A) => NoInfer<P>\n}): PositionalRecordGetter<P, A, R> => {\n const { getter, isPositional, toParams } = params\n return ((...args: unknown[]) => {\n const getterParams = isPositional(args[0]) ? toParams(...(args as A)) : (args[0] as P)\n return (record: ArenaRecord) => getter({ ...getterParams, record })\n }) as PositionalRecordGetter<P, A, R>\n}\n\nconst isRecordNode = (arg: unknown): arg is ArenaRecordNode =>\n typeof arg === 'object' && arg !== null && 'uuid' in arg && 'nodeDefUuid' in arg\nconst isString = (arg: unknown): arg is string => typeof arg === 'string'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\nexport const getNodeByUuid = positionalRecordGetter({\n getter: ({ record, uuid }: RecordParams & { uuid: string }): ArenaRecordNode | undefined => record.nodes?.[uuid],\n isPositional: isString,\n toParams: (uuid: string) => ({ uuid }),\n})\n\nexport const getNodesByUuids = positionalRecordGetter({\n getter: ({ record, uuids }: RecordParams & { uuids: string[] }): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[],\n isPositional: Array.isArray,\n toParams: (uuids: string[]) => ({ uuids }),\n})\n\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid({ uuid: rootUuid })(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid?: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: childrenUuids })(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid?: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getChild = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid: string }): ArenaRecordNode => {\n const children = getChildren({ parentNode, childDefUuid })(record)\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n if (children.length === 1) {\n return children[0]\n }\n if (children.length > 1) {\n throw new SystemError('systemError.record.multipleNodesFound', errorParams)\n }\n throw new SystemError('systemError.record.childNotFound', errorParams)\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getParent = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode | undefined =>\n node.parentUuid ? getNodeByUuid({ uuid: node.parentUuid })(record) : undefined,\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getNodesByDefUuid = positionalRecordGetter({\n getter: ({ record, nodeDefUuid }: RecordParams & { nodeDefUuid: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n },\n isPositional: isString,\n toParams: (nodeDefUuid: string) => ({ nodeDefUuid }),\n})\n\nconst isNodeFlagTrue = (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n recordGetter((params: RecordParams & { node: ArenaRecordNode }): boolean => {\n const { record, node } = params\n const ancestorsAndSelf = getAncestorsAndSelf({ node })(record)\n for (let i = 0; i < ancestorsAndSelf.length - 1; i++) {\n const child = ancestorsAndSelf[i]\n const parent = ancestorsAndSelf[i + 1]\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n }\n return true\n })\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\nexport const getDependentCodeAttributes = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n throw new SystemError('record.nodesIndexNotInitialized')\n },\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getParentCodeAttribute =\n (params: { parentNode: ArenaRecordNode; nodeDef: NodeDefCode }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { parentNode, nodeDef } = params\n\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf({ node: parentNode })(record)\n for (const ancestor of ancestors) {\n const children = getChildren({ parentNode: ancestor, childDefUuid: parentCodeDefUuid })(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf = positionalRecordGetter({\n getter: ({\n record,\n node,\n visitor,\n }: RecordParams & { node: ArenaRecordNode; visitor: (node: ArenaRecordNode) => boolean | void }): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParent({ node: currentNode })(record)\n }\n },\n isPositional: isRecordNode,\n // deprecated form: the visit stops when stopIfFn returns true\n toParams: (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => void, stopIfFn?: () => boolean) => ({\n node,\n visitor: (visitedNode: ArenaRecordNode): boolean => {\n visitor(visitedNode)\n return !!stopIfFn?.()\n },\n }),\n})\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf({\n node,\n visitor: (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n },\n })(record)\n return result\n }\n\nexport const getAncestor = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; ancestorDefUuid: string }): ArenaRecordNode | undefined => {\n const { record, node, ancestorDefUuid } = params\n if (node.nodeDefUuid === ancestorDefUuid) return node\n\n let ancestor = getParent({ node })(record)\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParent({ node: ancestor })(record)\n }\n return ancestor\n }\n)\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode }): Array<ArenaRecordNode> => {\n const { record, node } = params\n const ancestors: Array<ArenaRecordNode> = []\n visitAncestorsAndSelf({\n node,\n visitor: (currentNode) => {\n ancestors.push(currentNode)\n },\n })(record)\n return ancestors\n }\n)\n\n// descendants\n\nexport const getDescendantsOrSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode[] => {\n const { record, node, nodeDefDescendant } = params\n\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(\n ...getChildren({ parentNode: currentAncestor, childDefUuid: currentDescendantDefUuid })(record)\n )\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n)\n\nexport const getDescendant = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode => {\n const { record, node, nodeDefDescendant } = params\n\n return getDescendantsOrSelf({ node, nodeDefDescendant })(record)[0]\n }\n)\n\nexport const isDescendantOf = (params: { node: ArenaRecordNode; ancestor: ArenaRecordNode }): boolean => {\n const { node, ancestor } = params\n return Nodes.getHierarchy(node).includes(ancestor.uuid)\n}\n\nexport const visitDescendantsAndSelf = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n visitor: (node: ArenaRecordNode) => boolean | void\n traverseMethod?: TraverseMethod\n }): void => {\n const { record, node, visitor, traverseMethod = TraverseMethod.bfs } = params\n\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren({ parentNode: visitedNode })(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n)\n\nexport const findDescendantOrSelf =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let found = undefined\n\n visitDescendantsAndSelf({\n node,\n visitor: (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n },\n })(record)\n return found\n }\n\nconst getClosestAncestorNode = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n dependentDef: NodeDef<NodeDefType, NodeDefProps>\n dependencyType: SurveyDependencyType\n }): ArenaRecordNode | undefined => {\n const { record, node, nodeDef, dependentDef, dependencyType } = params\n\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent({ node })(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor({ node, ancestorDefUuid: commonAncestorDefUuid })(record)\n }\n)\n\ntype EntityKeyNodesGetterParams = {\n survey: Survey\n cycle?: string\n record: ArenaRecord\n entity: ArenaRecordNode\n keyDefs?: NodeDef<NodeDefType, NodeDefProps>[]\n}\n\nexport const getEntityKeyNodesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): NodesMap => {\n const { survey, cycle, record, entity, keyDefs } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant({ node: entity, nodeDefDescendant: nodeDefKey })(record)\n acc[nodeDefKey.uuid] = nodeKey\n return acc\n }, {})\n})\n\nexport const getEntityKeyNodes = recordGetter(\n ({ record, ...otherParams }: EntityKeyNodesGetterParams): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(otherParams)(record))\n)\n\nexport const getEntityKeyValuesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): Dictionary<any> => {\n const { record, ...otherParams } = params\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(otherParams)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n})\n\nexport const getEntityKeyValues = recordGetter(({ record, ...otherParams }: EntityKeyNodesGetterParams): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(otherParams)(record))\n)\n\nexport const getEntitySiblings = recordGetter(\n (params: { record: ArenaRecord; entity: ArenaRecordNode; includeSelf?: boolean }) => {\n const { record, entity, includeSelf = false } = params\n const parentEntity = getParent({ node: entity })(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entity.nodeDefUuid })(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n)\n\nexport const getAttributeSiblings = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) => {\n const { record, node, nodeDef } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings({ entity: parentEntity })(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren({ parentNode: siblingEntity, childDefUuid: nodeDef.uuid })(record))\n return siblingsAcc\n }, [])\n }\n)\n\nexport const getNodeIndex = recordGetter((params: { record: ArenaRecord; node: ArenaRecordNode }) => {\n const { record, node } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren({ parentNode: parentEntity, childDefUuid: node.nodeDefUuid })(record)\n return siblings.indexOf(node)\n})\n\nexport const findEntityByKeyValues = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n entityDefUuid: string\n keyValuesByDefUuid: Dictionary<any>\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, record, parentEntity, entityDefUuid, keyValuesByDefUuid } = params\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entityDefUuid })(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid({ survey, entity: siblingEntity, keyDefs })(\n record\n )\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n)\n\nexport const findEntityWithSameKeysInAnotherRecord = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n entityUuid: string\n record: ArenaRecord\n recordOther: ArenaRecord\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, entityUuid, record, recordOther } = params\n const entity = getNodeByUuid({ uuid: entityUuid })(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf({ node: entity })(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid({ survey, entity: ancestor })(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues({\n survey,\n cycle,\n parentEntity: otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid,\n })(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n)\n\nexport const getDependentNodePointers = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n node: ArenaRecordNode\n dependencyType: SurveyDependencyType\n includeSelf?: boolean\n filterFn?: (nodePointer: NodePointer) => boolean\n }) => {\n const { survey, record, node, dependencyType, includeSelf = false, filterFn = null } = params\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode({ node, nodeDef, dependentDef, dependencyType })(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError('record.nodes.dependents.dependencyOnRootFound')\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf({\n node: commonAncestorNode,\n nodeDefDescendant: nodeDefDependentParent,\n })(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent({ node })(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n)\n\nexport const getAncestorCodePath = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n parentNode: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n }): string[] => {\n const { record, parentNode, nodeDef, survey } = params\n\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef })(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef: ancestorCodeDef })(record)\n }\n return codePaths\n }\n)\n\nexport const getCategoryItemUuid = recordGetter(\n (params: {\n survey: Survey\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n record: ArenaRecord\n parentNode: ArenaRecordNode\n code: string\n }): string | undefined => {\n const { survey, nodeDef, record, parentNode, code } = params\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath({ survey, parentNode, nodeDef })(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n)\n\nexport const isNodeFilledByUser = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !!findDescendantOrSelf({ node, predicate: (visitedNode) => Nodes.hasUserInputValue(visitedNode) })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isNodeEmpty = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !isNodeFilledByUser({ node })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty({ node: rootNode })(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
@@ -3,14 +3,14 @@ import { ArenaRecordNode, NodePointer, NodesMap } from '../../node';
3
3
  import { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefType } from '../../nodeDef';
4
4
  import { Survey, SurveyDependencyType } from '../../survey/survey';
5
5
  import { ArenaRecord } from '../record';
6
- type RecordParams = {
6
+ export type RecordParams = {
7
7
  record: ArenaRecord;
8
8
  };
9
9
  /**
10
10
  * Record getter: takes the parameters first and the record as separate (curried) parameter: `getter(params)(record)`.
11
11
  * The deprecated form, with the record inside the parameters (`getter({ record, ...params })`), is still supported.
12
12
  */
13
- type RecordGetter<P extends RecordParams, R> = {
13
+ export type RecordGetter<P extends RecordParams, R> = {
14
14
  /** @deprecated Pass the record as separate parameter: `getter(params)(record)` */
15
15
  (params: P): R;
16
16
  (params: Omit<P, 'record'>): (record: ArenaRecord) => R;
@@ -19,7 +19,7 @@ type RecordGetter<P extends RecordParams, R> = {
19
19
  * Record getter (with parameters object) that also supports the deprecated form with positional parameters:
20
20
  * `getter(arg1, arg2)(record)`.
21
21
  */
22
- type PositionalRecordGetter<P, A extends unknown[], R> = {
22
+ export type PositionalRecordGetter<P, A extends unknown[], R> = {
23
23
  (params: P): (record: ArenaRecord) => R;
24
24
  /** @deprecated Pass the parameters as an object: `getter({ ...params })(record)` */
25
25
  (...args: A): (record: ArenaRecord) => R;
@@ -1 +1 @@
1
- {"version":3,"file":"recordGetters.js","sourceRoot":"","sources":["../../../src/record/_records/recordGetters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAAyD;AACzD,uCAAyC;AACzC,qCAA0E;AAC1E,sDAAkD;AAClD,2CAA2G;AAC3G,yCAAoD;AAEpD,uCAA2C;AAC3C,sCAA4D;AAC5D,8CAAsD;AACtD,qEAAiE;AACjE,mEAA+D;AAc/D,MAAM,cAAc,GAAG,CAAC,MAAc,EAA0B,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAA;AAErF,MAAM,YAAY,GAAG,CAA4B,MAAwB,EAAsB,EAAE,CAC/F,CAAC,CAAC,MAA6B,EAAE,EAAE,CACjC,cAAc,CAAC,MAAM,CAAC;IACpB,CAAC,CAAC,MAAM,CAAC,MAAW,CAAC;IACrB,CAAC,CAAC,CAAC,MAAmB,EAAE,EAAE,CAAC,MAAM,CAAC,gCAAK,MAAM,KAAE,MAAM,GAAO,CAAC,CAAuB,CAAA;AAY1F,MAAM,sBAAsB,GAAG,CAA4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GAAG,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,CAAA;IAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAA,QAAA,WAAW,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAClE,CAAC,CAAA;AAHY,QAAA,OAAO,GAAP,OAAO,CAGnB;AAEM,MAAM,OAAO,GAAG,CAAC,MAAmB,EAAU,EAAE,wBAAC,MAAM,CAAC,IAAI,mCAAI,4BAAmB,GAAA,CAAA;AAA7E,QAAA,OAAO,GAAP,OAAO,CAAsE;AAEnF,MAAM,gBAAgB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,IAAA,QAAA,OAAO,EAAC,MAAM,CAAC,KAAK,mCAAsB,CAAA;AAA/F,QAAA,gBAAgB,GAAhB,gBAAgB,CAA+E","sourcesContent":["import { Dictionary, TraverseMethod } from '../../common'\nimport { SystemError } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\ntype RecordParams = { record: ArenaRecord }\n\n/**\n * Record getter: takes the parameters first and the record as separate (curried) parameter: `getter(params)(record)`.\n * The deprecated form, with the record inside the parameters (`getter({ record, ...params })`), is still supported.\n */\ntype RecordGetter<P extends RecordParams, R> = {\n /** @deprecated Pass the record as separate parameter: `getter(params)(record)` */\n (params: P): R\n (params: Omit<P, 'record'>): (record: ArenaRecord) => R\n}\n\nconst isRecordParams = (params: object): params is RecordParams => 'record' in params\n\nconst recordGetter = <P extends RecordParams, R>(getter: (params: P) => R): RecordGetter<P, R> =>\n ((params: P | Omit<P, 'record'>) =>\n isRecordParams(params)\n ? getter(params as P)\n : (record: ArenaRecord) => getter({ ...params, record } as P)) as RecordGetter<P, R>\n\n/**\n * Record getter (with parameters object) that also supports the deprecated form with positional parameters:\n * `getter(arg1, arg2)(record)`.\n */\ntype PositionalRecordGetter<P, A extends unknown[], R> = {\n (params: P): (record: ArenaRecord) => R\n /** @deprecated Pass the parameters as an object: `getter({ ...params })(record)` */\n (...args: A): (record: ArenaRecord) => R\n}\n\nconst positionalRecordGetter = <P, A extends unknown[], R>(params: {\n getter: (params: P & RecordParams) => R\n isPositional: (firstArg: unknown) => boolean\n toParams: (...args: A) => NoInfer<P>\n}): PositionalRecordGetter<P, A, R> => {\n const { getter, isPositional, toParams } = params\n return ((...args: unknown[]) => {\n const getterParams = isPositional(args[0]) ? toParams(...(args as A)) : (args[0] as P)\n return (record: ArenaRecord) => getter({ ...getterParams, record })\n }) as PositionalRecordGetter<P, A, R>\n}\n\nconst isRecordNode = (arg: unknown): arg is ArenaRecordNode =>\n typeof arg === 'object' && arg !== null && 'uuid' in arg && 'nodeDefUuid' in arg\nconst isString = (arg: unknown): arg is string => typeof arg === 'string'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\nexport const getNodeByUuid = positionalRecordGetter({\n getter: ({ record, uuid }: RecordParams & { uuid: string }): ArenaRecordNode | undefined => record.nodes?.[uuid],\n isPositional: isString,\n toParams: (uuid: string) => ({ uuid }),\n})\n\nexport const getNodesByUuids = positionalRecordGetter({\n getter: ({ record, uuids }: RecordParams & { uuids: string[] }): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[],\n isPositional: Array.isArray,\n toParams: (uuids: string[]) => ({ uuids }),\n})\n\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid({ uuid: rootUuid })(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid?: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: childrenUuids })(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid?: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getChild = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid: string }): ArenaRecordNode => {\n const children = getChildren({ parentNode, childDefUuid })(record)\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n if (children.length === 1) {\n return children[0]\n }\n if (children.length > 1) {\n throw new SystemError('systemError.record.multipleNodesFound', errorParams)\n }\n throw new SystemError('systemError.record.childNotFound', errorParams)\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getParent = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode | undefined =>\n node.parentUuid ? getNodeByUuid({ uuid: node.parentUuid })(record) : undefined,\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getNodesByDefUuid = positionalRecordGetter({\n getter: ({ record, nodeDefUuid }: RecordParams & { nodeDefUuid: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n },\n isPositional: isString,\n toParams: (nodeDefUuid: string) => ({ nodeDefUuid }),\n})\n\nconst isNodeFlagTrue = (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n recordGetter((params: RecordParams & { node: ArenaRecordNode }): boolean => {\n const { record, node } = params\n const ancestorsAndSelf = getAncestorsAndSelf({ node })(record)\n for (let i = 0; i < ancestorsAndSelf.length - 1; i++) {\n const child = ancestorsAndSelf[i]\n const parent = ancestorsAndSelf[i + 1]\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n }\n return true\n })\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\nexport const getDependentCodeAttributes = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n throw new SystemError('record.nodesIndexNotInitialized')\n },\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getParentCodeAttribute =\n (params: { parentNode: ArenaRecordNode; nodeDef: NodeDefCode }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { parentNode, nodeDef } = params\n\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf({ node: parentNode })(record)\n for (const ancestor of ancestors) {\n const children = getChildren({ parentNode: ancestor, childDefUuid: parentCodeDefUuid })(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf = positionalRecordGetter({\n getter: ({\n record,\n node,\n visitor,\n }: RecordParams & { node: ArenaRecordNode; visitor: (node: ArenaRecordNode) => boolean | void }): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParent({ node: currentNode })(record)\n }\n },\n isPositional: isRecordNode,\n // deprecated form: the visit stops when stopIfFn returns true\n toParams: (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => void, stopIfFn?: () => boolean) => ({\n node,\n visitor: (visitedNode: ArenaRecordNode): boolean => {\n visitor(visitedNode)\n return !!stopIfFn?.()\n },\n }),\n})\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf({\n node,\n visitor: (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n },\n })(record)\n return result\n }\n\nexport const getAncestor = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; ancestorDefUuid: string }): ArenaRecordNode | undefined => {\n const { record, node, ancestorDefUuid } = params\n if (node.nodeDefUuid === ancestorDefUuid) return node\n\n let ancestor = getParent({ node })(record)\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParent({ node: ancestor })(record)\n }\n return ancestor\n }\n)\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode }): Array<ArenaRecordNode> => {\n const { record, node } = params\n const ancestors: Array<ArenaRecordNode> = []\n visitAncestorsAndSelf({\n node,\n visitor: (currentNode) => {\n ancestors.push(currentNode)\n },\n })(record)\n return ancestors\n }\n)\n\n// descendants\n\nexport const getDescendantsOrSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode[] => {\n const { record, node, nodeDefDescendant } = params\n\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(\n ...getChildren({ parentNode: currentAncestor, childDefUuid: currentDescendantDefUuid })(record)\n )\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n)\n\nexport const getDescendant = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode => {\n const { record, node, nodeDefDescendant } = params\n\n return getDescendantsOrSelf({ node, nodeDefDescendant })(record)[0]\n }\n)\n\nexport const isDescendantOf = (params: { node: ArenaRecordNode; ancestor: ArenaRecordNode }): boolean => {\n const { node, ancestor } = params\n return Nodes.getHierarchy(node).includes(ancestor.uuid)\n}\n\nexport const visitDescendantsAndSelf = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n visitor: (node: ArenaRecordNode) => boolean | void\n traverseMethod?: TraverseMethod\n }): void => {\n const { record, node, visitor, traverseMethod = TraverseMethod.bfs } = params\n\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren({ parentNode: visitedNode })(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n)\n\nexport const findDescendantOrSelf =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let found = undefined\n\n visitDescendantsAndSelf({\n node,\n visitor: (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n },\n })(record)\n return found\n }\n\nconst getClosestAncestorNode = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n dependentDef: NodeDef<NodeDefType, NodeDefProps>\n dependencyType: SurveyDependencyType\n }): ArenaRecordNode | undefined => {\n const { record, node, nodeDef, dependentDef, dependencyType } = params\n\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent({ node })(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor({ node, ancestorDefUuid: commonAncestorDefUuid })(record)\n }\n)\n\ntype EntityKeyNodesGetterParams = {\n survey: Survey\n cycle?: string\n record: ArenaRecord\n entity: ArenaRecordNode\n keyDefs?: NodeDef<NodeDefType, NodeDefProps>[]\n}\n\nexport const getEntityKeyNodesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): NodesMap => {\n const { survey, cycle, record, entity, keyDefs } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant({ node: entity, nodeDefDescendant: nodeDefKey })(record)\n acc[nodeDefKey.uuid] = nodeKey\n return acc\n }, {})\n})\n\nexport const getEntityKeyNodes = recordGetter(\n ({ record, ...otherParams }: EntityKeyNodesGetterParams): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(otherParams)(record))\n)\n\nexport const getEntityKeyValuesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): Dictionary<any> => {\n const { record, ...otherParams } = params\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(otherParams)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n})\n\nexport const getEntityKeyValues = recordGetter(({ record, ...otherParams }: EntityKeyNodesGetterParams): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(otherParams)(record))\n)\n\nexport const getEntitySiblings = recordGetter(\n (params: { record: ArenaRecord; entity: ArenaRecordNode; includeSelf?: boolean }) => {\n const { record, entity, includeSelf = false } = params\n const parentEntity = getParent({ node: entity })(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entity.nodeDefUuid })(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n)\n\nexport const getAttributeSiblings = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) => {\n const { record, node, nodeDef } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings({ entity: parentEntity })(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren({ parentNode: siblingEntity, childDefUuid: nodeDef.uuid })(record))\n return siblingsAcc\n }, [])\n }\n)\n\nexport const getNodeIndex = recordGetter((params: { record: ArenaRecord; node: ArenaRecordNode }) => {\n const { record, node } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren({ parentNode: parentEntity, childDefUuid: node.nodeDefUuid })(record)\n return siblings.indexOf(node)\n})\n\nexport const findEntityByKeyValues = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n entityDefUuid: string\n keyValuesByDefUuid: Dictionary<any>\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, record, parentEntity, entityDefUuid, keyValuesByDefUuid } = params\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entityDefUuid })(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid({ survey, entity: siblingEntity, keyDefs })(\n record\n )\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n)\n\nexport const findEntityWithSameKeysInAnotherRecord = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n entityUuid: string\n record: ArenaRecord\n recordOther: ArenaRecord\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, entityUuid, record, recordOther } = params\n const entity = getNodeByUuid({ uuid: entityUuid })(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf({ node: entity })(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid({ survey, entity: ancestor })(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues({\n survey,\n cycle,\n parentEntity: otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid,\n })(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n)\n\nexport const getDependentNodePointers = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n node: ArenaRecordNode\n dependencyType: SurveyDependencyType\n includeSelf?: boolean\n filterFn?: (nodePointer: NodePointer) => boolean\n }) => {\n const { survey, record, node, dependencyType, includeSelf = false, filterFn = null } = params\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode({ node, nodeDef, dependentDef, dependencyType })(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError('record.nodes.dependents.dependencyOnRootFound')\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf({\n node: commonAncestorNode,\n nodeDefDescendant: nodeDefDependentParent,\n })(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent({ node })(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n)\n\nexport const getAncestorCodePath = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n parentNode: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n }): string[] => {\n const { record, parentNode, nodeDef, survey } = params\n\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef })(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef: ancestorCodeDef })(record)\n }\n return codePaths\n }\n)\n\nexport const getCategoryItemUuid = recordGetter(\n (params: {\n survey: Survey\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n record: ArenaRecord\n parentNode: ArenaRecordNode\n code: string\n }): string | undefined => {\n const { survey, nodeDef, record, parentNode, code } = params\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath({ survey, parentNode, nodeDef })(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n)\n\nexport const isNodeFilledByUser = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !!findDescendantOrSelf({ node, predicate: (visitedNode) => Nodes.hasUserInputValue(visitedNode) })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isNodeEmpty = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !isNodeFilledByUser({ node })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty({ node: rootNode })(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
1
+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\nimport { SystemError } from '../../error'\nimport { ArenaRecordNode, NodePointer, Nodes, NodesMap } from '../../node'\nimport { NodeValues } from '../../node/nodeValues'\nimport { NodeDef, NodeDefCode, NodeDefCodeProps, NodeDefProps, NodeDefs, NodeDefType } from '../../nodeDef'\nimport { defaultCycle, Surveys } from '../../survey'\nimport { Survey, SurveyDependencyType } from '../../survey/survey'\nimport { Arrays, Queue } from '../../utils'\nimport { ArenaRecord, RECORD_STEP_DEFAULT } from '../record'\nimport { RecordStepAnalysisCode } from '../recordStep'\nimport { RecordNodesIndexReader } from './recordNodesIndexReader'\nimport { NodeDefSelfReferences } from './nodeDefSelfReferences'\n\nexport type RecordParams = { record: ArenaRecord }\n\n/**\n * Record getter: takes the parameters first and the record as separate (curried) parameter: `getter(params)(record)`.\n * The deprecated form, with the record inside the parameters (`getter({ record, ...params })`), is still supported.\n */\nexport type RecordGetter<P extends RecordParams, R> = {\n /** @deprecated Pass the record as separate parameter: `getter(params)(record)` */\n (params: P): R\n (params: Omit<P, 'record'>): (record: ArenaRecord) => R\n}\n\nconst isRecordParams = (params: object): params is RecordParams => 'record' in params\n\nconst recordGetter = <P extends RecordParams, R>(getter: (params: P) => R): RecordGetter<P, R> =>\n ((params: P | Omit<P, 'record'>) =>\n isRecordParams(params)\n ? getter(params as P)\n : (record: ArenaRecord) => getter({ ...params, record } as P)) as RecordGetter<P, R>\n\n/**\n * Record getter (with parameters object) that also supports the deprecated form with positional parameters:\n * `getter(arg1, arg2)(record)`.\n */\nexport type PositionalRecordGetter<P, A extends unknown[], R> = {\n (params: P): (record: ArenaRecord) => R\n /** @deprecated Pass the parameters as an object: `getter({ ...params })(record)` */\n (...args: A): (record: ArenaRecord) => R\n}\n\nconst positionalRecordGetter = <P, A extends unknown[], R>(params: {\n getter: (params: P & RecordParams) => R\n isPositional: (firstArg: unknown) => boolean\n toParams: (...args: A) => NoInfer<P>\n}): PositionalRecordGetter<P, A, R> => {\n const { getter, isPositional, toParams } = params\n return ((...args: unknown[]) => {\n const getterParams = isPositional(args[0]) ? toParams(...(args as A)) : (args[0] as P)\n return (record: ArenaRecord) => getter({ ...getterParams, record })\n }) as PositionalRecordGetter<P, A, R>\n}\n\nconst isRecordNode = (arg: unknown): arg is ArenaRecordNode =>\n typeof arg === 'object' && arg !== null && 'uuid' in arg && 'nodeDefUuid' in arg\nconst isString = (arg: unknown): arg is string => typeof arg === 'string'\n\nexport const getCycle = (record: ArenaRecord): string => record.cycle ?? defaultCycle\n\nexport const getNodes = (record: ArenaRecord): Dictionary<ArenaRecordNode> => record.nodes ?? {}\n\nexport const getNodesArray = (record: ArenaRecord): ArenaRecordNode[] => Object.values(getNodes(record))\n\nexport const getNodeByUuid = positionalRecordGetter({\n getter: ({ record, uuid }: RecordParams & { uuid: string }): ArenaRecordNode | undefined => record.nodes?.[uuid],\n isPositional: isString,\n toParams: (uuid: string) => ({ uuid }),\n})\n\nexport const getNodesByUuids = positionalRecordGetter({\n getter: ({ record, uuids }: RecordParams & { uuids: string[] }): ArenaRecordNode[] =>\n uuids.map((uuid: string) => record.nodes?.[uuid]) as ArenaRecordNode[],\n isPositional: Array.isArray,\n toParams: (uuids: string[]) => ({ uuids }),\n})\n\nexport const getRoot = (record: ArenaRecord): ArenaRecordNode | undefined => {\n const rootUuid = record._nodesIndex ? RecordNodesIndexReader.getNodeRootUuid(record._nodesIndex) : null\n if (rootUuid) {\n return getNodeByUuid({ uuid: rootUuid })(record)\n }\n return getNodesArray(record).find((node) => !node.parentUuid)\n}\n\nexport const getChildren = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid?: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const childrenUuids = childDefUuid\n ? RecordNodesIndexReader.getNodeUuidsByParentAndChildDef({\n parentNodeUuid: parentNode.uuid,\n childDefUuid,\n })(record._nodesIndex)\n : RecordNodesIndexReader.getNodeUuidsByParent(parentNode.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: childrenUuids })(record)\n }\n return getNodesArray(record).filter(\n (node) => node.parentUuid === parentNode.uuid && (!childDefUuid || node.nodeDefUuid == childDefUuid)\n )\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid?: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getChild = positionalRecordGetter({\n getter: ({\n record,\n parentNode,\n childDefUuid,\n }: RecordParams & { parentNode: ArenaRecordNode; childDefUuid: string }): ArenaRecordNode => {\n const children = getChildren({ parentNode, childDefUuid })(record)\n const errorParams = { childDefUuid, parentNodeUuid: parentNode.uuid, recordUuid: record.uuid }\n if (children.length === 1) {\n return children[0]\n }\n if (children.length > 1) {\n throw new SystemError('systemError.record.multipleNodesFound', errorParams)\n }\n throw new SystemError('systemError.record.childNotFound', errorParams)\n },\n isPositional: isRecordNode,\n toParams: (parentNode: ArenaRecordNode, childDefUuid: string) => ({ parentNode, childDefUuid }),\n})\n\nexport const getParent = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode | undefined =>\n node.parentUuid ? getNodeByUuid({ uuid: node.parentUuid })(record) : undefined,\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getNodesByDefUuid = positionalRecordGetter({\n getter: ({ record, nodeDefUuid }: RecordParams & { nodeDefUuid: string }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeUuidsByDef(nodeDefUuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n return getNodesArray(record).filter((node) => node.nodeDefUuid === nodeDefUuid)\n },\n isPositional: isString,\n toParams: (nodeDefUuid: string) => ({ nodeDefUuid }),\n})\n\nconst isNodeFlagTrue = (isChildFlagTrue: (parent: ArenaRecordNode, nodeDefUuid: string) => boolean) =>\n recordGetter((params: RecordParams & { node: ArenaRecordNode }): boolean => {\n const { record, node } = params\n const ancestorsAndSelf = getAncestorsAndSelf({ node })(record)\n for (let i = 0; i < ancestorsAndSelf.length - 1; i++) {\n const child = ancestorsAndSelf[i]\n const parent = ancestorsAndSelf[i + 1]\n if (!isChildFlagTrue(parent, child.nodeDefUuid)) return false\n }\n return true\n })\n\nexport const isNodeApplicable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildApplicable(parent, nodeDefUuid))\nexport const isNodeEditable = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildEditable(parent, nodeDefUuid))\nexport const isNodeVisible = isNodeFlagTrue((parent, nodeDefUuid) => Nodes.isChildVisible(parent, nodeDefUuid))\n\nexport const getDependentCodeAttributes = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): ArenaRecordNode[] => {\n if (record._nodesIndex) {\n const nodeUuids = RecordNodesIndexReader.getNodeCodeDependentUuids(node.uuid)(record._nodesIndex)\n return getNodesByUuids({ uuids: nodeUuids })(record)\n }\n throw new SystemError('record.nodesIndexNotInitialized')\n },\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const getParentCodeAttribute =\n (params: { parentNode: ArenaRecordNode; nodeDef: NodeDefCode }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { parentNode, nodeDef } = params\n\n const parentCodeDefUuid = NodeDefs.getParentCodeDefUuid(nodeDef)\n if (!parentCodeDefUuid) return undefined\n\n const ancestors = getAncestorsAndSelf({ node: parentNode })(record)\n for (const ancestor of ancestors) {\n const children = getChildren({ parentNode: ancestor, childDefUuid: parentCodeDefUuid })(record)\n if (children.length === 1) {\n return children[0]\n }\n }\n return undefined\n }\n\n// ancestors\n\n/**\n * Visits the specified node and its ancestors, from the node up to the root: the visit stops when the visitor returns true.\n */\nexport const visitAncestorsAndSelf = positionalRecordGetter({\n getter: ({\n record,\n node,\n visitor,\n }: RecordParams & { node: ArenaRecordNode; visitor: (node: ArenaRecordNode) => boolean | void }): void => {\n let currentNode: ArenaRecordNode | undefined = node\n while (currentNode) {\n if (visitor(currentNode)) return\n currentNode = getParent({ node: currentNode })(record)\n }\n },\n isPositional: isRecordNode,\n // deprecated form: the visit stops when stopIfFn returns true\n toParams: (node: ArenaRecordNode, visitor: (node: ArenaRecordNode) => void, stopIfFn?: () => boolean) => ({\n node,\n visitor: (visitedNode: ArenaRecordNode): boolean => {\n visitor(visitedNode)\n return !!stopIfFn?.()\n },\n }),\n})\n\n/**\n * Returns the first node satisfying the predicate among the specified node and its ancestors (from the node up to the root).\n */\nexport const findAncestor =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let result: ArenaRecordNode | undefined = undefined\n visitAncestorsAndSelf({\n node,\n visitor: (visitedNode) => {\n if (predicate(visitedNode)) {\n result = visitedNode\n return true\n }\n return false\n },\n })(record)\n return result\n }\n\nexport const getAncestor = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; ancestorDefUuid: string }): ArenaRecordNode | undefined => {\n const { record, node, ancestorDefUuid } = params\n if (node.nodeDefUuid === ancestorDefUuid) return node\n\n let ancestor = getParent({ node })(record)\n while (ancestor && ancestor.nodeDefUuid !== ancestorDefUuid) {\n ancestor = getParent({ node: ancestor })(record)\n }\n return ancestor\n }\n)\n\n/**\n * Returns the list of ancestors from the given node to the root entity\n */\nexport const getAncestorsAndSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode }): Array<ArenaRecordNode> => {\n const { record, node } = params\n const ancestors: Array<ArenaRecordNode> = []\n visitAncestorsAndSelf({\n node,\n visitor: (currentNode) => {\n ancestors.push(currentNode)\n },\n })(record)\n return ancestors\n }\n)\n\n// descendants\n\nexport const getDescendantsOrSelf = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode[] => {\n const { record, node, nodeDefDescendant } = params\n\n if (nodeDefDescendant.uuid === node.nodeDefUuid) return [node]\n\n const nodeDefDescendantFullHierarchy = [...nodeDefDescendant.meta.h, nodeDefDescendant.uuid]\n\n // 1. get the descendant node defs uuids starting from node nodeDefUuid (not inclusive) down to the specified nodeDefDescendant uuid\n const descendantNodeDefUuids = nodeDefDescendantFullHierarchy.slice(\n nodeDefDescendantFullHierarchy.indexOf(node.nodeDefUuid) + 1\n )\n // 2. for every level in the hierarchy, find the children having the nodeDefUuid equal to the current one\n let currentAncestors = [node]\n let currentDescendants: ArenaRecordNode[] = []\n for (const currentDescendantDefUuid of descendantNodeDefUuids) {\n for (const currentAncestor of currentAncestors) {\n currentDescendants.push(\n ...getChildren({ parentNode: currentAncestor, childDefUuid: currentDescendantDefUuid })(record)\n )\n }\n currentAncestors = currentDescendants\n currentDescendants = []\n }\n return currentAncestors // currentAncestors is equal to the currentDescendants of the last level\n }\n)\n\nexport const getDescendant = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDefDescendant: NodeDef<any> }): ArenaRecordNode => {\n const { record, node, nodeDefDescendant } = params\n\n return getDescendantsOrSelf({ node, nodeDefDescendant })(record)[0]\n }\n)\n\nexport const isDescendantOf = (params: { node: ArenaRecordNode; ancestor: ArenaRecordNode }): boolean => {\n const { node, ancestor } = params\n return Nodes.getHierarchy(node).includes(ancestor.uuid)\n}\n\nexport const visitDescendantsAndSelf = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n visitor: (node: ArenaRecordNode) => boolean | void\n traverseMethod?: TraverseMethod\n }): void => {\n const { record, node, visitor, traverseMethod = TraverseMethod.bfs } = params\n\n if (traverseMethod === TraverseMethod.bfs) {\n const queue = new Queue()\n\n queue.enqueue(node)\n\n while (!queue.isEmpty()) {\n const visitedNode = queue.dequeue()\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren(visitedNode)(record)\n queue.enqueueItems(children)\n }\n } else {\n const stack = []\n\n stack.push(node)\n\n while (stack.length > 0) {\n const visitedNode = stack.pop() as ArenaRecordNode\n\n if (visitor(visitedNode)) {\n // stop if visitor returns true\n return\n }\n\n const children = getChildren({ parentNode: visitedNode })(record)\n\n // add children to stack in reverse order\n for (let index = children.length - 1; index >= 0; index--) {\n const child = children[index]\n stack.push(child)\n }\n }\n }\n }\n)\n\nexport const findDescendantOrSelf =\n (params: { node: ArenaRecordNode; predicate: (node: ArenaRecordNode) => boolean }) =>\n (record: ArenaRecord): ArenaRecordNode | undefined => {\n const { node, predicate } = params\n let found = undefined\n\n visitDescendantsAndSelf({\n node,\n visitor: (currentNode) => {\n if (predicate(currentNode)) {\n found = currentNode\n return true\n }\n return false\n },\n })(record)\n return found\n }\n\nconst getClosestAncestorNode = recordGetter(\n (params: {\n record: ArenaRecord\n node: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType, NodeDefProps>\n dependentDef: NodeDef<NodeDefType, NodeDefProps>\n dependencyType: SurveyDependencyType\n }): ArenaRecordNode | undefined => {\n const { record, node, nodeDef, dependentDef, dependencyType } = params\n\n // 1a if dependent def is the same as node def, potentially all nodes with\n // nodeDefUuid === dependentDef.uuid in record could be dependent of nodeDef;\n // consider the root node as the closest ancestor node,\n // unless the node def references itself only among the children of its parent entity (e.g. validation \"dbh > 0\")\n if (nodeDef.uuid === dependentDef.uuid) {\n return NodeDefSelfReferences.isSelfReferenceLocal({ nodeDef, dependencyType })\n ? getParent({ node })(record)\n : getRoot(record)\n }\n // 1 find common ancestor def\n const commonAncestorDefUuid = Arrays.last(Arrays.intersection(nodeDef.meta.h, dependentDef.meta.h))\n if (!commonAncestorDefUuid) return undefined\n\n // 2 get ancestor node with common parent def\n return getAncestor({ node, ancestorDefUuid: commonAncestorDefUuid })(record)\n }\n)\n\ntype EntityKeyNodesGetterParams = {\n survey: Survey\n cycle?: string\n record: ArenaRecord\n entity: ArenaRecordNode\n keyDefs?: NodeDef<NodeDefType, NodeDefProps>[]\n}\n\nexport const getEntityKeyNodesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): NodesMap => {\n const { survey, cycle, record, entity, keyDefs } = params\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: entity.nodeDefUuid })\n const nodeDefKeys = keyDefs ?? Surveys.getNodeDefKeys({ survey, cycle, nodeDef })\n return nodeDefKeys.reduce((acc: NodesMap, nodeDefKey) => {\n const nodeKey = getDescendant({ node: entity, nodeDefDescendant: nodeDefKey })(record)\n acc[nodeDefKey.uuid] = nodeKey\n return acc\n }, {})\n})\n\nexport const getEntityKeyNodes = recordGetter(\n ({ record, ...otherParams }: EntityKeyNodesGetterParams): ArenaRecordNode[] =>\n Object.values(getEntityKeyNodesByDefUuid(otherParams)(record))\n)\n\nexport const getEntityKeyValuesByDefUuid = recordGetter((params: EntityKeyNodesGetterParams): Dictionary<any> => {\n const { record, ...otherParams } = params\n const keyNodesByDefUuid = getEntityKeyNodesByDefUuid(otherParams)(record)\n return Object.entries(keyNodesByDefUuid).reduce((acc: Dictionary<any>, [uuid, keyNode]) => {\n acc[uuid] = keyNode?.value\n return acc\n }, {})\n})\n\nexport const getEntityKeyValues = recordGetter(({ record, ...otherParams }: EntityKeyNodesGetterParams): any[] =>\n Object.values(getEntityKeyValuesByDefUuid(otherParams)(record))\n)\n\nexport const getEntitySiblings = recordGetter(\n (params: { record: ArenaRecord; entity: ArenaRecordNode; includeSelf?: boolean }) => {\n const { record, entity, includeSelf = false } = params\n const parentEntity = getParent({ node: entity })(record)\n if (!parentEntity) return []\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entity.nodeDefUuid })(record)\n return includeSelf ? siblingEntities : siblingEntities.filter((sibling) => !Nodes.areEqual(sibling, entity))\n }\n)\n\nexport const getAttributeSiblings = recordGetter(\n (params: { record: ArenaRecord; node: ArenaRecordNode; nodeDef: NodeDef<NodeDefType, NodeDefProps> }) => {\n const { record, node, nodeDef } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return []\n const siblingParentEntities = getEntitySiblings({ entity: parentEntity })(record)\n return siblingParentEntities.reduce((siblingsAcc: ArenaRecordNode[], siblingEntity) => {\n siblingsAcc.push(...getChildren({ parentNode: siblingEntity, childDefUuid: nodeDef.uuid })(record))\n return siblingsAcc\n }, [])\n }\n)\n\nexport const getNodeIndex = recordGetter((params: { record: ArenaRecord; node: ArenaRecordNode }) => {\n const { record, node } = params\n const parentEntity = getParent({ node })(record)\n if (!parentEntity) return 0 // root entity\n const siblings = getChildren({ parentNode: parentEntity, childDefUuid: node.nodeDefUuid })(record)\n return siblings.indexOf(node)\n})\n\nexport const findEntityByKeyValues = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n record: ArenaRecord\n parentEntity: ArenaRecordNode\n entityDefUuid: string\n keyValuesByDefUuid: Dictionary<any>\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, record, parentEntity, entityDefUuid, keyValuesByDefUuid } = params\n const entityDef = Surveys.getNodeDefByUuid({ survey, uuid: entityDefUuid })\n const siblingEntities = getChildren({ parentNode: parentEntity, childDefUuid: entityDefUuid })(record)\n if (NodeDefs.isSingle(entityDef)) {\n return siblingEntities[0]\n }\n const keyDefs = Surveys.getNodeDefKeys({ survey, cycle, nodeDef: entityDef })\n\n return siblingEntities.find((siblingEntity) => {\n const siblingEntityKeyValuesByDefUuid = getEntityKeyValuesByDefUuid({ survey, entity: siblingEntity, keyDefs })(\n record\n )\n return keyDefs.every((keyDef) => {\n const keyValue = siblingEntityKeyValuesByDefUuid[keyDef.uuid]\n const keyValueSearch = keyValuesByDefUuid[keyDef.uuid]\n return NodeValues.isValueEqual({\n survey,\n nodeDef: keyDef,\n value: keyValue,\n valueSearch: keyValueSearch,\n })\n })\n })\n }\n)\n\nexport const findEntityWithSameKeysInAnotherRecord = recordGetter(\n (params: {\n survey: Survey\n cycle: string\n entityUuid: string\n record: ArenaRecord\n recordOther: ArenaRecord\n }): ArenaRecordNode | undefined => {\n const { survey, cycle, entityUuid, record, recordOther } = params\n const entity = getNodeByUuid({ uuid: entityUuid })(record)\n if (!entity) return undefined\n\n let otherRecordCurrentParentEntity = getRoot(recordOther)\n if (!otherRecordCurrentParentEntity) return undefined\n\n const entityAncestorsAndSelf = getAncestorsAndSelf({ node: entity })(record)\n const ancestorDefUuidsAndKeys = entityAncestorsAndSelf.map((ancestor) => ({\n entityDefUuid: ancestor.nodeDefUuid,\n keyValuesByDefUuid: getEntityKeyValuesByDefUuid({ survey, entity: ancestor })(record),\n }))\n\n const ancestorDefUuidsAndKeysToVisit = [...ancestorDefUuidsAndKeys].reverse()\n\n for (let index = 1; otherRecordCurrentParentEntity && index < ancestorDefUuidsAndKeysToVisit.length; index++) {\n const { entityDefUuid, keyValuesByDefUuid } = ancestorDefUuidsAndKeysToVisit[index]\n otherRecordCurrentParentEntity = findEntityByKeyValues({\n survey,\n cycle,\n parentEntity: otherRecordCurrentParentEntity,\n entityDefUuid,\n keyValuesByDefUuid,\n })(recordOther)\n }\n return otherRecordCurrentParentEntity\n }\n)\n\nexport const getDependentNodePointers = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n node: ArenaRecordNode\n dependencyType: SurveyDependencyType\n includeSelf?: boolean\n filterFn?: (nodePointer: NodePointer) => boolean\n }) => {\n const { survey, record, node, dependencyType, includeSelf = false, filterFn = null } = params\n const nodeDefUuid = node.nodeDefUuid\n const nodeDef = Surveys.getNodeDefByUuid({ survey, uuid: nodeDefUuid })\n const dependentDefs = Surveys.getNodeDefDependents({ survey, nodeDefUuid, dependencyType })\n const nodePointers: Array<NodePointer> = []\n\n const addToNodePointers = (nodePointer: NodePointer): void => {\n if (filterFn === null || filterFn(nodePointer)) {\n nodePointers.push(nodePointer)\n }\n }\n\n for (const dependentDef of dependentDefs) {\n // 1 find common ancestor node\n const commonAncestorNode = getClosestAncestorNode({ node, nodeDef, dependentDef, dependencyType })(record)\n if (!commonAncestorNode) continue\n\n const nodeDefDependentParent = Surveys.getNodeDefParent({ survey, nodeDef: dependentDef })\n if (!nodeDefDependentParent) throw new SystemError('record.nodes.dependents.dependencyOnRootFound')\n\n // 2 find descendant nodes of common parent node with nodeDefUuid = dependentDef uuid\n const dependentContextNodes = getDescendantsOrSelf({\n node: commonAncestorNode,\n nodeDefDescendant: nodeDefDependentParent,\n })(record)\n\n for (const dependentContextNode of dependentContextNodes) {\n addToNodePointers({\n nodeCtx: dependentContextNode,\n nodeDef: dependentDef,\n })\n }\n }\n if (includeSelf) {\n const parentNode = getParent({ node })(record)\n if (parentNode) {\n addToNodePointers({\n nodeCtx: parentNode,\n nodeDef,\n })\n }\n }\n\n return nodePointers\n }\n)\n\nexport const getAncestorCodePath = recordGetter(\n (params: {\n survey: Survey\n record: ArenaRecord\n parentNode: ArenaRecordNode\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n }): string[] => {\n const { record, parentNode, nodeDef, survey } = params\n\n const getCodeAttributeItemCode = (codeAttribute: ArenaRecordNode | undefined): string => {\n const codeItemUuid = codeAttribute ? NodeValues.getItemUuid(codeAttribute) : undefined\n if (!codeItemUuid) return ''\n const item = Surveys.getCategoryItemByUuid({ survey, itemUuid: codeItemUuid })\n return item?.props.code ?? ''\n }\n\n const codePaths = []\n let currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef })(record)\n\n while (currentParentCodeAttribute) {\n const ancestorItemCode = getCodeAttributeItemCode(currentParentCodeAttribute)\n codePaths.unshift(ancestorItemCode)\n const ancestorCodeDef = Surveys.getNodeDefByUuid({\n survey,\n uuid: currentParentCodeAttribute.nodeDefUuid,\n }) as NodeDefCode\n currentParentCodeAttribute = getParentCodeAttribute({ parentNode, nodeDef: ancestorCodeDef })(record)\n }\n return codePaths\n }\n)\n\nexport const getCategoryItemUuid = recordGetter(\n (params: {\n survey: Survey\n nodeDef: NodeDef<NodeDefType.code, NodeDefCodeProps>\n record: ArenaRecord\n parentNode: ArenaRecordNode\n code: string\n }): string | undefined => {\n const { survey, nodeDef, record, parentNode, code } = params\n const categoryUuid = nodeDef.props.categoryUuid\n\n const codePaths = [...getAncestorCodePath({ survey, parentNode, nodeDef })(record), code]\n\n const item = Surveys.getCategoryItemByCodePaths({ survey, categoryUuid, codePaths })\n\n return item?.uuid\n }\n)\n\nexport const isNodeFilledByUser = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !!findDescendantOrSelf({ node, predicate: (visitedNode) => Nodes.hasUserInputValue(visitedNode) })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isNodeEmpty = positionalRecordGetter({\n getter: ({ record, node }: RecordParams & { node: ArenaRecordNode }): boolean =>\n !isNodeFilledByUser({ node })(record),\n isPositional: isRecordNode,\n toParams: (node: ArenaRecordNode) => ({ node }),\n})\n\nexport const isEmpty = (record: ArenaRecord): boolean => {\n const rootNode = getRoot(record)\n return rootNode ? isNodeEmpty({ node: rootNode })(record) : true\n}\n\nexport const getStep = (record: ArenaRecord): string => record.step ?? RECORD_STEP_DEFAULT\n\nexport const isInAnalysisStep = (record: ArenaRecord): boolean => getStep(record) === RecordStepAnalysisCode\n"]}
@@ -9,347 +9,153 @@ export declare const Records: {
9
9
  getRoot: typeof getRoot;
10
10
  getNodes: typeof getNodes;
11
11
  getNodesArray: typeof getNodesArray;
12
- getNodeByUuid: {
13
- (params: {
14
- uuid: string;
15
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
16
- (uuid: string): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
17
- };
18
- getNodesByUuids: {
19
- (params: {
20
- uuids: string[];
21
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
22
- (uuids: string[]): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
23
- };
24
- getNodesByDefUuid: {
25
- (params: {
26
- nodeDefUuid: string;
27
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
28
- (nodeDefUuid: string): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
29
- };
30
- getChild: {
31
- (params: {
32
- parentNode: import("..").ArenaRecordNode;
33
- childDefUuid: string;
34
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode;
35
- (parentNode: import("..").ArenaRecordNode, childDefUuid: string): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode;
36
- };
37
- getChildren: {
38
- (params: {
39
- parentNode: import("..").ArenaRecordNode;
40
- childDefUuid?: string;
41
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
42
- (parentNode: import("..").ArenaRecordNode, childDefUuid?: string | undefined): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
43
- };
44
- getParent: {
45
- (params: {
46
- node: import("..").ArenaRecordNode;
47
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
48
- (node: import("..").ArenaRecordNode): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
49
- };
12
+ getNodeByUuid: import("./_records/recordGetters").PositionalRecordGetter<{
13
+ uuid: string;
14
+ }, [uuid: string], import("..").ArenaRecordNode | undefined>;
15
+ getNodesByUuids: import("./_records/recordGetters").PositionalRecordGetter<{
16
+ uuids: string[];
17
+ }, [uuids: string[]], import("..").ArenaRecordNode[]>;
18
+ getNodesByDefUuid: import("./_records/recordGetters").PositionalRecordGetter<{
19
+ nodeDefUuid: string;
20
+ }, [nodeDefUuid: string], import("..").ArenaRecordNode[]>;
21
+ getChild: import("./_records/recordGetters").PositionalRecordGetter<{
22
+ parentNode: import("..").ArenaRecordNode;
23
+ childDefUuid: string;
24
+ }, [parentNode: import("..").ArenaRecordNode, childDefUuid: string], import("..").ArenaRecordNode>;
25
+ getChildren: import("./_records/recordGetters").PositionalRecordGetter<{
26
+ parentNode: import("..").ArenaRecordNode;
27
+ childDefUuid?: string;
28
+ }, [parentNode: import("..").ArenaRecordNode, childDefUuid?: string | undefined], import("..").ArenaRecordNode[]>;
29
+ getParent: import("./_records/recordGetters").PositionalRecordGetter<{
30
+ node: import("..").ArenaRecordNode;
31
+ }, [node: import("..").ArenaRecordNode], import("..").ArenaRecordNode | undefined>;
50
32
  getParentCodeAttribute: typeof getParentCodeAttribute;
51
- getAncestorCodePath: {
52
- (params: {
53
- survey: import("..").Survey;
54
- record: import("./record").ArenaRecord;
55
- parentNode: import("..").ArenaRecordNode;
56
- nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
57
- }): string[];
58
- (params: Omit<{
59
- survey: import("..").Survey;
60
- record: import("./record").ArenaRecord;
61
- parentNode: import("..").ArenaRecordNode;
62
- nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
63
- }, "record">): (record: import("./record").ArenaRecord) => string[];
64
- };
65
- getDependentCodeAttributes: {
66
- (params: {
67
- node: import("..").ArenaRecordNode;
68
- }): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
69
- (node: import("..").ArenaRecordNode): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
70
- };
71
- getAncestor: {
72
- (params: {
73
- record: import("./record").ArenaRecord;
74
- node: import("..").ArenaRecordNode;
75
- ancestorDefUuid: string;
76
- }): import("..").ArenaRecordNode | undefined;
77
- (params: Omit<{
78
- record: import("./record").ArenaRecord;
79
- node: import("..").ArenaRecordNode;
80
- ancestorDefUuid: string;
81
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
82
- };
83
- getEntityKeyNodes: {
84
- (params: {
85
- survey: import("..").Survey;
86
- cycle?: string;
87
- record: import("./record").ArenaRecord;
88
- entity: import("..").ArenaRecordNode;
89
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
90
- }): import("..").ArenaRecordNode[];
91
- (params: Omit<{
92
- survey: import("..").Survey;
93
- cycle?: string;
94
- record: import("./record").ArenaRecord;
95
- entity: import("..").ArenaRecordNode;
96
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
97
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
98
- };
99
- getEntityKeyNodesByDefUuid: {
100
- (params: {
101
- survey: import("..").Survey;
102
- cycle?: string;
103
- record: import("./record").ArenaRecord;
104
- entity: import("..").ArenaRecordNode;
105
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
106
- }): import("..").NodesMap;
107
- (params: Omit<{
108
- survey: import("..").Survey;
109
- cycle?: string;
110
- record: import("./record").ArenaRecord;
111
- entity: import("..").ArenaRecordNode;
112
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
113
- }, "record">): (record: import("./record").ArenaRecord) => import("..").NodesMap;
114
- };
115
- getEntityKeyValues: {
116
- (params: {
117
- survey: import("..").Survey;
118
- cycle?: string;
119
- record: import("./record").ArenaRecord;
120
- entity: import("..").ArenaRecordNode;
121
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
122
- }): any[];
123
- (params: Omit<{
124
- survey: import("..").Survey;
125
- cycle?: string;
126
- record: import("./record").ArenaRecord;
127
- entity: import("..").ArenaRecordNode;
128
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
129
- }, "record">): (record: import("./record").ArenaRecord) => any[];
130
- };
131
- getEntityKeyValuesByDefUuid: {
132
- (params: {
133
- survey: import("..").Survey;
134
- cycle?: string;
135
- record: import("./record").ArenaRecord;
136
- entity: import("..").ArenaRecordNode;
137
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
138
- }): import("..").Dictionary<any>;
139
- (params: Omit<{
140
- survey: import("..").Survey;
141
- cycle?: string;
142
- record: import("./record").ArenaRecord;
143
- entity: import("..").ArenaRecordNode;
144
- keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
145
- }, "record">): (record: import("./record").ArenaRecord) => import("..").Dictionary<any>;
146
- };
147
- getEntitySiblings: {
148
- (params: {
149
- record: import("./record").ArenaRecord;
150
- entity: import("..").ArenaRecordNode;
151
- includeSelf?: boolean;
152
- }): import("..").ArenaRecordNode[];
153
- (params: Omit<{
154
- record: import("./record").ArenaRecord;
155
- entity: import("..").ArenaRecordNode;
156
- includeSelf?: boolean;
157
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
158
- };
159
- getAttributeSiblings: {
160
- (params: {
161
- record: import("./record").ArenaRecord;
162
- node: import("..").ArenaRecordNode;
163
- nodeDef: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>;
164
- }): import("..").ArenaRecordNode[];
165
- (params: Omit<{
166
- record: import("./record").ArenaRecord;
167
- node: import("..").ArenaRecordNode;
168
- nodeDef: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>;
169
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
170
- };
171
- getNodeIndex: {
172
- (params: {
173
- record: import("./record").ArenaRecord;
174
- node: import("..").ArenaRecordNode;
175
- }): number;
176
- (params: Omit<{
177
- record: import("./record").ArenaRecord;
178
- node: import("..").ArenaRecordNode;
179
- }, "record">): (record: import("./record").ArenaRecord) => number;
180
- };
181
- isNodeApplicable: {
182
- (params: {
183
- record: import("./record").ArenaRecord;
184
- } & {
185
- node: import("..").ArenaRecordNode;
186
- }): boolean;
187
- (params: Omit<{
188
- record: import("./record").ArenaRecord;
189
- } & {
190
- node: import("..").ArenaRecordNode;
191
- }, "record">): (record: import("./record").ArenaRecord) => boolean;
192
- };
193
- isNodeEditable: {
194
- (params: {
195
- record: import("./record").ArenaRecord;
196
- } & {
197
- node: import("..").ArenaRecordNode;
198
- }): boolean;
199
- (params: Omit<{
200
- record: import("./record").ArenaRecord;
201
- } & {
202
- node: import("..").ArenaRecordNode;
203
- }, "record">): (record: import("./record").ArenaRecord) => boolean;
204
- };
205
- isNodeVisible: {
206
- (params: {
207
- record: import("./record").ArenaRecord;
208
- } & {
209
- node: import("..").ArenaRecordNode;
210
- }): boolean;
211
- (params: Omit<{
212
- record: import("./record").ArenaRecord;
213
- } & {
214
- node: import("..").ArenaRecordNode;
215
- }, "record">): (record: import("./record").ArenaRecord) => boolean;
216
- };
217
- visitAncestorsAndSelf: {
218
- (params: {
219
- node: import("..").ArenaRecordNode;
220
- visitor: (node: import("..").ArenaRecordNode) => boolean | void;
221
- }): (record: import("./record").ArenaRecord) => void;
222
- (node: import("..").ArenaRecordNode, visitor: (node: import("..").ArenaRecordNode) => void, stopIfFn?: (() => boolean) | undefined): (record: import("./record").ArenaRecord) => void;
223
- };
224
- getAncestorsAndSelf: {
225
- (params: {
226
- record: import("./record").ArenaRecord;
227
- node: import("..").ArenaRecordNode;
228
- }): import("..").ArenaRecordNode[];
229
- (params: Omit<{
230
- record: import("./record").ArenaRecord;
231
- node: import("..").ArenaRecordNode;
232
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
233
- };
234
- getDescendant: {
235
- (params: {
236
- record: import("./record").ArenaRecord;
237
- node: import("..").ArenaRecordNode;
238
- nodeDefDescendant: import("..").NodeDef<any>;
239
- }): import("..").ArenaRecordNode;
240
- (params: Omit<{
241
- record: import("./record").ArenaRecord;
242
- node: import("..").ArenaRecordNode;
243
- nodeDefDescendant: import("..").NodeDef<any>;
244
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode;
245
- };
246
- getDescendantsOrSelf: {
247
- (params: {
248
- record: import("./record").ArenaRecord;
249
- node: import("..").ArenaRecordNode;
250
- nodeDefDescendant: import("..").NodeDef<any>;
251
- }): import("..").ArenaRecordNode[];
252
- (params: Omit<{
253
- record: import("./record").ArenaRecord;
254
- node: import("..").ArenaRecordNode;
255
- nodeDefDescendant: import("..").NodeDef<any>;
256
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode[];
257
- };
33
+ getAncestorCodePath: import("./_records/recordGetters").RecordGetter<{
34
+ survey: import("..").Survey;
35
+ record: import("./record").ArenaRecord;
36
+ parentNode: import("..").ArenaRecordNode;
37
+ nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
38
+ }, string[]>;
39
+ getDependentCodeAttributes: import("./_records/recordGetters").PositionalRecordGetter<{
40
+ node: import("..").ArenaRecordNode;
41
+ }, [node: import("..").ArenaRecordNode], import("..").ArenaRecordNode[]>;
42
+ getAncestor: import("./_records/recordGetters").RecordGetter<{
43
+ record: import("./record").ArenaRecord;
44
+ node: import("..").ArenaRecordNode;
45
+ ancestorDefUuid: string;
46
+ }, import("..").ArenaRecordNode | undefined>;
47
+ getEntityKeyNodes: import("./_records/recordGetters").RecordGetter<{
48
+ survey: import("..").Survey;
49
+ cycle?: string;
50
+ record: import("./record").ArenaRecord;
51
+ entity: import("..").ArenaRecordNode;
52
+ keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
53
+ }, import("..").ArenaRecordNode[]>;
54
+ getEntityKeyNodesByDefUuid: import("./_records/recordGetters").RecordGetter<{
55
+ survey: import("..").Survey;
56
+ cycle?: string;
57
+ record: import("./record").ArenaRecord;
58
+ entity: import("..").ArenaRecordNode;
59
+ keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
60
+ }, import("..").NodesMap>;
61
+ getEntityKeyValues: import("./_records/recordGetters").RecordGetter<{
62
+ survey: import("..").Survey;
63
+ cycle?: string;
64
+ record: import("./record").ArenaRecord;
65
+ entity: import("..").ArenaRecordNode;
66
+ keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
67
+ }, any[]>;
68
+ getEntityKeyValuesByDefUuid: import("./_records/recordGetters").RecordGetter<{
69
+ survey: import("..").Survey;
70
+ cycle?: string;
71
+ record: import("./record").ArenaRecord;
72
+ entity: import("..").ArenaRecordNode;
73
+ keyDefs?: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>[];
74
+ }, import("..").Dictionary<any>>;
75
+ getEntitySiblings: import("./_records/recordGetters").RecordGetter<{
76
+ record: import("./record").ArenaRecord;
77
+ entity: import("..").ArenaRecordNode;
78
+ includeSelf?: boolean;
79
+ }, import("..").ArenaRecordNode[]>;
80
+ getAttributeSiblings: import("./_records/recordGetters").RecordGetter<{
81
+ record: import("./record").ArenaRecord;
82
+ node: import("..").ArenaRecordNode;
83
+ nodeDef: import("..").NodeDef<import("..").NodeDefType, import("..").NodeDefProps>;
84
+ }, import("..").ArenaRecordNode[]>;
85
+ getNodeIndex: import("./_records/recordGetters").RecordGetter<{
86
+ record: import("./record").ArenaRecord;
87
+ node: import("..").ArenaRecordNode;
88
+ }, number>;
89
+ isNodeApplicable: import("./_records/recordGetters").RecordGetter<import("./_records/recordGetters").RecordParams & {
90
+ node: import("..").ArenaRecordNode;
91
+ }, boolean>;
92
+ isNodeEditable: import("./_records/recordGetters").RecordGetter<import("./_records/recordGetters").RecordParams & {
93
+ node: import("..").ArenaRecordNode;
94
+ }, boolean>;
95
+ isNodeVisible: import("./_records/recordGetters").RecordGetter<import("./_records/recordGetters").RecordParams & {
96
+ node: import("..").ArenaRecordNode;
97
+ }, boolean>;
98
+ visitAncestorsAndSelf: import("./_records/recordGetters").PositionalRecordGetter<{
99
+ node: import("..").ArenaRecordNode;
100
+ visitor: (node: import("..").ArenaRecordNode) => boolean | void;
101
+ }, [node: import("..").ArenaRecordNode, visitor: (node: import("..").ArenaRecordNode) => void, stopIfFn?: (() => boolean) | undefined], void>;
102
+ getAncestorsAndSelf: import("./_records/recordGetters").RecordGetter<{
103
+ record: import("./record").ArenaRecord;
104
+ node: import("..").ArenaRecordNode;
105
+ }, import("..").ArenaRecordNode[]>;
106
+ getDescendant: import("./_records/recordGetters").RecordGetter<{
107
+ record: import("./record").ArenaRecord;
108
+ node: import("..").ArenaRecordNode;
109
+ nodeDefDescendant: import("..").NodeDef<any>;
110
+ }, import("..").ArenaRecordNode>;
111
+ getDescendantsOrSelf: import("./_records/recordGetters").RecordGetter<{
112
+ record: import("./record").ArenaRecord;
113
+ node: import("..").ArenaRecordNode;
114
+ nodeDefDescendant: import("..").NodeDef<any>;
115
+ }, import("..").ArenaRecordNode[]>;
258
116
  isDescendantOf: typeof isDescendantOf;
259
- visitDescendantsAndSelf: {
260
- (params: {
261
- record: import("./record").ArenaRecord;
262
- node: import("..").ArenaRecordNode;
263
- visitor: (node: import("..").ArenaRecordNode) => boolean | void;
264
- traverseMethod?: import("..").TraverseMethod;
265
- }): void;
266
- (params: Omit<{
267
- record: import("./record").ArenaRecord;
268
- node: import("..").ArenaRecordNode;
269
- visitor: (node: import("..").ArenaRecordNode) => boolean | void;
270
- traverseMethod?: import("..").TraverseMethod;
271
- }, "record">): (record: import("./record").ArenaRecord) => void;
272
- };
273
- getDependentNodePointers: {
274
- (params: {
275
- survey: import("..").Survey;
276
- record: import("./record").ArenaRecord;
277
- node: import("..").ArenaRecordNode;
278
- dependencyType: import("..").SurveyDependencyType;
279
- includeSelf?: boolean;
280
- filterFn?: (nodePointer: import("..").NodePointer) => boolean;
281
- }): import("..").NodePointer[];
282
- (params: Omit<{
283
- survey: import("..").Survey;
284
- record: import("./record").ArenaRecord;
285
- node: import("..").ArenaRecordNode;
286
- dependencyType: import("..").SurveyDependencyType;
287
- includeSelf?: boolean;
288
- filterFn?: (nodePointer: import("..").NodePointer) => boolean;
289
- }, "record">): (record: import("./record").ArenaRecord) => import("..").NodePointer[];
290
- };
291
- findEntityByKeyValues: {
292
- (params: {
293
- survey: import("..").Survey;
294
- cycle: string;
295
- record: import("./record").ArenaRecord;
296
- parentEntity: import("..").ArenaRecordNode;
297
- entityDefUuid: string;
298
- keyValuesByDefUuid: import("..").Dictionary<any>;
299
- }): import("..").ArenaRecordNode | undefined;
300
- (params: Omit<{
301
- survey: import("..").Survey;
302
- cycle: string;
303
- record: import("./record").ArenaRecord;
304
- parentEntity: import("..").ArenaRecordNode;
305
- entityDefUuid: string;
306
- keyValuesByDefUuid: import("..").Dictionary<any>;
307
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
308
- };
309
- findEntityWithSameKeysInAnotherRecord: {
310
- (params: {
311
- survey: import("..").Survey;
312
- cycle: string;
313
- entityUuid: string;
314
- record: import("./record").ArenaRecord;
315
- recordOther: import("./record").ArenaRecord;
316
- }): import("..").ArenaRecordNode | undefined;
317
- (params: Omit<{
318
- survey: import("..").Survey;
319
- cycle: string;
320
- entityUuid: string;
321
- record: import("./record").ArenaRecord;
322
- recordOther: import("./record").ArenaRecord;
323
- }, "record">): (record: import("./record").ArenaRecord) => import("..").ArenaRecordNode | undefined;
324
- };
325
- getCategoryItemUuid: {
326
- (params: {
327
- survey: import("..").Survey;
328
- nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
329
- record: import("./record").ArenaRecord;
330
- parentNode: import("..").ArenaRecordNode;
331
- code: string;
332
- }): string | undefined;
333
- (params: Omit<{
334
- survey: import("..").Survey;
335
- nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
336
- record: import("./record").ArenaRecord;
337
- parentNode: import("..").ArenaRecordNode;
338
- code: string;
339
- }, "record">): (record: import("./record").ArenaRecord) => string | undefined;
340
- };
341
- isNodeEmpty: {
342
- (params: {
343
- node: import("..").ArenaRecordNode;
344
- }): (record: import("./record").ArenaRecord) => boolean;
345
- (node: import("..").ArenaRecordNode): (record: import("./record").ArenaRecord) => boolean;
346
- };
347
- isNodeFilledByUser: {
348
- (params: {
349
- node: import("..").ArenaRecordNode;
350
- }): (record: import("./record").ArenaRecord) => boolean;
351
- (node: import("..").ArenaRecordNode): (record: import("./record").ArenaRecord) => boolean;
352
- };
117
+ visitDescendantsAndSelf: import("./_records/recordGetters").RecordGetter<{
118
+ record: import("./record").ArenaRecord;
119
+ node: import("..").ArenaRecordNode;
120
+ visitor: (node: import("..").ArenaRecordNode) => boolean | void;
121
+ traverseMethod?: import("..").TraverseMethod;
122
+ }, void>;
123
+ getDependentNodePointers: import("./_records/recordGetters").RecordGetter<{
124
+ survey: import("..").Survey;
125
+ record: import("./record").ArenaRecord;
126
+ node: import("..").ArenaRecordNode;
127
+ dependencyType: import("..").SurveyDependencyType;
128
+ includeSelf?: boolean;
129
+ filterFn?: (nodePointer: import("..").NodePointer) => boolean;
130
+ }, import("..").NodePointer[]>;
131
+ findEntityByKeyValues: import("./_records/recordGetters").RecordGetter<{
132
+ survey: import("..").Survey;
133
+ cycle: string;
134
+ record: import("./record").ArenaRecord;
135
+ parentEntity: import("..").ArenaRecordNode;
136
+ entityDefUuid: string;
137
+ keyValuesByDefUuid: import("..").Dictionary<any>;
138
+ }, import("..").ArenaRecordNode | undefined>;
139
+ findEntityWithSameKeysInAnotherRecord: import("./_records/recordGetters").RecordGetter<{
140
+ survey: import("..").Survey;
141
+ cycle: string;
142
+ entityUuid: string;
143
+ record: import("./record").ArenaRecord;
144
+ recordOther: import("./record").ArenaRecord;
145
+ }, import("..").ArenaRecordNode | undefined>;
146
+ getCategoryItemUuid: import("./_records/recordGetters").RecordGetter<{
147
+ survey: import("..").Survey;
148
+ nodeDef: import("..").NodeDef<import("..").NodeDefType.code, import("..").NodeDefCodeProps>;
149
+ record: import("./record").ArenaRecord;
150
+ parentNode: import("..").ArenaRecordNode;
151
+ code: string;
152
+ }, string | undefined>;
153
+ isNodeEmpty: import("./_records/recordGetters").PositionalRecordGetter<{
154
+ node: import("..").ArenaRecordNode;
155
+ }, [node: import("..").ArenaRecordNode], boolean>;
156
+ isNodeFilledByUser: import("./_records/recordGetters").PositionalRecordGetter<{
157
+ node: import("..").ArenaRecordNode;
158
+ }, [node: import("..").ArenaRecordNode], boolean>;
353
159
  isEmpty: typeof isEmpty;
354
160
  getStep: typeof getStep;
355
161
  isInAnalysisStep: typeof isInAnalysisStep;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "OpenForis",
5
5
  "email": "openforis.arena@gmail.com"
6
6
  },
7
- "version": "2.4.0",
7
+ "version": "2.4.1",
8
8
  "description": "Arena core module",
9
9
  "repository": {
10
10
  "type": "git",