import { IExecuteFunctions, IHttpRequestMethods, IHttpRequestOptions } from 'n8n-workflow'; import { IPrestaShopCredentials } from '../types'; /** * Map of filter operators to their PrestaShop format templates. * {v} is replaced by the filter value. */ export declare const FILTER_OPERATOR_FORMATS: Record; /** * Common operation options extracted once per iteration */ export interface OperationOptions { timeout: number; neverError: boolean; includeResponseHeaders: boolean; rawMode: boolean; showRequestInfo: boolean; showRequestUrl: boolean; delayBetweenCalls: number; retry: RetryOptions; } /** * Retry configuration applied to each individual HTTP call. * The retry budget is per call: every failing call gets a fresh set of attempts. */ export interface RetryOptions { enabled: boolean; maxRetries: number; retryDelay: number; /** Optional hook called before each retry wait, with the upcoming retry number (1-based) and the error. */ onRetry?: (attempt: number, error: any) => void; /** * Set for non-idempotent calls (POST/create): ambiguous network errors * (timeout, reset) are then NOT retried because the server may already * have processed the request, which would create duplicate records. */ nonIdempotent?: boolean; } /** * Pause execution for the given number of milliseconds (used to throttle calls). */ export declare function sleep(ms: number): Promise; /** * Determine whether an error is transient and worth retrying. * Retries on network/timeout errors, 5xx server errors and 429 rate-limit. * Never retries on 4xx (invalid key, not found, invalid XML, etc.). */ export declare function isRetryableError(error: any, nonIdempotent?: boolean): boolean; /** * Build a short human-readable reason from an error, for retry logging. * Prefers the network code, then the HTTP status, then the message. */ export declare function describeError(error: any): string; /** * Run an async HTTP operation with per-call retry on transient errors. * Each call gets its own retry budget; on the last attempt the error is rethrown * so existing neverError / continueOnFail handling applies unchanged. */ export declare function withRetry(retry: RetryOptions, fn: () => Promise): Promise; /** * Extract common operation options from node parameters */ export declare function getOperationOptions(executeFunctions: IExecuteFunctions, itemIndex: number): OperationOptions; /** * Build HTTP request options with appropriate headers */ export declare function buildHttpOptions(method: IHttpRequestMethods, url: string, credentials: IPrestaShopCredentials, rawMode: boolean, timeout: number, body?: string): IHttpRequestOptions; /** * Mask a secret for debug output: keep the first 4 characters to help * identify which key was used, never expose the full value. */ export declare function maskSecret(secret: unknown): string; /** * Capture complete request information for debugging. * The API key is the Basic auth username, so both the Authorization header * and the username must be masked to avoid persisting the key in execution data. */ export declare function captureRequestDebugInfo(options: any, credentials: any, rawMode: boolean, operation: string, resource: string, body?: string): any; /** * Wrap response with optional headers and status information */ export declare function wrapResponse(processedResponse: any, includeHeaders: boolean, headers?: any, statusCode?: number): any; /** * Execute HTTP request with debug capture and response metadata */ export declare function executeHttpRequest(helpers: any, options: IHttpRequestOptions, credentials: any, rawMode: boolean, operation: string, resource: string, neverError?: boolean, body?: string, retry?: RetryOptions): Promise<{ response: any; debugInfo: any; url: string; responseHeaders?: any; statusCode?: number; }>; /** * Execute a raw mode request through n8n's httpRequest helper. * encoding 'text' + json false keep the body as a raw string (no parsing). */ export declare function executeRawModeRequest(helpers: any, requestUrl: string, credentials: IPrestaShopCredentials, timeout: number, neverError: boolean, includeResponseHeaders: boolean, operation: string, resource: string, retry?: RetryOptions): Promise<{ responseData: any; requestDebugInfo: any; requestHeaders: any; }>;