publishing_event.ts

Structured events for multi-repo publishing.

Publishing emits a stream of tagged events alongside its human-readable logging, so machine consumers (CI, dashboards) can follow a run step by step. Every run opens with a run_started event carrying wetrun: when false, the run is a dry run and every package_completed is a prediction (its commit is 'simulated') rather than an applied change. A run's run_finished summary is derived from the same event list via summarize_events, so the stream and the summary never drift.

Events are consumed through a PublishingEventHandler sink (see publishing_event_handler.ts).

Declarations
#

4 declarations

view source

PublishingErrorCode
#

publishing_event.ts view source

ZodEnum<{ publish: "publish"; network: "network"; auth: "auth"; dependency: "dependency"; build: "build"; other: "other"; }>

Coarse triage classification for a failed package. Lets consumers branch on failure kind without parsing the message.

PublishingEvent
#

publishing_event.ts view source

ZodDiscriminatedUnion<[ZodObject<{ event: ZodLiteral<"run_started">; wetrun: ZodBoolean; total: ZodNumber; }, $strict>, ZodObject<{ event: ZodLiteral<"iteration_started">; iteration: ZodNumber; max: ZodNumber; }, $strict>, ... 11 more ..., ZodObject<...>], "event">

A single structured event emitted during a publishing run. Tagged on event so the union serializes as one self-describing JSON object per event (JSON-lines on the wire).

PublishingRunSummary
#

publishing_event.ts view source

ZodObject<{ total: ZodNumber; published: ZodNumber; failed: ZodNumber; skipped: ZodNumber; duration: ZodNumber; }, $strict>

Tallied outcome of a publishing run, derived from its events via summarize_events.

summarize_events
#

publishing_event.ts view source

(events: ({ event: "run_started"; wetrun: boolean; total: number; } | { event: "iteration_started"; iteration: number; max: number; } | { event: "iteration_finished"; iteration: number; published_count: number; converged: boolean; } | ... 10 more ... | { ...; })[], duration: number): { ...; }

Derives a run summary from the captured event list — the single canonical path from events to summary, so the run_finished summary always agrees with the stream. Call before emitting run_finished (which is not itself counted).

events

the events captured so far this run

type ({ event: "run_started"; wetrun: boolean; total: number; } | { event: "iteration_started"; iteration: number; max: number; } | { event: "iteration_finished"; iteration: number; published_count: number; converged: boolean; } | ... 10 more ... | { ...; })[]

duration

wall-clock duration in milliseconds

type number

returns

{ total: number; published: number; failed: number; skipped: number; duration: number; }

Depends on
#

Imported by
#