From 492b5914edb35cc063bcf5e933d99ff1301b6c40 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Fri, 25 Apr 2025 18:38:06 -0700 Subject: [PATCH] improvement(api): added XML support --- sim/executor/resolver.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sim/executor/resolver.ts b/sim/executor/resolver.ts index 01c2fff36..0d05b43b1 100644 --- a/sim/executor/resolver.ts +++ b/sim/executor/resolver.ts @@ -345,9 +345,35 @@ export class InputResolver { context: ExecutionContext, currentBlock: SerializedBlock ): string { + // Skip resolution for API block body content that looks like XML + if ( + currentBlock.metadata?.id === 'api' && + typeof value === 'string' && + ( + // Check if this looks like XML content + (value.includes('')) + ) + ) { + return value; + } + const blockMatches = value.match(/<([^>]+)>/g) if (!blockMatches) return value + // If we're in an API block body, check each match to see if it looks like XML rather than a reference + if (currentBlock.metadata?.id === 'api' && blockMatches.some(match => { + const innerContent = match.slice(1, -1); + // Patterns that suggest this is XML, not a block reference: + return innerContent.includes(':') || // namespaces like soap:Envelope + innerContent.includes('=') || // attributes like xmlns="http://..." + innerContent.includes(' ') || // any space indicates attributes + innerContent.includes('/') || // self-closing tags + !innerContent.includes('.'); // block refs always have dots + })) { + return value; // Likely XML content, return unchanged + } + let resolvedValue = value // Check if we're in a template literal for function blocks @@ -363,6 +389,11 @@ export class InputResolver { const path = match.slice(1, -1) const [blockRef, ...pathParts] = path.split('.') + + // Skip XML-like tags that have no path parts (not a valid block reference) + if (pathParts.length === 0 || blockRef.includes(':') || blockRef.includes(' ')) { + continue; + } // Special case for "start" references // This allows users to reference the starter block using