Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mediocre/walmart-marketplace

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mediocre/walmart-marketplace - npm Package Compare versions

Comparing version 1.4.2 to 1.4.3

60

index.js

@@ -772,2 +772,4 @@ const crypto = require('crypto');

* @param {Object} [options]
* @param {Boolean} [options.autoPagination] If true, automatically fetches all pages of results. Defaults to false.
* @param {Number} [options.limit] Number of records to be returned. Default is 10.
* @param {String} [options.reportVersion] Version of report for which the request is created. Example, v1.

@@ -789,26 +791,50 @@ * @param {String} [options.requestStatus] Status of report request. Possible values are RECEIVED, INPROGRESS, READY, ERROR.

const queryParameters = new URLSearchParams({ reportType });
const reportRequests = [];
['reportVersion', 'requestStatus', 'requestSubmissionEndDate', 'requestSubmissionStartDate'].forEach(key => {
if (Object.hasOwn(options, key)) {
queryParameters.set(key, options[key]);
const fetchReportRequests = async cursor => {
let url;
if (cursor) {
url = `${_options.url}/v3/reports/reportRequests?${cursor}`;
} else {
const queryParameters = new URLSearchParams({ reportType });
['limit', 'reportVersion', 'requestStatus', 'requestSubmissionEndDate', 'requestSubmissionStartDate'].forEach(key => {
if (Object.hasOwn(options, key)) {
queryParameters.set(key, options[key]);
}
});
url = `${_options.url}/v3/reports/reportRequests?${queryParameters.toString()}`;
}
});
const url = `${_options.url}/v3/reports/reportRequests?${queryParameters.toString()}`;
const response = await fetch(url, {
headers: {
Accept: 'application/json',
'WM_QOS.CORRELATION_ID': crypto.randomUUID(),
'WM_SEC.ACCESS_TOKEN': (await _this.authentication.getAccessToken()).access_token,
'WM_SVC.NAME': _options['WM_SVC.NAME']
}
});
const response = await fetch(url, {
headers: {
Accept: 'application/json',
'WM_QOS.CORRELATION_ID': options['WM_QOS.CORRELATION_ID'] || crypto.randomUUID(),
'WM_SEC.ACCESS_TOKEN': (await _this.authentication.getAccessToken()).access_token,
'WM_SVC.NAME': _options['WM_SVC.NAME']
if (!response.ok) {
throw new Error(response.statusText, { cause: response });
}
});
if (!response.ok) {
throw new Error(response.statusText, { cause: response });
}
const data = await response.json();
return finalize(null, await response.json(), callback);
if (Array.isArray(data?.requests)) {
reportRequests.push(...data.requests);
// Check for more pages and if pagination is requested
if (options.autoPagination && data?.nextCursor) {
await fetchReportRequests(data.nextCursor);
}
}
};
// Initial call to fetch report requests
await fetchReportRequests(null);
return finalize(null, reportRequests, callback);
} catch(err) {

@@ -815,0 +841,0 @@ return finalize(err, null, callback);

@@ -20,3 +20,3 @@ {

},
"version": "1.4.2"
"version": "1.4.3"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc