@snyk/code-client
Advanced tools
Comparing version 4.10.0 to 4.11.0
@@ -22,3 +22,3 @@ "use strict"; | ||
const apiParams = { | ||
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'removedFiles', 'requestId']), | ||
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'removedFiles', 'requestId', 'base64Encoding']), | ||
files: chunkedFiles.reduce((d, f) => { | ||
@@ -58,3 +58,3 @@ // deepcode ignore PrototypePollution: FP this is an internal code | ||
emitter_1.emitter.uploadBundleProgress(0, options.files.length); | ||
const apiParams = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'bundleHash', 'requestId']); | ||
const apiParams = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'bundleHash', 'requestId', 'base64Encoding']); | ||
const uploadFileChunks = async (bucketFiles) => { | ||
@@ -88,3 +88,3 @@ // Note: we specifically create __new__ isolated bundles here to faster files upload | ||
let { remoteBundle } = options; | ||
const connectionOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId']); | ||
const connectionOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'base64Encoding']); | ||
while (remoteBundle.missingFiles.length && attempts < (options.maxAttempts || constants_1.MAX_UPLOAD_ATTEMPTS)) { | ||
@@ -109,3 +109,3 @@ const missingFiles = await (0, files_1.resolveBundleFiles)(options.baseDir, remoteBundle.missingFiles); | ||
let remoteBundle = null; | ||
const baseOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'baseDir', 'requestId']); | ||
const baseOptions = (0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'baseDir', 'requestId', 'base64Encoding']); | ||
const bundleFactory = prepareRemoteBundle((0, lodash_omit_1.default)(options, ['baseDir'])); | ||
@@ -181,3 +181,3 @@ for await (const response of bundleFactory) { | ||
const bundleOptions = { | ||
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId']), | ||
...(0, lodash_pick_1.default)(options, ['baseURL', 'sessionToken', 'source', 'requestId', 'base64Encoding']), | ||
baseDir, | ||
@@ -184,0 +184,0 @@ files: bundleFiles, |
@@ -23,2 +23,3 @@ import { ErrorCodes, GenericErrorTypes } from './constants'; | ||
requestId?: string; | ||
base64Encoding: boolean; | ||
} | ||
@@ -25,0 +26,0 @@ declare type StartSessionResponseDto = { |
@@ -123,2 +123,10 @@ "use strict"; | ||
async function createBundle(options) { | ||
let payloadBody; | ||
if (options.base64Encoding) { | ||
const payloadBuffer = Buffer.from(JSON.stringify(options.files)); | ||
payloadBody = payloadBuffer.toString('base64'); | ||
} | ||
else { | ||
payloadBody = options.files; | ||
} | ||
const payload = { | ||
@@ -132,3 +140,3 @@ headers: { | ||
method: 'post', | ||
body: options.files, | ||
body: payloadBody, | ||
}; | ||
@@ -172,2 +180,10 @@ const res = await (0, needle_1.makeRequest)(payload); | ||
async function extendBundle(options) { | ||
let payloadBody; | ||
if (options.base64Encoding) { | ||
const payloadBuffer = Buffer.from(JSON.stringify((0, lodash_pick_1.default)(options, ['files', 'removedFiles']))); | ||
payloadBody = payloadBuffer.toString('base64'); | ||
} | ||
else { | ||
payloadBody = (0, lodash_pick_1.default)(options, ['files', 'removedFiles']); | ||
} | ||
const res = await (0, needle_1.makeRequest)({ | ||
@@ -181,3 +197,3 @@ headers: { | ||
method: 'put', | ||
body: (0, lodash_pick_1.default)(options, ['files', 'removedFiles']), | ||
body: payloadBody, | ||
}); | ||
@@ -184,0 +200,0 @@ if (res.success) |
@@ -86,3 +86,3 @@ { | ||
}, | ||
"version": "4.10.0" | ||
"version": "4.11.0" | ||
} |
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
134869
1868