UNPKG

pms-analysis-reports-mcp-server

Version:

PMS analysis reports server handling maintenance reports, equipment analysis, compliance tracking, and performance metrics with ERP access for data extraction

110 lines (109 loc) 7.62 kB
import { ToolArguments, ToolResponse } from "./types/index.js"; export declare function fetchQADetails(imo: string, qaId: number, vesselInfoDbName: string, vesselInfoMongoUri: string, collectionName?: string): Promise<any>; export declare function fetchQADetailsAndCreateResponse(imo: string | undefined, questionNo: number, functionName: string, linkHeader: string, sessionId: string | undefined, vesselInfoDbName: string, vesselInfoMongoUri: string, collectionName?: string): Promise<ToolResponse>; export declare function getComponentData(componentId: string, vesselComponentsDbName: string, vesselComponentsMongoUri: string, collectionName?: string): Promise<string>; export declare function addComponentData(answer: string, imo: string, vesselComponentsDbName: string, vesselComponentsMongoUri: string): Promise<string>; export declare function getVesselQnASnapshot(imo: string, questionNo: string): Promise<any>; export declare function getVesselQnASnapshotHandler(arguments_: ToolArguments): Promise<ToolResponse>; export declare function getDataLink(data: any[]): Promise<string>; export declare function getArtifact(toolName: string, link: string): Promise<any>; export declare function getListOfArtifacts(toolName: string, linkData: Array<{ title: string; url: string | null; }>): Promise<ToolResponse>; export declare function convertUnixDates(document: any): any; /** * Convert data to CSV format * @param data - Array of objects to convert * @returns CSV string */ export declare function convertToCSV(data: any[]): string; export declare function processTypesenseResults(searchResult: any, toolName: string, title: string, session_id: string | undefined, linkHeader: string, artifactTitle?: string, dbName?: string, mongoUri?: string): Promise<ToolResponse>; export declare function processTypesenseExportResults(documents: any[], toolName: string, title: string, artifactTitle: string, session_id: string, linkHeader: string, imo: string, vesselName: string | null, dbName?: string, mongoUri?: string): Promise<ToolResponse>; export declare function formatTypesenseResults(searchResult: any, toolName: string, title: string, dataLink: string, artifactTitle?: string): Promise<ToolResponse>; /** * Step 1: Query Typesense fleet-details collection to get fleet IMO by name * @param fleetName - Name of the fleet (e.g., "SMPL DRY") * @returns Promise<number | null> - Fleet IMO number or null if not found */ export declare function getFleetImoByName(fleetName: string): Promise<number | null>; /** * Step 2: Query MongoDB common_group_details collection to get vessel IMO list * @param fleetImo - IMO number of the fleet * @returns Promise<number[]> - Array of vessel IMO numbers */ export declare function getVesselImoListFromFleet(fleetImo: number, dbName: string, mongoUri: string, collectionName?: string): Promise<number[]>; /** * ============================================================================ * OLD IMPLEMENTATION (COMMENTED OUT - REPLACED BY OPTIMIZED VERSION) * ============================================================================ * The old implementation has been replaced with an optimized version that includes: * - In-memory caching with TTL (5 minutes) * - MongoDB connection pooling * - Set-based IMO lookups (O(1) instead of O(n)) * - Cached environment variables and config * * See: src/utils/company-filtering.ts for the optimized implementation * ============================================================================ */ export declare function updateTypesenseFilterWithCompanyImos(filter: string, dbName?: string, mongoUri?: string): Promise<string>; export declare function updateTypesenseFilterWithCompanyImosPms(filter: string, dbName?: string, mongoUri?: string): Promise<string>; export declare function updateTypesenseFilterWithCompanyImosDefect(filter: string, dbName?: string, mongoUri?: string): Promise<string>; /** * Update MongoDB filter with company IMO numbers for filtering (PMS version) * @param filter - Existing MongoDB filter object * @returns Updated filter object with IMO restrictions */ export declare function updateMongoFilterWithCompanyImos(filter: any, dbName?: string, mongoUri?: string): Promise<any>; /** * Update MongoDB aggregation pipeline with company IMO numbers for filtering (PMS version) * @param pipeline - Existing MongoDB aggregation pipeline * @returns Updated pipeline with IMO restrictions */ export declare function updateMongoAggregationWithCompanyImos(pipeline: any[], dbName?: string, mongoUri?: string): Promise<any[]>; /** * Update search query parameters with company IMO filtering (PMS version) * @param searchParams - Search parameters object * @returns Updated search parameters with IMO restrictions */ export declare function updateSearchParamsWithCompanyImos(searchParams: any, dbName?: string, mongoUri?: string): Promise<any>; /** * Check if a vessel IMO is authorized for the current company (PMS version) * @param imo - IMO number to check * @returns True if authorized, false otherwise */ export declare function isVesselAuthorizedForCompany(imo: string | number, dbName?: string, mongoUri?: string): Promise<boolean>; /** * Get authorized IMO numbers for the current company (PMS version) * @returns Array of authorized IMO numbers */ export declare function getAuthorizedImoNumbers(dbName?: string, mongoUri?: string): Promise<string[]>; /** * Log IMO filtering activity for monitoring (PMS version) * @param action - Action being performed * @param details - Additional details about the filtering */ export declare function logImoFilteringActivity(action: string, details?: any, dbName?: string, mongoUri?: string): Promise<void>; /** * Generic function to export Typesense data for a given collection and IMO list * @param collectionName - Name of the Typesense collection * @param imoList - Array of IMO numbers * @param startDate - Optional start date filter (ISO string) * @param endDate - Optional end date filter (ISO string) * @param dateField - Name of the date field to filter on * @param excludeFields - Fields to exclude in the export * @param timestampFields - Fields to convert from UNIX timestamp to ISO string * @returns Array of parsed and processed documents */ export declare function exportDataForImoListGeneric(collectionName: string | undefined, imoList: number[], startDate?: string, endDate?: string, dateField?: string, excludeFields?: string, timestampFields?: string[]): Promise<any[]>; export declare function exportDefectsForImoList(imoList: number[], startDate?: string, endDate?: string): Promise<any[]>; export declare function exportPurchasesForImoList(imoList: number[], startDate?: string, endDate?: string): Promise<any[]>; export declare function exportBudgetsForImoList(imoList: number[], startDate?: string, endDate?: string): Promise<any[]>; export declare function exportExpensesForImoList(imoList: number[], startDate?: string, endDate?: string): Promise<any[]>; export declare function exportSurveysForImoList(imoList: number[], startDate?: string, endDate?: string): Promise<any[]>; export declare function combined_mongotools_with_single_category_mapping(args: any, allQuestions?: number[], toolNamePrefix?: string, questionMappings?: { [key: number]: string; }, qaDbName?: string, qaMongoUri?: string): Promise<ToolResponse>; export declare function combined_mongotools_with_grouped_category_mapping(args: any, allowedCategories?: string[], categoryMappings?: { [key: string]: number[]; }, toolNamePrefix?: string, qaDbName?: string, qaMongoUri?: string): Promise<ToolResponse>;