(
reference: string,
context: ResolutionContext,
useAsyncPath: boolean
)
| 73 | ): Promise<any> |
| 74 | private resolveInternal(reference: string, context: ResolutionContext, useAsyncPath: false): any |
| 75 | private resolveInternal( |
| 76 | reference: string, |
| 77 | context: ResolutionContext, |
| 78 | useAsyncPath: boolean |
| 79 | ): any | Promise<any> { |
| 80 | const parts = parseReferencePath(reference) |
| 81 | if (parts.length === 0) { |
| 82 | logger.warn('Invalid loop reference', { reference }) |
| 83 | return undefined |
| 84 | } |
| 85 | |
| 86 | const [firstPart, ...rest] = parts |
| 87 | const isGenericRef = firstPart === REFERENCE.PREFIX.LOOP |
| 88 | |
| 89 | let targetLoopId: string | undefined |
| 90 | |
| 91 | if (isGenericRef) { |
| 92 | targetLoopId = this.findInnermostLoopForBlock(context.currentNodeId) |
| 93 | if (!targetLoopId && !context.loopScope) { |
| 94 | return undefined |
| 95 | } |
| 96 | } else { |
| 97 | targetLoopId = this.loopNameToId.get(firstPart) |
| 98 | if (!targetLoopId) { |
| 99 | return undefined |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | // Resolve the effective (possibly cloned) loop ID for scope/output lookups |
| 104 | if (targetLoopId && context.executionContext.loopExecutions) { |
| 105 | const mappedBranchIndex = |
| 106 | (isGenericRef |
| 107 | ? extractInnermostOuterBranchIndex(context.currentNodeId) |
| 108 | : extractOuterBranchIndex(context.currentNodeId)) ?? |
| 109 | context.executionContext.parallelBlockMapping?.get(context.currentNodeId)?.iterationIndex |
| 110 | targetLoopId = findEffectiveContainerId( |
| 111 | targetLoopId, |
| 112 | context.currentNodeId, |
| 113 | context.executionContext.loopExecutions, |
| 114 | mappedBranchIndex |
| 115 | ) |
| 116 | } |
| 117 | |
| 118 | if (rest.length > 0) { |
| 119 | const { property, pathParts: bracketPathParts } = splitLeadingBracketPath(rest[0]) |
| 120 | |
| 121 | if (LoopResolver.OUTPUT_PROPERTIES.has(property)) { |
| 122 | if (!targetLoopId) { |
| 123 | return undefined |
| 124 | } |
| 125 | return useAsyncPath |
| 126 | ? this.resolveOutputAsync(targetLoopId, [...bracketPathParts, ...rest.slice(1)], context) |
| 127 | : this.resolveOutput(targetLoopId, [...bracketPathParts, ...rest.slice(1)], context) |
| 128 | } |
| 129 | |
| 130 | const isContextual = |
| 131 | isGenericRef || |
| 132 | (targetLoopId !== undefined && |
no test coverage detected