|
|
|
@ -118,7 +118,7 @@ namespace isnd.Services
|
|
|
|
|
Type = "RegistrationsBaseUrl/3.6.0",
|
|
|
|
|
Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -184,9 +184,9 @@ namespace isnd.Services
|
|
|
|
|
var oldIndex = CurrentCatalogIndex;
|
|
|
|
|
var oldPages = CurrentCatalogPages;
|
|
|
|
|
string baseid = extUrl + ApiConfig.Catalog;
|
|
|
|
|
string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}/";
|
|
|
|
|
string bidreg = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
|
|
|
|
|
string basepageid = extUrl + ApiConfig.CatalogPage;
|
|
|
|
|
CurrentCatalogIndex = new RegistrationPageIndex(baseid);
|
|
|
|
|
CurrentCatalogIndex = new RegistrationPageIndex(baseid,"index");
|
|
|
|
|
CurrentCatalogPages = new List<RegistrationPage>();
|
|
|
|
|
|
|
|
|
|
var scope = dbContext.Commits.OrderBy(c => c.TimeStamp);
|
|
|
|
@ -197,14 +197,14 @@ namespace isnd.Services
|
|
|
|
|
{
|
|
|
|
|
if (i >= this.isndSettings.CatalogPageLen)
|
|
|
|
|
{
|
|
|
|
|
page = new RegistrationPage(basepageid + "-" + p++)
|
|
|
|
|
page = new RegistrationPage(basepageid, extUrl)
|
|
|
|
|
{
|
|
|
|
|
Parent = baseid,
|
|
|
|
|
CommitId = commit.CommitId,
|
|
|
|
|
CommitTimeStamp = commit.CommitTimeStamp
|
|
|
|
|
};
|
|
|
|
|
CurrentCatalogPages.Add(page);
|
|
|
|
|
var pageRef = new RegistrationPage(page.Id)
|
|
|
|
|
var pageRef = new RegistrationPage(page.Id, extUrl)
|
|
|
|
|
{
|
|
|
|
|
CommitId = commit.CommitId,
|
|
|
|
|
CommitTimeStamp = commit.CommitTimeStamp
|
|
|
|
@ -218,27 +218,27 @@ namespace isnd.Services
|
|
|
|
|
.Include(pkg => pkg.LatestVersion)
|
|
|
|
|
.Where(
|
|
|
|
|
pkg => pkg.Versions.Count(v => v.CommitId == commit.CommitId) > 0
|
|
|
|
|
).GroupBy((q)=> q.Id);
|
|
|
|
|
).GroupBy((q) => q.Id);
|
|
|
|
|
// pkg.Versions.OrderByDescending(vi => vi.CommitNId).First().FullString
|
|
|
|
|
foreach (var pkgid in validPkgs)
|
|
|
|
|
{
|
|
|
|
|
StringBuilder refid = new StringBuilder(bidreg);
|
|
|
|
|
refid.AppendFormat("{0}/",
|
|
|
|
|
pkgid.Key);
|
|
|
|
|
/* var pkgref = new PackageRef
|
|
|
|
|
{
|
|
|
|
|
Version = v.FullString,
|
|
|
|
|
LastCommit = v.LatestCommit,
|
|
|
|
|
CommitId = v.LatestCommit.CommitId,
|
|
|
|
|
CommitTimeStamp = v.LatestCommit.CommitTimeStamp,
|
|
|
|
|
RefId = refid.ToString(),
|
|
|
|
|
Id = v.PackageId,
|
|
|
|
|
RefType = v.LatestCommit.Action == PackageAction.PublishPackage
|
|
|
|
|
? "nuget:PackageDetails" :
|
|
|
|
|
"nuget:PackageDelete"
|
|
|
|
|
}; */
|
|
|
|
|
foreach (var pkgv in pkgid)
|
|
|
|
|
page.Items.Add(pkgv.ToLeave(bidreg));
|
|
|
|
|
/* var pkgref = new PackageRef
|
|
|
|
|
{
|
|
|
|
|
Version = v.FullString,
|
|
|
|
|
LastCommit = v.LatestCommit,
|
|
|
|
|
CommitId = v.LatestCommit.CommitId,
|
|
|
|
|
CommitTimeStamp = v.LatestCommit.CommitTimeStamp,
|
|
|
|
|
RefId = refid.ToString(),
|
|
|
|
|
Id = v.PackageId,
|
|
|
|
|
RefType = v.LatestCommit.Action == PackageAction.PublishPackage
|
|
|
|
|
? "nuget:PackageDetails" :
|
|
|
|
|
"nuget:PackageDelete"
|
|
|
|
|
}; */
|
|
|
|
|
foreach (var pkgv in pkgid)
|
|
|
|
|
page.AddVersionRange(pkgv.Versions);
|
|
|
|
|
}
|
|
|
|
|
reason = commit;
|
|
|
|
|
i++;
|
|
|
|
@ -293,8 +293,8 @@ namespace isnd.Services
|
|
|
|
|
return dbContext.PackageVersions
|
|
|
|
|
.Include(v => v.Package)
|
|
|
|
|
.Include(v => v.LatestCommit)
|
|
|
|
|
.Where(v => v.PackageId == pkgId
|
|
|
|
|
&& (semver == null ||
|
|
|
|
|
.Where(v => v.PackageId == pkgId
|
|
|
|
|
&& (semver == null ||
|
|
|
|
|
semver.StartsWith(v.SementicVersionString))
|
|
|
|
|
&& (pkgType == null || pkgType == v.Type));
|
|
|
|
|
}
|
|
|
|
@ -312,13 +312,16 @@ namespace isnd.Services
|
|
|
|
|
|
|
|
|
|
public IEnumerable<Data.Catalog.RegistrationLeaf> SearchById(string pkgId, string semver, string pkgType)
|
|
|
|
|
{
|
|
|
|
|
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}/";
|
|
|
|
|
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
|
|
|
|
|
return dbContext.PackageVersions
|
|
|
|
|
.Include(v => v.Package)
|
|
|
|
|
.Include(v => v.Package.Owner)
|
|
|
|
|
.Include(v => v.LatestCommit)
|
|
|
|
|
.Where(v => v.PackageId == pkgId && semver.StartsWith(v.SementicVersionString)
|
|
|
|
|
&& (pkgType == null || pkgType == v.Type)).Select(p => p.Package.ToLeave(bid));
|
|
|
|
|
.Where(v => v.PackageId == pkgId && semver.Equals(v.FullString, StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
&& (pkgType == null || pkgType == v.Type))
|
|
|
|
|
.OrderByDescending(p=> p.CommitId)
|
|
|
|
|
.Select(p => p.Package.ToLeave(bid))
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
public PackageVersion GetPackage(string pkgId, string semver, string pkgType)
|
|
|
|
|
{
|
|
|
|
@ -329,24 +332,18 @@ namespace isnd.Services
|
|
|
|
|
&& (pkgType == null || pkgType == v.Type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public RegistrationPageIndexQuery GetPackageRegistrationIndex(RegistrationPageIndexQuery query)
|
|
|
|
|
public RegistrationPageIndex GetPackageRegistrationIndex(RegistrationPageIndexQuery query)
|
|
|
|
|
{
|
|
|
|
|
// RegistrationPageIndexAndQuery
|
|
|
|
|
var scope = dbContext.Packages
|
|
|
|
|
.Include(p => p.Versions)
|
|
|
|
|
.Include(p => p.Owner)
|
|
|
|
|
.Where(
|
|
|
|
|
p => (PackageIdHelpers.CamelCaseMatch(p.Id, query.Query)
|
|
|
|
|
|| PackageIdHelpers.SeparatedByMinusMatch(p.Id, query.Query))
|
|
|
|
|
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease))
|
|
|
|
|
);
|
|
|
|
|
var scope = dbContext.Packages.Include(p => p.Versions).Include(p => p.Owner)
|
|
|
|
|
.Where(p => (PackageIdHelpers.CamelCaseMatch(p.Id, query.Query)
|
|
|
|
|
|| PackageIdHelpers.SeparatedByMinusMatch(p.Id, query.Query))
|
|
|
|
|
&& (query.Prerelease || p.Versions.Any(v => !v.IsPrerelease)));
|
|
|
|
|
var total = scope.Count();
|
|
|
|
|
var pkgs = scope.Skip(query.Skip).Take(query.Take).ToArray();
|
|
|
|
|
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}/";
|
|
|
|
|
var leaves = pkgs.Select(p => p.ToLeave(bid));
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
new RegistrationPageIndexQuery(bid, leaves);
|
|
|
|
|
string bid = $"{extUrl}v3.4.0/{ApiConfig.Registration}";
|
|
|
|
|
return
|
|
|
|
|
new RegistrationPageIndex(bid, query.Query, extUrl, pkgs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|