import type { EndpointPolicy } from '../../core/endpoint-policy'; import type { TagValue } from '../../core/types'; export function stableEndpointKey(endpoints?: readonly EndpointPolicy[]): string { if (!endpoints?.length) { return ''; } return endpoints .map( endpoint => `${endpoint.match}\0${endpoint.slowRequestMs ?? ''}\0${endpoint.ignore === true}` ) .join('\n'); } export function stableExpectedKey(expected?: readonly string[]): string { return expected?.join('\0') ?? ''; } export function stableTagsKey(tags?: Record): string { if (!tags) { return ''; } return Object.keys(tags) .sort() .map(key => `${key}\0${String(tags[key])}`) .join('\n'); }