class NpmPublishParser extends ComponentSupport {

  public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException {
    try {
      NestedAttributesMap packageRoot = parsePackageRoot();

      if(currentUserId != null && !currentUserId.isEmpty()) {
        updateMaintainer(packageRoot, currentUserId);
      }
      return new NpmPublishRequest(packageRoot, tempBlobs);
    }
    catch (Throwable t) { //NOSONAR
      for (TempBlob tempBlob : tempBlobs.values()) {
        tempBlob.close();
      }
      throw t;
    }
  }

  public  NpmPublishParser(
      final JsonParser jsonParser,
      final BiFunction<InputStream, List<HashAlgorithm>, TempBlob> tempBlobCreator,
      final List<HashAlgorithm> hashAlgorithms);

}