/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/core/data-transfer/src/utils/capped-warnings.ts
33 строки
757 B
Ben Irvin
fix(data-transfer): skip orphaned links and isolate FK failures on restore (#26852)
05 авг 2026, 16:08
Не верифицирован
05 авг 2026, 16:08
f2632a9
Код
Авторство
О чём код?
export const DEFAULT_DETAILED_WARNING_LIMIT = 10; /** * Emits per-item warning messages up to `limit`, then a one-time suppression * notice. Callers should still emit an unconditional end-of-stage summary. */ export const createCappedWarningReporter = ( onWarning?: (message: string) => void, limit: number = DEFAULT_DETAILED_WARNING_LIMIT ) => { let emitted = 0; return { warn(message: string) { if (!onWarning) { return; } if (emitted >= limit) { return; } onWarning(message); emitted += 1; if (emitted === limit) { onWarning( `Further detailed warnings suppressed after ${limit} messages. See the stage summary for totals.` ); } }, }; };