Skip to content

Commit 24f1ba7

Browse files
authored
fix: Add type defintions for the recently added Backend methods (#698)
1 parent ceb0498 commit 24f1ba7

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

types/fastly:backend.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,30 @@ declare module 'fastly:backend' {
243243
* Returns the name of the Backend, which can be used on {@link "globals".RequestInit.backend}
244244
*/
245245
toString(): string;
246+
247+
/**
248+
* Returns the name associated with the Backend instance.
249+
*/
250+
toName(): string;
251+
252+
/**
253+
* Returns a boolean indicating if a Backend with the given name exists or not.
254+
*/
255+
static exists(name: string): boolean;
256+
257+
/**
258+
* Returns the Backend instance with the given name, if one exists. If one does not exist, an error is thrown.
259+
*/
260+
static fromName(name: string): Backend;
261+
262+
/**
263+
* Returns a string representing the health of the given Backend instance.
264+
* Possible values are:
265+
*
266+
* "healthy" - The backend's health check has succeeded, indicating the backend is working as expected and should receive requests.
267+
* "unhealthy" - The backend's health check has failed, indicating the backend is not working as expected and should not receive requests.
268+
* "unknown" - The backend does not have a health check configured.
269+
*/
270+
static health(backend: Backend): "healthy" | "unhealthy" | "unknown"
246271
}
247272
}

0 commit comments

Comments
 (0)