@rpldy/sender
Advanced tools
Comparing version 0.14.2 to 0.15.0
@@ -6,6 +6,6 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "getXhrSend", { | ||
Object.defineProperty(exports, "MissingUrlError", { | ||
enumerable: true, | ||
get: function () { | ||
return _xhrSender.default; | ||
return _MissingUrlError.default; | ||
} | ||
@@ -19,9 +19,10 @@ }); | ||
}); | ||
Object.defineProperty(exports, "MissingUrlError", { | ||
exports.default = void 0; | ||
Object.defineProperty(exports, "getXhrSend", { | ||
enumerable: true, | ||
get: function () { | ||
return _MissingUrlError.default; | ||
return _xhrSender.default; | ||
} | ||
}); | ||
exports.send = exports.default = void 0; | ||
exports.send = void 0; | ||
@@ -28,0 +29,0 @@ var _xhrSender = _interopRequireDefault(require("./xhrSender/xhrSender")); |
@@ -14,6 +14,10 @@ "use strict"; | ||
*/ | ||
const addToFormData = (fd, name, ...rest) => { | ||
const addToFormData = function (fd, name) { | ||
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
rest[_key - 2] = arguments[_key]; | ||
} | ||
//rest = [value, fileName = undefined] | ||
if ("set" in fd) { | ||
// $FlowFixMe - ignore flow for not allowing FileLike here | ||
//$FlowExpectedError[speculation-ambiguous] - ignore flow for not allowing FileLike here | ||
fd.set(name, ...rest); | ||
@@ -23,3 +27,3 @@ } else { | ||
fd.delete(name); | ||
} // $FlowFixMe - ignore flow for not allowing FileLike here | ||
} //$FlowExpectedError[speculation-ambiguous] - ignore flow for not allowing FileLike here | ||
@@ -48,3 +52,9 @@ | ||
if (options.params) { | ||
Object.entries(options.params).forEach(([key, val]) => addToFormData(fd, key, val)); | ||
Object.entries(options.params).forEach(_ref => { | ||
let [key, val] = _ref; | ||
if (options.formDataAllowUndefined || val !== undefined) { | ||
addToFormData(fd, key, val); | ||
} | ||
}); | ||
} | ||
@@ -51,0 +61,0 @@ |
@@ -47,3 +47,6 @@ "use strict"; | ||
const issueRequest = (requestUrl = url, requestData = data, requestOptions) => { | ||
const issueRequest = function () { | ||
let requestUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url; | ||
let requestData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : data; | ||
let requestOptions = arguments.length > 2 ? arguments[2] : undefined; | ||
requestOptions = (0, _shared.merge)({ ...(0, _shared.pick)(options, ["method", "headers", "withCredentials"]), | ||
@@ -50,0 +53,0 @@ preSend: req => { |
@@ -7,6 +7,10 @@ import { isFunction } from "@rpldy/shared"; | ||
*/ | ||
const addToFormData = (fd, name, ...rest) => { | ||
const addToFormData = function (fd, name) { | ||
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
rest[_key - 2] = arguments[_key]; | ||
} | ||
//rest = [value, fileName = undefined] | ||
if ("set" in fd) { | ||
// $FlowFixMe - ignore flow for not allowing FileLike here | ||
//$FlowExpectedError[speculation-ambiguous] - ignore flow for not allowing FileLike here | ||
fd.set(name, ...rest); | ||
@@ -16,3 +20,3 @@ } else { | ||
fd.delete(name); | ||
} // $FlowFixMe - ignore flow for not allowing FileLike here | ||
} //$FlowExpectedError[speculation-ambiguous] - ignore flow for not allowing FileLike here | ||
@@ -41,3 +45,9 @@ | ||
if (options.params) { | ||
Object.entries(options.params).forEach(([key, val]) => addToFormData(fd, key, val)); | ||
Object.entries(options.params).forEach(_ref => { | ||
let [key, val] = _ref; | ||
if (options.formDataAllowUndefined || val !== undefined) { | ||
addToFormData(fd, key, val); | ||
} | ||
}); | ||
} | ||
@@ -44,0 +54,0 @@ |
@@ -30,3 +30,6 @@ import { logger, FILE_STATES, request, parseResponseHeaders, pick, merge } from "@rpldy/shared"; | ||
const issueRequest = (requestUrl = url, requestData = data, requestOptions) => { | ||
const issueRequest = function () { | ||
let requestUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : url; | ||
let requestData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : data; | ||
let requestOptions = arguments.length > 2 ? arguments[2] : undefined; | ||
requestOptions = merge({ ...pick(options, ["method", "headers", "withCredentials"]), | ||
@@ -33,0 +36,0 @@ preSend: req => { |
{ | ||
"version": "0.14.2", | ||
"version": "0.15.0", | ||
"name": "@rpldy/sender", | ||
@@ -21,6 +21,6 @@ "description": "react-uploady's default XHR sender", | ||
"dependencies": { | ||
"@rpldy/shared": "^0.14.2" | ||
"@rpldy/shared": "^0.15.0" | ||
}, | ||
"devDependencies": { | ||
"flow-bin": "^0.159.0" | ||
"flow-bin": "^0.164.0" | ||
}, | ||
@@ -30,3 +30,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "a03a076546fd0895f2eada2687de86a2e23f7732" | ||
"gitHead": "7909b3aacc4afd229e4bc6810da8560be19706b2" | ||
} |
import { | ||
BatchItem, | ||
FormatParamGroupNameMethod, | ||
UploadData, | ||
FormatServerResponseMethod, | ||
SendOptions | ||
} from "@rpldy/shared"; | ||
export interface SendOptions { | ||
method: string; | ||
paramName: string; | ||
params?: Record<string, unknown>; | ||
headers?: Record<string, unknown>; | ||
forceJsonResponse?: boolean; | ||
withCredentials?: boolean; | ||
formatGroupParamName?: FormatParamGroupNameMethod; | ||
sendWithFormData?: boolean; | ||
formatServerResponse?: FormatServerResponseMethod; | ||
} | ||
export interface XhrSendConfig { | ||
@@ -51,1 +38,5 @@ preRequestHandler: ( | ||
export default send; | ||
export { | ||
SendOptions, | ||
}; |
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
19629
462
+ Added@rpldy/shared@0.15.0(transitive)
- Removed@rpldy/shared@0.14.2(transitive)
Updated@rpldy/shared@^0.15.0