( value: string | number | null | undefined, paramName = 'ID' )
| 1295 | * ``` |
| 1296 | */ |
| 1297 | export function validateMondayNumericId( |
| 1298 | value: string | number | null | undefined, |
| 1299 | paramName = 'ID' |
| 1300 | ): ValidationResult { |
| 1301 | if (value === null || value === undefined || value === '') { |
| 1302 | return { |
| 1303 | isValid: false, |
| 1304 | error: `${paramName} is required`, |
| 1305 | } |
| 1306 | } |
| 1307 | |
| 1308 | const str = String(value).trim() |
| 1309 | |
| 1310 | if (!/^\d+$/.test(str)) { |
| 1311 | logger.warn('Monday.com ID is not a valid numeric integer', { |
| 1312 | paramName, |
| 1313 | value: str.substring(0, 50), |
| 1314 | }) |
| 1315 | return { |
| 1316 | isValid: false, |
| 1317 | error: `${paramName} must be a numeric integer`, |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | return { isValid: true, sanitized: str } |
| 1322 | } |
| 1323 | |
| 1324 | /** |
| 1325 | * Validates a Monday.com group ID. |
no test coverage detected