(reference: string, context: ResolutionContext)
| 149 | } |
| 150 | |
| 151 | async resolveAsync(reference: string, context: ResolutionContext): Promise<any> { |
| 152 | if (!this.navigatePathAsync) { |
| 153 | return this.resolve(reference, context) |
| 154 | } |
| 155 | const parts = parseReferencePath(reference) |
| 156 | if (parts.length === 0) { |
| 157 | return undefined |
| 158 | } |
| 159 | const [blockName, ...pathParts] = parts |
| 160 | |
| 161 | const blockId = this.findBlockIdByName(blockName) |
| 162 | if (!blockId) { |
| 163 | return undefined |
| 164 | } |
| 165 | |
| 166 | const block = this.blockById.get(blockId)! |
| 167 | const output = this.getBlockOutput(blockId, context) |
| 168 | |
| 169 | const blockData: Record<string, unknown> = {} |
| 170 | const blockOutputSchemas: Record<string, OutputSchema> = {} |
| 171 | |
| 172 | if (output !== undefined) { |
| 173 | blockData[blockId] = output |
| 174 | } |
| 175 | |
| 176 | const outputSchema = getBlockSchema(block) |
| 177 | |
| 178 | if (outputSchema && Object.keys(outputSchema).length > 0) { |
| 179 | blockOutputSchemas[blockId] = outputSchema |
| 180 | } |
| 181 | |
| 182 | try { |
| 183 | const blockReferenceContext = { |
| 184 | blockNameMapping: Object.fromEntries(this.nameToBlockId), |
| 185 | blockData, |
| 186 | blockOutputSchemas, |
| 187 | } |
| 188 | const result = (await resolveBlockReferenceAsync( |
| 189 | blockName, |
| 190 | pathParts, |
| 191 | blockReferenceContext, |
| 192 | context, |
| 193 | this.navigatePathAsync |
| 194 | ))! |
| 195 | |
| 196 | if (result.value !== undefined) { |
| 197 | if (!context.allowLargeValueRefs) { |
| 198 | assertNoLargeValueRefs(result.value) |
| 199 | } |
| 200 | return result.value |
| 201 | } |
| 202 | |
| 203 | const backwardsCompat = await this.handleBackwardsCompat(block, output, pathParts, context) |
| 204 | if (backwardsCompat !== undefined) { |
| 205 | return backwardsCompat |
| 206 | } |
| 207 | |
| 208 | return RESOLVED_EMPTY |
nothing calls this directly
no test coverage detected