Open
Description
Summary of the new feature / enhancement
When fetching Nuget v3 info, only pages that contain the requested version should be fetched. All version info is present on the Registration Index by virtue of the upper and lower markers. For example:
https://pwsh.gallery/invokebuild/index.json
{
"@id": "https://pwsh.gallery/invokebuild/index.json",
"count": 3,
"items": [
{
"@id": "https://pwsh.gallery/invokebuild/index.json#page/latest",
"lower": "5.10.4",
"upper": "5.10.4",
"count": 1,
"items": [
{
"@id": "https://pwsh.gallery/invokebuild/5.10.4.json",
"catalogEntry": {
"@id": "https://pwsh.gallery/invokebuild/5.10.4.json#catalogEntry",
"id": "InvokeBuild",
"version": "5.10.4",
"tags": [],
"dependencyGroups": []
},
"packageContent": "https://www.powershellgallery.com/api/v2/package/InvokeBuild/5.10.4"
}
]
},
{
"@id": "https://pwsh.gallery/invokebuild/page/other.json",
"lower": "3.2.0",
"upper": "5.10.3",
"count": 99
},
{
"@id": "https://pwsh.gallery/invokebuild/page/older.json",
"lower": "0.0.0",
"upper": "3.2.0",
"count": 0
}
]
}
In this case, the latest version is inlined, so no additional page queries should be made. If version 3.2.1 is requested, then only other.json
should be requested and not older.json
. Currently PSResourceGet inefficiently fetches all pages, which in this example is simple, but in other v3 repositories could be hundreds of calls.
As an example, with pwsh.gallery:
DEBUG: Request url is 'https://pwsh.gallery/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pwsh.gallery/invokebuild/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromIdLinkElement()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pwsh.gallery/invokebuild/page/other.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementFromIdLinkElement()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pwsh.gallery/invokebuild/page/older.json'
Proposed technical implementation details (optional)
No response