firewalla-mcp-server
Version:
Model Context Protocol (MCP) server for Firewalla MSP API - Provides real-time network monitoring, security analysis, and firewall management through 28 specialized tools compatible with any MCP client
96 lines • 3.21 kB
TypeScript
/**
* Simple Field Normalization Layer for Solo Dev OSS Project
*
* Provides consistent field handling across the codebase.
* Focuses on practical normalization for common issues.
*/
/**
* Simple field mapping configuration
*/
export interface FieldMapping {
/** Source field name */
from: string;
/** Target field name */
to: string;
/** Transform function for the value */
transform?: (value: any) => any;
}
/**
* Field normalization options
*/
export interface FieldNormalizationOptions {
/** Convert field names to snake_case */
toSnakeCase?: boolean;
/** Convert field names to camelCase */
toCamelCase?: boolean;
/** Remove null/undefined fields */
removeEmpty?: boolean;
/** Default value for null/undefined fields */
defaultValue?: any;
/** Custom field mappings */
mappings?: FieldMapping[];
}
/**
* Convert camelCase to snake_case
*/
export declare function toSnakeCase(str: string): string;
/**
* Convert snake_case to camelCase
*/
export declare function toCamelCase(str: string): string;
/**
* Check if a value is empty (null, undefined, empty string, empty array)
*/
export declare function isEmpty(value: any): boolean;
/**
* Normalize a single field value
*/
export declare function normalizeFieldValue(value: any, options?: {
defaultValue?: any;
removeEmpty?: boolean;
transform?: (value: any) => any;
}): any;
/**
* Normalize field names in an object
*/
export declare function normalizeFieldNames(obj: Record<string, any>, options?: Pick<FieldNormalizationOptions, 'toSnakeCase' | 'toCamelCase' | 'mappings'>): Record<string, any>;
/**
* Normalize an entire object with all options
*/
export declare function normalizeObject<T extends Record<string, any>>(obj: T, options?: FieldNormalizationOptions): Partial<T>;
/**
* Normalize an array of objects
*/
export declare function normalizeArray<T extends Record<string, any>>(array: T[], options?: FieldNormalizationOptions): Array<Partial<T>>;
/**
* Alias mapping for known problematic field names
* Used by toSnakeCaseDeep for intelligent field conversion
*/
export declare const FIELD_ALIAS_MAP: Record<string, string>;
/**
* Deep snake_case conversion for objects and arrays
* Recursively converts all field names to snake_case with intelligent alias handling
*/
export declare function toSnakeCaseDeep<T = any>(obj: T): T;
/**
* Common field mappings for Firewalla data
*/
export declare const COMMON_FIELD_MAPPINGS: FieldMapping[];
/**
* Preset normalization for Firewalla API responses
*/
export declare function normalizeFirewallaResponse<T extends Record<string, any>>(data: T | T[]): Partial<T> | Array<Partial<T>>;
/**
* Quick field normalization utility for common cases
*/
export declare const normalize: {
/** Normalize to snake_case with empty handling */
toApi: (obj: any) => Partial<any>;
/** Normalize from API response */
fromApi: (obj: any) => Partial<any> | Partial<any>[];
/** Just handle empty values */
emptyValues: (obj: any) => Partial<any>;
/** Just normalize field names */
fieldNames: (obj: any) => Record<string, any>;
};
//# sourceMappingURL=field-normalizer.d.ts.map