@mikitasazan/notify 1.6.1 → 1.7.0
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 +18 -0
- package/dist/render.js +39 -30
- package/package.json +1 -1
package/dist/render.d.ts
CHANGED
|
@@ -46,6 +46,24 @@ export declare const slug: (raw: string) => string;
|
|
|
46
46
|
* заголовок и есть единственное стабильное поле).
|
|
47
47
|
*/
|
|
48
48
|
export declare const eventKey: (e: NotifyEvent) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Третий тег — ИСХОД, и он есть всегда. Владелец: «не хватает тега fail или
|
|
51
|
+
* похожего, чтобы фейлы можно было группировать и ок можно было группировать».
|
|
52
|
+
* Одно нажатие в Telegram собирает все падения проекта разом, каким бы типом
|
|
53
|
+
* они ни пришли — выкатка, проверка, задача по расписанию, авария.
|
|
54
|
+
*
|
|
55
|
+
* The value comes from the ICON, never from the status word. The icon is
|
|
56
|
+
* already the single source of truth for the sound, and a second list of "what
|
|
57
|
+
* counts as broken" would drift from the first — it already did once, when a
|
|
58
|
+
* red card arrived silent.
|
|
59
|
+
*
|
|
60
|
+
* One icon meaning, one tag. A watchdog that SWITCHED SOMETHING OFF is not a
|
|
61
|
+
* failure and must not be filed under the same word as one: the owner read
|
|
62
|
+
* `#fail` under a 🚫 and said so. Nor is a task that has simply gone quiet —
|
|
63
|
+
* nobody knows yet whether it broke, and `#unknown` is the honest word for it.
|
|
64
|
+
*/
|
|
65
|
+
export declare const OUTCOME_TAG: Readonly<Record<string, string>>;
|
|
66
|
+
export declare const outcomeTag: (e: NotifyEvent) => string;
|
|
49
67
|
/**
|
|
50
68
|
* Строка тегов для свободного HTML (`sendReport`). Тег — это ФИЛЬТР владельца,
|
|
51
69
|
* и к формату тела он отношения не имеет: дневной отчёт остаётся свободным
|
package/dist/render.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* строка разделяет БЛОКИ ПО СМЫСЛУ (шапка / суть / действия), не механически
|
|
20
20
|
* после каждой строки.
|
|
21
21
|
*/
|
|
22
|
-
import { ICON,
|
|
22
|
+
import { ICON, iconFor } from "./events.js";
|
|
23
23
|
/** Первая буква — заглавная, остальное как есть (ga4/GitHub остаются собой). */
|
|
24
24
|
/**
|
|
25
25
|
* Ярлык с большой буквы — но НЕ у имени, которое пишется со строчной нарочно:
|
|
@@ -332,15 +332,22 @@ const labelled = (rows) => {
|
|
|
332
332
|
* на зелёную. Строка заголовка стоит дешевле, чем необходимость каждый раз
|
|
333
333
|
* заново искать глазами, где что.
|
|
334
334
|
*/
|
|
335
|
+
/**
|
|
336
|
+
* A deploy or a check has two subjects: the run itself and the commit it went
|
|
337
|
+
* out with. Facts about the RUN touch the type line with no heading, because
|
|
338
|
+
* the type line already names the run — that is how every job card is built,
|
|
339
|
+
* and `Reason:` must not sit against the name on one card and under a heading
|
|
340
|
+
* on another. Facts about the COMMIT are a different subject, so they keep a
|
|
341
|
+
* heading of their own.
|
|
342
|
+
*
|
|
343
|
+
* The `Run` heading is gone for the same reason the word `open` went: it
|
|
344
|
+
* announced what line 2 had already said.
|
|
345
|
+
*/
|
|
335
346
|
const twoBlocks = (run, change) => {
|
|
336
347
|
const live = (rows) => rows.filter((r) => r !== null && r !== '');
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
out.push('', group(name), ...rows);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
return out;
|
|
348
|
+
const runRows = live(run);
|
|
349
|
+
const changeRows = live(change);
|
|
350
|
+
return [...runRows, ...(changeRows.length > 0 ? ['', group('Change'), ...changeRows] : [])];
|
|
344
351
|
};
|
|
345
352
|
// Значок и его закон живут в events.ts: от него зависит и звук.
|
|
346
353
|
/** Строка 2: значок вне жирного, `<b>Тип:</b> действие` — то же поле, не особый случай. */
|
|
@@ -417,17 +424,12 @@ const renderJob = (e) => {
|
|
|
417
424
|
// were two words for one thing, and the outcome that took the first line is
|
|
418
425
|
// already the icon, and now the third tag too.
|
|
419
426
|
//
|
|
420
|
-
//
|
|
421
|
-
// "it
|
|
422
|
-
// and the
|
|
423
|
-
|
|
424
|
-
? 'switched off, not broken'
|
|
425
|
-
: e.status === 'silent'
|
|
426
|
-
? 'no word from it at all'
|
|
427
|
-
: undefined;
|
|
427
|
+
// There is no `State:` row. It said "switched off, not broken" under a 🚫
|
|
428
|
+
// and "no word from it at all" under a ❓ — the third way of saying what the
|
|
429
|
+
// icon says and what the third tag now says too. The icon table on the
|
|
430
|
+
// catalogue page defines both marks.
|
|
428
431
|
return join([
|
|
429
432
|
typeLine(icon, 'Job', e.job, e.workflowUrl ?? e.url),
|
|
430
|
-
field('State', state),
|
|
431
433
|
field('Reason', e.note),
|
|
432
434
|
field('Expected', e.expected),
|
|
433
435
|
// `Last run` when the task is alive, `Last seen` when it is not: the same
|
|
@@ -633,21 +635,28 @@ export const eventKey = (e) => {
|
|
|
633
635
|
* Одно нажатие в Telegram собирает все падения проекта разом, каким бы типом
|
|
634
636
|
* они ни пришли — выкатка, проверка, задача по расписанию, авария.
|
|
635
637
|
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
638
|
+
* The value comes from the ICON, never from the status word. The icon is
|
|
639
|
+
* already the single source of truth for the sound, and a second list of "what
|
|
640
|
+
* counts as broken" would drift from the first — it already did once, when a
|
|
641
|
+
* red card arrived silent.
|
|
642
|
+
*
|
|
643
|
+
* One icon meaning, one tag. A watchdog that SWITCHED SOMETHING OFF is not a
|
|
644
|
+
* failure and must not be filed under the same word as one: the owner read
|
|
645
|
+
* `#fail` under a 🚫 and said so. Nor is a task that has simply gone quiet —
|
|
646
|
+
* nobody knows yet whether it broke, and `#unknown` is the honest word for it.
|
|
642
647
|
*/
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
648
|
+
export const OUTCOME_TAG = {
|
|
649
|
+
[ICON.red]: 'fail',
|
|
650
|
+
[ICON.alarm]: 'fail',
|
|
651
|
+
[ICON.off]: 'off',
|
|
652
|
+
[ICON.unknown]: 'unknown',
|
|
653
|
+
[ICON.ok]: 'ok',
|
|
654
|
+
[ICON.landed]: 'ok',
|
|
655
|
+
[ICON.approved]: 'ok'
|
|
650
656
|
};
|
|
657
|
+
// Everything left over — a task was opened, a PR opened, edits asked for, a
|
|
658
|
+
// digest — is news: something happened, no verdict was passed.
|
|
659
|
+
export const outcomeTag = (e) => OUTCOME_TAG[iconFor(e)] ?? 'news';
|
|
651
660
|
const tagsLine = (e) => `#${TYPE_TAG[e.type]} #${esc(eventKey(e))} #${outcomeTag(e)}`;
|
|
652
661
|
/**
|
|
653
662
|
* Строка тегов для свободного HTML (`sendReport`). Тег — это ФИЛЬТР владельца,
|
package/package.json
CHANGED