Files
Bingbing b09cde814d refactor: extract insomnia-data into workspace package (#10010)
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
2026-06-02 09:49:10 +00:00

16 lines
304 B
TypeScript

import { v4 as uuidv4 } from 'uuid';
/**
* Generate an ID of the format "<MODEL_NAME>_<TIMESTAMP><RANDOM>"
* @param prefix
* @returns {string}
*/
export function generateId(prefix?: string) {
const id = uuidv4().replace(/-/g, '');
if (prefix) {
return `${prefix}_${id}`;
}
return id;
}