@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
32 lines • 1.31 kB
TypeScript
/**
* Safe ID String Converter
*
* Handles conversion of numeric IDs to strings without scientific notation.
* JavaScript's Number type can only safely represent integers up to 2^53 - 1.
* Large IDs from APIs can exceed this and get converted to scientific notation
* when using String() or toString(), causing duplicate records in the database.
*
* Example problem:
* - API returns: 5600699287863296
* - String(id): "5.6006992878633e+15" ❌
* - safeIdToString(id): "5600699287863296" ✅
*/
/**
* Safely converts any ID value to a string without scientific notation
* @param id - The ID to convert (can be string, number, bigint, or object with toString)
* @returns String representation of the ID without scientific notation
*/
export declare function safeIdToString(id: any): string;
/**
* Validates if an ID string contains scientific notation
* @param idStr - The ID string to check
* @returns true if the string contains scientific notation
*/
export declare function hasScientificNotation(idStr: string): boolean;
/**
* Batch converts an array of IDs to safe strings
* @param ids - Array of IDs to convert
* @returns Array of string IDs without scientific notation
*/
export declare function safeIdArrayToStrings(ids: any[]): string[];
//# sourceMappingURL=SafeIdConverter.d.ts.map