Release !

main 1.1.0
Paul Schneider 1 year ago
parent 7987fa04a0
commit 72839e8251
14 changed files with 42 additions and 72 deletions

27
.vscode/tasks.json vendored

@ -11,7 +11,8 @@
"/consoleloggerparameters:NoSummary", "/consoleloggerparameters:NoSummary",
"--ignore-failed-sources" "--ignore-failed-sources"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile",
"group": "build"
}, },
{ {
"label": "build", "label": "build",
@ -23,7 +24,8 @@
"/property:GenerateFullPaths=true", "/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary" "/consoleloggerparameters:NoSummary"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile",
"group": "build"
}, },
{ {
"label": "db-upgrade", "label": "db-upgrade",
@ -40,9 +42,9 @@
"env": { "env": {
"ASPNETCORE_ENV": "Development" "ASPNETCORE_ENV": "Development"
} }
} },
"dependsOn":["build"],
"group": "test"
}, },
{ {
@ -56,7 +58,8 @@
"/consoleloggerparameters:NoSummary", "/consoleloggerparameters:NoSummary",
"/restore" "/restore"
], ],
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile",
"group": "build"
}, },
{ {
"label": "publish", "label": "publish",
@ -73,7 +76,8 @@
"problemMatcher": "$msCompile", "problemMatcher": "$msCompile",
"options": { "options": {
"cwd": "${workspaceFolder}" "cwd": "${workspaceFolder}"
} },
"group": "none"
}, },
{ {
"label": "monopublish", "label": "monopublish",
@ -90,7 +94,8 @@
"label": "copyTestConfig", "label": "copyTestConfig",
"command": "dotnet", "command": "dotnet",
"type": "process", "type": "process",
"args": [ "build", "/t:CopyTestConfig" ] "args": [ "build", "/t:CopyTestConfig" ],
"group": "test"
}, },
{ {
"label": "test", "label": "test",
@ -107,7 +112,8 @@
"--logger:xunit" "--logger:xunit"
], ],
"problemMatcher": "$msCompile", "problemMatcher": "$msCompile",
"dependsOn": [ "build", "copyTestConfig"] "dependsOn": [ "build", "copyTestConfig"],
"group": "test"
}, },
{ {
"label": "watch", "label": "watch",
@ -123,7 +129,8 @@
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
}, },
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile",
"group": "test"
} }
] ]
} }

@ -4,6 +4,7 @@ namespace isnd.Entities
{ {
public static class ApiConfig public static class ApiConfig
{ {
public const string Index = "/index.json";
public const string Catalog = "/catalog"; public const string Catalog = "/catalog";
public const string Package = "/package"; public const string Package = "/package";
public const string Search = "/search"; public const string Search = "/search";
@ -11,6 +12,7 @@ namespace isnd.Entities
public const string Registration = "/registration"; public const string Registration = "/registration";
public const string Nuspec = "/nuspec"; public const string Nuspec = "/nuspec";
public const string Content = "/content";
public const string Nuget = "/nuget"; public const string Nuget = "/nuget";
public const string Find = "/index/FindPackagesById()"; // /FindPackagesById()?id='isn.abst'&semVerLevel=2.0.0 public const string Find = "/index/FindPackagesById()"; // /FindPackagesById()?id='isn.abst'&semVerLevel=2.0.0

@ -4,7 +4,7 @@ using isn.Abstract;
using isn.abst; using isn.abst;
using isnd.Interfaces; using isnd.Interfaces;
using System.Linq; using System.Linq;
using isnd.Entities;
namespace isnd.Controllers namespace isnd.Controllers
{ {
@ -30,7 +30,7 @@ namespace isnd.Controllers
/// API index /// API index
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("~" + Constants.ApiVersionPrefix + "/index")] [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Index)]
public IActionResult ApiIndex() public IActionResult ApiIndex()
{ {
return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl){ Version = PackageManager.BASE_API_LEVEL, Resources = resources }); return Ok(new ApiIndexViewModel(packageManager.CatalogBaseUrl){ Version = PackageManager.BASE_API_LEVEL, Resources = resources });

@ -13,6 +13,8 @@ namespace isnd.Controllers
// Web get the paquet // Web get the paquet
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}." [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.PaquetFileEstension)] + Constants.PaquetFileEstension)]
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}."
+ Constants.PaquetFileEstension)]
public IActionResult GetPackage( public IActionResult GetPackage(
[FromRoute][SafeName][Required] string id, [FromRoute][SafeName][Required] string id,
[FromRoute][SafeName][Required] string lower, [FromRoute][SafeName][Required] string lower,

@ -7,7 +7,7 @@ namespace isnd.Controllers
{ {
public partial class PackagesController public partial class PackagesController
{ {
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Find)]
public IActionResult GetVersions( public IActionResult GetVersions(
string id, string id,
string lower, string lower,

@ -1,44 +0,0 @@
using System.Linq;
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using isnd.Entities;
using isn.abst;
using isnd.Data.Catalog;
namespace isnd.Controllers
{
public partial class PackagesController
{
// GET {@id}?q={QUERY}&skip={SKIP}&take={TAKE}&prerelease={PRERELEASE}&semVerLevel={SEMVERLEVEL}&packageType={PACKAGETYPE}
[HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Find)]
[HttpPost("~" + Constants.ApiVersionPrefix + ApiConfig.Find)]
public async Task<IActionResult> Search(
string id,
bool prerelease = false,
// string packageType = null,
string semVerLevel = null,
int skip = 0,
int take = 25
)
{
id = id.Trim('\'');
if (semVerLevel == "2.0.0") prerelease = true;
//packageManager.SearchCatalogEntriesById(id, semVerLevel, packageType, prerelease);
var regs = await packageManager.SearchPackageAsync(
new PackageRegistrationQuery
{
Query = id,
Prerelease = prerelease,
Take = take,
Skip = skip
}
);
return Ok(new { totalHits = regs.Count(), data = regs });
}
}
}

@ -56,7 +56,7 @@ namespace isnd.Data.Catalog
/// The dependencies of the package, grouped by target framework /// The dependencies of the package, grouped by target framework
/// </summary> /// </summary>
/// <value>array of objects</value> /// <value>array of objects</value>
public DependencyGroup[] dependencyGroups { get; set; } public DependencyGroup[] dependencyGroups { get; set; } = Array.Empty<DependencyGroup>();
/// <summary> /// <summary>
/// The deprecation associated with the package /// The deprecation associated with the package
@ -128,6 +128,7 @@ namespace isnd.Data.Catalog
public string PackageId { get; set; } public string PackageId { get; set; }
public IEnumerable<PackageDependencyGroup> DependencySets { get; set; } public IEnumerable<PackageDependencyGroup> DependencySets { get; set; }
= Array.Empty<PackageDependencyGroup>();
public long? DownloadCount { get; set; } public long? DownloadCount { get; set; }

@ -47,12 +47,12 @@ namespace isnd.Services
Comment = "URI template used by NuGet Client to construct details URL for packages" Comment = "URI template used by NuGet Client to construct details URL for packages"
}, },
new Resource(apiBase + ApiConfig.Nuget, new Resource(apiBase + ApiConfig.Content,
"PackageBaseAddress/3.0.0") "PackageBaseAddress/3.0.0")
{ {
Comment = "Package Base Address service - " + Comment = "Package Base Address service - " +
"Base URL of where NuGet packages are stored, in the format " + "Base URL of where NuGet packages are stored, in the format "
"https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg" // "https://<host>/nupkg/{id-lower}/{version-lower}/{id-lower}.{version-lower}.nupkg"
}, },
new Resource(apiBase + ApiConfig.AutoComplete, new Resource(apiBase + ApiConfig.AutoComplete,
@ -67,6 +67,7 @@ namespace isnd.Services
Comment = "Search Query service" Comment = "Search Query service"
}, },
new Resource(apiBase + ApiConfig.Registration, new Resource(apiBase + ApiConfig.Registration,
"RegistrationsBaseUrl/Versioned") "RegistrationsBaseUrl/Versioned")
{ {
@ -100,7 +101,7 @@ namespace isnd.Services
public string[] GetVersions( public string[] GetVersions(
string id, string id,
NuGetVersion parsedVersion, NuGetVersion parsedVersion = null,
bool prerelease = false, bool prerelease = false,
string packageType = null, string packageType = null,
int skip = 0, int skip = 0,
@ -110,7 +111,7 @@ namespace isnd.Services
v => v.PackageId == id v => v.PackageId == id
&& (prerelease || !v.IsPrerelease) && (prerelease || !v.IsPrerelease)
&& (packageType == null || v.Type == packageType) && (packageType == null || v.Type == packageType)
&& (parsedVersion.CompareTo && (parsedVersion==null || parsedVersion.CompareTo
(new SemanticVersion(v.Major, v.Minor, v.Patch)) < 0) (new SemanticVersion(v.Major, v.Minor, v.Patch)) < 0)
) )
.OrderBy(v => v.NugetVersion) .OrderBy(v => v.NugetVersion)
@ -287,6 +288,7 @@ namespace isnd.Services
.Include(p => p.LatestCommit) .Include(p => p.LatestCommit)
.Where(p => p.Id.StartsWith(query.Query) .Where(p => p.Id.StartsWith(query.Query)
&& (query.Prerelease || p.Versions.Any(p => !p.IsPrerelease))) && (query.Prerelease || p.Versions.Any(p => !p.IsPrerelease)))
.OrderBy(p => p.CommitNId)
.Skip(query.Skip).Take(query.Take) .Skip(query.Skip).Take(query.Take)
.ToListAsync() .ToListAsync()
); );

@ -93,7 +93,8 @@ namespace isnd
.AddNewtonsoftJson(s => .AddNewtonsoftJson(s =>
{ {
s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver(); s.SerializerSettings.ReferenceResolverProvider = () => new NSJWebApiReferenceResolver();
}); })
.AddXmlSerializerFormatters();
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo

@ -8,9 +8,4 @@
<p> <p>
<strong>@Model.PkgCount identifiant(s) de paquet dans le SI</strong> <strong>@Model.PkgCount identifiant(s) de paquet dans le SI</strong>
</p> </p>
</div>
<div style="text-align: center;">
<iframe width="560" height="315" src="https://crowdbunker.com/embed/i5PhucYQhBw" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
<iframe width="560" height="315" src="https://crowdbunker.com/embed/BumpeEansBp" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
<iframe width="560" height="315" src="https://crowdbunker.com/embed/admChkeiYFP" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen scrolling="no" ></iframe>
</div> </div>

@ -3,6 +3,6 @@
<apikeys> <apikeys>
</apikeys> </apikeys>
<packageSources> <packageSources>
<add key="dev" value="http://localhost:5000/v3/index" protocolVersion="3" /> <add key="dev" value="http://localhost:5000/v3/index.json" protocolVersion="3" />
</packageSources> </packageSources>
</configuration> </configuration>

@ -10,4 +10,7 @@
<InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion> <InformationalVersion>1.0.7+Branch.main.Sha.3695c1742965d93eba0ad851656cfaa3e44ba327</InformationalVersion>
<Version>1.0.7</Version> <Version>1.0.7</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="isn.abst" Version="1.0.1" />
</ItemGroup>
</Project> </Project>

@ -54,7 +54,7 @@ namespace isn.tests
[Fact] [Fact]
public void GetServerResourcesUsingHttpClientAsyncTest() public void GetServerResourcesUsingHttpClientAsyncTest()
{ {
var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/index.json"); var model = SourceHelpers.GetServerResources("Https://isn.pschneider.fr/v3/index");
Console.WriteLine(JsonConvert.SerializeObject(model)); Console.WriteLine(JsonConvert.SerializeObject(model));
Assert.NotNull(model.Resources); Assert.NotNull(model.Resources);
var pub = model.Resources.FirstOrDefault((r) => r.Type.StartsWith("PackagePublish/")); var pub = model.Resources.FirstOrDefault((r) => r.Type.StartsWith("PackagePublish/"));

@ -10,12 +10,13 @@
<Version>1.0.7</Version> <Version>1.0.7</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="XunitXml.TestLogger" Version="3.0.70" />
<PackageReference Include="xunit" Version="2.4.2" /> <PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" /> <PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.2" /> <PackageReference Include="xunit.runner.reporters" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.2" />
<PackageToolReference Include="xunit.runner.console" Version="2.4.2" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\isnd\isnd.csproj" /> <ProjectReference Include="..\..\src\isnd\isnd.csproj" />

Loading…