Result object for postretrieve and postsourceupdate plugin hooks doesn't support different metadata types with the same API name
Summary
The result object for postretrieve and postsourceupdate plugin hooks doesn't support different metadata types with the same API name. For example, a class called Account and the standard Account object will both have an aggregateName of Account and therefore only a single entry in the result. This will happen in numerous scenarios.
I'd suggest either making the aggregateName unique by including the metadata type (e.g. ApexClass:Account, CustomObject:Account) or returning an array instead of an object.
Steps To Reproduce:
Repository to reproduce:
- Create an Apex class with name Account
- Retrieve metadata for Account class and Account object (sfdx force:source:retrieve -m ApexClass:Account,CustomObject:Account)
Expected result
There should be an entry in the hook result for both pieces of metadata.
Actual result
There is only one entry in the hook result for either the class or the object.
Additional information
SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.78.1-5a65d9dd2f darwin-x64 node-v12.18.3
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core) @oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.2.0 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.1 (core) @oclif/plugin-update 1.3.10 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.4.3 (core) alias 1.1.2 (core) analytics 1.12.1 (core) auth 1.3.0 (core) config 1.1.10 (core) generator 1.1.3 (core) plugin-metadata-hook-demo 48.8.0 (link) xxx salesforcedx 50.3.1 (core) ├─ apex 0.1.2 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) ├─ custom-metadata 1.0.10 (core) ├─ salesforce-alm 50.3.1 (core) └─ templates 50.1.0 (core) sfdx-cli 7.78.1 (core)
OS and version: Mac OSX 10.15.6