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

View File

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