Skip to content
Français

readArtifact

import { readArtifact } from "@elie-laloum/outpost";

Read the artifact published by a declared dependency: take its reference from context.value(), reject with Artifact dependency producer mismatch when another execution or task produced it, then verify and decode it like readStoredArtifact() under the task’s signal.

Complete example and detailed rules.

  • contextRequired
    TaskContext
    Context of the running task; supplies the dependency output, the execution id and the cancellation signal.
  • dependencyRequired
    Task<ArtifactReference>
    Artifact task listed in this task’s after; its output is the reference to read. An undeclared dependency throws.
  • contractRequired
    ArtifactContract<T>
    Expected contract; must match the reference’s name, version and encoding.
  • storeRequired
    ArtifactStore
    Store holding the artifact bytes.

Promise<T>

export declare function readArtifact<T>(
  context: TaskContext,
  dependency: Task<ArtifactReference>,
  contract: ArtifactContract<T>,
  store: ArtifactStore,
): Promise<T>;