bc-webclient-mcp
Version:
Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central via WebUI protocol. Enables AI assistants to interact with BC through the web client protocol, supporting Card, List, and Document pages with full line item support and server
78 lines • 3.02 kB
TypeScript
/**
* Handler Parser Implementation
*
* Parses BC JSON-RPC responses and extracts handlers.
* Handles decompression, validation, and LogicalForm extraction.
*/
import type { IHandlerParser } from '../core/interfaces.js';
import type { Result } from '../core/result.js';
import type { Handler, LogicalForm } from '../types/bc-types.js';
import { ProtocolError, LogicalFormParseError } from '../core/errors.js';
/**
* Implementation of IHandlerParser.
* Parses BC WebSocket responses and extracts handlers.
*/
export declare class HandlerParser implements IHandlerParser {
/**
* Parses handlers from a JSON-RPC response.
* Handles both compressed and uncompressed responses.
*
* @param response - Raw response from BC WebSocket
* @returns Result containing handlers array or error
*/
parse(response: unknown): Result<readonly Handler[], ProtocolError>;
/**
* Extracts formId from CallbackResponseProperties in handlers.
* The formId is returned by BC after OpenForm and identifies which form was opened.
*
* @param handlers - Array of handlers to search
* @returns FormId string if found, undefined otherwise
*/
extractFormId(handlers: readonly Handler[]): string | undefined;
/**
* Extracts LogicalForm from FormToShow event in handlers.
* If formId is provided, filters to the specific form by ServerId.
*
* @param handlers - Array of handlers to search
* @param formId - Optional formId to filter by (from OpenForm callback)
* @returns Result containing LogicalForm or error
*/
extractLogicalForm(handlers: readonly Handler[], formId?: string): Result<LogicalForm, LogicalFormParseError>;
/** Find all FormToShow handlers */
private findFormToShowHandlers;
/** Handle case when no FormToShow found - check for dialog error */
private handleNoFormToShow;
/** Select the appropriate FormToShow handler based on formId */
private selectFormHandler;
/** Extract and validate LogicalForm from handler */
private extractAndValidateLogicalForm;
/**
* Extracts LogicalForm from DialogToShow event in handlers.
* Dialogs use the same LogicalForm structure as regular forms.
*
* @param handlers - Array of handlers to search
* @returns Result containing LogicalForm or error
*/
extractDialogForm(handlers: readonly Handler[]): Result<LogicalForm, LogicalFormParseError>;
/**
* Parses compressed result from base64 gzipped data.
*/
private parseCompressedResult;
/**
* Parses handlers from decompressed result.
*/
private parseHandlers;
/**
* Validates that LogicalForm has required properties.
*/
private isValidLogicalForm;
/**
* Gets list of missing required fields from LogicalForm.
*/
private getMissingLogicalFormFields;
/**
* Type guard for checking if value is an object.
*/
private isObject;
}
//# sourceMappingURL=handler-parser.d.ts.map