TemplateExpander.expandTemplate() method
Expands a template into multiple instances based on matrix parameters.
Signature
expandTemplate(input: {
templateName: string;
matrix: JsonTemplateMatrix;
templateContent: TTemplate;
templateType: string;
instanceFactory: InstanceFactoryCallback<TTemplate, TInstance>;
}): Promise<Map<string, TInstance>>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
{ templateName, matrix, templateContent, templateType, instanceFactory, } |
(not declared) | |
|
input |
{ templateName: string; matrix: JsonTemplateMatrix; templateContent: TTemplate; templateType: string; instanceFactory: InstanceFactoryCallback<TTemplate, TInstance>; } |
Returns
Promise<Map<string, TInstance>>
A promise that resolves to a map of expanded names to their corresponding instances.
Exceptions
ConfigurationError If the matrix structure is invalid, template name substitution fails, or the factory callback throws an error.
Remarks
This method orchestrates the template expansion process by validating the matrix, generating all parameter combinations, expanding the template name for each combination, and creating instances via the factory callback.
Processing steps:
- Processes the matrix to extract and validate parameter keys and values.
- Generates all combinations using the Cartesian product.
- For each combination:
- Performs Liquid substitution on the template name with matrix parameters.
- Invokes the factory callback to create an instance.
- Stores the instance in the result map.
The factory callback is responsible for creating the appropriate instance type and associating it with the expanded name and matrix parameters.
Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.