The words on a hop that was not a plain call — the Flow strip's connector label, in short.
(meta: Record<string, unknown>, synthesized: boolean)
| 1718 | |
| 1719 | /** The words on a hop that was not a plain call — the Flow strip's connector label, in short. */ |
| 1720 | function hopLabel(meta: Record<string, unknown>, synthesized: boolean): string { |
| 1721 | const parts: string[] = []; |
| 1722 | if (typeof meta.synthesizedBy === 'string') parts.push(`via ${meta.synthesizedBy}`); |
| 1723 | else if (synthesized) parts.push('inferred'); |
| 1724 | if (meta.channel === 'server-action') parts.push('server action'); |
| 1725 | if (meta.channel === 'http' && typeof meta.method === 'string') parts.push(`${meta.method} ${typeof meta.href === 'string' ? meta.href : ''}`.trim()); |
| 1726 | if (meta.tier === 'client→server') parts.push('to the server'); |
| 1727 | else if (meta.tier === 'server→client') parts.push('from the server'); |
| 1728 | if (meta.resolvedBy === 'receiver-type') parts.push('by the receiver’s declared type'); |
| 1729 | if (typeof meta.event === 'string') parts.push(`${meta.channel === 'queue' ? 'job' : meta.channel === 'socket' ? 'message' : 'event'} ${meta.event}`); |
| 1730 | if (typeof meta.queue === 'string') parts.push(`queue ${meta.queue}`); |
| 1731 | if (meta.bridge === 'react-native') parts.push(`React Native bridge${typeof meta.module === 'string' ? ` · ${meta.module}` : ''}`); |
| 1732 | if (typeof meta.registeredAt === 'string') parts.push(`registered at ${meta.registeredAt}`); |
| 1733 | return parts.join(' · '); |
| 1734 | } |
| 1735 | |
| 1736 | /** Source order of two hops: a hop written inside the other's call runs first; else by position; another file sorts after. */ |
| 1737 | function hopCompare(a: HopSite | undefined, b: HopSite | undefined): number { |