(reference: string, context: ResolutionContext)
| 82 | } |
| 83 | |
| 84 | resolve(reference: string, context: ResolutionContext): any { |
| 85 | const parts = parseReferencePath(reference) |
| 86 | if (parts.length === 0) { |
| 87 | return undefined |
| 88 | } |
| 89 | const [blockName, ...pathParts] = parts |
| 90 | |
| 91 | const blockId = this.findBlockIdByName(blockName) |
| 92 | if (!blockId) { |
| 93 | return undefined |
| 94 | } |
| 95 | |
| 96 | const block = this.blockById.get(blockId)! |
| 97 | const output = this.getBlockOutput(blockId, context) |
| 98 | |
| 99 | const blockData: Record<string, unknown> = {} |
| 100 | const blockOutputSchemas: Record<string, OutputSchema> = {} |
| 101 | |
| 102 | if (output !== undefined) { |
| 103 | blockData[blockId] = output |
| 104 | } |
| 105 | |
| 106 | const outputSchema = getBlockSchema(block) |
| 107 | |
| 108 | if (outputSchema && Object.keys(outputSchema).length > 0) { |
| 109 | blockOutputSchemas[blockId] = outputSchema |
| 110 | } |
| 111 | |
| 112 | try { |
| 113 | const result = resolveBlockReference( |
| 114 | blockName, |
| 115 | pathParts, |
| 116 | { |
| 117 | blockNameMapping: Object.fromEntries(this.nameToBlockId), |
| 118 | blockData, |
| 119 | blockOutputSchemas, |
| 120 | }, |
| 121 | { |
| 122 | allowLargeValueRefs: context.allowLargeValueRefs, |
| 123 | executionContext: context.executionContext, |
| 124 | } |
| 125 | )! |
| 126 | |
| 127 | if (result.value !== undefined) { |
| 128 | if (!context.allowLargeValueRefs) { |
| 129 | assertNoLargeValueRefs(result.value) |
| 130 | } |
| 131 | return result.value |
| 132 | } |
| 133 | |
| 134 | const backwardsCompat = this.handleBackwardsCompatSync(block, output, pathParts) |
| 135 | if (backwardsCompat !== undefined) { |
| 136 | return backwardsCompat |
| 137 | } |
| 138 | |
| 139 | return RESOLVED_EMPTY |
| 140 | } catch (error) { |
| 141 | if (error instanceof InvalidFieldError) { |
no test coverage detected