@snyk/code-client
Advanced tools
Comparing version 4.23.1 to 4.23.2
@@ -31,3 +31,3 @@ import { FileInfo, SupportedFiles } from './interfaces/files.interface'; | ||
*/ | ||
export declare function getSupportedFiles(baseURL: string, source: string, requestId?: string, languages?: string[], orgId?: string): Promise<SupportedFiles>; | ||
export declare function getSupportedFiles(baseURL: string, source: string, requestId?: string, languages?: string[], orgId?: string, extraHeaders?: Record<string, string>): Promise<SupportedFiles>; | ||
export interface FileBundle extends RemoteBundle { | ||
@@ -34,0 +34,0 @@ baseDir: string; |
@@ -162,5 +162,12 @@ "use strict"; | ||
*/ | ||
async function getSupportedFiles(baseURL, source, requestId, languages, orgId) { | ||
async function getSupportedFiles(baseURL, source, requestId, languages, orgId, extraHeaders) { | ||
emitter_1.emitter.supportedFilesLoaded(null); | ||
const resp = await http_1.getFilters(baseURL, source, constants_1.MAX_RETRY_ATTEMPTS, requestId, orgId); | ||
const resp = await http_1.getFilters({ | ||
baseURL, | ||
source, | ||
orgId, | ||
requestId, | ||
attempts: constants_1.MAX_RETRY_ATTEMPTS, | ||
extraHeaders: extraHeaders !== null && extraHeaders !== void 0 ? extraHeaders : {}, | ||
}); | ||
if (resp.type === 'error') { | ||
@@ -195,3 +202,3 @@ throw resp.error; | ||
// Fetch supported files to save network traffic | ||
const supportedFiles = await getSupportedFiles(options.baseURL, options.source, options.requestId, options.languages, options.orgId); | ||
const supportedFiles = await getSupportedFiles(options.baseURL, options.source, options.requestId, options.languages, options.orgId, options.extraHeaders); | ||
// Collect files and create a remote bundle | ||
@@ -198,0 +205,0 @@ return await createBundleWithCustomFiles(options, supportedFiles); |
@@ -56,3 +56,11 @@ /// <reference types="node" /> | ||
export declare function checkSession(options: CheckSessionOptions): Promise<Result<string, CheckSessionErrorCodes>>; | ||
export declare function getFilters(baseURL: string, source: string, attempts?: number, requestId?: string, orgId?: string): Promise<Result<SupportedFiles, GenericErrorTypes>>; | ||
export interface FilterArgs { | ||
extraHeaders: Record<string, string>; | ||
attempts: number; | ||
baseURL: string; | ||
source: string; | ||
requestId?: string; | ||
orgId?: string; | ||
} | ||
export declare function getFilters({ baseURL, orgId, attempts, source, extraHeaders, requestId, }: FilterArgs): Promise<Result<SupportedFiles, GenericErrorTypes>>; | ||
export declare type RemoteBundle = { | ||
@@ -59,0 +67,0 @@ readonly bundleHash: string; |
@@ -108,3 +108,3 @@ "use strict"; | ||
exports.checkSession = checkSession; | ||
async function getFilters(baseURL, source, attempts = constants_1.MAX_RETRY_ATTEMPTS, requestId, orgId) { | ||
async function getFilters({ baseURL, orgId, attempts, source, extraHeaders, requestId, }) { | ||
const apiName = 'filters'; | ||
@@ -119,3 +119,7 @@ let url; | ||
const res = await needle_1.makeRequest({ | ||
headers: { source, ...(requestId && { 'snyk-request-id': requestId }) }, | ||
headers: { | ||
source, | ||
...extraHeaders, | ||
...(requestId && { 'snyk-request-id': requestId }), | ||
}, | ||
url, | ||
@@ -122,0 +126,0 @@ method: 'get', |
@@ -94,3 +94,3 @@ { | ||
}, | ||
"version": "4.23.1" | ||
"version": "4.23.2" | ||
} |
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
185362
2655