@obzerver/server 0.0.0-stage → 0.6.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/LICENSE +21 -0
- package/dist/alerts.d.ts +67 -0
- package/dist/alerts.js +281 -0
- package/dist/alerts.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +107 -0
- package/dist/cli.js.map +1 -0
- package/dist/db.d.ts +34 -0
- package/dist/db.js +209 -0
- package/dist/db.js.map +1 -0
- package/dist/ingest.d.ts +23 -0
- package/dist/ingest.js +116 -0
- package/dist/ingest.js.map +1 -0
- package/dist/issues.d.ts +60 -0
- package/dist/issues.js +127 -0
- package/dist/issues.js.map +1 -0
- package/dist/mailer.d.ts +32 -0
- package/dist/mailer.js +82 -0
- package/dist/mailer.js.map +1 -0
- package/dist/mcp.d.ts +22 -0
- package/dist/mcp.js +190 -0
- package/dist/mcp.js.map +1 -0
- package/dist/projects.d.ts +49 -0
- package/dist/projects.js +184 -0
- package/dist/projects.js.map +1 -0
- package/dist/queries.d.ts +624 -0
- package/dist/queries.js +857 -0
- package/dist/queries.js.map +1 -0
- package/dist/seed.d.ts +14 -0
- package/dist/seed.js +487 -0
- package/dist/seed.js.map +1 -0
- package/dist/server.d.ts +45 -0
- package/dist/server.js +628 -0
- package/dist/server.js.map +1 -0
- package/dist/slos.d.ts +100 -0
- package/dist/slos.js +172 -0
- package/dist/slos.js.map +1 -0
- package/dist/status.d.ts +147 -0
- package/dist/status.js +264 -0
- package/dist/status.js.map +1 -0
- package/dist/trackers.d.ts +201 -0
- package/dist/trackers.js +585 -0
- package/dist/trackers.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +35 -4
- package/public/assets/index-C4xcvzwn.css +1 -0
- package/public/assets/index-Dnpzem0I.js +513 -0
- package/public/index.html +15 -0
- package/README.md +0 -3
package/dist/status.js
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
// Public status pages: components mapped to services/routes, a status computed
|
|
2
|
+
// from live traffic, 90-day uptime bars, and incidents (manual or automatic).
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
export const STATUS_ORDER = ['no_data', 'operational', 'degraded', 'partial_outage', 'major_outage'];
|
|
5
|
+
export const INCIDENT_STATUSES = ['investigating', 'identified', 'monitoring', 'resolved'];
|
|
6
|
+
export const IMPACTS = ['minor', 'major', 'critical'];
|
|
7
|
+
const IMPACT_STATUS = { minor: 'degraded', major: 'partial_outage', critical: 'major_outage' };
|
|
8
|
+
const LIVE_WINDOW = 10 * 60e3;
|
|
9
|
+
const DAY = 86400e3;
|
|
10
|
+
const parse = (s, fb) => { try {
|
|
11
|
+
return typeof s === 'string' ? JSON.parse(s) : fb;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return fb;
|
|
15
|
+
} };
|
|
16
|
+
const worst = (list) => list.reduce((a, b) => (STATUS_ORDER.indexOf(b) > STATUS_ORDER.indexOf(a) ? b : a), 'no_data');
|
|
17
|
+
export const toPage = (r) => ({
|
|
18
|
+
id: r.id, slug: r.slug, title: r.title, description: r.description, components: parse(r.components, []),
|
|
19
|
+
autoIncidents: !!r.auto_incidents, published: !!r.published, created: r.created, updated: r.updated,
|
|
20
|
+
});
|
|
21
|
+
export const toIncident = (r) => ({
|
|
22
|
+
id: r.id, pageId: r.page_id, title: r.title, status: r.status, impact: r.impact, components: parse(r.components, []),
|
|
23
|
+
auto: !!r.auto, created: r.created, updated: r.updated, resolvedAt: r.resolved_at, updates: parse(r.updates, []),
|
|
24
|
+
});
|
|
25
|
+
// ------------------------------------------------------------------ validation & persistence
|
|
26
|
+
export function slugify(s) {
|
|
27
|
+
return s.toLowerCase().normalize('NFKD').replace(/[^\w\s-]/g, '').trim().replace(/[\s_]+/g, '-').replace(/-+/g, '-').slice(0, 60);
|
|
28
|
+
}
|
|
29
|
+
export function validatePage(db, b, id) {
|
|
30
|
+
if (!b.title?.trim())
|
|
31
|
+
return 'title is required';
|
|
32
|
+
const slug = slugify(b.slug || b.title);
|
|
33
|
+
if (!slug)
|
|
34
|
+
return 'slug is required';
|
|
35
|
+
const clash = db.get('SELECT id FROM status_pages WHERE slug = ?', slug);
|
|
36
|
+
if (clash && clash.id !== id)
|
|
37
|
+
return `slug "${slug}" is already used`;
|
|
38
|
+
for (const c of b.components || []) {
|
|
39
|
+
if (!c.name?.trim())
|
|
40
|
+
return 'every component needs a name';
|
|
41
|
+
if (!c.service?.trim())
|
|
42
|
+
return `component "${c.name}" needs an application`;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
export function savePage(db, b, id) {
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
const components = (b.components || []).map((c) => ({
|
|
49
|
+
id: c.id || crypto.randomBytes(4).toString('hex'),
|
|
50
|
+
name: String(c.name).trim(), service: String(c.service).trim(), operation: c.operation?.trim() || null,
|
|
51
|
+
latencyMs: c.latencyMs ? Number(c.latencyMs) : null,
|
|
52
|
+
}));
|
|
53
|
+
const vals = [slugify(b.slug || b.title), b.title.trim(), b.description ?? null, JSON.stringify(components), b.autoIncidents === false ? 0 : 1, b.published === false ? 0 : 1];
|
|
54
|
+
if (id) {
|
|
55
|
+
db.run('UPDATE status_pages SET slug = ?, title = ?, description = ?, components = ?, auto_incidents = ?, published = ?, updated = ? WHERE id = ?', ...vals, now, id);
|
|
56
|
+
return id;
|
|
57
|
+
}
|
|
58
|
+
return db.run('INSERT INTO status_pages(slug, title, description, components, auto_incidents, published, created, updated) VALUES(?, ?, ?, ?, ?, ?, ?, ?)', ...vals, now, now).lastId;
|
|
59
|
+
}
|
|
60
|
+
export function deletePage(db, id) {
|
|
61
|
+
db.run('DELETE FROM incidents WHERE page_id = ?', id);
|
|
62
|
+
db.run('DELETE FROM status_pages WHERE id = ?', id);
|
|
63
|
+
}
|
|
64
|
+
export function createIncident(db, pageId, b) {
|
|
65
|
+
const now = Date.now();
|
|
66
|
+
const status = INCIDENT_STATUSES.includes(b.status) ? b.status : 'investigating';
|
|
67
|
+
const impact = IMPACTS.includes(b.impact) ? b.impact : 'minor';
|
|
68
|
+
const updates = [{ ts: now, status, text: b.message?.trim() || 'We are investigating this issue.' }];
|
|
69
|
+
return db.run('INSERT INTO incidents(page_id, title, status, impact, components, auto, created, updated, resolved_at, updates) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', pageId, b.title.trim(), status, impact, JSON.stringify(b.components || []), b.auto ? 1 : 0, now, now, status === 'resolved' ? now : null, JSON.stringify(updates)).lastId;
|
|
70
|
+
}
|
|
71
|
+
export function updateIncident(db, id, b) {
|
|
72
|
+
const r = db.get('SELECT * FROM incidents WHERE id = ?', id);
|
|
73
|
+
if (!r)
|
|
74
|
+
return false;
|
|
75
|
+
const inc = toIncident(r);
|
|
76
|
+
const now = Date.now();
|
|
77
|
+
const status = b.status && INCIDENT_STATUSES.includes(b.status) ? b.status : inc.status;
|
|
78
|
+
const impact = b.impact && IMPACTS.includes(b.impact) ? b.impact : inc.impact;
|
|
79
|
+
if (b.message?.trim() || status !== inc.status)
|
|
80
|
+
inc.updates.push({ ts: now, status, text: b.message?.trim() || `Status changed to ${status}.` });
|
|
81
|
+
db.run('UPDATE incidents SET title = ?, status = ?, impact = ?, components = ?, updated = ?, resolved_at = ?, updates = ? WHERE id = ?', b.title?.trim() || inc.title, status, impact, JSON.stringify(b.components ?? inc.components), now, status === 'resolved' ? (inc.resolvedAt ?? now) : null, JSON.stringify(inc.updates), id);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
function componentScope(c) {
|
|
85
|
+
return c.operation ? { sql: 'service = ? AND name = ?', args: [c.service, c.operation] } : { sql: 'service = ?', args: [c.service] };
|
|
86
|
+
}
|
|
87
|
+
/** Status from the last 10 minutes of real traffic. */
|
|
88
|
+
export function liveHealth(db, c, now = Date.now()) {
|
|
89
|
+
const s = componentScope(c);
|
|
90
|
+
const rows = db.all(`SELECT duration, status, failed FROM traces WHERE ${s.sql} AND ts > ? AND ts <= ?`, ...s.args, now - LIVE_WINDOW, now);
|
|
91
|
+
if (!rows.length)
|
|
92
|
+
return { status: 'no_data', requests: 0, errorRate: null, p95: null };
|
|
93
|
+
const bad = rows.filter((r) => r.failed || (r.status ?? 0) >= 500).length;
|
|
94
|
+
const rate = bad / rows.length;
|
|
95
|
+
const d = rows.map((r) => r.duration).sort((a, b) => a - b);
|
|
96
|
+
const p95 = d[Math.min(d.length - 1, Math.ceil(d.length * 0.95) - 1)];
|
|
97
|
+
return { status: classify(rate, bad, rows.length, c.latencyMs != null && p95 > c.latencyMs), requests: rows.length, errorRate: Math.round(rate * 10000) / 100, p95: Math.round(p95 * 10) / 10 };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Outage levels are judged on the lower bound of the 95% Wilson interval of the
|
|
101
|
+
* failure rate, so a few failures in a small sample cannot declare an outage.
|
|
102
|
+
*/
|
|
103
|
+
export function wilsonLower(bad, n, z = 1.96) {
|
|
104
|
+
if (!n)
|
|
105
|
+
return 0;
|
|
106
|
+
const p = bad / n;
|
|
107
|
+
const denom = 1 + (z * z) / n;
|
|
108
|
+
const centre = p + (z * z) / (2 * n);
|
|
109
|
+
const margin = z * Math.sqrt((p * (1 - p)) / n + (z * z) / (4 * n * n));
|
|
110
|
+
return Math.max(0, (centre - margin) / denom);
|
|
111
|
+
}
|
|
112
|
+
function classify(rate, bad, n, slow) {
|
|
113
|
+
const lower = wilsonLower(bad, n);
|
|
114
|
+
if (lower >= 0.25)
|
|
115
|
+
return 'major_outage';
|
|
116
|
+
if (lower >= 0.1)
|
|
117
|
+
return 'partial_outage';
|
|
118
|
+
if ((rate >= 0.02 && bad >= 1) || slow)
|
|
119
|
+
return 'degraded';
|
|
120
|
+
return 'operational';
|
|
121
|
+
}
|
|
122
|
+
/** Daily availability (non-5xx share) for the last `days` days, plus incidents that touched the component. */
|
|
123
|
+
export function uptime(db, c, incidents, days = 90, now = Date.now()) {
|
|
124
|
+
const s = componentScope(c);
|
|
125
|
+
const start = Math.floor(now / DAY) * DAY - (days - 1) * DAY;
|
|
126
|
+
const rows = db.all(`SELECT CAST((ts - ?) / ? AS INTEGER) d, COUNT(*) n, SUM(CASE WHEN failed = 1 OR status >= 500 THEN 1 ELSE 0 END) bad FROM traces WHERE ${s.sql} AND ts >= ? GROUP BY d`, start, DAY, ...s.args, start);
|
|
127
|
+
const byDay = new Map(rows.map((r) => [r.d, r]));
|
|
128
|
+
let total = 0;
|
|
129
|
+
let bad = 0;
|
|
130
|
+
const out = [];
|
|
131
|
+
for (let i = 0; i < days; i++) {
|
|
132
|
+
const r = byDay.get(i);
|
|
133
|
+
const dayStart = start + i * DAY;
|
|
134
|
+
const dayEnd = dayStart + DAY;
|
|
135
|
+
const n = r?.n ?? 0;
|
|
136
|
+
const b = r?.bad ?? 0;
|
|
137
|
+
total += n;
|
|
138
|
+
bad += b;
|
|
139
|
+
const rate = n ? b / n : null;
|
|
140
|
+
let status = n ? classify(rate ?? 0, b, n, false) : 'no_data';
|
|
141
|
+
// An incident on this component that day raises the day to at least its impact.
|
|
142
|
+
for (const inc of incidents) {
|
|
143
|
+
if (!inc.components.includes(c.id) || inc.created >= dayEnd || (inc.resolvedAt ?? now) < dayStart)
|
|
144
|
+
continue;
|
|
145
|
+
status = worst([status, IMPACT_STATUS[inc.impact]]);
|
|
146
|
+
}
|
|
147
|
+
out.push({ day: dayStart, status, requests: n, errorRate: rate == null ? null : Math.round(rate * 10000) / 100 });
|
|
148
|
+
}
|
|
149
|
+
return { days: out, uptime: total ? Math.round((1 - bad / total) * 100000) / 1000 : null };
|
|
150
|
+
}
|
|
151
|
+
export function pageView(db, page, now = Date.now()) {
|
|
152
|
+
const incidents = db.all('SELECT * FROM incidents WHERE page_id = ? AND (resolved_at IS NULL OR resolved_at > ?) ORDER BY created DESC', page.id, now - 90 * DAY).map(toIncident);
|
|
153
|
+
const active = incidents.filter((i) => i.status !== 'resolved');
|
|
154
|
+
const components = page.components.map((c) => {
|
|
155
|
+
const live = liveHealth(db, c, now);
|
|
156
|
+
// A declared incident wins over a calmer live reading; it never makes a component look better.
|
|
157
|
+
const declared = active.filter((i) => i.components.includes(c.id)).map((i) => IMPACT_STATUS[i.impact]);
|
|
158
|
+
const status = worst([live.status, ...declared]);
|
|
159
|
+
const u = uptime(db, c, incidents, 90, now);
|
|
160
|
+
return { ...c, status, live, uptime: u.uptime, days: u.days };
|
|
161
|
+
});
|
|
162
|
+
const overall = components.length ? worst(components.map((c) => c.status)) : 'no_data';
|
|
163
|
+
return { page, overall, components, active, recent: incidents.filter((i) => i.status === 'resolved' && (i.resolvedAt ?? 0) > now - 14 * DAY), generatedAt: now };
|
|
164
|
+
}
|
|
165
|
+
/** Public JSON: nothing about routes or services, only names and states. */
|
|
166
|
+
export function publicView(v) {
|
|
167
|
+
return {
|
|
168
|
+
title: v.page.title,
|
|
169
|
+
description: v.page.description,
|
|
170
|
+
status: v.overall,
|
|
171
|
+
components: v.components.map((c) => ({ id: c.id, name: c.name, status: c.status, uptime: c.uptime, days: c.days.map((d) => ({ day: d.day, status: d.status })) })),
|
|
172
|
+
incidents: [...v.active, ...v.recent].map((i) => ({
|
|
173
|
+
id: i.id, title: i.title, status: i.status, impact: i.impact, created: i.created, resolvedAt: i.resolvedAt,
|
|
174
|
+
components: i.components.map((id) => v.page.components.find((c) => c.id === id)?.name).filter(Boolean),
|
|
175
|
+
updates: [...i.updates].reverse(),
|
|
176
|
+
})),
|
|
177
|
+
generatedAt: v.generatedAt,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
// ------------------------------------------------------------------ automatic incidents
|
|
181
|
+
/**
|
|
182
|
+
* Opens an incident when a component's live traffic reaches a partial or major
|
|
183
|
+
* outage, and resolves it once the component is operational again.
|
|
184
|
+
*/
|
|
185
|
+
export function runAutoIncidents(db, now = Date.now(), log) {
|
|
186
|
+
for (const page of db.all('SELECT * FROM status_pages WHERE auto_incidents = 1').map(toPage)) {
|
|
187
|
+
const openAll = db.all("SELECT * FROM incidents WHERE page_id = ? AND status != 'resolved'", page.id).map(toIncident);
|
|
188
|
+
const open = openAll.filter((i) => i.auto);
|
|
189
|
+
for (const c of page.components) {
|
|
190
|
+
const h = liveHealth(db, c, now);
|
|
191
|
+
const mine = open.find((i) => i.components.includes(c.id));
|
|
192
|
+
// A person is already handling this component: never stack an automatic incident on theirs.
|
|
193
|
+
const manual = openAll.some((i) => !i.auto && i.components.includes(c.id));
|
|
194
|
+
const bad = h.status === 'partial_outage' || h.status === 'major_outage';
|
|
195
|
+
if (bad && !mine && !manual) {
|
|
196
|
+
const impact = h.status === 'major_outage' ? 'critical' : 'major';
|
|
197
|
+
createIncident(db, page.id, {
|
|
198
|
+
title: `${c.name}: ${h.status === 'major_outage' ? 'major outage' : 'elevated error rate'}`, impact, components: [c.id], auto: true,
|
|
199
|
+
message: `Automatically detected: ${h.errorRate}% of requests are failing. We are investigating.`,
|
|
200
|
+
});
|
|
201
|
+
log?.(`status page ${page.slug}: opened incident for ${c.name}`);
|
|
202
|
+
}
|
|
203
|
+
else if (mine && h.status === 'operational') {
|
|
204
|
+
updateIncident(db, mine.id, { status: 'resolved', message: 'Error rates are back to normal. This incident is resolved.' });
|
|
205
|
+
log?.(`status page ${page.slug}: resolved incident for ${c.name}`);
|
|
206
|
+
}
|
|
207
|
+
else if (mine && bad && h.status === 'major_outage' && mine.impact !== 'critical') {
|
|
208
|
+
updateIncident(db, mine.id, { impact: 'critical', message: `Escalated: ${h.errorRate}% of requests are failing.` });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// ------------------------------------------------------------------ public HTML
|
|
214
|
+
const esc = (s) => s.replace(/[&<>"']/g, (ch) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[ch]);
|
|
215
|
+
const LABEL = {
|
|
216
|
+
operational: 'Operational', degraded: 'Degraded performance', partial_outage: 'Partial outage', major_outage: 'Major outage', no_data: 'No data',
|
|
217
|
+
};
|
|
218
|
+
const COLOR = {
|
|
219
|
+
operational: '#0ca30c', degraded: '#e6a100', partial_outage: '#ec835a', major_outage: '#d03b3b', no_data: '#c7c7d1',
|
|
220
|
+
};
|
|
221
|
+
const HEADLINE = {
|
|
222
|
+
operational: 'All systems operational', degraded: 'Some systems are degraded', partial_outage: 'Partial system outage', major_outage: 'Major system outage', no_data: 'Status unavailable',
|
|
223
|
+
};
|
|
224
|
+
const fmtDate = (ts) => new Date(ts).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', timeZone: 'UTC', hour12: false }) + ' UTC';
|
|
225
|
+
/** A self-contained, server-rendered page: works without JavaScript and refreshes itself. */
|
|
226
|
+
export function renderStatusHtml(v) {
|
|
227
|
+
const comp = v.components.map((c) => `
|
|
228
|
+
<div class="comp">
|
|
229
|
+
<div class="row"><span class="name">${esc(c.name)}</span><span class="st" style="color:${COLOR[c.status]}">${LABEL[c.status]}</span></div>
|
|
230
|
+
<div class="bars" role="img" aria-label="${esc(c.name)} daily status, last 90 days">${c.days.map((d) => `<i style="background:${COLOR[d.status]}" title="${new Date(d.day).toISOString().slice(0, 10)}: ${LABEL[d.status]}"></i>`).join('')}</div>
|
|
231
|
+
<div class="row small"><span>90 days ago</span><span>${c.uptime == null ? '' : `${c.uptime}% uptime`}</span><span>Today</span></div>
|
|
232
|
+
</div>`).join('');
|
|
233
|
+
const incident = (i) => `
|
|
234
|
+
<div class="inc">
|
|
235
|
+
<div class="row"><b>${esc(i.title)}</b><span class="pill ${i.status === 'resolved' ? 'ok' : 'live'}">${esc(i.status)}</span></div>
|
|
236
|
+
${i.components.length ? `<div class="small">Affects: ${i.components.map((n) => esc(String(n))).join(', ')}</div>` : ''}
|
|
237
|
+
${i.updates.map((u) => `<div class="upd"><b>${esc(u.status[0].toUpperCase() + u.status.slice(1))}</b> — ${esc(u.text)}<div class="small">${fmtDate(u.ts)}</div></div>`).join('')}
|
|
238
|
+
</div>`;
|
|
239
|
+
const active = v.incidents.filter((i) => i.status !== 'resolved');
|
|
240
|
+
const past = v.incidents.filter((i) => i.status === 'resolved');
|
|
241
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
242
|
+
<meta http-equiv="refresh" content="60"><title>${esc(v.title)} status</title>
|
|
243
|
+
<style>
|
|
244
|
+
*{box-sizing:border-box}body{margin:0;font-family:-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:#f6f6f8;color:#18181b}
|
|
245
|
+
main{max-width:760px;margin:0 auto;padding:40px 20px 60px}h1{font-size:24px;margin:0 0 6px}p.d{color:#52525b;margin:0 0 24px}
|
|
246
|
+
.banner{border-radius:10px;padding:16px 18px;color:#fff;font-weight:600;font-size:16px;margin-bottom:28px}
|
|
247
|
+
.card{background:#fff;border:1px solid #e4e4e7;border-radius:10px;margin-bottom:24px}
|
|
248
|
+
.comp{padding:16px 18px;border-bottom:1px solid #f0f0f2}.comp:last-child{border-bottom:0}
|
|
249
|
+
.row{display:flex;justify-content:space-between;align-items:center;gap:12px}.name{font-weight:600}.st{font-size:14px;font-weight:500}
|
|
250
|
+
.bars{display:flex;gap:2px;height:30px;margin:10px 0 6px}.bars i{flex:1;border-radius:2px;min-width:2px}
|
|
251
|
+
.small{font-size:12px;color:#71717a}h2{font-size:16px;margin:30px 0 12px}
|
|
252
|
+
.inc{padding:16px 18px;border-bottom:1px solid #f0f0f2}.inc:last-child{border-bottom:0}.upd{margin-top:10px;font-size:14px;line-height:1.45}
|
|
253
|
+
.pill{font-size:12px;padding:2px 9px;border-radius:999px;font-weight:600}.pill.ok{background:#e7f6e7;color:#0a7a0a}.pill.live{background:#fdecec;color:#b42323}
|
|
254
|
+
footer{margin-top:36px;font-size:12px;color:#a1a1aa;text-align:center}
|
|
255
|
+
</style></head><body><main>
|
|
256
|
+
<h1>${esc(v.title)}</h1>${v.description ? `<p class="d">${esc(v.description)}</p>` : '<p class="d"></p>'}
|
|
257
|
+
<div class="banner" style="background:${COLOR[v.status]}">${HEADLINE[v.status]}</div>
|
|
258
|
+
${active.length ? `<h2>Active incidents</h2><div class="card">${active.map(incident).join('')}</div>` : ''}
|
|
259
|
+
<div class="card">${comp || '<div class="comp small">No components yet.</div>'}</div>
|
|
260
|
+
<h2>Past incidents</h2>${past.length ? `<div class="card">${past.map(incident).join('')}</div>` : '<p class="small">No incidents in the last 14 days.</p>'}
|
|
261
|
+
<footer>Updated ${fmtDate(v.generatedAt)} · Powered by Obzerver</footer>
|
|
262
|
+
</main></body></html>`;
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,OAAO,MAAM,MAAM,aAAa,CAAC;AAkCjC,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACxH,MAAM,CAAC,MAAM,iBAAiB,GAAqB,CAAC,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAC7G,MAAM,CAAC,MAAM,OAAO,GAAa,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;AAChE,MAAM,aAAa,GAAoC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAChI,MAAM,WAAW,GAAG,EAAE,GAAG,IAAI,CAAC;AAC9B,MAAM,GAAG,GAAG,OAAO,CAAC;AAEpB,MAAM,KAAK,GAAG,CAAI,CAAU,EAAE,EAAK,EAAK,EAAE,GAAG,IAAI,CAAC;IAAC,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,CA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M,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IAChE,OAAO;iDACwC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;;;;;;;;;;;;;;MAcvD,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;wCAChE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;EAC5E,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,8CAA8C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;oBACtF,IAAI,IAAI,kDAAkD;yBACrD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,qBAAqB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,wDAAwD;kBACxI,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;sBAClB,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { type Db, type Row } from './db.js';
|
|
2
|
+
import { type Issue, type VerificationChange } from './issues.js';
|
|
3
|
+
export type Provider = 'github' | 'linear' | 'clickup' | 'trello';
|
|
4
|
+
export declare const PROVIDERS: readonly Provider[];
|
|
5
|
+
export declare const PROVIDER_LABEL: Record<Provider, string>;
|
|
6
|
+
export interface GithubConfig {
|
|
7
|
+
token: string;
|
|
8
|
+
repo: string;
|
|
9
|
+
labels: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface LinearConfig {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
teamId: string;
|
|
14
|
+
teamName?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Tasks are created in one ClickUp list; "closed"/"done" type statuses count as closed. */
|
|
17
|
+
export interface ClickupConfig {
|
|
18
|
+
token: string;
|
|
19
|
+
listId: string;
|
|
20
|
+
listName?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Cards are created in one list; moving a card to the done list closes it. */
|
|
23
|
+
export interface TrelloConfig {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
token: string;
|
|
26
|
+
boardId: string;
|
|
27
|
+
boardName?: string;
|
|
28
|
+
listId: string;
|
|
29
|
+
listName?: string;
|
|
30
|
+
doneListId: string;
|
|
31
|
+
doneListName?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TrackerSettings {
|
|
34
|
+
github: GithubConfig | null;
|
|
35
|
+
linear: LinearConfig | null;
|
|
36
|
+
clickup: ClickupConfig | null;
|
|
37
|
+
trello: TrelloConfig | null;
|
|
38
|
+
/** Where issues opened by alerts also get a ticket. */
|
|
39
|
+
autoCreate: Provider | null;
|
|
40
|
+
/** Shared secret GitHub signs webhooks with (generated here). */
|
|
41
|
+
githubWebhookSecret: string;
|
|
42
|
+
/** Signing secret Linear generated for the webhook (pasted here). */
|
|
43
|
+
linearWebhookSecret: string;
|
|
44
|
+
}
|
|
45
|
+
/** Ticket state normalised across trackers. */
|
|
46
|
+
export type TicketState = 'open' | 'closed' | 'canceled';
|
|
47
|
+
export interface Ticket {
|
|
48
|
+
provider: Provider;
|
|
49
|
+
id: string;
|
|
50
|
+
key: string;
|
|
51
|
+
url: string;
|
|
52
|
+
state: TicketState;
|
|
53
|
+
stateName: string;
|
|
54
|
+
}
|
|
55
|
+
export declare class TrackerError extends Error {
|
|
56
|
+
readonly status: number;
|
|
57
|
+
constructor(message: string, status?: number);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Effective settings: env vars win per provider. GitHub: OBZERVER_GITHUB_TOKEN + _REPO. Linear: OBZERVER_LINEAR_API_KEY + _TEAM.
|
|
61
|
+
* ClickUp: OBZERVER_CLICKUP_TOKEN + _LIST. Trello: OBZERVER_TRELLO_KEY + _TOKEN + _LIST + _DONE_LIST (+ _BOARD).
|
|
62
|
+
*/
|
|
63
|
+
export declare function trackerSettings(db: Db): TrackerSettings & {
|
|
64
|
+
source: Record<Provider, 'env' | 'settings' | null>;
|
|
65
|
+
};
|
|
66
|
+
/** "https://github.com/acme/shop.git" → "acme/shop". */
|
|
67
|
+
export declare const normalizeRepo: (repo: string) => string;
|
|
68
|
+
/** "https://app.clickup.com/9012/v/li/901234567" → "901234567". */
|
|
69
|
+
export declare const normalizeClickupList: (v: string) => string;
|
|
70
|
+
/** "https://trello.com/b/AbCd1234/my-board" → "AbCd1234". */
|
|
71
|
+
export declare const normalizeTrelloBoard: (v: string) => string;
|
|
72
|
+
/** Never reveals more than the last 4 characters, and nothing of short secrets. */
|
|
73
|
+
export declare const mask: (secret: string) => string;
|
|
74
|
+
/** Settings for the dashboard: secrets masked. */
|
|
75
|
+
export declare function publicTrackerSettings(db: Db): {
|
|
76
|
+
github: {
|
|
77
|
+
repo: string;
|
|
78
|
+
labels: string[];
|
|
79
|
+
token: string;
|
|
80
|
+
source: "env" | "settings" | null;
|
|
81
|
+
} | null;
|
|
82
|
+
linear: {
|
|
83
|
+
teamId: string;
|
|
84
|
+
teamName: string | null;
|
|
85
|
+
apiKey: string;
|
|
86
|
+
source: "env" | "settings" | null;
|
|
87
|
+
} | null;
|
|
88
|
+
clickup: {
|
|
89
|
+
listId: string;
|
|
90
|
+
listName: string | null;
|
|
91
|
+
token: string;
|
|
92
|
+
source: "env" | "settings" | null;
|
|
93
|
+
} | null;
|
|
94
|
+
trello: {
|
|
95
|
+
boardId: string;
|
|
96
|
+
boardName: string | null;
|
|
97
|
+
listId: string;
|
|
98
|
+
listName: string | null;
|
|
99
|
+
doneListId: string;
|
|
100
|
+
doneListName: string | null;
|
|
101
|
+
apiKey: string;
|
|
102
|
+
token: string;
|
|
103
|
+
source: "env" | "settings" | null;
|
|
104
|
+
} | null;
|
|
105
|
+
autoCreate: Provider | null;
|
|
106
|
+
webhooks: {
|
|
107
|
+
github: {
|
|
108
|
+
path: string;
|
|
109
|
+
secret: string;
|
|
110
|
+
};
|
|
111
|
+
linear: {
|
|
112
|
+
path: string;
|
|
113
|
+
secretSet: boolean;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export interface TrackerSettingsInput {
|
|
118
|
+
github?: {
|
|
119
|
+
token?: string;
|
|
120
|
+
repo?: string;
|
|
121
|
+
labels?: string[] | string;
|
|
122
|
+
} | null;
|
|
123
|
+
linear?: {
|
|
124
|
+
apiKey?: string;
|
|
125
|
+
teamId?: string;
|
|
126
|
+
teamName?: string;
|
|
127
|
+
} | null;
|
|
128
|
+
clickup?: {
|
|
129
|
+
token?: string;
|
|
130
|
+
listId?: string;
|
|
131
|
+
listName?: string;
|
|
132
|
+
} | null;
|
|
133
|
+
trello?: {
|
|
134
|
+
apiKey?: string;
|
|
135
|
+
token?: string;
|
|
136
|
+
boardId?: string;
|
|
137
|
+
boardName?: string;
|
|
138
|
+
listId?: string;
|
|
139
|
+
listName?: string;
|
|
140
|
+
doneListId?: string;
|
|
141
|
+
doneListName?: string;
|
|
142
|
+
} | null;
|
|
143
|
+
autoCreate?: Provider | null;
|
|
144
|
+
linearWebhookSecret?: string;
|
|
145
|
+
}
|
|
146
|
+
/** Save from the dashboard. A masked secret means "keep the stored one"; null removes a provider. */
|
|
147
|
+
export declare function saveTrackerSettings(db: Db, input: TrackerSettingsInput): void;
|
|
148
|
+
export interface TestResult {
|
|
149
|
+
ok: true;
|
|
150
|
+
detail: string;
|
|
151
|
+
teams?: Array<{
|
|
152
|
+
id: string;
|
|
153
|
+
key: string;
|
|
154
|
+
name: string;
|
|
155
|
+
}>;
|
|
156
|
+
boards?: Array<{
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
}>;
|
|
160
|
+
lists?: Array<{
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
}>;
|
|
164
|
+
/** The resolved name of the configured list, when there is one. */
|
|
165
|
+
listName?: string;
|
|
166
|
+
}
|
|
167
|
+
interface Client {
|
|
168
|
+
/** Check the credentials, and list what to pick from (Linear teams, Trello boards and lists). */
|
|
169
|
+
test(): Promise<TestResult>;
|
|
170
|
+
create(title: string, body: string): Promise<Ticket>;
|
|
171
|
+
get(id: string): Promise<Ticket>;
|
|
172
|
+
comment(id: string, body: string): Promise<void>;
|
|
173
|
+
close(id: string): Promise<void>;
|
|
174
|
+
reopen(id: string): Promise<void>;
|
|
175
|
+
}
|
|
176
|
+
export declare function githubClient(cfg: GithubConfig): Client;
|
|
177
|
+
export declare function linearClient(cfg: LinearConfig): Client;
|
|
178
|
+
export declare function clickupClient(cfg: ClickupConfig): Client;
|
|
179
|
+
export declare function trelloClient(cfg: TrelloConfig): Client;
|
|
180
|
+
export declare function clientFor(db: Db, provider: Provider): Client;
|
|
181
|
+
/** Test connection with unsaved values (masked secrets fall back to the stored ones). */
|
|
182
|
+
export declare function testTracker(db: Db, provider: Provider, input: TrackerSettingsInput): Promise<TestResult>;
|
|
183
|
+
/** Markdown with the context an engineer (or a coding agent) needs, from the issue's telemetry. */
|
|
184
|
+
export declare function ticketBody(db: Db, issue: Issue, provider: Provider, publicUrl: string | null): string;
|
|
185
|
+
/** Create a ticket for an issue and link it. */
|
|
186
|
+
export declare function createTicket(db: Db, issueId: number, provider: Provider, publicUrl: string | null): Promise<Ticket>;
|
|
187
|
+
/** Bring the issue in line with its ticket's state. Returns what happened (null = nothing to do). */
|
|
188
|
+
export declare function applyTicketState(db: Db, issueId: number, state: TicketState, stateName: string, now?: number): string | null;
|
|
189
|
+
/** Poll linked tickets and apply their state. Runs every couple of minutes; webhooks make it instant. */
|
|
190
|
+
export declare function syncTickets(db: Db, log?: (m: string) => void, now?: number): Promise<number>;
|
|
191
|
+
/** An issue was resolved in Obzerver: close its ticket. */
|
|
192
|
+
export declare function onIssueResolved(db: Db, issueId: number, log?: (m: string) => void): Promise<void>;
|
|
193
|
+
/** Verification finished: report on the ticket, and reopen it when the fix did not hold. */
|
|
194
|
+
export declare function onVerification(db: Db, changes: VerificationChange[], log?: (m: string) => void): Promise<void>;
|
|
195
|
+
export declare function verifyGithubSignature(secret: string, raw: Buffer, header: string | undefined): boolean;
|
|
196
|
+
export declare function verifyLinearSignature(secret: string, raw: Buffer, header: string | undefined): boolean;
|
|
197
|
+
/** GitHub `issues` event → the linked issue (matched by repository and number). */
|
|
198
|
+
export declare function handleGithubEvent(db: Db, event: string | undefined, payload: Row): string;
|
|
199
|
+
/** Linear `Issue` update → the linked issue (matched by Linear issue id). */
|
|
200
|
+
export declare function handleLinearEvent(db: Db, payload: Row): string;
|
|
201
|
+
export {};
|