Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 148x 1321x 1321x 1321x 1321x 1321x 1x 1x 1x 1x 1x 1x 1x 1x 1320x 1320x | const UNHYPHENATED_UUID = /^[0-9a-f]{32}$/;
/**
* Canonicalizes a uuid the way the server does, so a reference embedded in a
* flow definition in some other form (uppercase, braced, unhyphenated) still
* matches the normalized uuid the endpoint echoes back.
*
* This lives in its own module with no imports so both the store's asset cache
* and the flow definition rewriter can share it - they sit on opposite sides of
* a `Store -> AppState -> dependencies` chain, so a shared helper in either one
* would close an import cycle.
*/
export const normalizeUuid = (uuid: string): string => {
const trimmed = uuid
.trim()
.replace(/^\{|\}$/g, '')
.toLowerCase();
if (UNHYPHENATED_UUID.test(trimmed)) {
return [
trimmed.slice(0, 8),
trimmed.slice(8, 12),
trimmed.slice(12, 16),
trimmed.slice(16, 20),
trimmed.slice(20)
].join('-');
}
return trimmed;
};
|