Line

You are reading docs for v0.8. See latest (v0.9)

packages/engine/envelope

Ticket 7.1 -- Context Envelope helpers.

Engine, v0.8. Source: packages/engine/envelope.mjs.

Variables#

ENVELOPE_VERSION#

const ENVELOPE_VERSION: 1 = 1

Defined in: packages/engine/envelope.mjs:16

Functions#

createEnvelope()#

createEnvelope(feature, overrides?): object

Defined in: packages/engine/envelope.mjs:22

Build a fresh, valid v1 envelope for feature, optionally seeded with prior state (e.g. the previous pipeline step's output envelope).

Parameters#

feature

any

overrides?

Returns#

object

diagnostics

diagnostics: any[] = []

events

events: any[] = []

feature

feature: any

layers

layers: object = {}

status

status: string = 'pending'

unboundSlots

unboundSlots: any[] = []

version

version: number = ENVELOPE_VERSION


validateEnvelope()#

validateEnvelope(envelope): object

Defined in: packages/engine/envelope.mjs:51

Structural validation against schemas/envelope.v1.json's shape. Returns { valid, errors } rather than throwing, so a caller (e.g. construct pipeline run reading a malformed envelope off stdin) can report every problem at once instead of stopping at the first.

Parameters#

envelope

any

Parsed Context Envelope.

Returns#

object

Every structural problem found, not just the first.

errors

errors: string[]

valid

valid: boolean

Example#

validateEnvelope({ version: 1, feature: 'billing', status: 'pending', layers: [] });