/** * APIClaw Dynamic Executor * Executes provider-configured actions via self-service managed-provider routing */ export interface ProviderDirectCallConfig { _id: string; providerId: string; apiId: string; baseUrl: string; authType: 'bearer' | 'basic' | 'api_key' | 'none'; authHeader: string; authPrefix: string; encryptedMasterKey: string; rateLimitPerUser: number; rateLimitPerDay: number; pricePerRequest: number; status: 'draft' | 'testing' | 'live'; allowCustomerKeys?: boolean; requireCustomerKeys?: boolean; } export interface ActionParam { name: string; type: 'string' | 'number' | 'boolean' | 'object'; required: boolean; description: string; default?: unknown; in: 'body' | 'query' | 'path'; } export interface ResponseMapping { name: string; path: string; } export interface ProviderAction { _id: string; directCallId: string; name: string; displayName: string; description: string; method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; path: string; params: ActionParam[]; responseMapping: ResponseMapping[]; enabled: boolean; requiresConfirmation?: boolean; estimatedCost?: string; } export interface ExecuteResult { success: boolean; provider: string; action: string; data?: unknown; error?: string; cost?: number; latencyMs?: number; } interface UsageStats { minute: number; day: number; } /** * Check if a provider has dynamic (self-service) config */ export declare function hasDynamicConfig(providerId: string): Promise; /** * Fetch managed-provider routing configuration from Convex */ export declare function getProviderConfig(providerId: string): Promise; /** * Fetch action configuration from Convex */ export declare function getActionConfig(providerId: string, actionName: string): Promise; /** * Check if a dynamic action requires confirmation (for costly actions) * Returns action config if confirmation required, null otherwise */ export declare function getDynamicConfirmationConfig(providerId: string, actionName: string): Promise<{ required: boolean; action?: ProviderAction; estimatedCost?: string; }>; /** * Get user's current usage for rate limiting */ export declare function getUserUsage(userId: string, providerId: string): Promise; /** * Build the full URL with path and query parameters */ export declare function buildUrl(baseUrl: string, path: string, params: Record, paramDefs: ActionParam[]): string; /** * Build request body from parameters */ export declare function buildBody(params: Record, paramDefs: ActionParam[]): string | undefined; /** * Build authentication headers based on auth type */ export declare function buildAuthHeaders(config: ProviderDirectCallConfig, decryptedKey: string): Record; /** * Extract value from object using simple JSONPath-like expression * Supports: $.field, $.field.nested, $.array[0], $.array[*].field */ export declare function extractJsonPath(data: unknown, path: string): unknown; /** * Map response data using configured response mappings */ export declare function mapResponse(data: unknown, responseMapping: ResponseMapping[]): Record; /** * Log usage to Convex */ export declare function logUsage(params: { userId: string; providerId: string; actionName: string; timestamp: number; success: boolean; latencyMs: number; creditsUsed: number; }): Promise; /** * Main function: Execute a dynamically configured action */ export declare function executeDynamicAction(providerId: string, actionName: string, params: Record, userId: string, customerKey?: string): Promise; /** * List available actions for a dynamic provider */ export declare function listDynamicActions(providerId: string): Promise; export {}; //# sourceMappingURL=execute-dynamic.d.ts.map