Collapse UUIDs and numeric IDs so distinct paths share a cooldown key.
(method: string, path: string)
| 26 | |
| 27 | /** Collapse UUIDs and numeric IDs so distinct paths share a cooldown key. */ |
| 28 | function normalizeAlertKey(method: string, path: string): string { |
| 29 | return `${method}:${path |
| 30 | .replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, ":id") |
| 31 | .replace(/\/\d+\b/g, "/:n")}`; |
| 32 | } |
| 33 | |
| 34 | function shouldAlert(key: string): boolean { |
| 35 | const now = Date.now(); |
no outgoing calls
no test coverage detected