trade360-nodejs-sdk
Version:
LSports Trade360 SDK for Node.js
28 lines (27 loc) • 1.08 kB
TypeScript
/**
* Utility class for ID transformations across entities.
* Provides reusable transformation logic for converting various ID types to strings
* with strict validation to ensure only numeric integer values are accepted.
*/
export declare class IdTransformerUtil {
private static readonly numericStringSchema;
private static readonly numericSchema;
/**
* Transforms various ID types to string format with strict validation.
* Only accepts:
* - Positive integers (number type)
* - Numeric strings containing only digits
*
* Rejects:
* - Decimal numbers (e.g., 123.45)
* - Non-numeric strings (e.g., 'invalid', 'abc123')
* - Negative numbers
* - NaN, Infinity, null, undefined
*
* @param value - The ID value to transform (number, string, etc.)
* @param fieldName - The name of the field being transformed (for error reporting)
* @returns The ID as a string
* @throws IdTransformationError if the value is invalid
*/
static transformId(value: unknown, fieldName?: string): string;
}