Member Junction
    Preparing search index...

    Class RunActionParams<TContext>

    Class that holds the parameters for an action to be run. This is passed to the Run method of an action.

    // Define a typed context
    interface MyActionContext {
    apiEndpoint: string;
    apiKey: string;
    environment: 'dev' | 'staging' | 'prod';
    }

    // Use with type safety
    const params = new RunActionParams<MyActionContext>();
    params.Action = myAction;
    params.ContextUser = currentUser;
    params.Context = {
    apiEndpoint: 'https://api.example.com',
    apiKey: process.env.API_KEY,
    environment: 'prod'
    };

    Type Parameters

    • TContext = any

      Type of the context object passed to the action execution. This allows for type-safe context propagation from agents to actions. Defaults to any for backward compatibility.

    Index

    Constructors

    • Type Parameters

      • TContext = any

        Type of the context object passed to the action execution. This allows for type-safe context propagation from agents to actions. Defaults to any for backward compatibility.

      Returns RunActionParams<TContext>

    Properties

    AbortSignal?: AbortSignal

    Optional AbortSignal that is aborted when the action exceeds its wall-clock time budget (set via Action.MaxExecutionTimeMS or the engine default). Set automatically by ActionEngine.RunAction() — callers should not populate it directly. Long-running action implementations should poll this signal (e.g. between batches, between retries, inside tight loops) and return early with ResultCode = 'TIMEOUT' when it fires, so the enforcement is cooperative rather than ending the Node process.

    The engine also records the timeout on AbortSignal.reason as a string describing which side (action vs engine default) supplied the budget, which makes timeout-origin debugging straightforward.

    The action entity to be run.

    Context?: TContext

    Optional context object that provides runtime-specific information to the action. This context is separate from the action parameters and is not stored in the database.

    Common use cases include:

    • Environment-specific configuration (API endpoints, service URLs)
    • Runtime credentials or authentication tokens
    • User preferences or session information
    • Feature flags or toggles
    • Request-specific correlation IDs

    The context flows from agents to actions, maintaining consistency throughout the execution hierarchy. Actions can use this context to adapt their behavior based on runtime conditions without modifying their core parameter structure.

    Note: Avoid including sensitive data like passwords unless absolutely necessary, as context may be passed through multiple execution layers.

    ContextUser: UserInfo

    The user context for the action.

    Optional, a list of filters that should be run before the action is executed.

    Params: ActionParam[]

    Optional, the input and output parameters as defined in the metadata for the action.

    Optional metadata provider to use for entity lookups and data access during this action run.

    Why this matters for transaction isolation in multi-provider scenarios: MemberJunction supports running multiple providers in the same process (e.g., a transaction-scoped provider for a unit-of-work, alongside the default global provider). When an action runs inside a transaction, it MUST use the same provider that owns the transaction so that all reads/writes happen on the same connection and participate in the same transaction.

    If Provider is not supplied, action implementations fall back to the default global provider via new Metadata(). This preserves backward compatibility for single-provider deployments and for existing callers that don't yet thread a provider through.

    Action implementations should use the pattern:

    const md = params.Provider ?? new Metadata();
    

    to honor the caller's provider when supplied while remaining backward compatible.

    SkipActionLog?: boolean

    Optional, if true, an MJActionExecutionLogEntity will not be created for this action run.