inngest
Version:
Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.
49 lines • 1.38 kB
TypeScript
import { type Simplify } from "../helpers/types.js";
declare const globalFetch: typeof globalThis.fetch;
type Fetch = typeof globalFetch;
export type StepFetch = Fetch & Simplify<{
config: (options: StepFetch.Options) => StepFetch;
} & Readonly<StepFetch.Options>>;
export declare namespace StepFetch {
interface Options {
fallback?: Fetch | undefined;
}
interface Extras extends Options {
config: (options: Options) => StepFetch;
}
}
/**
* `fetch` is a Fetch API-compatible function that can be used to make any HTTP
* code durable if it's called within an Inngest function.
*
* It will gracefully fall back to the global `fetch` if called outside of this
* context, and a custom fallback can be set using the `config` method.
*
* @example Basic usage
* ```ts
* import { fetch } from "inngest";
*
* const api = new MyProductApi({ fetch });
* ```
*
* @example Setting a custom fallback
* ```ts
* import { fetch } from "inngest";
*
* const api = new MyProductApi({
* fetch: fetch.config({ fallback: myCustomFetch }),
* });
* ```
*
* @example Do not allow fallback
* ```ts
* import { fetch } from "inngest";
*
* const api = new MyProductApi({
* fetch: fetch.config({ fallback: undefined }),
* });
* ```
*/
export declare const fetch: StepFetch;
export {};
//# sourceMappingURL=Fetch.d.ts.map