UNPKG

sfcc-dev-mcp

Version:

MCP server for Salesforce B2C Commerce Cloud development assistance including logs, debugging, and development tools

60 lines 1.94 kB
/** * Shared utilities for job log operations */ export class JobLogValidators { /** * Allowed log levels for job logs (includes 'all' for job-specific operations) */ static ALLOWED_LEVELS = ['error', 'warn', 'info', 'debug', 'all']; /** * Validate job log level parameter * @param level - The level to validate * @param toolName - Optional tool name for better error messages */ static validateJobLogLevel(level, toolName) { if (!this.ALLOWED_LEVELS.includes(level)) { const errorPrefix = toolName ? `${toolName}: ` : ''; throw new Error(`${errorPrefix}Invalid log level: ${level}. Must be one of: ${this.ALLOWED_LEVELS.join(', ')}`); } } /** * Get default limit based on operation type * @param operationType - Type of operation ('search' | 'entries' | 'files') */ static getDefaultLimit(operationType) { switch (operationType) { case 'search': return 20; case 'entries': return 10; case 'files': return 10; default: return 10; } } } export class JobLogFormatters { /** * Format a consistent log message for job operations * @param operation - The operation being performed * @param params - Parameters for the operation */ static formatJobLogMessage(operation, params) { const parts = [operation]; if (params.jobName) { parts.push(`jobName=${params.jobName}`); } if (params.level) { parts.push(`level=${params.level}`); } if (params.limit !== undefined) { parts.push(`limit=${params.limit}`); } if (params.pattern) { parts.push(`pattern="${params.pattern}"`); } return parts.join(' '); } } //# sourceMappingURL=job-log-utils.js.map