@snyk/docker-registry-v2-client
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -10,3 +10,3 @@ "use strict"; | ||
async function checkSupport(registryBase, username, password, options = {}) { | ||
const result = await registry_call_1.registryV2Call(registryBase, "/", // full url path should be "/v2/" as per spec | ||
const result = await (0, registry_call_1.registryV2Call)(registryBase, "/", // full url path should be "/v2/" as per spec | ||
contentTypes.JSON, username, password, options); | ||
@@ -13,0 +13,0 @@ // always return thruthy object, even for ECR |
@@ -23,5 +23,5 @@ "use strict"; | ||
async function getAuthTokenForEndpoint(registryBase, endpoint, username, password, reqOptions = {}) { | ||
const reqConfig = registry_call_1.buildUnauthenticatedV2RequestConfig(registryBase, endpoint, contentTypes.JSON, reqOptions); | ||
const reqConfig = (0, registry_call_1.buildUnauthenticatedV2RequestConfig)(registryBase, endpoint, contentTypes.JSON, reqOptions); | ||
try { | ||
await needle_1.needleWrapper(reqConfig); | ||
await (0, needle_1.needleWrapper)(reqConfig); | ||
return null; | ||
@@ -37,3 +37,3 @@ } | ||
} | ||
const [authBase, service, scope] = registry_call_1.parseChallengeHeaders(challengeHeaders); | ||
const [authBase, service, scope] = (0, registry_call_1.parseChallengeHeaders)(challengeHeaders); | ||
if (!authBase) { | ||
@@ -44,3 +44,3 @@ return null; | ||
// Bearer token | ||
const token = await registry_call_1.getToken(registryBase, authBase, service, scope, username, password, reqOptions); | ||
const token = await (0, registry_call_1.getToken)(registryBase, authBase, service, scope, username, password, reqOptions); | ||
return token; | ||
@@ -47,0 +47,0 @@ } |
@@ -9,6 +9,6 @@ "use strict"; | ||
const endpoint = `/${repo}/blobs/${digest}`; | ||
const configResponse = await registry_call_1.registryV2Call(registryBase, endpoint, contentTypes.IMAGE_CONFIG, username, password, options); | ||
return needle_1.parseResponseBody(configResponse); | ||
const configResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, contentTypes.IMAGE_CONFIG, username, password, options); | ||
return (0, needle_1.parseResponseBody)(configResponse); | ||
} | ||
exports.getImageConfig = getImageConfig; | ||
//# sourceMappingURL=get-image-config.js.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
async function getImageSize(registryBase, repo, tag, username, password, options = {}) { | ||
const manifest = await get_manifest_1.getManifest(registryBase, repo, tag, username, password, options); | ||
const manifest = await (0, get_manifest_1.getManifest)(registryBase, repo, tag, username, password, options); | ||
const layers = manifest.layers || []; | ||
@@ -9,0 +9,0 @@ return layers.reduce((size, layerConfig) => size + layerConfig.size, 0); |
@@ -11,3 +11,3 @@ "use strict"; | ||
options = Object.assign({ json: false, encoding: null }, options); | ||
const layerResponse = await registry_call_1.registryV2Call(registryBase, endpoint, accept, username, password, options); | ||
const layerResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options); | ||
// When the content type is wrongly set to text instead of binary, response body is returned as string instead of a buffer | ||
@@ -14,0 +14,0 @@ // This forces a buffer response. |
@@ -27,4 +27,4 @@ "use strict"; | ||
try { | ||
validation_1.validateRepoOrImageRef(repo); | ||
validation_1.validateRepoOrImageRef(imageReference); | ||
(0, validation_1.validateRepoOrImageRef)(repo); | ||
(0, validation_1.validateRepoOrImageRef)(imageReference); | ||
} | ||
@@ -34,3 +34,3 @@ catch (err) { | ||
} | ||
let manifestResponse = await registry_call_1.registryV2Call(registryBase, endpoint, accept, username, password, options); | ||
let manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options); | ||
const contentType = manifestResponse.headers["content-type"]; | ||
@@ -44,3 +44,3 @@ let indexDigest; | ||
const endpoint = `/${repo}/manifests/${manifestDigest}`; | ||
manifestResponse = await registry_call_1.registryV2Call(registryBase, endpoint, accept, username, password, options); | ||
manifestResponse = await (0, registry_call_1.registryV2Call)(registryBase, endpoint, accept, username, password, options); | ||
} | ||
@@ -60,3 +60,3 @@ const dockerContentDigest = manifestResponse.headers["Docker-Content-Digest"]; | ||
} | ||
const parsedBody = needle_1.parseResponseBody(manifestResponse); | ||
const parsedBody = (0, needle_1.parseResponseBody)(manifestResponse); | ||
return Object.assign(Object.assign({}, parsedBody), { indexDigest, manifestDigest }); | ||
@@ -75,3 +75,3 @@ } | ||
} | ||
const hexDigest = crypto_1.createHash("sha256") | ||
const hexDigest = (0, crypto_1.createHash)("sha256") | ||
.update(body) | ||
@@ -89,3 +89,3 @@ .digest("hex") | ||
const platformFilter = platform ? platform : defaultPlatform; | ||
const manifestList = needle_1.parseResponseBody(manifestResponse); | ||
const manifestList = (0, needle_1.parseResponseBody)(manifestResponse); | ||
const manifestPlatform = getManifestByOsAndArch(manifestList.manifests, platformFilter.os, platformFilter.architecture); | ||
@@ -92,0 +92,0 @@ if (manifestPlatform) { |
@@ -8,5 +8,5 @@ "use strict"; | ||
const endpoint = "/_catalog"; | ||
return await registry_call_1.paginatedV2Call(registryBase, contentTypes.JSON, username, password, endpoint, "repositories", pageSize, maxPages, options); | ||
return await (0, registry_call_1.paginatedV2Call)(registryBase, contentTypes.JSON, username, password, endpoint, "repositories", pageSize, maxPages, options); | ||
} | ||
exports.getRepos = getRepos; | ||
//# sourceMappingURL=get-repos.js.map |
@@ -8,5 +8,5 @@ "use strict"; | ||
const endpoint = `/${repo}/tags/list`; | ||
return await registry_call_1.paginatedV2Call(registryBase, contentTypes.JSON, username, password, endpoint, "tags", pageSize, maxPages, options); | ||
return await (0, registry_call_1.paginatedV2Call)(registryBase, contentTypes.JSON, username, password, endpoint, "tags", pageSize, maxPages, options); | ||
} | ||
exports.getTags = getTags; | ||
//# sourceMappingURL=get-tags.js.map |
import { NeedleOptions, NeedleResponse } from "needle"; | ||
declare type Headers = NeedleOptions["headers"]; | ||
type Headers = NeedleOptions["headers"]; | ||
interface RequestOptions extends NeedleOptions { | ||
@@ -4,0 +4,0 @@ uri: string; |
@@ -13,3 +13,3 @@ "use strict"; | ||
try { | ||
return await needle_1.needleWrapper(reqConfig, MAX_RETRIES); | ||
return await (0, needle_1.needleWrapper)(reqConfig, MAX_RETRIES); | ||
} | ||
@@ -26,3 +26,3 @@ catch (err) { | ||
try { | ||
return await needle_1.needleWrapper(authConfig, MAX_RETRIES); | ||
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES); | ||
} | ||
@@ -56,3 +56,3 @@ catch (err) { | ||
try { | ||
return await needle_1.needleWrapper(reqConfig, MAX_RETRIES); | ||
return await (0, needle_1.needleWrapper)(reqConfig, MAX_RETRIES); | ||
} | ||
@@ -69,3 +69,3 @@ catch (err) { | ||
try { | ||
return await needle_1.needleWrapper(authConfig, MAX_RETRIES); | ||
return await (0, needle_1.needleWrapper)(authConfig, MAX_RETRIES); | ||
} | ||
@@ -92,3 +92,3 @@ catch (err) { | ||
const response = await registryV2Call(registryBase, pageEndpoint, accept, username, password, reqOptions); | ||
const body = needle_1.parseResponseBody(response); | ||
const body = (0, needle_1.parseResponseBody)(response); | ||
if (body && body[key]) { | ||
@@ -119,4 +119,4 @@ result.push(...body[key]); | ||
} | ||
const response = await needle_1.needleWrapper(reqConfig); | ||
const body = needle_1.parseResponseBody(response); | ||
const response = await (0, needle_1.needleWrapper)(reqConfig); | ||
const body = (0, needle_1.parseResponseBody)(response); | ||
return body.token || body.access_token; | ||
@@ -197,3 +197,3 @@ } | ||
try { | ||
return await needle_1.needleWrapper(config, MAX_RETRIES); | ||
return await (0, needle_1.needleWrapper)(config, MAX_RETRIES); | ||
} | ||
@@ -200,0 +200,0 @@ catch (err) { |
@@ -38,10 +38,10 @@ { | ||
"ts-node": "^10.2.1", | ||
"typescript": "^3.5.3" | ||
"typescript": "^4.7" | ||
}, | ||
"dependencies": { | ||
"needle": "^2.6.0", | ||
"needle": "^3.2.0", | ||
"parse-link-header": "^2.0.0", | ||
"tslib": "^1.10.0" | ||
}, | ||
"version": "2.8.0" | ||
"version": "2.8.1" | ||
} |
@@ -44,6 +44,6 @@ # snyk/docker-registry-v2-client | ||
export SNYK_DRA_ELASTIC_ACCESS_KEY_ID=AKIAJICAGDWS3GILA5WA | ||
export SNYK_DRA_ELASTIC_ACCESS_KEY_ID=AKIAX2FLE4CDHRAFCLS4 | ||
export SNYK_DRA_ELASTIC_REGION=eu-west-3 | ||
export SNYK_DRA_ELASTIC_REPOSITORY=amazon-goof | ||
export SNYK_DRA_ELASTIC_SECRET_ACCESS_KEY=<See 1password: Development/Elastic Container Registry (ECR) - Docker Registry Agent> | ||
export SNYK_DRA_ELASTIC_SECRET_ACCESS_KEY=<See 1password: Development/Elastic Container Registry (ECR) - Docker Registry Agent (role based auth) | ||
@@ -50,0 +50,0 @@ export SNYK_DRA_GOOGLE_PASSWORD='<See 1Password: Development/GCR Google Container Registry snyk-magma>' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59846
+ Addediconv-lite@0.6.3(transitive)
+ Addedneedle@3.3.1(transitive)
- Removeddebug@3.2.7(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedms@2.1.3(transitive)
- Removedneedle@2.9.1(transitive)
Updatedneedle@^3.2.0