/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Data processing module for the MCP server
* Provides input validation and output encoding
*/
// Configuration
export { SecurityConfig, DEFAULT_SECURITY_CONFIG, getSecurityConfig } from './config.js';
// Input validation
export {
ValidationResult,
SecurityValidationError,
InputValidators,
validators,
validateSearchDocumentationInput,
validateReadDocumentationInput,
} from './validators.js';
// Output encoding
export {
OutputEncoders,
encoders,
processSearchResponse,
processReadResponse,
createErrorResponse,
} from './encoders.js';
// Import instances for convenience object
import { validators, validateSearchDocumentationInput, validateReadDocumentationInput } from './validators.js';
import { encoders, processSearchResponse, processReadResponse, createErrorResponse } from './encoders.js';
/**
* Quick access to commonly used processing functions
*/
export const processing = {
// Input validation
validate: {
query: validators.validateQuery.bind(validators),
documentReference: validators.validateDocumentReference.bind(validators),
maxResults: validators.validateMaxResults.bind(validators),
documentationPath: validators.validateDocumentationPath.bind(validators),
searchInput: validateSearchDocumentationInput,
readInput: validateReadDocumentationInput,
},
// Output encoding
encode: {
json: encoders.encodeJson.bind(encoders),
url: encoders.encodeUrl.bind(encoders),
apiResponse: encoders.sanitizeApiResponse.bind(encoders),
errorMessage: encoders.sanitizeErrorMessage.bind(encoders),
},
// Response handling
response: {
processSearch: processSearchResponse,
processRead: processReadResponse,
createError: createErrorResponse,
},
};