fix: allow partial callbacks in config types

pull/135/head
mst-mkt 2025-08-07 15:24:07 +09:00
parent 7156fd83f2
commit 7079afb906
2 changed files with 5 additions and 5 deletions

View File

@ -56,7 +56,7 @@ export type Notification = {
}
export type Callbacks = {
onStatusChange: (
onStatusChange?: (
env: any,
monitor: any,
isUp: boolean,
@ -64,7 +64,7 @@ export type Callbacks = {
timeNow: number,
reason: string
) => Promise<any>
onIncident: (
onIncident?: (
env: any,
monitor: any,
timeIncidentStart: number,

View File

@ -179,7 +179,7 @@ const Worker = {
}
console.log('Calling config onStatusChange callback...')
await workerConfig.callbacks?.onStatusChange(
await workerConfig.callbacks?.onStatusChange?.(
env,
monitor,
true,
@ -250,7 +250,7 @@ const Worker = {
if (monitorStatusChanged) {
console.log('Calling config onStatusChange callback...')
await workerConfig.callbacks?.onStatusChange(
await workerConfig.callbacks?.onStatusChange?.(
env,
monitor,
false,
@ -266,7 +266,7 @@ const Worker = {
try {
console.log('Calling config onIncident callback...')
await workerConfig.callbacks?.onIncident(
await workerConfig.callbacks?.onIncident?.(
env,
monitor,
currentIncident.start[0],