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.
75 lines (73 loc) • 2.51 kB
TypeScript
import { IInngestExecution } from "./InngestExecution.js";
import { Context, StepOptions } from "../../types.js";
import { Inngest } from "../Inngest.js";
//#region src/components/execution/als.d.ts
/**
* Note - this structure can be used by other libraries, so cannot have breaking changes.
*/
interface AsyncContext {
/**
* The Inngest App that is currently being used to execute the function.
*
* If this is defined, we are in the context of an Inngest function execution,
* or a possible one.
*/
app: Inngest.Like;
/**
* Details of the current function execution context. If this doesn't exist,
* then we're not currently in a function execution context.
*/
execution?: {
/**
* The execution instance that is currently running the function.
*/
instance: IInngestExecution;
/**
* The `ctx` object that has been passed in to this function execution,
* including values such as `step` and `event`.
*/
ctx: Context.Any;
/**
* If present, this indicates we are currently executing a `step.run()` step's
* callback. Useful to understand whether we are in the context of a step
* execution or within the main function body.
*/
executingStep?: StepOptions;
/**
* If present, indicates the parallel mode that should be applied to steps
* created within this context. Set by `group.parallel()`.
*/
parallelMode?: "race";
/**
* If present, indicates the variant callback is executing within an
* experiment. Set by `group.experiment()`. Any `step.*()` call within
* this context will include these fields in `OutgoingOp.opts`.
*/
experimentContext?: {
experimentStepID: string;
experimentName: string;
variant: string;
};
/**
* A mutable tracker used to detect whether any step tool was invoked
* during a variant callback. Set by `group.experiment()`, flipped by
* `createTool` in `InngestStepTools.ts`.
*/
experimentStepTracker?: {
found: boolean;
};
/**
* If true, we are inside the `select()` callback of
* `group.experiment()`. Any `step.*()` call here would create a
* nested step, which is not allowed.
*/
insideExperimentSelect?: boolean;
};
}
/**
* Retrieve the async context for the current execution.
*/
declare const getAsyncCtx: () => Promise<AsyncContext | undefined>;
//#endregion
export { AsyncContext, getAsyncCtx };
//# sourceMappingURL=als.d.ts.map