Hidden Packages in Powershell Gallery Proxy Repo Breaking Search (Internalizing proxy packages and delisting them)

We are in the process of migrating Our internal powershell repository (nuget based) from Inedo Proget Free over to nexus oss.
We had our proget repo setup with a ‘connector’ (what proget calls proxy repos basically) to microsoft’s Powershell Gallery aka PSGallery which is a nuget v2 repository. Everything worked as expected for normal operations

We got the equivalent proxy repo and made a group repo with our internal repo. For most things it works the same except for one key and very specific issue.

In case you don’t know, Powershell accesses nuget based repositories to install packages (i.e. modules and scripts) using Microsoft’s PackageManagement and PowershellGet Our workflows (and that’s a pretty commonplace dependency for companies using powershell) rely on using these latest stable versions

They are developing powershellget 3 which is a full rewrite and uses nuget more directly, but it’s still in beta and has been for 3 years. Technically the problem I’m about to describe doesn’t happen in powershellget 3.0.19-beta19 but moving all our internal powershell package management to using a beta client isn’t a solution that we’re happy with nor is it in scope of moving to nexus. But I figure it’s worth noting.

So anyway, Microsoft went and released a powershellget 2.2.5.1 and then they “hid it” from the gallery PowerShell Gallery | PowerShellGet 2.2.5.1

Since this is a hidden/delisted package but also the latest stable version it causes weirdness with powershellget 2/package management.
i.e
if I register my nexus group repository in powershell with the name ‘ps-prod’ and then search for powershellget, I get this

Find-Module -Repository ps-prod -Name PowerShellGet
Find-Package: No match was found for the specified search criteria and module name 'PowerShellGet'. Try Get-PSRepository to see all
available registered module repositories.

If I search for all modules in the repo and filter to where name equals powershellget it comes up in the list with the de-listed version

find-module -Repository ps-prod | ? name -eq "PowershellGet"

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
2.2.5.1              PowerShellGet                       ps-prod          PowerShell module with commands for disc…

I can also search for a specific version, and it finds it correctly, but adding the required version every time makes checking for updates a bit of a pain especially since using the above method can return a result of an unlisted package that wouldn’t be found when you specify the version (i.e. if I put in 2.2.5.1 in -requiredversion I get no results)

find-module -name powershellget -requiredversion '2.2.5' -repository ps-prod
Version              Name                                Repository           Description
-------              ----                                ----------           -----------
2.2.5                PowerShellGet                       ArrowPS-new          PowerShell module with commands for disc…

In proget there was an option to ‘pull to proget’ which internalized/cached the package implicitly and I could then de-list the package at my local nuget repo and then the search for the latest version worked as expected. I haven’t found how to do that in necus and could use some help.

Is there any built in way or best practice to handle these situations? I did find this article related to npm repos Removing Non-Cataloged Package Versions for Proxied Repositories (sonatype.com) but I didn’t find an equivalent for nuget repos in the docs.

Thanks!