Skip to main content

Actions class

A collection of xpm actions for a build configuration or the entire package.

Signature

export declare class Actions

Remarks

This class manages a collection of named actions, each containing one or more commands to be executed. Actions can belong to a package or a build configuration and support template-based definitions with matrix expansion to generate multiple actions from a single template.

The collection always exists, even as empty if no actions are defined.

Action lifecycle phases:

  1. Construction: Basic setup with optional inheritance from parent package.
  2. Initialisation: Template name expansion without content evaluation.
  3. Retrieval: On-demand instantiation when accessed via get().
  4. Action Initialisation: Liquid template evaluation and substitution.

This multi-phase approach ensures efficient resource usage by deferring expensive operations until actions are actually needed.

Constructors

Constructor

Modifiers

Description

(constructor)({ engine, substitutionsVariables, jsonActions, inheritedActionsMap, buildConfiguration, log, }, input)

Constructs an actions collection instance.

Properties

Property

Modifiers

Type

Description

_actionsMap

protected

readonly

Map<string, Action | undefined>

Map of action names to their corresponding action instances.

_isInitialised

protected

boolean

Flag indicating whether the actions collection has been initialised.

_jsonActionsNamesMap

protected

readonly

Map<string, string>

Map of expanded action names to their original JSON action names.

_names

protected

string[]

Cached array of all action names in the collection.

_namesSet

protected

readonly

Set<string>

Set of all action names for quick lookup.

buildConfiguration

readonly

BuildConfiguration | undefined

The build configuration this actions collection belongs to, if any.

engine

readonly

LiquidEngine

The Liquid templating engine for variable substitution.

isEmpty

readonly

boolean

Indicates whether the actions collection is empty.

jsonActions

readonly

JsonActions

The JSON object containing action definitions from the package manifest.

log

readonly

Logger

The logger instance for output and diagnostics.

names

readonly

string[]

The names of all actions in the collection.

size

readonly

number

The number of actions in the collection.

substitutionsVariables

readonly

LiquidSubstitutionsVariables

The variables available for substitution in action definitions.

Methods

Method

Modifiers

Description

_expandTemplateActions({ actionName, jsonActionTemplate, }, input)

protected

Expands a template action into multiple concrete actions.

_processTemplate({ actionName, jsonActionTemplate, }, input)

protected

Processes a template action by expanding it and registering the generated actions.

get(actionName)

Retrieves an action by name, creating it if not yet instantiated.

has(actionName)

Checks whether an action with the specified name exists.

initialise()

Completes the async initialisation of the actions collection.


Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.