Skip to content

r.defineEvent(...)

r.defineEvent(name, schema, options?) — registers an event payload shape and returns the qualified EventDef, so callers pass .name to ctx.appendEvent instead of hand-building <feature>:event:<short>. options.version declares the CURRENT schema generation (default 1). options.migrations is a step-wise upcast chain — keyed by fromVersion (toVersion is always fromVersion + 1, enforced at registration, so it is not stored separately); the framework refuses to boot if the chain from 1 to version has gaps. Formerly a separate r.eventMigration() call per step, folded in here (#1082 step 8) — an event and its schema evolution are one lifecycle, not two registrar concepts.


From packages/framework/src/engine/feature-ast/patterns.ts -> DefineEventPattern