Trigger.dev API
Generated public TypeScript reference for @relkit/trigger.
For configuration and examples, read docker, providers.
Public imports
@relkit/trigger— 7 exports@relkit/trigger/runtime— 22 exports@relkit/trigger/local-recipe— 1 exports@relkit/trigger/deployment— 4 exports
All exported APIs
Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API’s inline sample, a maintained repository usage, or the shared module walkthrough.
index.ts
TriggerDeploymentProfile (interface)
Signature
export interface TriggerDeploymentProfile {
readonly provider: "trigger";
readonly compatibility: "unverified";
readonly adapterId: "trigger";
readonly sdk: "4.5.16";
readonly dockerImageDigest: "sha256:3563088912cf4b880602d99815ddd787274c4ce5fc77738adf1e5bad287fbd1e";
readonly dockerDurableSleep: false;
readonly managedStatus: "not-tested";
readonly scheduleVariants: readonly string[];
readonly workerRuntime: "bun";
readonly executionLimits: Readonly<{
readonly inputBytes: number;
readonly progressBytes: number;
readonly maxRunList: number;
}>;
readonly policyIdentity: readonly string[];
}
TriggerWorkerPublication (interface)
Signature
export interface TriggerWorkerPublication {
readonly provider: "trigger";
readonly mechanism: "trigger-sdk";
readonly taskId: string;
readonly taskVersion: string;
readonly buildId: string;
readonly serviceGeneration: string;
readonly entrypoint: string;
}
deploymentProfile
Signature
declare const deploymentProfile: TriggerDeploymentProfile;
nativeWorkerPublication
Signature
declare const nativeWorkerPublication: (
value: Omit<TriggerWorkerPublication, "provider" | "mechanism">,
) => TriggerWorkerPublication;
index.ts
TriggerAdapter (type alias)
Signature
type TriggerAdapter<Options extends TriggerOptions = TriggerOptions> = ProviderAdapter<
typeof job,
"trigger",
ProviderConnectionValues,
ProviderBehavior<TriggerBehavior>
>;
TriggerBehavior (type alias)
Signature
type TriggerBehavior = JobsServiceBehavior;
TriggerOptions (interface)
Signature
export interface TriggerOptions extends JobsServiceOptions {
readonly projectRef?: string | TextReference;
readonly secretKey?: SecretReference;
readonly baseUrl?: string | URL | TextReference;
readonly native?: Readonly<Record<string, import("@relkit/contracts").JsonValue>>;
}
trigger
Signature
declare const trigger: <const Options extends TriggerOptions = TriggerOptions>(
options?: Options,
) => TriggerAdapter<Options>;
triggerConnectionContract
Signature
declare const triggerConnectionContract: ProviderConnectionContract;
triggerIntegration
Signature
declare const triggerIntegration: IntegrationReference<"trigger">;
triggerLocalRecipe
Signature
declare const triggerLocalRecipe: ProviderLocalRecipeReference;
index.ts
localRecipe
Signature
declare const localRecipe: Readonly<{
kind: "local-service-recipe";
protocolVersion: 2;
integrationId: "trigger";
recipeId: "trigger-docker";
recipeVersion: 2;
materializerId: "docker";
containers: ReadonlyArray<
| Readonly<{
id: "postgres";
image: "postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685";
ports: Readonly<{}>;
volumes: ReadonlyArray<{ name: string; mountPath: string }>;
environment: Readonly<{
POSTGRES_DB: Readonly<{ value: "trigger" }>;
POSTGRES_USER: Readonly<{ value: "trigger" }>;
POSTGRES_PASSWORD: Readonly<{ secret: "postgresPassword" }>;
}>;
health: Readonly<{ command: Array<string>; intervalMs: 250; timeoutMs: 2000; retries: 60 }>;
networkAliases: ReadonlyArray<string>;
}>
| Readonly<{
id: "trigger";
image: "triggerdotdev/trigger.dev@sha256:3563088912cf4b880602d99815ddd787274c4ce5fc77738adf1e5bad287fbd1e";
dependsOn: ReadonlyArray<string>;
ports: Readonly<{ api: 8030 }>;
health: Readonly<{
command: Array<string>;
intervalMs: 500;
timeoutMs: 2000;
retries: 120;
}>;
networkAliases: ReadonlyArray<string>;
environment: Readonly<{
DATABASE_URL: Readonly<{
value: "postgres://trigger:$POSTGRES_PASSWORD@postgres:5432/trigger";
}>;
TRIGGER_ACCOUNT_FREE: Readonly<{ value: "1" }>;
TRIGGER_PROJECT_REF: Readonly<{ secret: "projectRef" }>;
TRIGGER_SECRET_KEY: Readonly<{ secret: "secretKey" }>;
}>;
}>
>;
init: ReadonlyArray<
Readonly<{
id: "postgres-ready";
image: "postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685";
dependsOn: ReadonlyArray<string>;
command: ReadonlyArray<string>;
environment: Readonly<{ POSTGRES_PASSWORD: Readonly<{ secret: "postgresPassword" }> }>;
}>
>;
workers: ReadonlyArray<
Readonly<{
id: "worker";
image: "oven/bun:1.3.10@sha256:b86c67b531d87b4db11470d9b2bd0c519b1976eee6fcd71634e73abfa6230d2e";
command: ReadonlyArray<string>;
dependsOn: ReadonlyArray<string>;
ports: Readonly<{ api: 3000 }>;
health: Readonly<{ command: Array<string>; intervalMs: 500; timeoutMs: 2000; retries: 120 }>;
networkAliases: ReadonlyArray<string>;
}>
>;
volumes: Readonly<{
postgres: Readonly<{ mountPath: "/var/lib/postgresql/data"; persistent: true }>;
}>;
generatedSecrets: Readonly<{
postgresPassword: Readonly<{ bytes: 24; encoding: "hex" }>;
projectRef: Readonly<{ bytes: 12; encoding: "hex" }>;
secretKey: Readonly<{ bytes: 32; encoding: "hex" }>;
}>;
network: Readonly<{ internal: false }>;
ownership: Readonly<{ scope: "project"; retainVolumes: true }>;
outputs: ({ ports, secrets }: LocalServiceRecipeOutputContext) => Readonly<{
baseUrl: string;
projectRef: string;
secretKey: string;
}>;
}>;
local.ts
localRecipe
Signature
declare const localRecipe: Readonly<{
kind: "local-service-recipe";
protocolVersion: 2;
integrationId: "trigger";
recipeId: "trigger-docker";
recipeVersion: 2;
materializerId: "docker";
containers: ReadonlyArray<
| Readonly<{
id: "postgres";
image: "postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685";
ports: Readonly<{}>;
volumes: ReadonlyArray<{ name: string; mountPath: string }>;
environment: Readonly<{
POSTGRES_DB: Readonly<{ value: "trigger" }>;
POSTGRES_USER: Readonly<{ value: "trigger" }>;
POSTGRES_PASSWORD: Readonly<{ secret: "postgresPassword" }>;
}>;
health: Readonly<{ command: Array<string>; intervalMs: 250; timeoutMs: 2000; retries: 60 }>;
networkAliases: ReadonlyArray<string>;
}>
| Readonly<{
id: "trigger";
image: "triggerdotdev/trigger.dev@sha256:3563088912cf4b880602d99815ddd787274c4ce5fc77738adf1e5bad287fbd1e";
dependsOn: ReadonlyArray<string>;
ports: Readonly<{ api: 8030 }>;
health: Readonly<{
command: Array<string>;
intervalMs: 500;
timeoutMs: 2000;
retries: 120;
}>;
networkAliases: ReadonlyArray<string>;
environment: Readonly<{
DATABASE_URL: Readonly<{
value: "postgres://trigger:$POSTGRES_PASSWORD@postgres:5432/trigger";
}>;
TRIGGER_ACCOUNT_FREE: Readonly<{ value: "1" }>;
TRIGGER_PROJECT_REF: Readonly<{ secret: "projectRef" }>;
TRIGGER_SECRET_KEY: Readonly<{ secret: "secretKey" }>;
}>;
}>
>;
init: ReadonlyArray<
Readonly<{
id: "postgres-ready";
image: "postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685";
dependsOn: ReadonlyArray<string>;
command: ReadonlyArray<string>;
environment: Readonly<{ POSTGRES_PASSWORD: Readonly<{ secret: "postgresPassword" }> }>;
}>
>;
workers: ReadonlyArray<
Readonly<{
id: "worker";
image: "oven/bun:1.3.10@sha256:b86c67b531d87b4db11470d9b2bd0c519b1976eee6fcd71634e73abfa6230d2e";
command: ReadonlyArray<string>;
dependsOn: ReadonlyArray<string>;
ports: Readonly<{ api: 3000 }>;
health: Readonly<{ command: Array<string>; intervalMs: 500; timeoutMs: 2000; retries: 120 }>;
networkAliases: ReadonlyArray<string>;
}>
>;
volumes: Readonly<{
postgres: Readonly<{ mountPath: "/var/lib/postgresql/data"; persistent: true }>;
}>;
generatedSecrets: Readonly<{
postgresPassword: Readonly<{ bytes: 24; encoding: "hex" }>;
projectRef: Readonly<{ bytes: 12; encoding: "hex" }>;
secretKey: Readonly<{ bytes: 32; encoding: "hex" }>;
}>;
network: Readonly<{ internal: false }>;
ownership: Readonly<{ scope: "project"; retainVolumes: true }>;
outputs: ({ ports, secrets }: LocalServiceRecipeOutputContext) => Readonly<{
baseUrl: string;
projectRef: string;
secretKey: string;
}>;
}>;
index-support.ts
observationOptions
Signature
declare const observationOptions: (options: TriggerRuntimeOptions) => TriggerObservationOptions;
optionalText
Signature
declare const optionalText: (value: unknown) => string | undefined;
text
Signature
declare const text: (value: unknown, label: string) => string;
unknown
Signature
declare const unknown: (value: NativeControlReceipt) => boolean;
url
Signature
declare const url: (value: string) => void;
index.ts
“./native.js” (namespace export)
Re-exports all named exports from the “./native.js” module.
Signature
export * from "./native.js";
“./subscription.js” (namespace export)
Re-exports all named exports from the “./subscription.js” module.
Signature
export * from "./subscription.js";
“./task-binding.js” (namespace export)
Re-exports all named exports from the “./task-binding.js” module.
Signature
export * from "./task-binding.js";
TriggerRuntime (interface)
Signature
export interface TriggerRuntime extends JobsAdapterRuntime {
readonly registerWorker: (options: TriggerWorkerRegistrationOptions) => TriggerWorkerHandle;
}
TriggerRuntimeOptions (interface)
Signature
export interface TriggerRuntimeOptions {
readonly projectRef: string;
readonly secretKey?: string;
readonly baseUrl: string;
readonly fetch?: typeof globalThis.fetch;
readonly native?: TriggerNativeClient;
readonly sdk?: TriggerSdk;
readonly supportsDurableSleep?: boolean;
readonly pollIntervalMs?: number;
readonly maxPolls?: number;
readonly serviceOptions?: JobsServiceOptions;
}
TriggerWorkerRegistrationOptions (interface)
Signature
export interface TriggerWorkerRegistrationOptions {
readonly definitions: readonly TriggerTaskDefinition[];
readonly executor: import("@relkit/jobs/adapter").TaskExecutor;
readonly startWorker?: boolean;
readonly register?: (tasks: readonly unknown[]) => Promise<void> | void;
}
createTriggerRuntime
Signature
declare const createTriggerRuntime: (options: TriggerRuntimeOptions) => TriggerRuntime;
runtimeIntegration
Signature
declare const runtimeIntegration: RuntimeProviderIntegration<"trigger">;
native.ts
TriggerHttpClientOptions (interface)
Signature
export interface TriggerHttpClientOptions {
readonly baseUrl: string;
readonly projectRef: string;
readonly secretKey?: string;
readonly fetch?: typeof globalThis.fetch;
readonly client?: TriggerSdkApi;
}
TriggerNativeClient (interface)
Signature
export interface TriggerNativeClient {
readonly submit: (request: NativeSubmission, context: OperationContext) => Promise<NativeReceipt>;
readonly get: (runId: string, context: OperationContext) => Promise<NativeRun>;
readonly list: (query: NativeRunQuery, context: OperationContext) => Promise<NativeRunPage>;
readonly cancel: (
runId: string,
operationId: string,
reason: string | undefined,
context: OperationContext,
) => Promise<NativeControlReceipt>;
readonly retry: (
request: NativeRetryRequest,
context: OperationContext,
) => Promise<NativeControlReceipt>;
readonly subscribeToRun?: (
runId: string,
context: OperationContext,
after?: string,
) => Promise<TriggerSubscription | undefined>;
readonly schedules?: NativeScheduleOperations;
readonly registerTasks?: (tasks: readonly unknown[]) => Promise<void> | void;
readonly close?: () => Promise<void>;
}
TriggerSdkApi (interface)
Signature
export interface TriggerSdkApi {
readonly tasks: {
readonly trigger: (...args: readonly unknown[]) => Promise<unknown>;
};
readonly runs: {
readonly retrieve: (...args: readonly unknown[]) => Promise<unknown>;
readonly list: (...args: readonly unknown[]) => Promise<unknown>;
readonly cancel: (...args: readonly unknown[]) => Promise<unknown>;
readonly replay: (...args: readonly unknown[]) => Promise<unknown>;
readonly subscribeToRun: (...args: readonly unknown[]) => AsyncIterable<unknown>;
};
}
TriggerSubscription (interface)
Signature
export interface TriggerSubscription {
readonly stream: AsyncIterable<unknown>;
readonly unsubscribe?: () => Promise<void> | void;
}
createTriggerHttpClient
Compatibility name retained for callers; the implementation uses the pinned SDK.
Signature
declare const createTriggerHttpClient: (options: TriggerHttpClientOptions) => TriggerNativeClient;
statusOf
Signature
declare const statusOf: (value: unknown) => RunSnapshot["status"];
triggerSnapshot
Signature
declare const triggerSnapshot: (
value: unknown,
context: OperationContext,
fallbackRunId?: string,
) => NativeRun;
triggerTaskIdentifier
Signature
declare const triggerTaskIdentifier: (
request: Pick<NativeSubmission, "jobId" | "taskId" | "taskVersion" | "buildId">,
) => string;
sdk-list.ts
listRuns
Signature
declare const listRuns: (
client: TriggerSdkApi,
projectRef: string,
query: NativeRunQuery,
context: OperationContext,
) => Promise<NativeRunPage>;
sdk-mapping.ts
isJsonValue
Signature
declare const isJsonValue: (value: unknown) => boolean;
record
Signature
declare const record: (value: unknown) => Record<string, any> | undefined;
statusOf
Signature
declare const statusOf: (value: unknown) => RunSnapshot["status"];
triggerSnapshot
Signature
declare const triggerSnapshot: (
value: unknown,
context: OperationContext,
fallbackRunId?: string,
) => NativeRun;
sdk-native-support.ts
definiteRejection
Signature
declare const definiteRejection: (error: unknown) => boolean;
handle
Signature
declare const handle: (value: unknown, request: NativeSubmission) => RunHandle;
loadClient
Signature
declare const loadClient: (options: TriggerHttpClientOptions) => TriggerSdkApi;
metadata
Signature
declare const metadata: (
request: NativeSubmission,
context: OperationContext,
) => Record<string, string>;
text
Signature
declare const text: (value: unknown, label: string) => string;
triggerOptions
Signature
declare const triggerOptions: (
request: NativeSubmission,
context: OperationContext,
) => Record<string, unknown>;
unknownControl
Signature
declare const unknownControl: (operationId: string) => JobUnknownOutcome;
unknownSubmission
Signature
declare const unknownSubmission: (request: NativeSubmission) => JobUnknownOutcome;
sdk-native.ts
createTriggerSdkNativeClient
Signature
declare const createTriggerSdkNativeClient: (
options: TriggerHttpClientOptions,
) => TriggerNativeClient;
sdk-support.ts
triggerTaskIdentifier
Signature
declare const triggerTaskIdentifier: (
request: Pick<NativeSubmission, "jobId" | "taskId" | "taskVersion" | "buildId">,
) => string;
subscription.ts
TriggerObservationOptions (interface)
Signature
export interface TriggerObservationOptions {
readonly pollIntervalMs?: number;
readonly readTimeoutMs?: number;
readonly maxPolls?: number;
}
observeTriggerRun
Signature
declare const observeTriggerRun: (
request: NativeWatchRequest,
context: OperationContext,
client: TriggerNativeClient,
options?: TriggerObservationOptions,
) => AsyncGenerator<NativeObservation>;
task-binding-support.ts
bindingFrom
Signature
declare const bindingFrom: (
envelope: TaskExecutionEnvelope,
context: unknown,
) => TaskExecutionBinding;
envelopeFrom
Signature
declare const envelopeFrom: (
payload: unknown,
context: unknown,
definition: TriggerTaskDefinition,
) => TaskExecutionEnvelope;
number
Signature
declare const number: (value: unknown) => number | undefined;
record
Signature
declare const record: (value: unknown) => Record<string, any> | undefined;
text
Signature
declare const text: (value: unknown, label: string) => string;
task-binding.ts
TriggerSdk (interface)
Signature
export interface TriggerSdk {
readonly createTask?: (options: Readonly<Record<string, unknown>>) => unknown;
readonly task?: (options: Readonly<Record<string, unknown>>) => unknown;
readonly tasks?:
((options: Readonly<Record<string, unknown>>) => unknown) | Readonly<Record<string, unknown>>;
}
TriggerTaskDefinition (interface)
Signature
export interface TriggerTaskDefinition {
readonly id: string;
readonly jobId?: string;
readonly taskId?: string;
readonly version: string;
readonly buildId: string;
readonly retries?: number;
readonly trigger?: Readonly<Record<string, unknown>>;
readonly policy?: unknown;
readonly resources?: {
readonly cpu: number;
readonly memory: string;
readonly nativeClass?: string;
};
}
TriggerWorkerHandle (interface)
Signature
export interface TriggerWorkerHandle {
readonly tasks: readonly unknown[];
readonly ready: () => Promise<void>;
readonly close: () => Promise<void>;
}
createTriggerTask
Signature
declare const createTriggerTask: (
sdk: TriggerSdk,
definition: TriggerTaskDefinition,
executor: TaskExecutor,
) => unknown;
createTriggerTaskConfig
Signature
declare const createTriggerTaskConfig: (
definition: TriggerTaskDefinition,
) => Readonly<Record<string, unknown>>;
createTriggerWorker
Signature
declare const createTriggerWorker: (options: {
readonly sdk?: TriggerSdk;
readonly definitions: readonly TriggerTaskDefinition[];
readonly executor: TaskExecutor;
readonly register?: (tasks: readonly unknown[]) => Promise<void> | void;
}) => TriggerWorkerHandle;
loadTriggerSdk
Signature
declare const loadTriggerSdk: () => TriggerSdk;