@mikitasazan/notify 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/render.d.ts CHANGED
@@ -1,56 +1,59 @@
1
1
  /**
2
- * Один рендерер на тип события, все по одному каркасуутверждён
3
- * владельцем 20.08.2026 после ~15 живых раундов в тестовом форуме:
2
+ * One renderer per event type, all built on one skeleton approved by
3
+ * the owner on 20.08.2026 after ~15 live rounds in the test forum:
4
4
  *
5
- * #тип #экземпляр
6
- * значок <b>Тип:</b> действие
5
+ * #type #instance
6
+ * icon <b>Type:</b> action
7
7
  *
8
- * <b>Ярлык:</b> значение
9
- * <blockquote>цитата чужого текстатело коммита, тело задачи</blockquote>
8
+ * <b>Label:</b> value
9
+ * <blockquote>quoted text from someone else commit body, task body</blockquote>
10
10
  *
11
- * <i><u>Группа</u></i>
12
- * <b>#N (overdue):</b> <a>заголовок</a>
11
+ * <i><u>Group</u></i>
12
+ * <b>#N (overdue):</b> <a>title</a>
13
13
  *
14
- * <b>Ярлык:</b> значениедействия/направления
14
+ * <b>Label:</b> valueactions/directions
15
15
  *
16
- * Три уровня начертания, никогда не смешиваются: поле жирный ярлык с
17
- * большой буквы + обычное значение; группа курсив+подчёркивание, без
18
- * жирности и без двоеточия; строка 2 (тип) тот же закон поля. Пустая
19
- * строка разделяет БЛОКИ ПО СМЫСЛУ (шапка / суть / действия), не механически
20
- * после каждой строки.
16
+ * Three levels of styling, never mixed: a field is a bold, capitalized
17
+ * label plus a plain value; a group is italic+underline, no bold and no
18
+ * colon; line 2 (the type) follows the same field rule. A blank line
19
+ * separates BLOCKS BY MEANING (header / body / actions), not mechanically
20
+ * after every line.
21
21
  */
22
22
  import { type NotifyEvent } from './events.ts';
23
- /** Экранируется ВСЁ, что пришло снаружитеги ставит только шаблон. */
23
+ /** Escapes EVERYTHING that comes from outside only the template adds tags. */
24
24
  export declare const esc: (v: unknown) => string;
25
25
  /**
26
- * Telegram режет сообщение на 4096 символахрежем сами, по возможности по
27
- * границе строки.
26
+ * Telegram cuts a message at 4096 characterswe cut it ourselves first,
27
+ * on a line boundary where possible.
28
28
  *
29
- * Два подвоха, оба приводили к ТИХОЙ потере сообщения:
30
- * 1. Резать строго по последнему `\n` нельзя: если длинный кусок идёт одной
31
- * строкой (стектрейс, вывод командысамый частый `detail` у инцидента),
32
- * последний перевод строки стоит ПЕРЕД ним, и содержимое выбрасывалось
33
- * целикомприходил заголовок без единого факта о поломке.
34
- * 2. Резать посреди HTML-тега или сущности тоже нельзя: Telegram отвечает
35
- * `400 can't parse entities`, а 4xx мы считаем постоянной ошибкой и не
36
- * повторяем сообщение исчезало совсем.
29
+ * Two traps, both caused a SILENT loss of the message:
30
+ * 1. Cutting strictly at the last `\n` does not work: if a long chunk runs
31
+ * as one line (a stack trace, command output the most common `detail`
32
+ * on an incident), the last line break sits BEFORE it, and the whole
33
+ * content got dropped only the heading arrived, with not a single
34
+ * fact about what broke.
35
+ * 2. Cutting in the middle of an HTML tag or entity does not work either:
36
+ * Telegram replies `400 can't parse entities`, and we treat a 4xx as a
37
+ * permanent error and do not retry — the message disappeared for good.
37
38
  */
38
39
  export declare const clampMessage: (text: string, limit?: number) => string;
39
40
  export declare const slug: (raw: string) => string;
40
41
  /**
41
- * Экземпляр-тег: что именно это конкретное событие (ветка, окружение,
42
- * задача, номер) — по нему разборщик сверяет 🔴 с более поздней зелёной
43
- * карточкой ТОГО ЖЕ экземпляра. Явный `key` побеждает всегда; без него —
44
- * выводится из самых стабильных полей типа (ветка/окружение важнее заголовка,
45
- * потому что заголовок у регулярной задачи не меняется, а у отчёта как раз
46
- * заголовок и есть единственное стабильное поле).
42
+ * The instance tag: exactly which concrete event this is (branch,
43
+ * environment, task, number) — the parser uses it to match a 🔴 against a
44
+ * later green card of the SAME instance. An explicit `key` always wins;
45
+ * without one, it is derived from the type's most stable fields (branch/
46
+ * environment outrank the title, because a recurring task's title does not
47
+ * change, while for a report the title is exactly the one stable field it
48
+ * has).
47
49
  */
48
50
  export declare const eventKey: (e: NotifyEvent) => string;
49
51
  /**
50
- * Третий тег ИСХОД, и он есть всегда. Владелец: «не хватает тега fail или
51
- * похожего, чтобы фейлы можно было группировать и ок можно было группировать».
52
- * Одно нажатие в Telegram собирает все падения проекта разом, каким бы типом
53
- * они ни пришли выкатка, проверка, задача по расписанию, авария.
52
+ * The third tag is the OUTCOME, and it is always there. The owner: "I'm
53
+ * missing a fail tag or something like it, so failures can be grouped and
54
+ * ok can be grouped." One tap in Telegram collects every failure of a
55
+ * project at once, no matter what type it arrived as — a deploy, a check,
56
+ * a scheduled task, an incident.
54
57
  *
55
58
  * The value comes from the ICON, never from the status word. The icon is
56
59
  * already the single source of truth for the sound, and a second list of "what
@@ -65,18 +68,18 @@ export declare const eventKey: (e: NotifyEvent) => string;
65
68
  export declare const OUTCOME_TAG: Readonly<Record<string, string>>;
66
69
  export declare const outcomeTag: (e: NotifyEvent) => string;
67
70
  /**
68
- * Строка тегов для свободного HTML (`sendReport`). Тег это ФИЛЬТР владельца,
69
- * и к формату тела он отношения не имеет: дневной отчёт остаётся свободным
70
- * текстом, но перестаёт быть единственной карточкой без тегов. Раньше ключ
71
- * висел хвостом в `<i><code>#ключ</code></i>` — это старый формат, до того как
72
- * теги переехали первой строкой.
71
+ * The tag line for free-form HTML (`sendReport`). The tag is the owner's
72
+ * FILTER, and it has nothing to do with the body's format: a daily report
73
+ * stays free-form text, but stops being the one card with no tags. The key
74
+ * used to hang off the tail as `<i><code>#key</code></i>` — that is the old
75
+ * format, from before tags moved to the first line.
73
76
  */
74
77
  export declare const reportTags: (key: string) => string;
75
78
  /**
76
- * Рендерит событие в готовый HTML-текст, обрезанный под лимит Telegram.
77
- * Теги ПЕРВАЯ строка, добавляются до обрезки (не после, как раньше): они
78
- * несут и человеческий фильтр, и машинный ключ разборщикаобрезанная
79
- * карточка без них была бы не только некликабельной, но и невидимой
80
- * разборщику ровно на самых длинных, то есть самых важных сообщениях.
79
+ * Renders an event into finished HTML text, cut to Telegram's limit.
80
+ * Tags are the FIRST line, added before the cut (not after, as before):
81
+ * they carry both the human filter and the parser's machine key a card
82
+ * cut without them would be not only unclickable but invisible to the
83
+ * parser on exactly the longest, meaning the most important, messages.
81
84
  */
82
85
  export declare const render: (e: NotifyEvent) => string;