UNPKG

@clipwhisperer/common

Version:

ClipWhisperer Common - Shared library providing core utilities, database schemas, authentication, bucket management, and common functionality across all ClipWhisperer microservices

53 lines (46 loc) 1.22 kB
/** * ID Generation Utilities * Centralized ID generation functions used across services */ /** * Generate a job ID with timestamp */ export function generateJobId(): string { return `job_${Date.now()}`; } /** * Generate a video ID with timestamp and random suffix */ export function generateVideoId(): string { return `video_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; } /** * Generate a request ID with timestamp */ export function generateRequestId(): string { return `req_${Date.now()}`; } /** * Generate an audio ID with timestamp */ export function generateAudioId(): string { return `audio_${Date.now()}`; } /** * Generate a generic ID with custom prefix */ export function generateId(prefix: string): string { return `${prefix}_${Date.now()}`; } /** * Generate a unique ID with timestamp and random component */ export function generateUniqueId(prefix: string): string { return `${prefix}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; } /** * Generate a session ID */ export function generateSessionId(): string { return `session_${Date.now()}_${Math.random().toString(36).substr(2, 12)}`; }