(prefix)
| 132 | * @returns {string} |
| 133 | */ |
| 134 | export function createCorrelationId(prefix) { |
| 135 | const uuid = generateUuid(); |
| 136 | if (typeof prefix !== "string" || prefix.trim().length === 0) { |
| 137 | return uuid; |
| 138 | } |
| 139 | |
| 140 | const normalizedPrefix = prefix.trim(); |
| 141 | const suffix = normalizedPrefix.endsWith("-") ? "" : "-"; |
| 142 | return `${normalizedPrefix}${suffix}${uuid}`; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * @typedef {Object} NormalizedProducerOptions |
no test coverage detected