optivise
Version:
Optivise - The Ultimate Optimizely Development Assistant with AI-powered features, zero-config setup, and comprehensive development support
14 lines • 514 B
JavaScript
import { AsyncLocalStorage } from 'async_hooks';
import { randomUUID } from 'crypto';
const correlationStorage = new AsyncLocalStorage();
export function runWithCorrelationId(correlationId, fn) {
return correlationStorage.run({ correlationId }, fn);
}
export function getCorrelationId() {
return correlationStorage.getStore()?.correlationId;
}
export function generateCorrelationId(prefix) {
const id = randomUUID();
return prefix ? `${prefix}-${id}` : id;
}
//# sourceMappingURL=correlation.js.map