Allow NPM package versions to have the form {id}#{url} for direct acc… (#1258)
* Allow NPM package versions to have the form {id}#{url} for direct access to packages * fix case issue --------- Co-authored-by: Grahame Grieve <grahameg@gmail.ccom>
This commit is contained in:
parent
3da96f8c02
commit
5242d7c9fa
|
@ -6,6 +6,7 @@
|
|||
* Slight improvement in performance
|
||||
* Fix FHIRPath split function (parameter is not regex)
|
||||
* Stop warning that Markdown autolinks need to be escaped
|
||||
* Allow NPM package versions to have the form {id}#{url} for direct access to packages
|
||||
|
||||
## Other code changes
|
||||
|
||||
|
|
|
@ -262,7 +262,6 @@ public class MarkDownProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static String makeMarkdownForString(String content) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (int i = 0; i < content.length(); i++) {
|
||||
|
|
|
@ -402,11 +402,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
@Override
|
||||
public NpmPackage addPackageToCache(String id, String version, InputStream packageTgzInputStream, String sourceDesc) throws IOException {
|
||||
checkValidVersionString(version, id);
|
||||
if (progress) {
|
||||
log("Installing " + id + "#" + (version == null ? "?" : version) + " to the package cache");
|
||||
log(" Fetching:");
|
||||
}
|
||||
|
||||
|
||||
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream, sourceDesc, true);
|
||||
|
||||
if (progress) {
|
||||
|
@ -414,8 +410,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
logn(" Installing: ");
|
||||
}
|
||||
|
||||
if (!suppressErrors && npm.name() == null || id == null || !id.equalsIgnoreCase(npm.name())) {
|
||||
if (!id.equals("hl7.fhir.r5.core") && !id.equals("hl7.fhir.us.immds")) {// temporary work around
|
||||
if ((npm.name() != null && id != null && !id.equalsIgnoreCase(npm.name()))) {
|
||||
if (!suppressErrors && (!id.equals("hl7.fhir.r5.core") && !id.equals("hl7.fhir.us.immds"))) {// temporary work around
|
||||
throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name());
|
||||
}
|
||||
}
|
||||
|
@ -569,10 +565,17 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
version = "current";
|
||||
}
|
||||
|
||||
if (progress) {
|
||||
log("Installing " + id + "#" + (version == null ? "?" : version) + " to the package cache");
|
||||
log(" Fetching:");
|
||||
}
|
||||
|
||||
// nup, don't have it locally (or it's expired)
|
||||
FilesystemPackageCacheManager.InputStreamWithSrc source;
|
||||
if (false && packageProvider != null && packageProvider.handlesPackage(id, version)) {
|
||||
source = packageProvider.provide(id, version);
|
||||
} else if (Utilities.isAbsoluteUrl(version)) {
|
||||
source = fetchSourceFromUrlSpecific(version);
|
||||
} else if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
|
||||
// special case - fetch from ci-build server
|
||||
source = loadFromCIBuild(id, version.startsWith("current$") ? version.substring(8) : null);
|
||||
|
@ -585,6 +588,10 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
return addPackageToCache(id, source.version, source.stream, source.url);
|
||||
}
|
||||
|
||||
private InputStreamWithSrc fetchSourceFromUrlSpecific(String url) {
|
||||
return new InputStreamWithSrc(fetchFromUrlSpecific(url, false), url, "current");
|
||||
}
|
||||
|
||||
private InputStream fetchFromUrlSpecific(String source, boolean optional) throws FHIRException {
|
||||
try {
|
||||
SimpleHTTPClient http = new SimpleHTTPClient();
|
||||
|
|
Loading…
Reference in New Issue