/** * Jira Field Resolution Service * * Automatically resolves Jira custom field IDs by name and caches them. * Handles field fetching, caching, and re-resolution on errors. */ import type { JiraCredential } from "@prisma/client"; export interface JiraField { id: string; name: string; type?: string; custom?: boolean; schema?: { type?: string; system?: string; }; } export interface FieldMappingConfig { fieldName: string; defaultFieldName?: string; } /** * Fetch all fields from Jira REST API */ export declare function fetchJiraFields(baseUrl: string, accessToken: string): Promise; /** * Get cached fields from database (if not expired) */ export declare function getCachedFields(jiraBaseUrl: string): Promise; /** * Cache fields in database for 24 hours */ export declare function cacheFields(jiraBaseUrl: string, fields: JiraField[]): Promise; /** * Find field by name (case-insensitive partial match) */ export declare function findFieldByName(fields: JiraField[], fieldName: string): JiraField | null; /** * Resolve field mappings for a Jira credential * Fetches fields from Jira (or cache), finds fields by name, and stores mappings */ export declare function resolveFieldMappings(credential: JiraCredential, configs?: FieldMappingConfig[]): Promise>; /** * Get field ID from database mapping * Returns null if not found */ export declare function getFieldId(credential: JiraCredential, fieldName: string): Promise; /** * Get field ID with auto-re-resolution on error * If fieldId is provided and Jira returns "field cannot be set" error, * this will re-resolve and retry */ export declare function getFieldIdWithAutoResolve(credential: JiraCredential, fieldName: string, onError?: (error: Error) => Promise): Promise; /** * Re-resolve all field mappings for a credential * Used when field errors are detected */ export declare function reResolveFieldMappings(credential: JiraCredential): Promise>; /** * Get all available fields for a Jira site (for admin UI) */ export declare function getAllFieldsForSite(credential: JiraCredential): Promise; /** * Get current field mappings for a credential */ export declare function getFieldMappings(credentialId: string): Promise>; /** * Update field mapping manually (for admin UI override) */ export declare function updateFieldMapping(credentialId: string, fieldName: string, fieldId: string, fieldType?: string): Promise; //# sourceMappingURL=fieldResolver.d.ts.map