- Simplify universal modules to be more framework-friendly
- Add comprehensive framework integration documentation (Next.js, Vue, React)
- Implement missing relateMany() batch relationship creation method
- Clean up obsolete test files and improve test coverage
- Reduce browser polyfill complexity while maintaining compatibility
- Remove unused browserFramework entry points for cleaner API surface
📄 3,120 lines added, 3,679 lines removed for net simplification
24 lines
No EOL
654 B
TypeScript
24 lines
No EOL
654 B
TypeScript
/**
|
|
* Universal UUID implementation
|
|
* Framework-friendly: Works in all environments
|
|
*/
|
|
|
|
export function v4(): string {
|
|
// Use crypto.randomUUID if available (Node.js 19+, modern browsers)
|
|
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
return crypto.randomUUID()
|
|
}
|
|
|
|
// Fallback implementation for older environments
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
const r = Math.random() * 16 | 0
|
|
const v = c === 'x' ? r : (r & 0x3 | 0x8)
|
|
return v.toString(16)
|
|
})
|
|
}
|
|
|
|
// Named export to match uuid package API
|
|
export { v4 as uuidv4 }
|
|
|
|
// Default export for convenience
|
|
export default { v4 } |