Skip to content
SegmentStream/ Docs

Loading documentation…

↑ ↓ to navigate  ↵ to open  Esc to close
Website Console
Section menu

@segmentstream/ontology/workflows

84 public exports from @segmentstream/ontology/workflows.

Public exports

ActionEvent

One committed run of an action, as an action trigger's `when` and `input` receive it: the facts history stores, as one value. `input` and `result` are typed from the action handle; for a trigger on an entity they are `unknown`.

interface ActionEvent<Input = unknown, Result = unknown> {
    readonly action: string;
    readonly actionId: string;
    readonly at: string;
    readonly principal: Principal;
    readonly input: Input;
    readonly result: Result;
    readonly edits: ReadonlyArray<Edit>;
}
ActionTrigger

An action trigger, `after(name, target, { description, when, input })`: starts the workflow after an action of `entity` commits, `action` or any of them. `when` and `input` are code: the manifest records the kind, the name, the description, the entity and the action, never the functions.

interface ActionTrigger<Name extends string = string, Input = unknown> {
    readonly [WorkflowTriggerTypeId]: typeof WorkflowTriggerTypeId;
    readonly kind: "action";
    readonly name: Name;
    readonly description: string;
    readonly entity: string;
    readonly action: string | undefined;
    readonly target: unknown;
    readonly when: TriggerFunction<ActionEvent, unknown, boolean> | undefined;
    readonly input: TriggerFunction<ActionEvent, unknown, Input> | undefined;
    readonly runs?: AnyActionHandle | undefined;
    readonly role?: string | undefined;
}
AfterOptions
interface AfterOptions<Event, T, Input> extends TriggerRuns {
    readonly description: string;
    readonly when?: TriggerFunction<Event, T, boolean>;
    readonly input?: TriggerFunction<Event, T, Input>;
}
AgentTaskFailure
type AgentTaskFailure = "agent_unavailable" | "busy" | "agent_failed";
AgentTaskOptions
interface AgentTaskOptions {
    readonly prompt: string;
    readonly timeoutMs?: number;
}
AgentTaskOptionsInvalid

`agentTask`'s options are invalid. Marked fatal, so that the Workflow SDK does not retry it.

class AgentTaskOptionsInvalid extends Error {
    readonly fatal = true;
    constructor(option: string, problem: string);
}
AgentTaskResult
type AgentTaskResult = {
    readonly status: "completed";
    readonly text: string;
    readonly truncated: boolean;
} | {
    readonly status: "needs_input";
    readonly text: string;
    readonly truncated: boolean;
} | {
    readonly status: "failed";
    readonly reason: AgentTaskFailure;
} | {
    readonly status: "timed_out";
};
AgentTaskWorkflowRequired

`agentTask` was called outside a `"use workflow"` body. Marked fatal, as above.

class AgentTaskWorkflowRequired extends Error {
    readonly fatal = true;
    constructor();
}
AnyActionHandle

An authored action handle, `Lead.actions.changeStatus`.

type AnyActionHandle = AnyAction & ActionHandle;
AnyProperty

Any property, required or optional, as entity `properties` accept it.

type AnyProperty = Property<unknown, boolean, boolean> | Schema.optionalKey<Property<unknown, boolean, boolean>>;
AnyWorkflow

Any workflow, whatever its input.

type AnyWorkflow = Workflow<string, any>;
ChangedBounds

The bounds of {@link changed}: the value before, the value after, or both.

interface ChangedBounds<V> {
    readonly from?: V | null;
    readonly to?: V | null;
}
CronOptions
interface CronOptions<Input = unknown> extends TriggerRuns {
    readonly description: string;
    readonly input?: Input;
}
CronProblem

Which field of a cron expression does not parse.

type CronProblem = "fields" | "minute" | "hour" | "day_of_month" | "month" | "day_of_week" | "both_days";
CronTrigger

A cron trigger, `cron(name, expression, { description, input })`: the platform writes it into the workspace deployment's crons, and each invocation starts the workflow with `input`. Five fields, read in UTC.

interface CronTrigger<Name extends string = string, Input = unknown> {
    readonly [WorkflowTriggerTypeId]: typeof WorkflowTriggerTypeId;
    readonly kind: "cron";
    readonly name: Name;
    readonly description: string;
    readonly cron: string;
    readonly input: Input | undefined;
    readonly runs?: AnyActionHandle | undefined;
    readonly role?: string | undefined;
}
DEFAULT_AGENT_TASK_TIMEOUT_MS

How long a task may run, by default and at most: 15 minutes, 1 minute and 1 hour.

const DEFAULT_AGENT_TASK_TIMEOUT_MS = 900000
MAX_ACTION_TRIGGERS

The most action triggers, `after(…)`, one ontology may declare across its workflows. Every action evaluates the triggers on its entity inside its own transaction, so this bounds the work one action can add: about 4 to 6 ms per trigger for a batch create of 100 records, nothing measurable for a single update. It does not bound the runs a bulk action starts, one per edited record. A workflow may carry several, so it exceeds the workflows an ontology may declare.

const MAX_ACTION_TRIGGERS = 100
MAX_AGENT_TASK_PROMPT_LENGTH

The longest prompt, in characters.

const MAX_AGENT_TASK_PROMPT_LENGTH = 32768
MAX_AGENT_TASK_TEXT_LENGTH

The longest text the agent reports; it cuts longer text and sets `truncated`.

const MAX_AGENT_TASK_TEXT_LENGTH = 65536
MAX_AGENT_TASK_TIMEOUT_MS
const MAX_AGENT_TASK_TIMEOUT_MS = 3600000
MAX_LIVE_AGENT_TASKS

The most tasks a workspace has live at once; one more is refused as `busy`.

const MAX_LIVE_AGENT_TASKS = 10
MAX_META_WEBHOOK_BODY_BYTES

Meta batches messages and statuses into deliveries up to 3 MiB. Other schemes keep 1 MiB.

const MAX_META_WEBHOOK_BODY_BYTES: number
MAX_PLATFORM_TRIGGERS

The most platform triggers, `platform(…)`, one ontology may declare across its workflows, as for webhooks: it bounds the runs one platform event can start.

const MAX_PLATFORM_TRIGGERS = 20
MAX_WEBHOOKS

The most webhook triggers one ontology may declare across its workflows.

const MAX_WEBHOOKS = 20
MAX_WEBHOOK_BODY_BYTES

The default delivery body limit, in bytes. Meta's opt-in scheme has its own limit below.

const MAX_WEBHOOK_BODY_BYTES = 1048576
MAX_WEBHOOK_HEADERS

The most request headers one webhook trigger may pass to its workflow.

const MAX_WEBHOOK_HEADERS = 10
MAX_WORKFLOWS

The most workflows one ontology may declare.

const MAX_WORKFLOWS = 50
MIN_AGENT_TASK_TIMEOUT_MS
const MIN_AGENT_TASK_TIMEOUT_MS = 60000
NumberOptions
interface NumberOptions extends PropertyOptions<number> {
    readonly min?: number;
    readonly max?: number;
}
PLATFORM_EVENT_TYPES

The catalog of platform events: what the platform recorded for a workspace that a platform trigger, `platform(name, { events })`, starts a workflow for. The platform decides which exist. An event carries ids and codes, never text: the console and the CLI explain them by the same ids. It names no workspace or organization, since it is delivered only to the workspace it is about. A type gains fields compatibly; a change to a field is a new type.

const PLATFORM_EVENT_TYPES: readonly [
    "deployment.succeeded",
    "deployment.failed"
]
PlatformEvent

Any event of the catalog, by `type`. Fields a later platform adds are ignored.

const PlatformEvent: Schema.Union<readonly [
    Schema.Struct<{
        readonly id: Schema.String;
        readonly type: Schema.Literal<"deployment.succeeded">;
        readonly at: Schema.String;
        readonly deployment: Schema.Struct<{
            readonly id: Schema.String;
            readonly commit: Schema.NullOr<Schema.String>;
        }>;
    }>,
    Schema.Struct<{
        readonly id: Schema.String;
        readonly type: Schema.Literal<"deployment.failed">;
        readonly at: Schema.String;
        readonly deployment: Schema.Struct<{
            readonly id: Schema.String;
            readonly commit: Schema.NullOr<Schema.String>;
        }>;
        readonly failure: Schema.Struct<{
            readonly code: Schema.String;
            readonly reference: Schema.String;
        }>;
    }>
]>
type PlatformEvent = typeof PlatformEvent.Type;
PlatformEventOf

The event of one catalog type.

type PlatformEventOf<T extends PlatformEventType> = Extract<PlatformEvent, {
    readonly type: T;
}>;
PlatformEventType
type PlatformEventType = (typeof PLATFORM_EVENT_TYPES)[number];
PlatformOptions
interface PlatformOptions<T extends PlatformEventType, Input> {
    readonly description: string;
    readonly events: readonly [
        T,
        ...ReadonlyArray<T>
    ];
    readonly when?: (event: PlatformEventOf<T>) => boolean;
    readonly input?: (event: PlatformEventOf<T>) => Input;
}
PlatformTrigger

A platform trigger, `platform(name, { description, events, when, input })`: starts the workflow for each event of the listed catalog types that the platform records for this workspace, such as a production deployment that failed. `when` and `input` are code: the manifest records the kind, the name, the description and the event types, never the functions.

interface PlatformTrigger<Name extends string = string, Input = unknown> {
    readonly [WorkflowTriggerTypeId]: typeof WorkflowTriggerTypeId;
    readonly kind: "platform";
    readonly name: Name;
    readonly description: string;
    readonly events: ReadonlyArray<string>;
    readonly when: ((event: PlatformEvent) => boolean) | undefined;
    readonly input: ((event: PlatformEvent) => Input) | undefined;
}
Property

A property: an Effect Schema of its value, usable in action inputs, with its storage metadata in the schema's annotations. The two `~ontology` members exist only in the type. They record whether the property has a default (which makes it optional in `create`) and whether it is unique (which makes it a key for `upsertBy`).

interface Property<T, Defaulted extends boolean = boolean, Unique extends boolean = boolean> extends Schema.Codec<T> {
    readonly "~ontology.defaulted": Defaulted;
    readonly "~ontology.unique": Unique;
}
PropertyOptions
interface PropertyOptions<T> {
    readonly column?: string;
    readonly scope?: ReadonlyArray<string>;
    readonly optional?: boolean;
    readonly default?: T;
    readonly unique?: boolean;
    readonly label?: string;
    readonly description?: string;
    readonly renamedFrom?: string;
    readonly managed?: boolean;
    readonly excludeFromReplication?: boolean;
    readonly display?: string;
}
StartRecoveryInput

The step's input: the horizon the run answers for, from its second sweep on.

interface StartRecoveryInput {
    readonly before?: string;
    readonly last?: boolean;
}
StartRecoveryOutcome

What one sweep did and what is left.

interface StartRecoveryOutcome {
    readonly started: number;
    readonly failed: number;
    readonly abandoned: number;
    readonly waiting: number;
    readonly at: string;
}
StartRecoveryReport

A recovery run's result: its sweeps added up.

interface StartRecoveryReport {
    readonly sweeps: number;
    readonly started: number;
    readonly failed: number;
    readonly waiting: number;
    readonly abandoned: number;
}
StartRecoveryWorkflowRequired

`recoverWorkflowStarts` was called outside a `"use workflow"` body. Marked fatal.

class StartRecoveryWorkflowRequired extends Error {
    readonly fatal = true;
    constructor();
}
TextOptions
interface TextOptions extends PropertyOptions<string> {
    readonly maxLength?: number;
}
TriggerFunction

A synchronous function of an action trigger: no `await`, no effects, no entity handles. It runs inside the action's transaction and reads only the event and the record.

type TriggerFunction<Event, T, Out> = (event: Event, record: TriggerRecord<T>) => Out;
TriggerRecord

The record of the trigger's entity an action edited: its id, and the stored record before and after the action. `before` is `undefined` on a create, `after` on a delete. Only stored properties and relationship ids; warehouse-backed properties are absent.

interface TriggerRecord<T = unknown> {
    readonly record: string;
    readonly before: T | undefined;
    readonly after: T | undefined;
}
TriggerRunUnsupported

The service has no binding for trigger actions: an SDK older than the generated workflow.

class TriggerRunUnsupported extends Error {
    readonly fatal = true;
    constructor();
}
TriggerRunWorkflowRequired

`runTriggerAction` was called outside a `"use workflow"` body. Marked fatal.

class TriggerRunWorkflowRequired extends Error {
    readonly fatal = true;
    constructor();
}
WEBHOOK_BASE_PATH

Where deliveries arrive: `/api/webhooks/<wire name>`, followed by the token when unsigned.

const WEBHOOK_BASE_PATH = "/api/webhooks"
WEBHOOK_SIGNATURE_SCHEMES

The signature schemes a webhook trigger can check: `hmac` declares a provider's HMAC format with the trigger; `stripe` and `meta` name two published formats.

const WEBHOOK_SIGNATURE_SCHEMES: readonly [
    "stripe",
    "meta",
    "hmac"
]
WORKFLOW_BASE_PATH

The path the Workflow SDK's callbacks for the ontology's runs live under.

const WORKFLOW_BASE_PATH = "/api/ontology"
WebhookDelivery

One webhook delivery, as the workflow's run function receives it.

type WebhookDelivery = typeof webhookDelivery.Type;
WebhookHmacFormat

A provider's HMAC signature format: which bytes it signs, where its signatures travel and how they are written. The ontology service reads them from each delivery; SegmentStream computes the HMAC with the workspace secret, which never leaves it.

interface WebhookHmacFormat {
    readonly algorithm: WebhookHmacAlgorithm;
    readonly encoding: WebhookSignatureEncoding;
    readonly key?: {
        readonly decode: "base64";
        readonly prefix?: string | undefined;
    } | undefined;
    readonly signatures: {
        readonly header: string;
        readonly prefix?: string | undefined;
        readonly entries?: {
            readonly separator: "," | ";" | " ";
            readonly assign: "=" | ",";
            readonly name: string;
        } | undefined;
    };
    readonly timestamp?: {
        readonly header?: string | undefined;
        readonly entry?: string | undefined;
        readonly unit?: "seconds" | "milliseconds" | undefined;
        readonly tolerance?: number | undefined;
    } | undefined;
    readonly message?: ReadonlyArray<WebhookSignedPart> | undefined;
}
WebhookOptions
interface WebhookOptions extends TriggerRuns {
    readonly description: string;
    readonly signature?: WebhookSignature;
    readonly verification?: WebhookVerification;
    readonly headers?: ReadonlyArray<string>;
    readonly connection?: AnyConnectionHandle;
    readonly input?: (delivery: WebhookDelivery) => unknown;
}
WebhookSignature

Where a webhook's deliveries are checked: a provider's signature format and where its signing secret is held. Without one, the webhook's URL ends in a token. `stripe` and `meta` name published formats; `hmac` declares any other HMAC format with the trigger.

type WebhookSignature = ({
    readonly scheme: Exclude<WebhookSignatureScheme, "hmac">;
} & WebhookSignatureSecret) | ({
    readonly scheme: "hmac";
} & WebhookSignatureSecret & WebhookHmacFormat);
WebhookSignatureScheme
type WebhookSignatureScheme = (typeof WEBHOOK_SIGNATURE_SCHEMES)[number];
WebhookSignedPart

One piece of the signed bytes: text, the body, a header's value or the timestamp.

type WebhookSignedPart = string | {
    readonly body: WebhookSignedBody;
} | {
    readonly header: string;
} | {
    readonly timestamp: true;
};
WebhookTrigger

A webhook trigger, `webhook(name, { description, signature, headers })`: the ontology service starts the workflow for each genuine delivery to `/api/webhooks/<name>`, with the delivery as its input. The workflow's `input` is `webhookDelivery`.

interface WebhookTrigger<Name extends string = string> {
    readonly [WorkflowTriggerTypeId]: typeof WorkflowTriggerTypeId;
    readonly kind: "webhook";
    readonly name: Name;
    readonly description: string;
    readonly signature: WebhookSignature | undefined;
    readonly verification?: WebhookVerification | undefined;
    readonly headers: ReadonlyArray<string>;
    readonly connection?: AnyConnectionHandle | undefined;
    readonly runs?: AnyActionHandle | undefined;
    readonly role?: string | undefined;
    readonly input?: ((delivery: WebhookDelivery) => unknown) | undefined;
}
WebhookVerification

Meta's registration handshake. The verify token is a verification value of the webhook's `connection` (`input`), or a workspace secret (`verifyToken`, the older form), separate from the app secret either way.

type WebhookVerification = {
    readonly scheme: "meta";
    readonly input: string;
    readonly verifyToken?: undefined;
} | {
    readonly scheme: "meta";
    readonly verifyToken: string;
    readonly input?: undefined;
};
Workflow

A workflow: a durable process written with the Vercel Workflow SDK, run by the ontology service as its own keyless service user holding `role`. The declaration only records; `check` and the sandbox evaluation of `index.ts` never call `run`.

interface Workflow<Name extends string = string, Input = unknown> {
    readonly [WorkflowTypeId]: typeof WorkflowTypeId;
    readonly name: Name;
    readonly description: string;
    readonly role: string;
    readonly input: Schema.Top | undefined;
    readonly run: WorkflowFunction<Input>;
    readonly triggers: ReadonlyArray<WorkflowTrigger>;
    readonly connections: ReadonlyArray<AnyConnectionHandle>;
    readonly runs?: AnyActionHandle | undefined;
}
WorkflowFunction

The function a workflow runs: a `"use workflow"` function of the decoded input.

type WorkflowFunction<Input> = (input: Input, context: WorkflowRunContext) => Promise<unknown>;
WorkflowOptions
interface WorkflowOptions<S extends AnyInputSchema | undefined = undefined> {
    readonly description: string;
    readonly role: string;
    readonly input?: S;
    readonly run: WorkflowFunction<InputOf<S>>;
    readonly triggers?: ReadonlyArray<WorkflowTrigger>;
    readonly connections?: ReadonlyArray<AnyConnectionHandle>;
}
WorkflowRunContext

Who started a run, as the ontology service passes it to the workflow function as its second argument and records it in plaintext run attributes: a trigger, a member through `POST /api/ontology/workflows/:workflow/start`, or the platform on behalf of a person.

interface WorkflowRunContext {
    readonly startedBy: {
        readonly kind: "trigger";
        readonly triggerKind?: "cron" | "action" | "webhook" | "platform";
        readonly trigger: string;
        readonly actionId?: string;
        readonly recordId?: string;
        readonly event?: string;
    } | {
        readonly kind: "member";
        readonly userId: string;
    } | {
        readonly kind: "platform";
        readonly userId: string | null;
    };
    readonly owner?: {
        readonly entity: "user";
        readonly id: string;
    };
}
WorkflowStepContext

The step that calls `run`, as the Workflow SDK's step context names it.

interface WorkflowStepContext {
    readonly workflowName: string;
    readonly workflowRunId: string;
    readonly stepId: string;
    readonly attempt: number;
}
WorkflowStepRequired

`run` was called where no step runs: in a `"use workflow"` body or outside any workflow.

class WorkflowStepRequired extends Error {
    constructor();
}
WorkflowStepServices

What a step's effect may require: the ontology runtime, its actions and its connections.

type WorkflowStepServices = OntologyReads | OntologyWrites | OntologyActions | Connection<string> | Files;
WorkflowTrigger

What starts a workflow on its own. A discriminated union on `kind`: `cron`, `action`, `webhook` and `platform`; other kinds are additions.

type WorkflowTrigger<Input = unknown> = CronTrigger<string, Input> | ActionTrigger<string, Input> | WebhookTrigger | PlatformTrigger<string, Input>;
after

Declares an action trigger; list it in `workflow(name, { triggers })`. The target is an action handle, `Lead.actions.changeStatus`, or an entity handle, `Lead`, for any of its actions, authored or generated. A trigger does not fire for an action the workflow's own user ran.

function after<const Name extends string, A extends AnyActionHandle, Input = unknown>(name: Name, target: A, options: AfterOptions<ActionEvent<ActionInput<A>, ActionResult<A>>, HandleRecord<A>, Input>): ActionTrigger<Name, Input>;
function after<const Name extends string, E extends AnyStoredEntity, Input = unknown>(name: Name, target: E, options: AfterOptions<ActionEvent, E["Type"], Input>): ActionTrigger<Name, Input>;
agentTask

Hands the workspace's agent a prompt, in a `"use workflow"` body, and waits for its final answer without holding compute. The agent runs as in chats, with the same instructions, models, tools and sandbox, acting as this workflow's user: it sees and does exactly what the workflow's role allows, and ontology actions run without confirmation. It resolves with: - `completed` and the agent's final text; - `needs_input` and its question, when it would need a person; - `failed` with `agent_unavailable` (no agent, an agent without tasks, or outside production), `busy` (10 tasks are live) or `agent_failed` (its turn failed); - `timed_out` when `timeoutMs`, counted from the call, passes first. Invalid options, and a call outside a workflow body, fail the workflow. A retried start may hand the agent the same prompt again, so prompts and later steps tolerate a repeat.

function agentTask(options: AgentTaskOptions): Promise<AgentTaskResult>;
changed

A `when` predicate: true when the record's `field` differs before and after the action and matches the bounds given. A missing record or value counts as no value, so a create that sets `status` changed it, and `{ to: "qualified" }` does not fire when it was already qualified.

function changed<T extends object, K extends keyof T & string>(field: K, bounds?: ChangedBounds<NoInfer<T[K]>>): TriggerFunction<unknown, T, boolean>;
cron

Declares a cron trigger; list it in `workflow(name, { triggers })`. UTC, five fields.

function cron<const Name extends string, Input = unknown>(name: Name, expression: string, options: CronOptions<Input>): CronTrigger<Name, Input>;
cronNeverFires

Whether a valid expression names no day that exists: a day of the month no listed month has, such as `0 0 31 4 *` or `0 0 30 2 *`. The 29th of February counts: it exists in leap years.

function cronNeverFires(expression: string): boolean;
cronProblem

Checks a cron expression by the syntax Vercel crons accept: five fields, read in UTC, each `*`, numbers, ranges, steps and lists, without month or day names, and with at most one of the day fields restricted. It validates syntax only. `undefined` when it parses.

function cronProblem(expression: string): CronProblem | undefined;
isWorkflow

Whether a value was declared with `workflow(…)`.

function isWorkflow(value: unknown): value is AnyWorkflow;
isWorkflowTrigger

Whether a value was declared with a trigger constructor such as `cron(…)` or `after(…)`.

function isWorkflowTrigger(value: unknown): value is WorkflowTrigger;
nextCronTime

The first minute after `after` at which the expression fires, in UTC, within the next 366 days; `undefined` for an invalid expression or one that does not fire in that time.

function nextCronTime(expression: string, after: Date): Date | undefined;
p
const p: {
    readonly text: typeof text;
    readonly email: typeof email;
    readonly url: typeof url;
    readonly integer: typeof integer;
    readonly number: typeof number;
    readonly boolean: typeof boolean;
    readonly date: typeof date;
    readonly timestamp: typeof timestamp;
    readonly select: typeof select;
    readonly json: typeof json;
    readonly blob: typeof blob;
    readonly list: typeof list;
    readonly ref: typeof ref;
}
platform

Declares a platform trigger; list it in `workflow(name, { triggers })`. The workflow starts for each listed event the platform records for this workspace, and its runs act as the workflow's own user. A workflow that follows a deployment declares one; work that follows another workflow stays in that workflow, since workflow runs are not events.

function platform<const Name extends string, const T extends PlatformEventType, Input = unknown>(name: Name, options: PlatformOptions<T, Input>): PlatformTrigger<Name, Input>;
recoverWorkflowStarts

Sleeps, then sweeps the pending starts until none created before the run's horizon is left, and answers with what it did. The horizon is the first sweep's instant plus {@link RECOVERY_CONFIRM_MS }, read from the database's clock in the step's result so that a replay computes the same value. An empty sweep is confirmed by one more at the horizon; a sweep that failed starts is followed by another after a growing delay, until every such row is started or abandoned. Rows created after the horizon belong to the runs their own requests armed.

function recoverWorkflowStarts(delays?: {
    readonly firstSweepMs?: number;
    readonly confirmMs?: number;
}): Promise<StartRecoveryReport>;
run

Runs an Effect inside a `"use step"` function with the ontology runtime provided and bound to the run's workflow user: entity handles (`Lead.find`, `Lead.actions.addNote(…)`) and the workflow's connections work as in an action handler, with each read and action checked against the workflow user's permissions and recorded in history like any caller's. A failure rejects the promise, so the SDK records a failed step; a refusal that would repeat (a missing permission, a rejected action, an invalid input) is marked fatal and not retried. The rejection carries a sanitized message and the service logs the full cause. Outside a step it throws {@link WorkflowStepRequired}.

function run<A, E>(effect: Effect.Effect<A, E, WorkflowStepServices>): Promise<A>;
runTriggerAction

Runs the trigger's action in one step and answers with what the action returned, or `{ skipped: true }` when a webhook's `input` skipped the delivery.

function runTriggerAction(input: unknown): Promise<unknown>;
webhook

Declares a webhook trigger; list it in `workflow(name, { input: webhookDelivery, triggers })`. A workflow with a webhook trigger has only webhook triggers.

function webhook<const Name extends string>(name: Name, options: WebhookOptions): WebhookTrigger<Name>;
webhookDelivery

The input of a workflow that a webhook starts: one delivery exactly as it arrived. The workflow parses the body; header names are data and keep their lowercase spelling on the wire.

const webhookDelivery: Schema.Struct<{
    readonly body: import("./property.js").Property<string, false, false>;
    readonly contentType: import("./property.js").Property<string, false, false>;
    readonly query: import("./property.js").Property<string, false, false>;
    readonly headers: Schema.$Record<Schema.String, Schema.String>;
    readonly receivedAt: import("./property.js").Property<string, false, false>;
}>
webhookHeaderProblem

Why a header may not be passed to a workflow, or `undefined` when it may.

function webhookHeaderProblem(name: unknown): string | undefined;
webhookPath

The path of a webhook, without its token: `/api/webhooks/stripe_eu`.

function webhookPath(name: string): string;
workflow

Declares a workflow; list it in `defineOntology({ workflows })`.

function workflow<const Name extends string, S extends AnyInputSchema | undefined = undefined>(name: Name, options: WorkflowOptions<S>): Workflow<Name, InputOf<S>>;