@mikitasazan/notify 1.7.0 → 1.8.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/cli-flags.js +1 -1
- package/dist/cli.js +4 -1
- package/dist/events.d.ts +15 -1
- package/dist/render.js +13 -9
- package/package.json +1 -1
package/dist/cli-flags.js
CHANGED
|
@@ -14,7 +14,7 @@ export const KNOWN_FLAGS = new Set([
|
|
|
14
14
|
'command', 'command-note', 'commit-body', 'commit-title', 'commit-url', 'detail',
|
|
15
15
|
'expected', 'filename', 'item',
|
|
16
16
|
'item-group', 'job', 'key', 'last-seen', 'line', 'logs', 'note',
|
|
17
|
-
'number', 'path', 'period', 'project', 'reviewer', 'stat', 'status',
|
|
17
|
+
'aside', 'number', 'path', 'period', 'project', 'reviewer', 'stat', 'status',
|
|
18
18
|
'target', 'title', 'url', 'via', 'workflow-name', 'workflow-url',
|
|
19
19
|
// Флаги без значения. Живут здесь же, чтобы разбор и список не разошлись.
|
|
20
20
|
'json', 'recovered', 'dry-run'
|
package/dist/cli.js
CHANGED
|
@@ -236,6 +236,7 @@ else {
|
|
|
236
236
|
project: project(),
|
|
237
237
|
job: one('job') ?? '(no name)',
|
|
238
238
|
status: jobStatus(),
|
|
239
|
+
aside: one('aside'),
|
|
239
240
|
expected: one('expected'),
|
|
240
241
|
lastSeen: one('last-seen'),
|
|
241
242
|
stats: pairs('stat'),
|
|
@@ -254,7 +255,9 @@ else {
|
|
|
254
255
|
type: 'report',
|
|
255
256
|
project: project(),
|
|
256
257
|
title: one('title') ?? '(no title)',
|
|
257
|
-
period
|
|
258
|
+
// `--period` is the old spelling of `--aside`; both fill the same
|
|
259
|
+
// slot, and two senders still use the old one.
|
|
260
|
+
aside: one('aside') ?? one('period'),
|
|
258
261
|
lines: pairs('line'),
|
|
259
262
|
items: items(),
|
|
260
263
|
url: one('url')
|
package/dist/events.d.ts
CHANGED
|
@@ -111,6 +111,14 @@ export type NotifyEvent = Keyed & (
|
|
|
111
111
|
* ПОЛНОМУ тегу. Один поток на задачу это чинит.
|
|
112
112
|
*/
|
|
113
113
|
status: 'ok' | 'fail' | 'disabled' | 'silent';
|
|
114
|
+
/**
|
|
115
|
+
* The one qualifier the name needs to be readable on its own, printed in
|
|
116
|
+
* brackets right after it: `Yandex game import (reporting again)`. It is
|
|
117
|
+
* the same slot a report uses for the day it covers. Anything that is a
|
|
118
|
+
* FACT about the job goes in a row of its own; this is for the word that
|
|
119
|
+
* finishes the name.
|
|
120
|
+
*/
|
|
121
|
+
aside?: string;
|
|
114
122
|
/** Как часто задача обязана отмечаться — для `silent` и для возврата из него. */
|
|
115
123
|
expected?: string;
|
|
116
124
|
/** Когда её видели в последний раз. */
|
|
@@ -162,7 +170,13 @@ export type NotifyEvent = Keyed & (
|
|
|
162
170
|
type: 'report';
|
|
163
171
|
project: Project;
|
|
164
172
|
title: string;
|
|
165
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Printed in brackets after the title — which day the report covers, or
|
|
175
|
+
* which day its arrows are measured against. Same slot, same name, as a
|
|
176
|
+
* job's. `period` is the old spelling of this field and the CLI still
|
|
177
|
+
* accepts `--period` for it.
|
|
178
|
+
*/
|
|
179
|
+
aside?: string;
|
|
166
180
|
/** Пусто/не передано, когда используются `groups` — два вида отчёта не смешиваются в одном событии. */
|
|
167
181
|
lines?: Array<[label: string, value: string | number, group?: string]>;
|
|
168
182
|
/**
|
package/dist/render.js
CHANGED
|
@@ -414,6 +414,10 @@ const renderDeploy = (e) => {
|
|
|
414
414
|
...twoBlocks([field('Target', e.target), field('Reason', e.note)], [fieldLink('Commit', e.commitUrl, e.commit), titleField(e.commitTitle), bodyQuote(e.commitBody)])
|
|
415
415
|
]);
|
|
416
416
|
};
|
|
417
|
+
const schedule = (expected, lastSeen, lastLabel) => {
|
|
418
|
+
const rows = [field('Expected', expected), field(lastLabel, lastSeen)].filter((r) => r !== null);
|
|
419
|
+
return rows.length > 0 ? ['', group('Schedule'), ...rows] : [];
|
|
420
|
+
};
|
|
417
421
|
const renderJob = (e) => {
|
|
418
422
|
const icon = iconFor(e);
|
|
419
423
|
const hasItems = (e.items ?? []).length > 0;
|
|
@@ -429,12 +433,13 @@ const renderJob = (e) => {
|
|
|
429
433
|
// icon says and what the third tag now says too. The icon table on the
|
|
430
434
|
// catalogue page defines both marks.
|
|
431
435
|
return join([
|
|
432
|
-
typeLine(icon, 'Job', e.job, e.workflowUrl ?? e.url),
|
|
436
|
+
typeLine(icon, 'Job', e.job, e.workflowUrl ?? e.url, e.aside),
|
|
433
437
|
field('Reason', e.note),
|
|
434
|
-
|
|
435
|
-
//
|
|
436
|
-
//
|
|
437
|
-
|
|
438
|
+
// The timetable is a different subject from this event: how often the task
|
|
439
|
+
// owes a sign of life and when it last gave one. It stood in a bare run
|
|
440
|
+
// under `Reason:` and read as more of the same. `Last run` when the task
|
|
441
|
+
// is alive, `Last seen` when it is not — one timestamp, two questions.
|
|
442
|
+
...schedule(e.expected, e.lastSeen, e.status === 'silent' ? 'Last seen' : 'Last run'),
|
|
438
443
|
...labelled(e.stats),
|
|
439
444
|
hasItems ? '' : null,
|
|
440
445
|
// Heading ONLY for `disabled`. It used to print for any job carrying a
|
|
@@ -459,7 +464,7 @@ const renderReport = (e) => {
|
|
|
459
464
|
// without a word.
|
|
460
465
|
const numbers = labelled(e.lines);
|
|
461
466
|
return join([
|
|
462
|
-
typeLine(iconFor(e), 'Report', e.title, e.url, e.
|
|
467
|
+
typeLine(iconFor(e), 'Report', e.title, e.url, e.aside),
|
|
463
468
|
// Rows with no group of their own sit flush against the header instead of
|
|
464
469
|
// forming a separate slab under a blank line. `labelled` puts the blank
|
|
465
470
|
// line before the first group itself, so there is none here.
|
|
@@ -472,7 +477,7 @@ const renderReport = (e) => {
|
|
|
472
477
|
return join([
|
|
473
478
|
// Both analytics jobs send a link to the day's snapshot in docs/. It used to
|
|
474
479
|
// hang off a trailing `Details: open` row; now it is the report's own name.
|
|
475
|
-
typeLine(iconFor(e), 'Report', e.title, e.url, e.
|
|
480
|
+
typeLine(iconFor(e), 'Report', e.title, e.url, e.aside),
|
|
476
481
|
// Flush against the header — see the branch above.
|
|
477
482
|
...labelled(e.lines),
|
|
478
483
|
items.length > 0 ? '' : null,
|
|
@@ -555,8 +560,7 @@ const renderHeartbeatMiss = (e) => {
|
|
|
555
560
|
// copy of that watchdog can, and the card it gets must obey the template.
|
|
556
561
|
typeLine(icon, 'Heartbeat', e.job, undefined, action),
|
|
557
562
|
field('Reason', e.note),
|
|
558
|
-
|
|
559
|
-
field(e.recovered ? 'Last run' : 'Last seen', e.lastSeen)
|
|
563
|
+
...schedule(e.expected, e.lastSeen, e.recovered ? 'Last run' : 'Last seen')
|
|
560
564
|
]);
|
|
561
565
|
};
|
|
562
566
|
const RENDERERS = {
|
package/package.json
CHANGED