@memberjunction/generated-actions
CodeGen-produced action subclasses for MemberJunction. Contains auto-generated TypeScript classes that implement database-defined actions with @RegisterClass decorators for automatic discovery and execution.
Overview
Section titled “Overview”This package is entirely generated by MemberJunction CodeGen and should never be manually edited. It contains a BaseAction subclass for every action defined in the MemberJunction database, each decorated with @RegisterClass so the MemberJunction action system can discover and execute them.
graph TD
A["CodeGen"] -->|generates| B["action_subclasses.ts"]
B --> C["Action Class A<br/>@RegisterClass"]
B --> D["Action Class B<br/>@RegisterClass"]
B --> E["Action Class N<br/>@RegisterClass"]
F["ActionEngineServer.RunAction()"] -->|class factory| C
F -->|class factory| D
F -->|class factory| E
C --> G["RunParams<br/>(Input Parameters)"]
C --> H["ActionResultSimple<br/>(Output)"]
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
style B fill:#7c5295,stroke:#563a6b,color:#fff
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
style D fill:#2d8659,stroke:#1a5c3a,color:#fff
style E fill:#2d8659,stroke:#1a5c3a,color:#fff
style F fill:#b8762f,stroke:#8a5722,color:#fff
style G fill:#7c5295,stroke:#563a6b,color:#fff
style H fill:#7c5295,stroke:#563a6b,color:#fff
Installation
Section titled “Installation”npm install @memberjunction/generated-actionsWhat Gets Generated
Section titled “What Gets Generated”For each action defined in the database, CodeGen produces:
- TypeScript class extending
BaseActionwith@RegisterClassdecorator InternalRunAction()method implementing the action’s database-defined logic- Parameter extraction from
RunActionParamswith proper typing - Child action invocation for actions composed of sub-actions
- Result objects using
ActionResultSimplewith success/failure semantics
Important Notes
Section titled “Important Notes”- Do not manually edit — All code is regenerated by CodeGen and manual changes will be overwritten
- Import for side effects — Simply importing this package triggers all
@RegisterClassdecorators - Server-side only — Actions execute on the server within
ActionEngineServer - For custom action implementations, create them in separate packages (e.g.,
@memberjunction/core-actions)
How It Works
Section titled “How It Works”When this package is imported, each action class’s @RegisterClass(BaseAction, 'Action Name') decorator registers the class with MemberJunction’s class factory. When code later calls ActionEngineServer.RunAction(), the factory locates the appropriate subclass and invokes its InternalRunAction() method.
Dependencies
Section titled “Dependencies”| Package | Purpose |
|---|---|
@memberjunction/core | Metadata, RunView, RunQuery |
@memberjunction/global | RegisterClass decorator, MJGlobal |
@memberjunction/actions-base | ActionResultSimple, RunActionParams, ActionParam |
@memberjunction/actions | BaseAction, ActionEngineServer |
License
Section titled “License”ISC