UNPKG

langsmith

Version:

Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.

17 lines (16 loc) 696 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertUuid = assertUuid; // Relaxed UUID validation regex (allows any valid UUID format including nil UUIDs) const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; function assertUuid(str, which) { // Use relaxed regex validation instead of strict uuid.validate() // This allows edge cases like nil UUIDs or test UUIDs that might not pass strict validation if (!UUID_REGEX.test(str)) { const msg = which !== undefined ? `Invalid UUID for ${which}: ${str}` : `Invalid UUID: ${str}`; throw new Error(msg); } return str; }