auto-builder-sdk
Version:
SDK for building Auto Builder workflow plugins
45 lines (44 loc) • 1.81 kB
TypeScript
export interface CredentialProperty {
/** Technical field name stored in DB */
name: string;
/** Human-friendly label shown in UI */
displayName: string;
/** Basic scalar input type – UI can decide which widget to render */
type: 'string' | 'number' | 'boolean' | 'password' | 'options';
/** Indicates whether the field must be provided before a credential can be saved */
required?: boolean;
/** Optional default value for the field */
default?: unknown;
/** For "options" type – key/value list rendered as select */
options?: Array<{
label: string;
value: string | number;
}>;
}
/**
* CredentialDefinition represents the schema and optional validator for one
* credential type (e.g. "jira", "aws", "postgres").
*/
export interface CredentialDefinition {
/** Unique key referenced by nodes (e.g. "jira") */
name: string;
/** Human-readable provider name shown in pickers */
displayName: string;
/** Set of fields that constitute the credential */
properties: CredentialProperty[];
/**
* Optional async validator executed when the user clicks
* "Test Credentials" in the UI. Throw to indicate failure.
*/
validate?: (data: Record<string, unknown>) => Promise<void>;
}
/**
* Register a credential definition.
* Invoke at plugin top-level so that the definition is available as soon as
* the plugin is imported.
*/
export declare const registerCredential: (def: CredentialDefinition) => void;
/** Retrieve a credential definition by its name (if registered) */
export declare const getCredentialDef: (name: string) => CredentialDefinition | undefined;
/** List all credential definitions registered so far */
export declare const listCredentialDefinitions: () => CredentialDefinition[];