MCPcopy
hub / github.com/simstudioai/sim / uuidV5

Function uuidV5

apps/sim/lib/workspaces/fork/remap/block-identity.ts:19–28  ·  view source on GitHub ↗

* Deterministic UUIDv5 (SHA-1) of `name` within `namespace`. The same inputs * always yield the same UUID, which is how fork block identity stays stable.

(name: string, namespace: string)

Source from the content-addressed store, hash-verified

17 * always yield the same UUID, which is how fork block identity stays stable.
18 */
19function uuidV5(name: string, namespace: string): string {
20 const hash = createHash('sha1')
21 hash.update(uuidToBytes(namespace))
22 hash.update(Buffer.from(name, 'utf8'))
23 const bytes = hash.digest().subarray(0, 16)
24 bytes[6] = (bytes[6] & 0x0f) | 0x50
25 bytes[8] = (bytes[8] & 0x3f) | 0x80
26 const hex = bytes.toString('hex')
27 return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`
28}
29
30/**
31 * Derive the target block id for a source block copied into a target workflow.

Callers 1

deriveForkBlockIdFunction · 0.85

Calls 2

uuidToBytesFunction · 0.85
toStringMethod · 0.45

Tested by

no test coverage detected