Code0 LogoCodeZero

RuntimeEvent

Internal event definitions and decorators

A RuntimeEvent is the internal definition of an event. It holds the identifier, signature, and settings that the platform uses to route and configure event triggers. Unlike RuntimeFunctions, RuntimeEvents have no run() method — they are purely declarative.

import { Identifier, Signature, Name, EventSetting } from '@code0-tech/hercules';

Overview

RuntimeEvents are the internal counterpart to public-facing Events. Your action fires them explicitly via action.fire().

@Identifier('user_created')
@Signature('(userId: number): void')
@Name({ code: 'en-US', content: 'User Created' })
@EventSetting({
  identifier: 'FILTER_ROLE',
  name: [{ code: 'en-US', content: 'Role Filter' }],
  optional: true,
})
export class UserCreatedRuntimeEvent {}

The descriptor stored in action.runtimeEvents is documented on the RuntimeEventManager page.

RuntimeEventClass

type RuntimeEventClass = new () => RuntimeEventRunnable;

The constructor type accepted by action.registerRuntimeEventClass() and action.fire().

Firing

await action.fire(UserCreatedRuntimeEvent, projectId, { userId: 42 });

See action.fire() for the full reference.

Decorators

DecoratorDescription
@IdentifierSets the unique runtime identifier
@NameSets the localised display name
@DescriptionSets a short localised description
@DocumentationSets long-form documentation text
@DisplayMessageSets the summary text shown in the flow UI
@AliasSets alternative search terms
@SignatureSets the TypeScript-like signature string
@DisplayIconSets the icon shown in the flow UI
@EditableControls editability in the platform UI
@EventSettingAdds a configurable setting
@OmitEventPrevents auto-generation of a public event definition

On this page