Class NpmPayloadBuilder


  • @ThreadSafe
    public final class NpmPayloadBuilder
    extends java.lang.Object
    Class used to create the payload to submit to the NPM Audit API service.
    Author:
    Steve Springett, Jeremy Long
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.json.JsonObject build​(javax.json.JsonObject lockJson, javax.json.JsonObject packageJson, org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.String> dependencyMap, boolean skipDevDependencies)
      Builds an npm audit API payload.
      static javax.json.JsonObject build​(javax.json.JsonObject packageJson, org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.String> dependencyMap, boolean skipDevDependencies)
      Attempts to build the request data for NPM Audit API call.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • build

        public static javax.json.JsonObject build​(javax.json.JsonObject lockJson,
                                                  javax.json.JsonObject packageJson,
                                                  org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.String> dependencyMap,
                                                  boolean skipDevDependencies)
        Builds an npm audit API payload.
        Parameters:
        lockJson - the package-lock.json
        packageJson - the package.json
        dependencyMap - a collection of module/version pairs that is populated while building the payload
        skipDevDependencies - whether devDependencies should be skipped
        Returns:
        the npm audit API payload
      • build

        public static javax.json.JsonObject build​(javax.json.JsonObject packageJson,
                                                  org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.String> dependencyMap,
                                                  boolean skipDevDependencies)
        Attempts to build the request data for NPM Audit API call. This may produce a payload that will fail.
        Parameters:
        packageJson - a raw package-lock.json file
        dependencyMap - a collection of module/version pairs that is
        skipDevDependencies - whether devDependencies should be skipped populated while building the payload
        Returns:
        the JSON payload for NPN Audit