Comparing version
@@ -59,5 +59,3 @@ "use strict"; | ||
if (snapshots.length === 0) { | ||
// only way we can get here is if the channels alerts are muted | ||
alert.setMuted(); | ||
yield sendMutedAlert(config, alert); | ||
yield sendMutedOrResolvedAlert(context, config, alert); | ||
return; | ||
@@ -91,3 +89,3 @@ } | ||
} | ||
function sendMutedAlert(config, alert) { | ||
function sendMutedOrResolvedAlert(context, config, alert) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
@@ -98,3 +96,10 @@ const channel = config.getChannelConfig(alert.channel); | ||
} | ||
yield channel.sendMutedAlert(alert); | ||
const currentButMutedIssues = context.digestableSnapshots.filter(x => x.muted); | ||
const resolved = alert.getResolvedOrMutedSnapshotList(currentButMutedIssues.map(x => x.uniqueId)); | ||
if (resolved.length === 0) { | ||
alert.setMuted(); | ||
yield channel.sendMutedAlert(alert); | ||
return; | ||
} | ||
yield sendResolvedAlerts([alert], config); | ||
}); | ||
@@ -101,0 +106,0 @@ } |
@@ -172,3 +172,6 @@ "use strict"; | ||
return this.digestableSnapshots | ||
.filter(x => !config.muteWindows.some(m => m.isMuted(x.uniqueId))); | ||
.filter(x => { | ||
x.muted = config.muteWindows.some(m => m.isMuted(x.uniqueId)); | ||
return !x.muted; | ||
}); | ||
} | ||
@@ -175,0 +178,0 @@ } |
@@ -59,3 +59,5 @@ "use strict"; | ||
today.setHours(0, 0, 0, 0); | ||
const yesterday = new Date(today.setDate(today.getDate() - 1)); | ||
const yesterday = new Date(); | ||
yesterday.setHours(0, 0, 0, 0); | ||
yesterday.setDate(today.getDate() - 1); | ||
return { | ||
@@ -62,0 +64,0 @@ from: yesterday, |
@@ -31,3 +31,3 @@ import { Snapshot } from "./snapshot"; | ||
track(snapshots: Snapshot[]): void; | ||
getResolvedSnapshotList(currentIssueIds: string[]): { | ||
getResolvedOrMutedSnapshotList(currentIssueIds: string[]): { | ||
key: IUniqueKey; | ||
@@ -34,0 +34,0 @@ lastSnapshot: ILastFailureSnapshot; |
@@ -80,3 +80,3 @@ "use strict"; | ||
} | ||
getResolvedSnapshotList(currentIssueIds) { | ||
getResolvedOrMutedSnapshotList(currentIssueIds) { | ||
const all = this.affectedKeys; | ||
@@ -83,0 +83,0 @@ const keys = all.filter(x => !currentIssueIds.includes(x)); |
@@ -39,6 +39,6 @@ "use strict"; | ||
} | ||
const resolved = alert.getResolvedSnapshotList(snapshots.map(x => x.uniqueId)); | ||
if (resolved.length > 0) { | ||
parts.push(`*☑️ ${resolved.length} resolved ${(0, utility_1.pluraliseWithS)("check", resolved.length)}:*`); | ||
const types = resolved.reduce((acc, x) => { | ||
const resolvedOrMuted = alert.getResolvedOrMutedSnapshotList(snapshots.map(x => x.uniqueId)); | ||
if (resolvedOrMuted.length > 0) { | ||
parts.push(`*☑️ ${resolvedOrMuted.length} resolved ${(0, utility_1.pluraliseWithS)("check", resolvedOrMuted.length)}:*`); | ||
const types = resolvedOrMuted.reduce((acc, x) => { | ||
var _a; | ||
@@ -93,6 +93,6 @@ const count = (_a = acc.get(x.key.type)) !== null && _a !== void 0 ? _a : 0; | ||
} | ||
const resolved = alert.getResolvedSnapshotList(snapshots.map(x => x.uniqueId)); | ||
if (resolved.length > 0) { | ||
parts.push(`*☑️ ${resolved.length} resolved/muted ${(0, utility_1.pluraliseWithS)("check", resolved.length)}:*`); | ||
resolved.forEach(x => { | ||
const resolvedOrMuted = alert.getResolvedOrMutedSnapshotList(snapshots.map(x => x.uniqueId)); | ||
if (resolvedOrMuted.length > 0) { | ||
parts.push(`*☑️ ${resolvedOrMuted.length} resolved/muted ${(0, utility_1.pluraliseWithS)("check", resolvedOrMuted.length)}:*`); | ||
resolvedOrMuted.forEach(x => { | ||
const lastResult = x.lastSnapshot ? `(last result before resolution: _${x.lastSnapshot.result}_)` : ""; | ||
@@ -99,0 +99,0 @@ parts.push(` • ${x.key.type}:${x.key.label} → ${x.key.identifier} ${lastResult} ${this.generateLinks(x.lastSnapshot)}`); |
@@ -23,2 +23,3 @@ import { IUniqueKey } from "../lib/key"; | ||
alert: AlertConfiguration; | ||
muted: boolean; | ||
constructor(snapshot: ISnapshot); | ||
@@ -25,0 +26,0 @@ get uniqueId(): string; |
{ | ||
"name": "barky", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A simple cloud services watchdog with digest notification support & no external dependencies", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Rohland/barky#readme", |
{ | ||
"name": "barky", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "A simple cloud services watchdog with digest notification support & no external dependencies", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Rohland/barky#readme", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
366935
0.27%4933
0.22%