/** * Credential-instance derivation. * * n8n binds a credential PER NODE, selected from a shared pool — two nodes of * the same service can use different accounts ("Slack — Marketing" vs * "Slack — Support"). Pikku models that as multiple encapsulated addon * INSTANCES of one package, each `wireAddon`'d with its own credential binding * (distinct RPC namespace + `credentialOverrides`). This module turns the * per-node credential pointers into that deduplicated instance set. * * The n8n export never carries the secret itself — only the `{ id, name, type }` * pointer — so we can provision the instance + its credential NAME automatically * and the user fills the secret in once, out of band. */ import type { ParsedWorkflow, N8nCredentialRef } from './types.js'; /** * Stable secret/credential name for an n8n credential pointer. A named ref wins * (kebabed) — consistent with the `instanceName` `deriveCredentialInstances` * derives — otherwise fall back to a per-node name so distinct nodes don't * collide onto one generic key. */ export declare function credentialNameForRef(ref: N8nCredentialRef | undefined, fallback: string): string; export interface CredentialInstance { /** Addon instance name — the `wireAddon` name / RPC namespace. */ instanceName: string; /** Global credential name this instance binds (== instanceName). */ credentialName: string; /** n8n credential type key, e.g. "slackApi". */ n8nCredType: string; /** n8n credential id, when present in the export. */ credId?: string; /** n8n credential display name, when present in the export. */ credName?: string; /** Best-effort addon package this instance is an instance of. */ package: string; /** The addon's own credential key that the override remaps. */ addonCredKey: string; /** RPC names of the nodes bound to this instance. */ nodeRpcNames: string[]; } /** "slackApi" -> "slack", "googleSheetsOAuth2Api" -> "googleSheets". */ export declare function serviceFromCredType(credType: string): string; /** Best-effort addon package for an n8n credential type. Refined downstream. */ export declare function packageForCredType(credType: string): string; /** * Deduplicated addon instances across the workflow — one per distinct * (credential type, credential id/name) pair, with the nodes bound to each. */ export declare function deriveCredentialInstances(parsed: ParsedWorkflow): CredentialInstance[]; /** Map each node's RPC name to the instance it binds (first credential wins). */ export declare function nodeInstanceBindings(instances: CredentialInstance[]): Record;