mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat: Add telemetry events for free AI credits feature (no-changelog) (#12459)
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user