/** * Simple validation utilities for the core-db package. * Designed to be lightweight and only run when needed. */ export const validateConfig = (configName: string, value?: string): string => { if (!value || value.trim() === "") { throw new Error( `[core-db] Configuration Error: '${configName}' is missing. ` + `Please provide it via parameters or set the corresponding environment variable.`, ); } return value; }; export const validateMongoUri = (uri: string): void => { if (!uri.startsWith("mongodb://") && !uri.startsWith("mongodb+srv://")) { throw new Error( `[core-db] Connection Error: The provided MongoDB URI is invalid. ` + `It must start with 'mongodb://' or 'mongodb+srv://'. Received: '${uri}'`, ); } };