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

@rpldy/sender

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/sender - npm Package Compare versions

Comparing version 1.6.0 to 1.6.1-rc.0

3

lib/cjs/consts.js

@@ -7,3 +7,2 @@ "use strict";

exports.XHR_SENDER_TYPE = void 0;
const XHR_SENDER_TYPE = "rpldy-sender";
exports.XHR_SENDER_TYPE = XHR_SENDER_TYPE;
const XHR_SENDER_TYPE = exports.XHR_SENDER_TYPE = "rpldy-sender";

@@ -30,5 +30,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const send = (0, _xhrSender.default)();
exports.send = send;
var _default = send;
exports.default = _default;
const send = exports.send = (0, _xhrSender.default)();
var _default = exports.default = send;

@@ -50,3 +50,2 @@ "use strict";

};
var _default = prepareFormData;
exports.default = _default;
var _default = exports.default = prepareFormData;

@@ -12,4 +12,3 @@ "use strict";

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const SUCCESS_CODES = [200, 201, 202, 203, 204];
exports.SUCCESS_CODES = SUCCESS_CODES;
const SUCCESS_CODES = exports.SUCCESS_CODES = [200, 201, 202, 203, 204];
const getRequestData = (items, options) => {

@@ -32,3 +31,3 @@ let data;

let xhr;
const data = config !== null && config !== void 0 && config.getRequestData ? config.getRequestData(items, options) : getRequestData(items, options);
const data = config?.getRequestData ? config.getRequestData(items, options) : getRequestData(items, options);
const issueRequest = function () {

@@ -54,3 +53,3 @@ let requestUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;

//pXhr is a promise that resolves to the upload XHR
const pXhr = config !== null && config !== void 0 && config.preRequestHandler ? config.preRequestHandler(issueRequest, items, url, options, onProgress, config) : issueRequest();
const pXhr = config?.preRequestHandler ? config.preRequestHandler(issueRequest, items, url, options, onProgress, config) : issueRequest();
return {

@@ -66,4 +65,4 @@ url,

let parsed = response;
const ct = headers === null || headers === void 0 ? void 0 : headers["content-type"];
if (options.forceJsonResponse || ct !== null && ct !== void 0 && ct.includes("json")) {
const ct = headers?.["content-type"];
if (options.forceJsonResponse || ct?.includes("json")) {
try {

@@ -83,3 +82,2 @@ parsed = JSON.parse(response);

return checkIsResponseSuccessful(xhr, options).then(isSuccess => {
var _options$formatServer, _options$formatServer2;
const state = isSuccess ? _shared.FILE_STATES.FINISHED : _shared.FILE_STATES.ERROR;

@@ -89,3 +87,3 @@ const status = xhr.status;

const response = {
data: (_options$formatServer = (_options$formatServer2 = options.formatServerResponse) === null || _options$formatServer2 === void 0 ? void 0 : _options$formatServer2.call(options, xhr.response, status, resHeaders)) !== null && _options$formatServer !== void 0 ? _options$formatServer : parseResponseJson(xhr.response, resHeaders, options),
data: options.formatServerResponse?.(xhr.response, status, resHeaders) ?? parseResponseJson(xhr.response, resHeaders, options),
headers: resHeaders

@@ -147,3 +145,2 @@ };

};
var _default = getXhrSend;
exports.default = _default;
var _default = exports.default = getXhrSend;

@@ -23,3 +23,3 @@ import { logger, FILE_STATES, request, parseResponseHeaders, pick, merge, isPromise } from "@rpldy/shared";

let xhr;
const data = config !== null && config !== void 0 && config.getRequestData ? config.getRequestData(items, options) : getRequestData(items, options);
const data = config?.getRequestData ? config.getRequestData(items, options) : getRequestData(items, options);
const issueRequest = function () {

@@ -45,3 +45,3 @@ let requestUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url;

//pXhr is a promise that resolves to the upload XHR
const pXhr = config !== null && config !== void 0 && config.preRequestHandler ? config.preRequestHandler(issueRequest, items, url, options, onProgress, config) : issueRequest();
const pXhr = config?.preRequestHandler ? config.preRequestHandler(issueRequest, items, url, options, onProgress, config) : issueRequest();
return {

@@ -57,4 +57,4 @@ url,

let parsed = response;
const ct = headers === null || headers === void 0 ? void 0 : headers["content-type"];
if (options.forceJsonResponse || ct !== null && ct !== void 0 && ct.includes("json")) {
const ct = headers?.["content-type"];
if (options.forceJsonResponse || ct?.includes("json")) {
try {

@@ -74,3 +74,2 @@ parsed = JSON.parse(response);

return checkIsResponseSuccessful(xhr, options).then(isSuccess => {
var _options$formatServer, _options$formatServer2;
const state = isSuccess ? FILE_STATES.FINISHED : FILE_STATES.ERROR;

@@ -80,3 +79,3 @@ const status = xhr.status;

const response = {
data: (_options$formatServer = (_options$formatServer2 = options.formatServerResponse) === null || _options$formatServer2 === void 0 ? void 0 : _options$formatServer2.call(options, xhr.response, status, resHeaders)) !== null && _options$formatServer !== void 0 ? _options$formatServer : parseResponseJson(xhr.response, resHeaders, options),
data: options.formatServerResponse?.(xhr.response, status, resHeaders) ?? parseResponseJson(xhr.response, resHeaders, options),
headers: resHeaders

@@ -83,0 +82,0 @@ };

{
"version": "1.6.0",
"version": "1.6.1-rc.0",
"name": "@rpldy/sender",

@@ -26,3 +26,3 @@ "description": "react-uploady's default XHR sender",

"dependencies": {
"@rpldy/shared": "^1.6.0"
"@rpldy/shared": "^1.6.1-rc.0"
},

@@ -35,3 +35,3 @@ "devDependencies": {

},
"gitHead": "6dae5ef18f9a3cd103d58706e48e832c9a43aa98"
"gitHead": "20f9f1f650c21e577ab120f8543991dc4335c0bc"
}
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