Constructor
new MetaChangeApplier(program)
Create a new MetaChangeApplier instance.
Parameters:
| Name | Type | Description |
|---|---|---|
program |
Program | The Program instance to modify in-place |
- Source:
Methods
upsertMetadata(updateArray) → {Program}
Insert or update substances from metadata update array into the program.
This method processes an array of SubstanceMetadataUpdate objects, ensures
required applications exist, and either updates existing substances or
creates new ones based on the oldName field. If oldName matches an existing
substance, it will be updated; otherwise a new substance is created.
All metadata is validated before any changes are applied to prevent partial updates.
Parameters:
| Name | Type | Description |
|---|---|---|
updateArray |
Array.<SubstanceMetadataUpdate> | Array of metadata update objects |
- Source:
Throws:
-
-
If validation fails for any metadata
- Type
- ValidationError
-
-
-
If input is invalid
- Type
- Error
-
Returns:
The modified program instance (for chaining)
- Type
- Program