/** * These utilities are meant to be shared both client and server. * Don't add anything that can't be shared (especially dependencies) */ /** * Generate a unique S3 key name for a chat file upload. * * Use the uuid module to generate the v7 uuid as in * * Replace punctation that isn't _ or - with a _ * * import { v7 as uuidv7 } from 'uuid'; * uuidv7() * * @param userId - The user id of the user uploading the file * @param fileName - The name of the file to upload. it should already be sanitized by calling sanitizeFileName * @param v7Uuid - The uuidv7 uuid of the file * @returns The S3 key name for the file */ declare function generateChatFileUploadS3KeyName(userId: string, fileName: string, v7Uuid: string): string; /** * Remove all punctuation from a file name except for the ending period for the file extension if it exists * * @param fileName - The name of the file to sanitize * @returns The sanitized file name */ declare function sanitizeFileName(fileName: string): string; type ToSnakeCase = S extends `${infer T}${infer U}` ? `${T extends Capitalize ? '_' : ''}${Lowercase}${ToSnakeCase}` : S; type ToCamelCase = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase}${Uppercase}${ToCamelCase}` : Lowercase; type SnakeCase = { [K in keyof T as K extends string ? ToSnakeCase : K]: T[K] extends object ? SnakeCase : T[K]; }; type CamelCase = { [K in keyof T as K extends string ? ToCamelCase : K]: T[K] extends object ? CamelCase : T[K]; }; declare function convertToCamelCase(data: SnakeCase): T; declare function convertToSnakeCase(data: T): SnakeCase; declare function convertStringToSnakeCase(str: string): string; export { type CamelCase, type SnakeCase, convertStringToSnakeCase, convertToCamelCase, convertToSnakeCase, generateChatFileUploadS3KeyName, sanitizeFileName };