UNPKG

n8n

Version:

n8n Workflow Automation Tool

41 lines 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SUPPORTED_AGENT_PROVIDERS = void 0; exports.mapCredentialForProvider = mapCredentialForProvider; exports.isSupportedAgentProvider = isSupportedAgentProvider; const PROVIDER_CREDENTIAL_MAPPERS = { openai: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), anthropic: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), google: (c) => ({ apiKey: c.apiKey, baseURL: c.host }), xai: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), groq: (c) => ({ apiKey: c.apiKey }), deepseek: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), cohere: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), mistral: (c) => ({ apiKey: c.apiKey }), vercel: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), openrouter: (c) => ({ apiKey: c.apiKey, baseURL: c.url }), 'azure-openai': (c) => ({ apiKey: c.apiKey, resourceName: c.resourceName, apiVersion: c.apiVersion, baseURL: c.endpoint, }), 'aws-bedrock': (c) => ({ region: c.region, accessKeyId: c.accessKeyId, secretAccessKey: c.secretAccessKey, sessionToken: c.sessionToken, }), }; function mapCredentialForProvider(provider, raw) { const mapper = PROVIDER_CREDENTIAL_MAPPERS[provider]; if (!mapper) return raw; const mapped = mapper(raw); return Object.fromEntries(Object.entries(mapped).filter(([, v]) => v !== undefined)); } exports.SUPPORTED_AGENT_PROVIDERS = Object.keys(PROVIDER_CREDENTIAL_MAPPERS); function isSupportedAgentProvider(provider) { return provider in PROVIDER_CREDENTIAL_MAPPERS; } //# sourceMappingURL=credential-field-mapping.js.map