Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves MappingOps functions by fixing bugs, improving code, and adding tests.
The changes here are necessary for the PR in frodo-cli that adds the new mapping command.
One thing to note is that this PR adds a sorting function for sorting mappings in the readMappings function according to sync order. This is good for the list and rename sub-commands in the CLI where ordering mappings by sync order would be a nice feature to have. There is an endpoint that is supposed to return all mappings in correct sync order which should be used instead when reading mappings, but I found that it doesn't always work as described in the documentation. In short, I found that not all mappings are always returned from the endpoint, and when I have successfully pulled all mappings from the endpoint, I found that the legacy mappings were ordered after the regular mappings instead of before as it should be according to the documentation. It's possible that the endpoint may not work as intended due to how I am creating/importing the regular mappings, but I'm not certain. In my experience, I haven't found a way to get the endpoint to work consistently, but if we can find a way to get it to work then we should probably use it instead.