Skip to content

steps/runtime ​

Read run context and update run resources outside workflow code.

Wrap steps in a factory-owned "use step" file. Never call them directly from a workflow.

Functions ​

createRunDirectory() ​

ts
function createRunDirectory(metadata): Promise<string>;

Create a working directory that survives retries and pauses in this run.

Parameters ​

ParameterType
metadataRunMetadata

Returns ​

Promise<string>


dashboardRunUrl() ​

ts
function dashboardRunUrl(runId): string | undefined;

The run's page on the dashboard this service hosts, or undefined when the service was started without one. Never a standalone workflow web URL: run against a live World it opens a second queue worker and steals the jobs the run is waiting on.

Parameters ​

ParameterType
runIdstring

Returns ​

string | undefined


registerResource() ​

ts
function registerResource(resource): Promise<RunResource>;

Register one resource on the active run.

Repeating kind + identity is idempotent. A new URL for that identity replaces the old URL; concurrent updates are last-committed-wins. Distinct identities occupy distinct atomic keys.

Parameters ​

ParameterType
resourceRunResource

Returns ​

Promise<RunResource>


releaseRunResources() ​

ts
function releaseRunResources(policy, metadata): Promise<ReleaseReport>;

Persist an explicit success action, release under the run lock and return the result.

Parameters ​

ParameterTypeDescription
policy{ onFailure: "release" | "keep"; onSuccess: "release" | "keep"; }-
policy.onFailure"release" | "keep"What to do with eligible resources after a failed or cancelled run.
policy.onSuccess"release" | "keep"What to do with eligible resources after a completed run.
metadataRunMetadata-

Returns ​

Promise<ReleaseReport>


removeRunDirectory() ​

ts
function removeRunDirectory(metadata): Promise<void>;

Remove this run's working directory after its work is finished, never while paused.

Parameters ​

ParameterType
metadataRunMetadata

Returns ​

Promise<void>


resolveReleasePolicy() ​

ts
function resolveReleasePolicy(metadata, definition): Promise<{
  onFailure: "release" | "keep";
  onSuccess: "release" | "keep";
}>;

Resolve the workflow policy, then the factory policy, then the built-in release/keep default.

Parameters ​

ParameterType
metadataNamedRunMetadata
definitionFactoryDefinition

Returns ​

Promise<{ onFailure: "release" | "keep"; onSuccess: "release" | "keep"; }>

Released under the MIT License.