Skip to main content

Function: stripForwardedEventMetadata()

stripForwardedEventMetadata(payload: object | readonly unknown[]): object | readonly unknown[]

Defined in: electron/utils/eventMetadataForwarding.ts:145

Produces a shallow clone of the provided payload with event-bus metadata properties removed.

Parameters

payload

Payload that may carry forwarded metadata. Must be an array or an object; primitives are rejected at runtime.

object | readonly unknown[]

Returns

object | readonly unknown[]

A shallow clone of payload with metadata properties removed. The original object is never mutated.

Remarks

Internal event buses attach metadata on the _meta, _originalMeta, and ORIGINAL_METADATA_SYMBOL properties. When forwarding these payloads across process or layer boundaries (for example, from the orchestrator to the renderer), consumers often need a clean view of the domain payload without bus-specific metadata.

This helper centralises that stripping logic so multiple callers do not duplicate knowledge of the metadata property keys.

Throws

TypeError If a primitive payload (non-object, non-array) is provided. Event metadata is only attached to object or array payloads, so attempting to strip metadata from primitives usually indicates a programming error.