(buffer: Buffer)
| 48 | }); |
| 49 | return Promise.race([promise, timeout]).finally(() => clearTimeout(timer)); |
| 50 | } |
| 51 | |
| 52 | const avatarCache = new Map<string, Buffer | undefined>(); |
| 53 | |
| 54 | function stableEntityKey(entity: any): string | undefined { |
| 55 | const raw = entity?.id ?? entity?.userId ?? entity?.channelId ?? entity?.chatId ?? entity?.accessHash ?? entity; |
| 56 | if (!raw) return undefined; |
| 57 | try { |
| 58 | return typeof raw === "bigint" ? raw.toString() : JSON.stringify(raw, (_, v) => typeof v === "bigint" ? v.toString() : v); |
| 59 | } catch (_) { |
| 60 | return String(raw); |
| 61 | } |
| 62 | } |
no outgoing calls
no test coverage detected