mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
sdk comments
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
import { HealthStatus } from "../../../base/lib/types"
|
||||
|
||||
/**
|
||||
* Input state provided to trigger functions.
|
||||
* Contains information about the health check's current state
|
||||
* that triggers can use to adjust their timing behavior.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const myTrigger: Trigger = (getInput) => {
|
||||
* return (async function* () {
|
||||
* while (true) {
|
||||
* const input: TriggerInput = getInput()
|
||||
* // Check more frequently if last result was failure
|
||||
* const delay = input.lastResult === 'failure' ? 1000 : 30000
|
||||
* await new Promise(r => setTimeout(r, delay))
|
||||
* yield
|
||||
* }
|
||||
* })()
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export type TriggerInput = {
|
||||
/** The result of the most recent health check execution, if any */
|
||||
lastResult?: HealthStatus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user