v0.4.0
Minor Changes
-
7cb7ed3: Add a kit-level
prepare→ctx.provided— a first-class, once-per-invocation context
provider, so sharing a live ref (a GraphQL executor, an authenticated vendor client, a
resolved tenant config) across an invocation no longer requires hand-rolling an
augmentJobContextplugin.Declare it as a reserved key on
createEventKit's config:const kit = createEventKit(hasuraEvent, { prepare: () => ({ executor: createFetchExecutor({ url, adminSecret }) }), }) .use(netlifyV2Platform) .registerEvents(events);
It runs once per invocation (after
normalize, before detection) and its returned
object is attached asctx.provided— the SAME instance — on every detector, module
prepare, and job of that invocation.- Request-scoped, never serialized. Unlike
envelope.meta(persisted to observability),
providedis safe for live objects. Defaults to{}when unset. - Distinct from the existing scopes: kit
prepare→ctx.provided(per invocation,
whole stack); moduleprepare→ctx.input/ctx.prepared(per event); per-job
input(per job, merges highest). - Also runs under
dryRunso detectors that readctx.providedbehave identically — keep it
cheap. A throw aborts the invocation cleanly, reported as the newErrorPhasevalue
'prepare'; no jobs run.
New public types:
KitPrepareContext,KitPrepareFunction.DetectorContext,
HandlerContext,InvocationContext, andJobContextgain aprovided: Record<string, unknown>field. Additive and backward-compatible (providedis{}when no kitprepare
is configured). - Request-scoped, never serialized. Unlike