publishing_event_handler.ts

Composable sinks for the publishing event stream.

A PublishingEventHandler is anything that can receive a PublishingEvent. Handlers compose: multi_handler fans out, masking_handler redacts secrets then forwards. Emission is best-effort and synchronous — an observability sink must never fail or slow a run. The default sink is null_handler (drops everything).

view source

Declarations
#

9 declarations

capture_handler
#

publishing_event_handler.ts view source

(): CapturingEventHandler import {capture_handler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Collects events in memory. Used to build the run report and in tests.

returns

CapturingEventHandler

CapturingEventHandler
#

mask_secrets
#

publishing_event_handler.ts view source

(event: { event: "run_started"; wetrun: boolean; total: number; } | { event: "package_skipped"; name: string; reason: string; } | { event: "package_completed"; name: string; old_version: string; new_version: string; bump_type: "major" | ... 1 more ... | "patch"; breaking: boolean; commit: string; tag: string; } | ... 6 more ... | { ...; }): { ...; } | ... 8 more ... | { ...; } import {mask_secrets} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Returns a copy of the event with secrets redacted from its string-valued fields.

event

type { event: "run_started"; wetrun: boolean; total: number; } | { event: "package_skipped"; name: string; reason: string; } | { event: "package_completed"; name: string; old_version: string; new_version: string; bump_type: "major" | ... 1 more ... | "patch"; breaking: boolean; commit: string; tag: string; } | ... 6 more...

returns

{ event: "run_started"; wetrun: boolean; total: number; } | { event: "package_skipped"; name: string; reason: string; } | { event: "package_completed"; name: string; old_version: string; new_version: string; bump_type: "major" | ... 1 more ... | "patch"; breaking: boolean; commit: string; tag: string; } | ... 6 more...

masking_handler
#

publishing_event_handler.ts view source

(inner: PublishingEventHandler, mask?: (event: { event: "run_started"; wetrun: boolean; total: number; } | { event: "package_skipped"; name: string; reason: string; } | { ...; } | ... 6 more ... | { ...; }) => { ...; } | ... 8 more ... | { ...; }): PublishingEventHandler import {masking_handler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Wraps a handler, masking secrets in each event's string fields before forwarding.

inner

the handler to forward masked events to

mask

the masking function, defaults to mask_secrets

type (event: { event: "run_started"; wetrun: boolean; total: number; } | { event: "package_skipped"; name: string; reason: string; } | { event: "package_completed"; name: string; old_version: string; new_version: string; bump_type: "major" | ... 1 more ... | "patch"; breaking: boolean; commit: string; tag: string; } | .....
default mask_secrets

returns

PublishingEventHandler

multi_handler
#

publishing_event_handler.ts view source

(handlers: PublishingEventHandler[]): PublishingEventHandler import {multi_handler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Fans an event out to every handler in order.

handlers

type PublishingEventHandler[]

returns

PublishingEventHandler

null_handler
#

publishing_event_handler.ts view source

(): PublishingEventHandler import {null_handler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Drops every event. The default when no handler is supplied.

returns

PublishingEventHandler

PublishingEventHandler
#

publishing_event_handler.ts view source

PublishingEventHandler import type {PublishingEventHandler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

A sink for publishing events.

emit

type (event: PublishingEvent) => void

redact_secrets
#

publishing_event_handler.ts view source

(text: string): string import {redact_secrets} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Redacts known secret shapes from a string.

text

type string

returns

string

stdout_handler
#

publishing_event_handler.ts view source

(): PublishingEventHandler import {stdout_handler} from '@fuzdev/fuz_gitops/publishing_event_handler.js';

Writes each event as one JSON object per line (JSON-lines) to process.stdout. Write failures are swallowed — the stream is observability, not control flow.

returns

PublishingEventHandler

Depends on
#

Imported by
#