UNPKG

@mcp-abap-adt/connection

Version:

ABAP connection layer for MCP ABAP ADT server

49 lines (48 loc) 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CSRF_ERROR_MESSAGES = exports.CSRF_CONFIG = void 0; /** * CSRF Token Configuration * * Centralized constants for CSRF token fetching to ensure consistency * across different connection implementations. */ exports.CSRF_CONFIG = { /** * Number of retry attempts for CSRF token fetch * Default: 3 attempts (total of 4 requests: initial + 3 retries) */ RETRY_COUNT: 3, /** * Delay between retry attempts (milliseconds) * Default: 1000ms (1 second) */ RETRY_DELAY: 1000, /** * CSRF token endpoint path (primary) * Standard SAP ADT core discovery endpoint (newer systems, returns smaller response) */ ENDPOINT: '/sap/bc/adt/core/discovery', /** * CSRF token endpoint path (fallback) * Legacy SAP ADT discovery endpoint for older systems (e.g. BASIS < 7.52) * that don't have /sap/bc/adt/core/discovery */ FALLBACK_ENDPOINT: '/sap/bc/adt/discovery', /** * Required headers for CSRF token fetch */ REQUIRED_HEADERS: { 'x-csrf-token': 'fetch', Accept: 'application/atomsvc+xml', }, }; /** * CSRF token error messages * Standardized error messages for consistent error reporting */ exports.CSRF_ERROR_MESSAGES = { FETCH_FAILED: (attempts, cause) => `Failed to fetch CSRF token after ${attempts} attempts: ${cause}`, NOT_IN_HEADERS: 'No CSRF token in response headers', REQUIRED_FOR_MUTATION: 'CSRF token is required for POST/PUT requests but could not be fetched', };