feat: Add telemetry events for free AI credits feature (no-changelog) (#12459)

This commit is contained in:
Ricardo Espinoza
2025-01-07 08:42:19 -05:00
committed by GitHub
parent adcedd1c2b
commit 61993c3906
6 changed files with 219 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ import type {
IDataObject,
IRunData,
ITaskData,
IRun,
} from './Interfaces';
import { getNodeParameters } from './NodeHelpers';
@@ -470,3 +471,21 @@ export function generateNodesGraph(
return { nodeGraph, nameIndices, webhookNodeNames };
}
export function extractLastExecutedNodeCredentialData(
runData: IRun,
): null | { credentialId: string; credentialType: string } {
const nodeCredentials = runData?.data?.executionData?.nodeExecutionStack?.[0]?.node?.credentials;
if (!nodeCredentials) return null;
const credentialType = Object.keys(nodeCredentials)[0] ?? null;
if (!credentialType) return null;
const { id } = nodeCredentials[credentialType];
if (!id) return null;
return { credentialId: id, credentialType };
}