INNER CODE UNIT · TypeScript
graphqlOperationName
odigos-io/odigos · frontend/webapp/cypress/functions/index.ts:5
const graphqlOperationName = (raw: unknown): string | undefined => {
if (raw == null) return undefined;
if (typeof raw === 'string') {
try {
return graphqlOperationName(JSON.parse(raw));
} catch {
return undefined;
}
}
if (typeof raw !== 'object') return undefined;
if (Array.isArray(raw)) {
const first = raw[0] as { operationName?: string } | undefined;
return first?.operationName;
}
return (raw as { operationName?: string }).operationName;
};
// Resolves only when the named operation completes.