@sap/ux-ui5-tooling 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -5
- package/dist/cli/index.js +25696 -25651
- package/dist/markdowns/add/add.en.md +3 -0
- package/dist/middlewares/fiori-tools-appreload.js +1877 -1879
- package/dist/middlewares/fiori-tools-preview.js +4428 -4423
- package/dist/middlewares/fiori-tools-proxy.js +7683 -7669
- package/dist/tasks/cf-deploy/index.js +259 -213
- package/dist/tasks/deploy/index.js +12785 -12738
- package/dist/templates/control-property-editor/app.js +1 -1
- package/dist/templates/control-property-editor/ui5-adaptation.js +1 -1
- package/dist/templates/control-property-editor/vendor.js +1 -1
- package/package.json +10 -10
|
@@ -22950,628 +22950,147 @@ function createConnectionSSL (port, host, options) {
|
|
|
22950
22950
|
|
|
22951
22951
|
/***/ }),
|
|
22952
22952
|
|
|
22953
|
-
/***/
|
|
22953
|
+
/***/ 74608:
|
|
22954
22954
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
22955
22955
|
|
|
22956
|
-
|
|
22957
|
-
var util = __webpack_require__(31669);
|
|
22958
|
-
var path = __webpack_require__(85622);
|
|
22959
|
-
var http = __webpack_require__(98605);
|
|
22960
|
-
var https = __webpack_require__(57211);
|
|
22961
|
-
var parseUrl = __webpack_require__(78835).parse;
|
|
22962
|
-
var fs = __webpack_require__(35747);
|
|
22963
|
-
var mime = __webpack_require__(19010);
|
|
22964
|
-
var asynckit = __webpack_require__(48564);
|
|
22965
|
-
var populate = __webpack_require__(10453);
|
|
22966
|
-
|
|
22967
|
-
// Public API
|
|
22968
|
-
module.exports = FormData;
|
|
22969
|
-
|
|
22970
|
-
// make it a Stream
|
|
22971
|
-
util.inherits(FormData, CombinedStream);
|
|
22972
|
-
|
|
22973
|
-
/**
|
|
22974
|
-
* Create readable "multipart/form-data" streams.
|
|
22975
|
-
* Can be used to submit forms
|
|
22976
|
-
* and file uploads to other web applications.
|
|
22977
|
-
*
|
|
22978
|
-
* @constructor
|
|
22979
|
-
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
22980
|
-
*/
|
|
22981
|
-
function FormData(options) {
|
|
22982
|
-
if (!(this instanceof FormData)) {
|
|
22983
|
-
return new FormData();
|
|
22984
|
-
}
|
|
22985
|
-
|
|
22986
|
-
this._overheadLength = 0;
|
|
22987
|
-
this._valueLength = 0;
|
|
22988
|
-
this._valuesToMeasure = [];
|
|
22956
|
+
"use strict";
|
|
22989
22957
|
|
|
22990
|
-
|
|
22958
|
+
var spin = __webpack_require__(74365)
|
|
22959
|
+
var progressBar = __webpack_require__(8936)
|
|
22991
22960
|
|
|
22992
|
-
|
|
22993
|
-
|
|
22994
|
-
|
|
22961
|
+
module.exports = {
|
|
22962
|
+
activityIndicator: function (values, theme, width) {
|
|
22963
|
+
if (values.spun == null) return
|
|
22964
|
+
return spin(theme, values.spun)
|
|
22965
|
+
},
|
|
22966
|
+
progressbar: function (values, theme, width) {
|
|
22967
|
+
if (values.completed == null) return
|
|
22968
|
+
return progressBar(theme, width, values.completed)
|
|
22995
22969
|
}
|
|
22996
22970
|
}
|
|
22997
22971
|
|
|
22998
|
-
FormData.LINE_BREAK = '\r\n';
|
|
22999
|
-
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
23000
|
-
|
|
23001
|
-
FormData.prototype.append = function(field, value, options) {
|
|
23002
|
-
|
|
23003
|
-
options = options || {};
|
|
23004
|
-
|
|
23005
|
-
// allow filename as single option
|
|
23006
|
-
if (typeof options == 'string') {
|
|
23007
|
-
options = {filename: options};
|
|
23008
|
-
}
|
|
23009
22972
|
|
|
23010
|
-
|
|
22973
|
+
/***/ }),
|
|
23011
22974
|
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
value = '' + value;
|
|
23015
|
-
}
|
|
22975
|
+
/***/ 15591:
|
|
22976
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
23016
22977
|
|
|
23017
|
-
|
|
23018
|
-
if (util.isArray(value)) {
|
|
23019
|
-
// Please convert your array into string
|
|
23020
|
-
// the way web server expects it
|
|
23021
|
-
this._error(new Error('Arrays are not supported.'));
|
|
23022
|
-
return;
|
|
23023
|
-
}
|
|
22978
|
+
"use strict";
|
|
23024
22979
|
|
|
23025
|
-
|
|
23026
|
-
var footer = this._multiPartFooter();
|
|
22980
|
+
var util = __webpack_require__(31669)
|
|
23027
22981
|
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
22982
|
+
var User = exports.User = function User (msg) {
|
|
22983
|
+
var err = new Error(msg)
|
|
22984
|
+
Error.captureStackTrace(err, User)
|
|
22985
|
+
err.code = 'EGAUGE'
|
|
22986
|
+
return err
|
|
22987
|
+
}
|
|
23031
22988
|
|
|
23032
|
-
|
|
23033
|
-
|
|
23034
|
-
|
|
22989
|
+
exports.MissingTemplateValue = function MissingTemplateValue (item, values) {
|
|
22990
|
+
var err = new User(util.format('Missing template value "%s"', item.type))
|
|
22991
|
+
Error.captureStackTrace(err, MissingTemplateValue)
|
|
22992
|
+
err.template = item
|
|
22993
|
+
err.values = values
|
|
22994
|
+
return err
|
|
22995
|
+
}
|
|
23035
22996
|
|
|
23036
|
-
|
|
23037
|
-
var
|
|
22997
|
+
exports.Internal = function Internal (msg) {
|
|
22998
|
+
var err = new Error(msg)
|
|
22999
|
+
Error.captureStackTrace(err, Internal)
|
|
23000
|
+
err.code = 'EGAUGEINTERNAL'
|
|
23001
|
+
return err
|
|
23002
|
+
}
|
|
23038
23003
|
|
|
23039
|
-
// used w/ getLengthSync(), when length is known.
|
|
23040
|
-
// e.g. for streaming directly from a remote server,
|
|
23041
|
-
// w/ a known file a size, and not wanting to wait for
|
|
23042
|
-
// incoming file to finish to get its size.
|
|
23043
|
-
if (options.knownLength != null) {
|
|
23044
|
-
valueLength += +options.knownLength;
|
|
23045
|
-
} else if (Buffer.isBuffer(value)) {
|
|
23046
|
-
valueLength = value.length;
|
|
23047
|
-
} else if (typeof value === 'string') {
|
|
23048
|
-
valueLength = Buffer.byteLength(value);
|
|
23049
|
-
}
|
|
23050
23004
|
|
|
23051
|
-
|
|
23005
|
+
/***/ }),
|
|
23052
23006
|
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
Buffer.byteLength(header) +
|
|
23056
|
-
FormData.LINE_BREAK.length;
|
|
23007
|
+
/***/ 18029:
|
|
23008
|
+
/***/ ((module) => {
|
|
23057
23009
|
|
|
23058
|
-
|
|
23059
|
-
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
|
|
23060
|
-
return;
|
|
23061
|
-
}
|
|
23010
|
+
"use strict";
|
|
23062
23011
|
|
|
23063
|
-
// no need to bother with the length
|
|
23064
|
-
if (!options.knownLength) {
|
|
23065
|
-
this._valuesToMeasure.push(value);
|
|
23066
|
-
}
|
|
23067
|
-
};
|
|
23068
23012
|
|
|
23069
|
-
|
|
23013
|
+
module.exports = isWin32() || isColorTerm()
|
|
23070
23014
|
|
|
23071
|
-
|
|
23015
|
+
function isWin32 () {
|
|
23016
|
+
return process.platform === 'win32'
|
|
23017
|
+
}
|
|
23072
23018
|
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
// it doesn't respect `end` options without `start` options
|
|
23078
|
-
// Fix it when node fixes it.
|
|
23079
|
-
// https://github.com/joyent/node/issues/7819
|
|
23080
|
-
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
23019
|
+
function isColorTerm () {
|
|
23020
|
+
var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i
|
|
23021
|
+
return !!process.env.COLORTERM || termHasColor.test(process.env.TERM)
|
|
23022
|
+
}
|
|
23081
23023
|
|
|
23082
|
-
// when end specified
|
|
23083
|
-
// no need to calculate range
|
|
23084
|
-
// inclusive, starts with 0
|
|
23085
|
-
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
23086
23024
|
|
|
23087
|
-
|
|
23088
|
-
} else {
|
|
23089
|
-
// still need to fetch file size from fs
|
|
23090
|
-
fs.stat(value.path, function(err, stat) {
|
|
23025
|
+
/***/ }),
|
|
23091
23026
|
|
|
23092
|
-
|
|
23027
|
+
/***/ 1757:
|
|
23028
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23093
23029
|
|
|
23094
|
-
|
|
23095
|
-
callback(err);
|
|
23096
|
-
return;
|
|
23097
|
-
}
|
|
23030
|
+
"use strict";
|
|
23098
23031
|
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23032
|
+
var Plumbing = __webpack_require__(17852)
|
|
23033
|
+
var hasUnicode = __webpack_require__(29253)
|
|
23034
|
+
var hasColor = __webpack_require__(18029)
|
|
23035
|
+
var onExit = __webpack_require__(40412)
|
|
23036
|
+
var defaultThemes = __webpack_require__(62834)
|
|
23037
|
+
var setInterval = __webpack_require__(29165)
|
|
23038
|
+
var process = __webpack_require__(22156)
|
|
23039
|
+
var setImmediate = __webpack_require__(48761)
|
|
23104
23040
|
|
|
23105
|
-
|
|
23106
|
-
} else if (value.hasOwnProperty('httpVersion')) {
|
|
23107
|
-
callback(null, +value.headers['content-length']);
|
|
23041
|
+
module.exports = Gauge
|
|
23108
23042
|
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
callback(null, +response.headers['content-length']);
|
|
23115
|
-
});
|
|
23116
|
-
value.resume();
|
|
23043
|
+
function callWith (obj, method) {
|
|
23044
|
+
return function () {
|
|
23045
|
+
return method.call(obj)
|
|
23046
|
+
}
|
|
23047
|
+
}
|
|
23117
23048
|
|
|
23118
|
-
|
|
23049
|
+
function Gauge (arg1, arg2) {
|
|
23050
|
+
var options, writeTo
|
|
23051
|
+
if (arg1 && arg1.write) {
|
|
23052
|
+
writeTo = arg1
|
|
23053
|
+
options = arg2 || {}
|
|
23054
|
+
} else if (arg2 && arg2.write) {
|
|
23055
|
+
writeTo = arg2
|
|
23056
|
+
options = arg1 || {}
|
|
23119
23057
|
} else {
|
|
23120
|
-
|
|
23058
|
+
writeTo = process.stderr
|
|
23059
|
+
options = arg1 || arg2 || {}
|
|
23121
23060
|
}
|
|
23122
|
-
};
|
|
23123
23061
|
|
|
23124
|
-
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
if (typeof options.header == 'string') {
|
|
23129
|
-
return options.header;
|
|
23062
|
+
this._status = {
|
|
23063
|
+
spun: 0,
|
|
23064
|
+
section: '',
|
|
23065
|
+
subsection: ''
|
|
23130
23066
|
}
|
|
23067
|
+
this._paused = false // are we paused for back pressure?
|
|
23068
|
+
this._disabled = true // are all progress bar updates disabled?
|
|
23069
|
+
this._showing = false // do we WANT the progress bar on screen
|
|
23070
|
+
this._onScreen = false // IS the progress bar on screen
|
|
23071
|
+
this._needsRedraw = false // should we print something at next tick?
|
|
23072
|
+
this._hideCursor = options.hideCursor == null ? true : options.hideCursor
|
|
23073
|
+
this._fixedFramerate = options.fixedFramerate == null
|
|
23074
|
+
? !(/^v0\.8\./.test(process.version))
|
|
23075
|
+
: options.fixedFramerate
|
|
23076
|
+
this._lastUpdateAt = null
|
|
23077
|
+
this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval
|
|
23131
23078
|
|
|
23132
|
-
|
|
23133
|
-
|
|
23079
|
+
this._themes = options.themes || defaultThemes
|
|
23080
|
+
this._theme = options.theme
|
|
23081
|
+
var theme = this._computeTheme(options.theme)
|
|
23082
|
+
var template = options.template || [
|
|
23083
|
+
{type: 'progressbar', length: 20},
|
|
23084
|
+
{type: 'activityIndicator', kerning: 1, length: 1},
|
|
23085
|
+
{type: 'section', kerning: 1, default: ''},
|
|
23086
|
+
{type: 'subsection', kerning: 1, default: ''}
|
|
23087
|
+
]
|
|
23088
|
+
this.setWriteTo(writeTo, options.tty)
|
|
23089
|
+
var PlumbingClass = options.Plumbing || Plumbing
|
|
23090
|
+
this._gauge = new PlumbingClass(theme, template, this.getWidth())
|
|
23134
23091
|
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
// add custom disposition as third element or keep it two elements if not
|
|
23138
|
-
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
23139
|
-
// if no content type. allow it to be empty array
|
|
23140
|
-
'Content-Type': [].concat(contentType || [])
|
|
23141
|
-
};
|
|
23142
|
-
|
|
23143
|
-
// allow custom headers.
|
|
23144
|
-
if (typeof options.header == 'object') {
|
|
23145
|
-
populate(headers, options.header);
|
|
23146
|
-
}
|
|
23147
|
-
|
|
23148
|
-
var header;
|
|
23149
|
-
for (var prop in headers) {
|
|
23150
|
-
if (!headers.hasOwnProperty(prop)) continue;
|
|
23151
|
-
header = headers[prop];
|
|
23152
|
-
|
|
23153
|
-
// skip nullish headers.
|
|
23154
|
-
if (header == null) {
|
|
23155
|
-
continue;
|
|
23156
|
-
}
|
|
23157
|
-
|
|
23158
|
-
// convert all headers to arrays.
|
|
23159
|
-
if (!Array.isArray(header)) {
|
|
23160
|
-
header = [header];
|
|
23161
|
-
}
|
|
23162
|
-
|
|
23163
|
-
// add non-empty headers.
|
|
23164
|
-
if (header.length) {
|
|
23165
|
-
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
|
|
23166
|
-
}
|
|
23167
|
-
}
|
|
23168
|
-
|
|
23169
|
-
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
23170
|
-
};
|
|
23171
|
-
|
|
23172
|
-
FormData.prototype._getContentDisposition = function(value, options) {
|
|
23173
|
-
|
|
23174
|
-
var filename
|
|
23175
|
-
, contentDisposition
|
|
23176
|
-
;
|
|
23177
|
-
|
|
23178
|
-
if (typeof options.filepath === 'string') {
|
|
23179
|
-
// custom filepath for relative paths
|
|
23180
|
-
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
23181
|
-
} else if (options.filename || value.name || value.path) {
|
|
23182
|
-
// custom filename take precedence
|
|
23183
|
-
// formidable and the browser add a name property
|
|
23184
|
-
// fs- and request- streams have path property
|
|
23185
|
-
filename = path.basename(options.filename || value.name || value.path);
|
|
23186
|
-
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
|
23187
|
-
// or try http response
|
|
23188
|
-
filename = path.basename(value.client._httpMessage.path);
|
|
23189
|
-
}
|
|
23190
|
-
|
|
23191
|
-
if (filename) {
|
|
23192
|
-
contentDisposition = 'filename="' + filename + '"';
|
|
23193
|
-
}
|
|
23194
|
-
|
|
23195
|
-
return contentDisposition;
|
|
23196
|
-
};
|
|
23197
|
-
|
|
23198
|
-
FormData.prototype._getContentType = function(value, options) {
|
|
23199
|
-
|
|
23200
|
-
// use custom content-type above all
|
|
23201
|
-
var contentType = options.contentType;
|
|
23202
|
-
|
|
23203
|
-
// or try `name` from formidable, browser
|
|
23204
|
-
if (!contentType && value.name) {
|
|
23205
|
-
contentType = mime.lookup(value.name);
|
|
23206
|
-
}
|
|
23207
|
-
|
|
23208
|
-
// or try `path` from fs-, request- streams
|
|
23209
|
-
if (!contentType && value.path) {
|
|
23210
|
-
contentType = mime.lookup(value.path);
|
|
23211
|
-
}
|
|
23212
|
-
|
|
23213
|
-
// or if it's http-reponse
|
|
23214
|
-
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
|
|
23215
|
-
contentType = value.headers['content-type'];
|
|
23216
|
-
}
|
|
23217
|
-
|
|
23218
|
-
// or guess it from the filepath or filename
|
|
23219
|
-
if (!contentType && (options.filepath || options.filename)) {
|
|
23220
|
-
contentType = mime.lookup(options.filepath || options.filename);
|
|
23221
|
-
}
|
|
23222
|
-
|
|
23223
|
-
// fallback to the default content type if `value` is not simple value
|
|
23224
|
-
if (!contentType && typeof value == 'object') {
|
|
23225
|
-
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
23226
|
-
}
|
|
23227
|
-
|
|
23228
|
-
return contentType;
|
|
23229
|
-
};
|
|
23230
|
-
|
|
23231
|
-
FormData.prototype._multiPartFooter = function() {
|
|
23232
|
-
return function(next) {
|
|
23233
|
-
var footer = FormData.LINE_BREAK;
|
|
23234
|
-
|
|
23235
|
-
var lastPart = (this._streams.length === 0);
|
|
23236
|
-
if (lastPart) {
|
|
23237
|
-
footer += this._lastBoundary();
|
|
23238
|
-
}
|
|
23239
|
-
|
|
23240
|
-
next(footer);
|
|
23241
|
-
}.bind(this);
|
|
23242
|
-
};
|
|
23243
|
-
|
|
23244
|
-
FormData.prototype._lastBoundary = function() {
|
|
23245
|
-
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
|
23246
|
-
};
|
|
23247
|
-
|
|
23248
|
-
FormData.prototype.getHeaders = function(userHeaders) {
|
|
23249
|
-
var header;
|
|
23250
|
-
var formHeaders = {
|
|
23251
|
-
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
23252
|
-
};
|
|
23253
|
-
|
|
23254
|
-
for (header in userHeaders) {
|
|
23255
|
-
if (userHeaders.hasOwnProperty(header)) {
|
|
23256
|
-
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
23257
|
-
}
|
|
23258
|
-
}
|
|
23259
|
-
|
|
23260
|
-
return formHeaders;
|
|
23261
|
-
};
|
|
23262
|
-
|
|
23263
|
-
FormData.prototype.getBoundary = function() {
|
|
23264
|
-
if (!this._boundary) {
|
|
23265
|
-
this._generateBoundary();
|
|
23266
|
-
}
|
|
23267
|
-
|
|
23268
|
-
return this._boundary;
|
|
23269
|
-
};
|
|
23270
|
-
|
|
23271
|
-
FormData.prototype._generateBoundary = function() {
|
|
23272
|
-
// This generates a 50 character boundary similar to those used by Firefox.
|
|
23273
|
-
// They are optimized for boyer-moore parsing.
|
|
23274
|
-
var boundary = '--------------------------';
|
|
23275
|
-
for (var i = 0; i < 24; i++) {
|
|
23276
|
-
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
23277
|
-
}
|
|
23278
|
-
|
|
23279
|
-
this._boundary = boundary;
|
|
23280
|
-
};
|
|
23281
|
-
|
|
23282
|
-
// Note: getLengthSync DOESN'T calculate streams length
|
|
23283
|
-
// As workaround one can calculate file size manually
|
|
23284
|
-
// and add it as knownLength option
|
|
23285
|
-
FormData.prototype.getLengthSync = function() {
|
|
23286
|
-
var knownLength = this._overheadLength + this._valueLength;
|
|
23287
|
-
|
|
23288
|
-
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
23289
|
-
// so it basically checks if there is any value added to the form
|
|
23290
|
-
if (this._streams.length) {
|
|
23291
|
-
knownLength += this._lastBoundary().length;
|
|
23292
|
-
}
|
|
23293
|
-
|
|
23294
|
-
// https://github.com/form-data/form-data/issues/40
|
|
23295
|
-
if (!this.hasKnownLength()) {
|
|
23296
|
-
// Some async length retrievers are present
|
|
23297
|
-
// therefore synchronous length calculation is false.
|
|
23298
|
-
// Please use getLength(callback) to get proper length
|
|
23299
|
-
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
23300
|
-
}
|
|
23301
|
-
|
|
23302
|
-
return knownLength;
|
|
23303
|
-
};
|
|
23304
|
-
|
|
23305
|
-
// Public API to check if length of added values is known
|
|
23306
|
-
// https://github.com/form-data/form-data/issues/196
|
|
23307
|
-
// https://github.com/form-data/form-data/issues/262
|
|
23308
|
-
FormData.prototype.hasKnownLength = function() {
|
|
23309
|
-
var hasKnownLength = true;
|
|
23310
|
-
|
|
23311
|
-
if (this._valuesToMeasure.length) {
|
|
23312
|
-
hasKnownLength = false;
|
|
23313
|
-
}
|
|
23314
|
-
|
|
23315
|
-
return hasKnownLength;
|
|
23316
|
-
};
|
|
23317
|
-
|
|
23318
|
-
FormData.prototype.getLength = function(cb) {
|
|
23319
|
-
var knownLength = this._overheadLength + this._valueLength;
|
|
23320
|
-
|
|
23321
|
-
if (this._streams.length) {
|
|
23322
|
-
knownLength += this._lastBoundary().length;
|
|
23323
|
-
}
|
|
23324
|
-
|
|
23325
|
-
if (!this._valuesToMeasure.length) {
|
|
23326
|
-
process.nextTick(cb.bind(this, null, knownLength));
|
|
23327
|
-
return;
|
|
23328
|
-
}
|
|
23329
|
-
|
|
23330
|
-
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
23331
|
-
if (err) {
|
|
23332
|
-
cb(err);
|
|
23333
|
-
return;
|
|
23334
|
-
}
|
|
23335
|
-
|
|
23336
|
-
values.forEach(function(length) {
|
|
23337
|
-
knownLength += length;
|
|
23338
|
-
});
|
|
23339
|
-
|
|
23340
|
-
cb(null, knownLength);
|
|
23341
|
-
});
|
|
23342
|
-
};
|
|
23343
|
-
|
|
23344
|
-
FormData.prototype.submit = function(params, cb) {
|
|
23345
|
-
var request
|
|
23346
|
-
, options
|
|
23347
|
-
, defaults = {method: 'post'}
|
|
23348
|
-
;
|
|
23349
|
-
|
|
23350
|
-
// parse provided url if it's string
|
|
23351
|
-
// or treat it as options object
|
|
23352
|
-
if (typeof params == 'string') {
|
|
23353
|
-
|
|
23354
|
-
params = parseUrl(params);
|
|
23355
|
-
options = populate({
|
|
23356
|
-
port: params.port,
|
|
23357
|
-
path: params.pathname,
|
|
23358
|
-
host: params.hostname,
|
|
23359
|
-
protocol: params.protocol
|
|
23360
|
-
}, defaults);
|
|
23361
|
-
|
|
23362
|
-
// use custom params
|
|
23363
|
-
} else {
|
|
23364
|
-
|
|
23365
|
-
options = populate(params, defaults);
|
|
23366
|
-
// if no port provided use default one
|
|
23367
|
-
if (!options.port) {
|
|
23368
|
-
options.port = options.protocol == 'https:' ? 443 : 80;
|
|
23369
|
-
}
|
|
23370
|
-
}
|
|
23371
|
-
|
|
23372
|
-
// put that good code in getHeaders to some use
|
|
23373
|
-
options.headers = this.getHeaders(params.headers);
|
|
23374
|
-
|
|
23375
|
-
// https if specified, fallback to http in any other case
|
|
23376
|
-
if (options.protocol == 'https:') {
|
|
23377
|
-
request = https.request(options);
|
|
23378
|
-
} else {
|
|
23379
|
-
request = http.request(options);
|
|
23380
|
-
}
|
|
23381
|
-
|
|
23382
|
-
// get content length and fire away
|
|
23383
|
-
this.getLength(function(err, length) {
|
|
23384
|
-
if (err) {
|
|
23385
|
-
this._error(err);
|
|
23386
|
-
return;
|
|
23387
|
-
}
|
|
23388
|
-
|
|
23389
|
-
// add content length
|
|
23390
|
-
request.setHeader('Content-Length', length);
|
|
23391
|
-
|
|
23392
|
-
this.pipe(request);
|
|
23393
|
-
if (cb) {
|
|
23394
|
-
request.on('error', cb);
|
|
23395
|
-
request.on('response', cb.bind(this, null));
|
|
23396
|
-
}
|
|
23397
|
-
}.bind(this));
|
|
23398
|
-
|
|
23399
|
-
return request;
|
|
23400
|
-
};
|
|
23401
|
-
|
|
23402
|
-
FormData.prototype._error = function(err) {
|
|
23403
|
-
if (!this.error) {
|
|
23404
|
-
this.error = err;
|
|
23405
|
-
this.pause();
|
|
23406
|
-
this.emit('error', err);
|
|
23407
|
-
}
|
|
23408
|
-
};
|
|
23409
|
-
|
|
23410
|
-
FormData.prototype.toString = function () {
|
|
23411
|
-
return '[object FormData]';
|
|
23412
|
-
};
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
/***/ }),
|
|
23416
|
-
|
|
23417
|
-
/***/ 10453:
|
|
23418
|
-
/***/ ((module) => {
|
|
23419
|
-
|
|
23420
|
-
// populates missing values
|
|
23421
|
-
module.exports = function(dst, src) {
|
|
23422
|
-
|
|
23423
|
-
Object.keys(src).forEach(function(prop)
|
|
23424
|
-
{
|
|
23425
|
-
dst[prop] = dst[prop] || src[prop];
|
|
23426
|
-
});
|
|
23427
|
-
|
|
23428
|
-
return dst;
|
|
23429
|
-
};
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
/***/ }),
|
|
23433
|
-
|
|
23434
|
-
/***/ 74608:
|
|
23435
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23436
|
-
|
|
23437
|
-
"use strict";
|
|
23438
|
-
|
|
23439
|
-
var spin = __webpack_require__(74365)
|
|
23440
|
-
var progressBar = __webpack_require__(8936)
|
|
23441
|
-
|
|
23442
|
-
module.exports = {
|
|
23443
|
-
activityIndicator: function (values, theme, width) {
|
|
23444
|
-
if (values.spun == null) return
|
|
23445
|
-
return spin(theme, values.spun)
|
|
23446
|
-
},
|
|
23447
|
-
progressbar: function (values, theme, width) {
|
|
23448
|
-
if (values.completed == null) return
|
|
23449
|
-
return progressBar(theme, width, values.completed)
|
|
23450
|
-
}
|
|
23451
|
-
}
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
/***/ }),
|
|
23455
|
-
|
|
23456
|
-
/***/ 15591:
|
|
23457
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
23458
|
-
|
|
23459
|
-
"use strict";
|
|
23460
|
-
|
|
23461
|
-
var util = __webpack_require__(31669)
|
|
23462
|
-
|
|
23463
|
-
var User = exports.User = function User (msg) {
|
|
23464
|
-
var err = new Error(msg)
|
|
23465
|
-
Error.captureStackTrace(err, User)
|
|
23466
|
-
err.code = 'EGAUGE'
|
|
23467
|
-
return err
|
|
23468
|
-
}
|
|
23469
|
-
|
|
23470
|
-
exports.MissingTemplateValue = function MissingTemplateValue (item, values) {
|
|
23471
|
-
var err = new User(util.format('Missing template value "%s"', item.type))
|
|
23472
|
-
Error.captureStackTrace(err, MissingTemplateValue)
|
|
23473
|
-
err.template = item
|
|
23474
|
-
err.values = values
|
|
23475
|
-
return err
|
|
23476
|
-
}
|
|
23477
|
-
|
|
23478
|
-
exports.Internal = function Internal (msg) {
|
|
23479
|
-
var err = new Error(msg)
|
|
23480
|
-
Error.captureStackTrace(err, Internal)
|
|
23481
|
-
err.code = 'EGAUGEINTERNAL'
|
|
23482
|
-
return err
|
|
23483
|
-
}
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
/***/ }),
|
|
23487
|
-
|
|
23488
|
-
/***/ 18029:
|
|
23489
|
-
/***/ ((module) => {
|
|
23490
|
-
|
|
23491
|
-
"use strict";
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
module.exports = isWin32() || isColorTerm()
|
|
23495
|
-
|
|
23496
|
-
function isWin32 () {
|
|
23497
|
-
return process.platform === 'win32'
|
|
23498
|
-
}
|
|
23499
|
-
|
|
23500
|
-
function isColorTerm () {
|
|
23501
|
-
var termHasColor = /^screen|^xterm|^vt100|color|ansi|cygwin|linux/i
|
|
23502
|
-
return !!process.env.COLORTERM || termHasColor.test(process.env.TERM)
|
|
23503
|
-
}
|
|
23504
|
-
|
|
23505
|
-
|
|
23506
|
-
/***/ }),
|
|
23507
|
-
|
|
23508
|
-
/***/ 1757:
|
|
23509
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
23510
|
-
|
|
23511
|
-
"use strict";
|
|
23512
|
-
|
|
23513
|
-
var Plumbing = __webpack_require__(17852)
|
|
23514
|
-
var hasUnicode = __webpack_require__(29253)
|
|
23515
|
-
var hasColor = __webpack_require__(18029)
|
|
23516
|
-
var onExit = __webpack_require__(40412)
|
|
23517
|
-
var defaultThemes = __webpack_require__(62834)
|
|
23518
|
-
var setInterval = __webpack_require__(29165)
|
|
23519
|
-
var process = __webpack_require__(22156)
|
|
23520
|
-
var setImmediate = __webpack_require__(48761)
|
|
23521
|
-
|
|
23522
|
-
module.exports = Gauge
|
|
23523
|
-
|
|
23524
|
-
function callWith (obj, method) {
|
|
23525
|
-
return function () {
|
|
23526
|
-
return method.call(obj)
|
|
23527
|
-
}
|
|
23528
|
-
}
|
|
23529
|
-
|
|
23530
|
-
function Gauge (arg1, arg2) {
|
|
23531
|
-
var options, writeTo
|
|
23532
|
-
if (arg1 && arg1.write) {
|
|
23533
|
-
writeTo = arg1
|
|
23534
|
-
options = arg2 || {}
|
|
23535
|
-
} else if (arg2 && arg2.write) {
|
|
23536
|
-
writeTo = arg2
|
|
23537
|
-
options = arg1 || {}
|
|
23538
|
-
} else {
|
|
23539
|
-
writeTo = process.stderr
|
|
23540
|
-
options = arg1 || arg2 || {}
|
|
23541
|
-
}
|
|
23542
|
-
|
|
23543
|
-
this._status = {
|
|
23544
|
-
spun: 0,
|
|
23545
|
-
section: '',
|
|
23546
|
-
subsection: ''
|
|
23547
|
-
}
|
|
23548
|
-
this._paused = false // are we paused for back pressure?
|
|
23549
|
-
this._disabled = true // are all progress bar updates disabled?
|
|
23550
|
-
this._showing = false // do we WANT the progress bar on screen
|
|
23551
|
-
this._onScreen = false // IS the progress bar on screen
|
|
23552
|
-
this._needsRedraw = false // should we print something at next tick?
|
|
23553
|
-
this._hideCursor = options.hideCursor == null ? true : options.hideCursor
|
|
23554
|
-
this._fixedFramerate = options.fixedFramerate == null
|
|
23555
|
-
? !(/^v0\.8\./.test(process.version))
|
|
23556
|
-
: options.fixedFramerate
|
|
23557
|
-
this._lastUpdateAt = null
|
|
23558
|
-
this._updateInterval = options.updateInterval == null ? 50 : options.updateInterval
|
|
23559
|
-
|
|
23560
|
-
this._themes = options.themes || defaultThemes
|
|
23561
|
-
this._theme = options.theme
|
|
23562
|
-
var theme = this._computeTheme(options.theme)
|
|
23563
|
-
var template = options.template || [
|
|
23564
|
-
{type: 'progressbar', length: 20},
|
|
23565
|
-
{type: 'activityIndicator', kerning: 1, length: 1},
|
|
23566
|
-
{type: 'section', kerning: 1, default: ''},
|
|
23567
|
-
{type: 'subsection', kerning: 1, default: ''}
|
|
23568
|
-
]
|
|
23569
|
-
this.setWriteTo(writeTo, options.tty)
|
|
23570
|
-
var PlumbingClass = options.Plumbing || Plumbing
|
|
23571
|
-
this._gauge = new PlumbingClass(theme, template, this.getWidth())
|
|
23572
|
-
|
|
23573
|
-
this._$$doRedraw = callWith(this, this._doRedraw)
|
|
23574
|
-
this._$$handleSizeChange = callWith(this, this._handleSizeChange)
|
|
23092
|
+
this._$$doRedraw = callWith(this, this._doRedraw)
|
|
23093
|
+
this._$$handleSizeChange = callWith(this, this._handleSizeChange)
|
|
23575
23094
|
|
|
23576
23095
|
this._cleanupOnExit = options.cleanupOnExit == null || options.cleanupOnExit
|
|
23577
23096
|
this._removeOnExit = null
|
|
@@ -29830,9 +29349,7 @@ function escapeJsonPtr(str) {
|
|
|
29830
29349
|
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
|
|
29831
29350
|
* JSONSchema Validator - Validates JavaScript objects using JSON Schemas
|
|
29832
29351
|
* (http://www.json.com/json-schema-proposal/)
|
|
29833
|
-
*
|
|
29834
|
-
* Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
|
|
29835
|
-
* Licensed under the MIT (MIT-LICENSE.txt) license.
|
|
29352
|
+
* Licensed under AFL-2.1 OR BSD-3-Clause
|
|
29836
29353
|
To use the validator call the validate function with an instance object and an optional schema object.
|
|
29837
29354
|
If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
|
|
29838
29355
|
that schema will be used to validate and the schema parameter is not necessary (if both exist,
|
|
@@ -29929,7 +29446,7 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
|
|
|
29929
29446
|
!(value instanceof Array && type == 'array') &&
|
|
29930
29447
|
!(value instanceof Date && type == 'date') &&
|
|
29931
29448
|
!(type == 'integer' && value%1===0)){
|
|
29932
|
-
return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
|
|
29449
|
+
return [{property:path,message:value + " - " + (typeof value) + " value found, but a " + type + " is required"}];
|
|
29933
29450
|
}
|
|
29934
29451
|
if(type instanceof Array){
|
|
29935
29452
|
var unionErrors=[];
|
|
@@ -29992,11 +29509,11 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
|
|
|
29992
29509
|
if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){
|
|
29993
29510
|
addError("must be at least " + schema.minLength + " characters long");
|
|
29994
29511
|
}
|
|
29995
|
-
if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum &&
|
|
29512
|
+
if(typeof schema.minimum !== 'undefined' && typeof value == typeof schema.minimum &&
|
|
29996
29513
|
schema.minimum > value){
|
|
29997
29514
|
addError("must have a minimum value of " + schema.minimum);
|
|
29998
29515
|
}
|
|
29999
|
-
if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum &&
|
|
29516
|
+
if(typeof schema.maximum !== 'undefined' && typeof value == typeof schema.maximum &&
|
|
30000
29517
|
schema.maximum < value){
|
|
30001
29518
|
addError("must have a maximum value of " + schema.maximum);
|
|
30002
29519
|
}
|
|
@@ -30031,8 +29548,8 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
|
|
|
30031
29548
|
}
|
|
30032
29549
|
|
|
30033
29550
|
for(var i in objTypeDef){
|
|
30034
|
-
if(objTypeDef.hasOwnProperty(i)){
|
|
30035
|
-
var value = instance[i];
|
|
29551
|
+
if(objTypeDef.hasOwnProperty(i) && i != '__proto__' && i != 'constructor'){
|
|
29552
|
+
var value = instance.hasOwnProperty(i) ? instance[i] : undefined;
|
|
30036
29553
|
// skip _not_ specified properties
|
|
30037
29554
|
if (value === undefined && options.existingOnly) continue;
|
|
30038
29555
|
var propDef = objTypeDef[i];
|
|
@@ -30053,7 +29570,7 @@ var validate = exports._validate = function(/*Any*/instance,/*Object*/schema,/*O
|
|
|
30053
29570
|
delete instance[i];
|
|
30054
29571
|
continue;
|
|
30055
29572
|
} else {
|
|
30056
|
-
errors.push({property:path,message:
|
|
29573
|
+
errors.push({property:path,message:"The property " + i +
|
|
30057
29574
|
" is not defined in the schema and the schema does not allow additional properties"});
|
|
30058
29575
|
}
|
|
30059
29576
|
}
|
|
@@ -36734,1747 +36251,2228 @@ module.exports = function (options) {
|
|
|
36734
36251
|
throw new TypeError(errorText + '.PromiseImpl');
|
|
36735
36252
|
}
|
|
36736
36253
|
|
|
36737
|
-
if (!isUndefined(options.constructorMixin) && !isFunction(options.constructorMixin)) {
|
|
36738
|
-
throw new TypeError(errorText + '.PromiseImpl');
|
|
36739
|
-
}
|
|
36254
|
+
if (!isUndefined(options.constructorMixin) && !isFunction(options.constructorMixin)) {
|
|
36255
|
+
throw new TypeError(errorText + '.PromiseImpl');
|
|
36256
|
+
}
|
|
36257
|
+
|
|
36258
|
+
var PromiseImpl = options.PromiseImpl;
|
|
36259
|
+
var constructorMixin = options.constructorMixin;
|
|
36260
|
+
|
|
36261
|
+
|
|
36262
|
+
var plumbing = {};
|
|
36263
|
+
|
|
36264
|
+
plumbing.init = function (requestOptions) {
|
|
36265
|
+
|
|
36266
|
+
var self = this;
|
|
36267
|
+
|
|
36268
|
+
self._rp_promise = new PromiseImpl(function (resolve, reject) {
|
|
36269
|
+
self._rp_resolve = resolve;
|
|
36270
|
+
self._rp_reject = reject;
|
|
36271
|
+
if (constructorMixin) {
|
|
36272
|
+
constructorMixin.apply(self, arguments); // Using arguments since specific Promise libraries may pass additional parameters
|
|
36273
|
+
}
|
|
36274
|
+
});
|
|
36275
|
+
|
|
36276
|
+
self._rp_callbackOrig = requestOptions.callback;
|
|
36277
|
+
requestOptions.callback = self.callback = function RP$callback(err, response, body) {
|
|
36278
|
+
plumbing.callback.call(self, err, response, body);
|
|
36279
|
+
};
|
|
36280
|
+
|
|
36281
|
+
if (isString(requestOptions.method)) {
|
|
36282
|
+
requestOptions.method = requestOptions.method.toUpperCase();
|
|
36283
|
+
}
|
|
36284
|
+
|
|
36285
|
+
requestOptions.transform = requestOptions.transform || plumbing.defaultTransformations[requestOptions.method];
|
|
36286
|
+
|
|
36287
|
+
self._rp_options = requestOptions;
|
|
36288
|
+
self._rp_options.simple = requestOptions.simple !== false;
|
|
36289
|
+
self._rp_options.resolveWithFullResponse = requestOptions.resolveWithFullResponse === true;
|
|
36290
|
+
self._rp_options.transform2xxOnly = requestOptions.transform2xxOnly === true;
|
|
36291
|
+
|
|
36292
|
+
};
|
|
36293
|
+
|
|
36294
|
+
plumbing.defaultTransformations = {
|
|
36295
|
+
HEAD: function (body, response, resolveWithFullResponse) {
|
|
36296
|
+
return resolveWithFullResponse ? response : response.headers;
|
|
36297
|
+
}
|
|
36298
|
+
};
|
|
36299
|
+
|
|
36300
|
+
plumbing.callback = function (err, response, body) {
|
|
36301
|
+
|
|
36302
|
+
var self = this;
|
|
36303
|
+
|
|
36304
|
+
var origCallbackThrewException = false, thrownException = null;
|
|
36305
|
+
|
|
36306
|
+
if (isFunction(self._rp_callbackOrig)) {
|
|
36307
|
+
try {
|
|
36308
|
+
self._rp_callbackOrig.apply(self, arguments); // TODO: Apply to self mimics behavior of request@2. Is that also right for request@next?
|
|
36309
|
+
} catch (e) {
|
|
36310
|
+
origCallbackThrewException = true;
|
|
36311
|
+
thrownException = e;
|
|
36312
|
+
}
|
|
36313
|
+
}
|
|
36314
|
+
|
|
36315
|
+
var is2xx = !err && /^2/.test('' + response.statusCode);
|
|
36316
|
+
|
|
36317
|
+
if (err) {
|
|
36318
|
+
|
|
36319
|
+
self._rp_reject(new errors.RequestError(err, self._rp_options, response));
|
|
36320
|
+
|
|
36321
|
+
} else if (self._rp_options.simple && !is2xx) {
|
|
36322
|
+
|
|
36323
|
+
if (isFunction(self._rp_options.transform) && self._rp_options.transform2xxOnly === false) {
|
|
36324
|
+
|
|
36325
|
+
(new PromiseImpl(function (resolve) {
|
|
36326
|
+
resolve(self._rp_options.transform(body, response, self._rp_options.resolveWithFullResponse)); // transform may return a Promise
|
|
36327
|
+
}))
|
|
36328
|
+
.then(function (transformedResponse) {
|
|
36329
|
+
self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, transformedResponse));
|
|
36330
|
+
})
|
|
36331
|
+
.catch(function (transformErr) {
|
|
36332
|
+
self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
|
|
36333
|
+
});
|
|
36334
|
+
|
|
36335
|
+
} else {
|
|
36336
|
+
self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, response));
|
|
36337
|
+
}
|
|
36338
|
+
|
|
36339
|
+
} else {
|
|
36340
|
+
|
|
36341
|
+
if (isFunction(self._rp_options.transform) && (is2xx || self._rp_options.transform2xxOnly === false)) {
|
|
36342
|
+
|
|
36343
|
+
(new PromiseImpl(function (resolve) {
|
|
36344
|
+
resolve(self._rp_options.transform(body, response, self._rp_options.resolveWithFullResponse)); // transform may return a Promise
|
|
36345
|
+
}))
|
|
36346
|
+
.then(function (transformedResponse) {
|
|
36347
|
+
self._rp_resolve(transformedResponse);
|
|
36348
|
+
})
|
|
36349
|
+
.catch(function (transformErr) {
|
|
36350
|
+
self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
|
|
36351
|
+
});
|
|
36352
|
+
|
|
36353
|
+
} else if (self._rp_options.resolveWithFullResponse) {
|
|
36354
|
+
self._rp_resolve(response);
|
|
36355
|
+
} else {
|
|
36356
|
+
self._rp_resolve(body);
|
|
36357
|
+
}
|
|
36358
|
+
|
|
36359
|
+
}
|
|
36360
|
+
|
|
36361
|
+
if (origCallbackThrewException) {
|
|
36362
|
+
throw thrownException;
|
|
36363
|
+
}
|
|
36364
|
+
|
|
36365
|
+
};
|
|
36366
|
+
|
|
36367
|
+
plumbing.exposePromiseMethod = function (exposeTo, bindTo, promisePropertyKey, methodToExpose, exposeAs) {
|
|
36368
|
+
|
|
36369
|
+
exposeAs = exposeAs || methodToExpose;
|
|
36370
|
+
|
|
36371
|
+
if (exposeAs in exposeTo) {
|
|
36372
|
+
throw new Error('Unable to expose method "' + exposeAs + '"');
|
|
36373
|
+
}
|
|
36374
|
+
|
|
36375
|
+
exposeTo[exposeAs] = function RP$exposed() {
|
|
36376
|
+
var self = bindTo || this;
|
|
36377
|
+
return self[promisePropertyKey][methodToExpose].apply(self[promisePropertyKey], arguments);
|
|
36378
|
+
};
|
|
36379
|
+
|
|
36380
|
+
};
|
|
36381
|
+
|
|
36382
|
+
plumbing.exposePromise = function (exposeTo, bindTo, promisePropertyKey, exposeAs) {
|
|
36383
|
+
|
|
36384
|
+
exposeAs = exposeAs || 'promise';
|
|
36385
|
+
|
|
36386
|
+
if (exposeAs in exposeTo) {
|
|
36387
|
+
throw new Error('Unable to expose method "' + exposeAs + '"');
|
|
36388
|
+
}
|
|
36389
|
+
|
|
36390
|
+
exposeTo[exposeAs] = function RP$promise() {
|
|
36391
|
+
var self = bindTo || this;
|
|
36392
|
+
return self[promisePropertyKey];
|
|
36393
|
+
};
|
|
36394
|
+
|
|
36395
|
+
};
|
|
36396
|
+
|
|
36397
|
+
return plumbing;
|
|
36398
|
+
|
|
36399
|
+
};
|
|
36400
|
+
|
|
36401
|
+
|
|
36402
|
+
/***/ }),
|
|
36403
|
+
|
|
36404
|
+
/***/ 19602:
|
|
36405
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
36406
|
+
|
|
36407
|
+
"use strict";
|
|
36408
|
+
/* module decorator */ module = __webpack_require__.nmd(module);
|
|
36409
|
+
|
|
36410
|
+
|
|
36411
|
+
var Bluebird = __webpack_require__(56102).getNewLibraryCopy(),
|
|
36412
|
+
configure = __webpack_require__(49531),
|
|
36413
|
+
stealthyRequire = __webpack_require__(81303);
|
|
36414
|
+
|
|
36415
|
+
try {
|
|
36416
|
+
|
|
36417
|
+
// Load Request freshly - so that users can require an unaltered request instance!
|
|
36418
|
+
var request = stealthyRequire(__webpack_require__.c, function () {
|
|
36419
|
+
return __webpack_require__(27761);
|
|
36420
|
+
},
|
|
36421
|
+
function () {
|
|
36422
|
+
__webpack_require__(98913);
|
|
36423
|
+
}, module);
|
|
36424
|
+
|
|
36425
|
+
} catch (err) {
|
|
36426
|
+
/* istanbul ignore next */
|
|
36427
|
+
var EOL = __webpack_require__(12087).EOL;
|
|
36428
|
+
/* istanbul ignore next */
|
|
36429
|
+
console.error(EOL + '###' + EOL + '### The "request" library is not installed automatically anymore.' + EOL + '### But is a dependency of "request-promise".' + EOL + '### Please install it with:' + EOL + '### npm install request --save' + EOL + '###' + EOL);
|
|
36430
|
+
/* istanbul ignore next */
|
|
36431
|
+
throw err;
|
|
36432
|
+
}
|
|
36433
|
+
|
|
36434
|
+
Bluebird.config({cancellation: true});
|
|
36435
|
+
|
|
36436
|
+
configure({
|
|
36437
|
+
request: request,
|
|
36438
|
+
PromiseImpl: Bluebird,
|
|
36439
|
+
expose: [
|
|
36440
|
+
'then',
|
|
36441
|
+
'catch',
|
|
36442
|
+
'finally',
|
|
36443
|
+
'cancel',
|
|
36444
|
+
'promise'
|
|
36445
|
+
// Would you like to expose more Bluebird methods? Try e.g. `rp(...).promise().tap(...)` first. `.promise()` returns the full-fledged Bluebird promise.
|
|
36446
|
+
],
|
|
36447
|
+
constructorMixin: function (resolve, reject, onCancel) {
|
|
36448
|
+
var self = this;
|
|
36449
|
+
onCancel(function () {
|
|
36450
|
+
self.abort();
|
|
36451
|
+
});
|
|
36452
|
+
}
|
|
36453
|
+
});
|
|
36454
|
+
|
|
36455
|
+
request.bindCLS = function RP$bindCLS() {
|
|
36456
|
+
throw new Error('CLS support was dropped. To get it back read: https://github.com/request/request-promise/wiki/Getting-Back-Support-for-Continuation-Local-Storage');
|
|
36457
|
+
};
|
|
36458
|
+
|
|
36459
|
+
|
|
36460
|
+
module.exports = request;
|
|
36461
|
+
|
|
36462
|
+
|
|
36463
|
+
/***/ }),
|
|
36464
|
+
|
|
36465
|
+
/***/ 27761:
|
|
36466
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
36467
|
+
|
|
36468
|
+
"use strict";
|
|
36469
|
+
// Copyright 2010-2012 Mikeal Rogers
|
|
36470
|
+
//
|
|
36471
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
36472
|
+
// you may not use this file except in compliance with the License.
|
|
36473
|
+
// You may obtain a copy of the License at
|
|
36474
|
+
//
|
|
36475
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
36476
|
+
//
|
|
36477
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
36478
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
36479
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36480
|
+
// See the License for the specific language governing permissions and
|
|
36481
|
+
// limitations under the License.
|
|
36482
|
+
|
|
36740
36483
|
|
|
36741
|
-
var PromiseImpl = options.PromiseImpl;
|
|
36742
|
-
var constructorMixin = options.constructorMixin;
|
|
36743
36484
|
|
|
36485
|
+
var extend = __webpack_require__(51302)
|
|
36486
|
+
var cookies = __webpack_require__(77225)
|
|
36487
|
+
var helpers = __webpack_require__(73093)
|
|
36744
36488
|
|
|
36745
|
-
|
|
36489
|
+
var paramsHaveRequestBody = helpers.paramsHaveRequestBody
|
|
36746
36490
|
|
|
36747
|
-
|
|
36491
|
+
// organize params for patch, post, put, head, del
|
|
36492
|
+
function initParams (uri, options, callback) {
|
|
36493
|
+
if (typeof options === 'function') {
|
|
36494
|
+
callback = options
|
|
36495
|
+
}
|
|
36748
36496
|
|
|
36749
|
-
|
|
36497
|
+
var params = {}
|
|
36498
|
+
if (options !== null && typeof options === 'object') {
|
|
36499
|
+
extend(params, options, {uri: uri})
|
|
36500
|
+
} else if (typeof uri === 'string') {
|
|
36501
|
+
extend(params, {uri: uri})
|
|
36502
|
+
} else {
|
|
36503
|
+
extend(params, uri)
|
|
36504
|
+
}
|
|
36750
36505
|
|
|
36751
|
-
|
|
36752
|
-
|
|
36753
|
-
|
|
36754
|
-
if (constructorMixin) {
|
|
36755
|
-
constructorMixin.apply(self, arguments); // Using arguments since specific Promise libraries may pass additional parameters
|
|
36756
|
-
}
|
|
36757
|
-
});
|
|
36506
|
+
params.callback = callback || params.callback
|
|
36507
|
+
return params
|
|
36508
|
+
}
|
|
36758
36509
|
|
|
36759
|
-
|
|
36760
|
-
|
|
36761
|
-
|
|
36762
|
-
|
|
36510
|
+
function request (uri, options, callback) {
|
|
36511
|
+
if (typeof uri === 'undefined') {
|
|
36512
|
+
throw new Error('undefined is not a valid uri or options object.')
|
|
36513
|
+
}
|
|
36763
36514
|
|
|
36764
|
-
|
|
36765
|
-
requestOptions.method = requestOptions.method.toUpperCase();
|
|
36766
|
-
}
|
|
36515
|
+
var params = initParams(uri, options, callback)
|
|
36767
36516
|
|
|
36768
|
-
|
|
36517
|
+
if (params.method === 'HEAD' && paramsHaveRequestBody(params)) {
|
|
36518
|
+
throw new Error('HTTP HEAD requests MUST NOT include a request body.')
|
|
36519
|
+
}
|
|
36769
36520
|
|
|
36770
|
-
|
|
36771
|
-
|
|
36772
|
-
self._rp_options.resolveWithFullResponse = requestOptions.resolveWithFullResponse === true;
|
|
36773
|
-
self._rp_options.transform2xxOnly = requestOptions.transform2xxOnly === true;
|
|
36521
|
+
return new request.Request(params)
|
|
36522
|
+
}
|
|
36774
36523
|
|
|
36775
|
-
|
|
36524
|
+
function verbFunc (verb) {
|
|
36525
|
+
var method = verb.toUpperCase()
|
|
36526
|
+
return function (uri, options, callback) {
|
|
36527
|
+
var params = initParams(uri, options, callback)
|
|
36528
|
+
params.method = method
|
|
36529
|
+
return request(params, params.callback)
|
|
36530
|
+
}
|
|
36531
|
+
}
|
|
36776
36532
|
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36533
|
+
// define like this to please codeintel/intellisense IDEs
|
|
36534
|
+
request.get = verbFunc('get')
|
|
36535
|
+
request.head = verbFunc('head')
|
|
36536
|
+
request.options = verbFunc('options')
|
|
36537
|
+
request.post = verbFunc('post')
|
|
36538
|
+
request.put = verbFunc('put')
|
|
36539
|
+
request.patch = verbFunc('patch')
|
|
36540
|
+
request.del = verbFunc('delete')
|
|
36541
|
+
request['delete'] = verbFunc('delete')
|
|
36782
36542
|
|
|
36783
|
-
|
|
36543
|
+
request.jar = function (store) {
|
|
36544
|
+
return cookies.jar(store)
|
|
36545
|
+
}
|
|
36784
36546
|
|
|
36785
|
-
|
|
36547
|
+
request.cookie = function (str) {
|
|
36548
|
+
return cookies.parse(str)
|
|
36549
|
+
}
|
|
36786
36550
|
|
|
36787
|
-
|
|
36551
|
+
function wrapRequestMethod (method, options, requester, verb) {
|
|
36552
|
+
return function (uri, opts, callback) {
|
|
36553
|
+
var params = initParams(uri, opts, callback)
|
|
36788
36554
|
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
self._rp_callbackOrig.apply(self, arguments); // TODO: Apply to self mimics behavior of request@2. Is that also right for request@next?
|
|
36792
|
-
} catch (e) {
|
|
36793
|
-
origCallbackThrewException = true;
|
|
36794
|
-
thrownException = e;
|
|
36795
|
-
}
|
|
36796
|
-
}
|
|
36555
|
+
var target = {}
|
|
36556
|
+
extend(true, target, options, params)
|
|
36797
36557
|
|
|
36798
|
-
|
|
36558
|
+
target.pool = params.pool || options.pool
|
|
36799
36559
|
|
|
36800
|
-
|
|
36560
|
+
if (verb) {
|
|
36561
|
+
target.method = verb.toUpperCase()
|
|
36562
|
+
}
|
|
36801
36563
|
|
|
36802
|
-
|
|
36564
|
+
if (typeof requester === 'function') {
|
|
36565
|
+
method = requester
|
|
36566
|
+
}
|
|
36803
36567
|
|
|
36804
|
-
|
|
36568
|
+
return method(target, target.callback)
|
|
36569
|
+
}
|
|
36570
|
+
}
|
|
36805
36571
|
|
|
36806
|
-
|
|
36572
|
+
request.defaults = function (options, requester) {
|
|
36573
|
+
var self = this
|
|
36807
36574
|
|
|
36808
|
-
|
|
36809
|
-
resolve(self._rp_options.transform(body, response, self._rp_options.resolveWithFullResponse)); // transform may return a Promise
|
|
36810
|
-
}))
|
|
36811
|
-
.then(function (transformedResponse) {
|
|
36812
|
-
self._rp_reject(new errors.StatusCodeError(response.statusCode, body, self._rp_options, transformedResponse));
|
|
36813
|
-
})
|
|
36814
|
-
.catch(function (transformErr) {
|
|
36815
|
-
self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
|
|
36816
|
-
});
|
|
36575
|
+
options = options || {}
|
|
36817
36576
|
|
|
36818
|
-
|
|
36819
|
-
|
|
36820
|
-
|
|
36577
|
+
if (typeof options === 'function') {
|
|
36578
|
+
requester = options
|
|
36579
|
+
options = {}
|
|
36580
|
+
}
|
|
36821
36581
|
|
|
36822
|
-
|
|
36582
|
+
var defaults = wrapRequestMethod(self, options, requester)
|
|
36823
36583
|
|
|
36824
|
-
|
|
36584
|
+
var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete']
|
|
36585
|
+
verbs.forEach(function (verb) {
|
|
36586
|
+
defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
|
|
36587
|
+
})
|
|
36825
36588
|
|
|
36826
|
-
|
|
36827
|
-
|
|
36828
|
-
|
|
36829
|
-
|
|
36830
|
-
|
|
36831
|
-
})
|
|
36832
|
-
.catch(function (transformErr) {
|
|
36833
|
-
self._rp_reject(new errors.TransformError(transformErr, self._rp_options, response));
|
|
36834
|
-
});
|
|
36589
|
+
defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
|
|
36590
|
+
defaults.jar = self.jar
|
|
36591
|
+
defaults.defaults = self.defaults
|
|
36592
|
+
return defaults
|
|
36593
|
+
}
|
|
36835
36594
|
|
|
36836
|
-
|
|
36837
|
-
|
|
36838
|
-
|
|
36839
|
-
|
|
36840
|
-
|
|
36595
|
+
request.forever = function (agentOptions, optionsArg) {
|
|
36596
|
+
var options = {}
|
|
36597
|
+
if (optionsArg) {
|
|
36598
|
+
extend(options, optionsArg)
|
|
36599
|
+
}
|
|
36600
|
+
if (agentOptions) {
|
|
36601
|
+
options.agentOptions = agentOptions
|
|
36602
|
+
}
|
|
36841
36603
|
|
|
36842
|
-
|
|
36604
|
+
options.forever = true
|
|
36605
|
+
return request.defaults(options)
|
|
36606
|
+
}
|
|
36843
36607
|
|
|
36844
|
-
|
|
36845
|
-
throw thrownException;
|
|
36846
|
-
}
|
|
36608
|
+
// Exports
|
|
36847
36609
|
|
|
36848
|
-
|
|
36610
|
+
module.exports = request
|
|
36611
|
+
request.Request = __webpack_require__(80946)
|
|
36612
|
+
request.initParams = initParams
|
|
36849
36613
|
|
|
36850
|
-
|
|
36614
|
+
// Backwards compatibility for request.debug
|
|
36615
|
+
Object.defineProperty(request, 'debug', {
|
|
36616
|
+
enumerable: true,
|
|
36617
|
+
get: function () {
|
|
36618
|
+
return request.Request.debug
|
|
36619
|
+
},
|
|
36620
|
+
set: function (debug) {
|
|
36621
|
+
request.Request.debug = debug
|
|
36622
|
+
}
|
|
36623
|
+
})
|
|
36851
36624
|
|
|
36852
|
-
exposeAs = exposeAs || methodToExpose;
|
|
36853
36625
|
|
|
36854
|
-
|
|
36855
|
-
throw new Error('Unable to expose method "' + exposeAs + '"');
|
|
36856
|
-
}
|
|
36626
|
+
/***/ }),
|
|
36857
36627
|
|
|
36858
|
-
|
|
36859
|
-
|
|
36860
|
-
return self[promisePropertyKey][methodToExpose].apply(self[promisePropertyKey], arguments);
|
|
36861
|
-
};
|
|
36628
|
+
/***/ 13350:
|
|
36629
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
36862
36630
|
|
|
36863
|
-
|
|
36631
|
+
"use strict";
|
|
36864
36632
|
|
|
36865
|
-
plumbing.exposePromise = function (exposeTo, bindTo, promisePropertyKey, exposeAs) {
|
|
36866
36633
|
|
|
36867
|
-
|
|
36634
|
+
var caseless = __webpack_require__(72464)
|
|
36635
|
+
var uuid = __webpack_require__(69355)
|
|
36636
|
+
var helpers = __webpack_require__(73093)
|
|
36868
36637
|
|
|
36869
|
-
|
|
36870
|
-
|
|
36871
|
-
}
|
|
36638
|
+
var md5 = helpers.md5
|
|
36639
|
+
var toBase64 = helpers.toBase64
|
|
36872
36640
|
|
|
36873
|
-
|
|
36874
|
-
|
|
36875
|
-
|
|
36876
|
-
|
|
36641
|
+
function Auth (request) {
|
|
36642
|
+
// define all public properties here
|
|
36643
|
+
this.request = request
|
|
36644
|
+
this.hasAuth = false
|
|
36645
|
+
this.sentAuth = false
|
|
36646
|
+
this.bearerToken = null
|
|
36647
|
+
this.user = null
|
|
36648
|
+
this.pass = null
|
|
36649
|
+
}
|
|
36877
36650
|
|
|
36878
|
-
|
|
36651
|
+
Auth.prototype.basic = function (user, pass, sendImmediately) {
|
|
36652
|
+
var self = this
|
|
36653
|
+
if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
|
|
36654
|
+
self.request.emit('error', new Error('auth() received invalid user or password'))
|
|
36655
|
+
}
|
|
36656
|
+
self.user = user
|
|
36657
|
+
self.pass = pass
|
|
36658
|
+
self.hasAuth = true
|
|
36659
|
+
var header = user + ':' + (pass || '')
|
|
36660
|
+
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
|
36661
|
+
var authHeader = 'Basic ' + toBase64(header)
|
|
36662
|
+
self.sentAuth = true
|
|
36663
|
+
return authHeader
|
|
36664
|
+
}
|
|
36665
|
+
}
|
|
36666
|
+
|
|
36667
|
+
Auth.prototype.bearer = function (bearer, sendImmediately) {
|
|
36668
|
+
var self = this
|
|
36669
|
+
self.bearerToken = bearer
|
|
36670
|
+
self.hasAuth = true
|
|
36671
|
+
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
|
36672
|
+
if (typeof bearer === 'function') {
|
|
36673
|
+
bearer = bearer()
|
|
36674
|
+
}
|
|
36675
|
+
var authHeader = 'Bearer ' + (bearer || '')
|
|
36676
|
+
self.sentAuth = true
|
|
36677
|
+
return authHeader
|
|
36678
|
+
}
|
|
36679
|
+
}
|
|
36879
36680
|
|
|
36880
|
-
|
|
36681
|
+
Auth.prototype.digest = function (method, path, authHeader) {
|
|
36682
|
+
// TODO: More complete implementation of RFC 2617.
|
|
36683
|
+
// - handle challenge.domain
|
|
36684
|
+
// - support qop="auth-int" only
|
|
36685
|
+
// - handle Authentication-Info (not necessarily?)
|
|
36686
|
+
// - check challenge.stale (not necessarily?)
|
|
36687
|
+
// - increase nc (not necessarily?)
|
|
36688
|
+
// For reference:
|
|
36689
|
+
// http://tools.ietf.org/html/rfc2617#section-3
|
|
36690
|
+
// https://github.com/bagder/curl/blob/master/lib/http_digest.c
|
|
36881
36691
|
|
|
36882
|
-
|
|
36692
|
+
var self = this
|
|
36883
36693
|
|
|
36694
|
+
var challenge = {}
|
|
36695
|
+
var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi
|
|
36696
|
+
while (true) {
|
|
36697
|
+
var match = re.exec(authHeader)
|
|
36698
|
+
if (!match) {
|
|
36699
|
+
break
|
|
36700
|
+
}
|
|
36701
|
+
challenge[match[1]] = match[2] || match[3]
|
|
36702
|
+
}
|
|
36884
36703
|
|
|
36885
|
-
|
|
36704
|
+
/**
|
|
36705
|
+
* RFC 2617: handle both MD5 and MD5-sess algorithms.
|
|
36706
|
+
*
|
|
36707
|
+
* If the algorithm directive's value is "MD5" or unspecified, then HA1 is
|
|
36708
|
+
* HA1=MD5(username:realm:password)
|
|
36709
|
+
* If the algorithm directive's value is "MD5-sess", then HA1 is
|
|
36710
|
+
* HA1=MD5(MD5(username:realm:password):nonce:cnonce)
|
|
36711
|
+
*/
|
|
36712
|
+
var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) {
|
|
36713
|
+
var ha1 = md5(user + ':' + realm + ':' + pass)
|
|
36714
|
+
if (algorithm && algorithm.toLowerCase() === 'md5-sess') {
|
|
36715
|
+
return md5(ha1 + ':' + nonce + ':' + cnonce)
|
|
36716
|
+
} else {
|
|
36717
|
+
return ha1
|
|
36718
|
+
}
|
|
36719
|
+
}
|
|
36886
36720
|
|
|
36887
|
-
|
|
36888
|
-
|
|
36721
|
+
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
|
|
36722
|
+
var nc = qop && '00000001'
|
|
36723
|
+
var cnonce = qop && uuid().replace(/-/g, '')
|
|
36724
|
+
var ha1 = ha1Compute(challenge.algorithm, self.user, challenge.realm, self.pass, challenge.nonce, cnonce)
|
|
36725
|
+
var ha2 = md5(method + ':' + path)
|
|
36726
|
+
var digestResponse = qop
|
|
36727
|
+
? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2)
|
|
36728
|
+
: md5(ha1 + ':' + challenge.nonce + ':' + ha2)
|
|
36729
|
+
var authValues = {
|
|
36730
|
+
username: self.user,
|
|
36731
|
+
realm: challenge.realm,
|
|
36732
|
+
nonce: challenge.nonce,
|
|
36733
|
+
uri: path,
|
|
36734
|
+
qop: qop,
|
|
36735
|
+
response: digestResponse,
|
|
36736
|
+
nc: nc,
|
|
36737
|
+
cnonce: cnonce,
|
|
36738
|
+
algorithm: challenge.algorithm,
|
|
36739
|
+
opaque: challenge.opaque
|
|
36740
|
+
}
|
|
36889
36741
|
|
|
36890
|
-
|
|
36891
|
-
|
|
36742
|
+
authHeader = []
|
|
36743
|
+
for (var k in authValues) {
|
|
36744
|
+
if (authValues[k]) {
|
|
36745
|
+
if (k === 'qop' || k === 'nc' || k === 'algorithm') {
|
|
36746
|
+
authHeader.push(k + '=' + authValues[k])
|
|
36747
|
+
} else {
|
|
36748
|
+
authHeader.push(k + '="' + authValues[k] + '"')
|
|
36749
|
+
}
|
|
36750
|
+
}
|
|
36751
|
+
}
|
|
36752
|
+
authHeader = 'Digest ' + authHeader.join(', ')
|
|
36753
|
+
self.sentAuth = true
|
|
36754
|
+
return authHeader
|
|
36755
|
+
}
|
|
36892
36756
|
|
|
36757
|
+
Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
|
|
36758
|
+
var self = this
|
|
36759
|
+
var request = self.request
|
|
36893
36760
|
|
|
36894
|
-
var
|
|
36895
|
-
|
|
36896
|
-
|
|
36761
|
+
var authHeader
|
|
36762
|
+
if (bearer === undefined && user === undefined) {
|
|
36763
|
+
self.request.emit('error', new Error('no auth mechanism defined'))
|
|
36764
|
+
} else if (bearer !== undefined) {
|
|
36765
|
+
authHeader = self.bearer(bearer, sendImmediately)
|
|
36766
|
+
} else {
|
|
36767
|
+
authHeader = self.basic(user, pass, sendImmediately)
|
|
36768
|
+
}
|
|
36769
|
+
if (authHeader) {
|
|
36770
|
+
request.setHeader('authorization', authHeader)
|
|
36771
|
+
}
|
|
36772
|
+
}
|
|
36897
36773
|
|
|
36898
|
-
|
|
36774
|
+
Auth.prototype.onResponse = function (response) {
|
|
36775
|
+
var self = this
|
|
36776
|
+
var request = self.request
|
|
36899
36777
|
|
|
36900
|
-
|
|
36901
|
-
var request = stealthyRequire(__webpack_require__.c, function () {
|
|
36902
|
-
return __webpack_require__(27761);
|
|
36903
|
-
},
|
|
36904
|
-
function () {
|
|
36905
|
-
__webpack_require__(98913);
|
|
36906
|
-
}, module);
|
|
36778
|
+
if (!self.hasAuth || self.sentAuth) { return null }
|
|
36907
36779
|
|
|
36908
|
-
|
|
36909
|
-
/* istanbul ignore next */
|
|
36910
|
-
var EOL = __webpack_require__(12087).EOL;
|
|
36911
|
-
/* istanbul ignore next */
|
|
36912
|
-
console.error(EOL + '###' + EOL + '### The "request" library is not installed automatically anymore.' + EOL + '### But is a dependency of "request-promise".' + EOL + '### Please install it with:' + EOL + '### npm install request --save' + EOL + '###' + EOL);
|
|
36913
|
-
/* istanbul ignore next */
|
|
36914
|
-
throw err;
|
|
36915
|
-
}
|
|
36780
|
+
var c = caseless(response.headers)
|
|
36916
36781
|
|
|
36917
|
-
|
|
36782
|
+
var authHeader = c.get('www-authenticate')
|
|
36783
|
+
var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase()
|
|
36784
|
+
request.debug('reauth', authVerb)
|
|
36918
36785
|
|
|
36919
|
-
|
|
36920
|
-
|
|
36921
|
-
|
|
36922
|
-
expose: [
|
|
36923
|
-
'then',
|
|
36924
|
-
'catch',
|
|
36925
|
-
'finally',
|
|
36926
|
-
'cancel',
|
|
36927
|
-
'promise'
|
|
36928
|
-
// Would you like to expose more Bluebird methods? Try e.g. `rp(...).promise().tap(...)` first. `.promise()` returns the full-fledged Bluebird promise.
|
|
36929
|
-
],
|
|
36930
|
-
constructorMixin: function (resolve, reject, onCancel) {
|
|
36931
|
-
var self = this;
|
|
36932
|
-
onCancel(function () {
|
|
36933
|
-
self.abort();
|
|
36934
|
-
});
|
|
36935
|
-
}
|
|
36936
|
-
});
|
|
36786
|
+
switch (authVerb) {
|
|
36787
|
+
case 'basic':
|
|
36788
|
+
return self.basic(self.user, self.pass, true)
|
|
36937
36789
|
|
|
36938
|
-
|
|
36939
|
-
|
|
36940
|
-
};
|
|
36790
|
+
case 'bearer':
|
|
36791
|
+
return self.bearer(self.bearerToken, true)
|
|
36941
36792
|
|
|
36793
|
+
case 'digest':
|
|
36794
|
+
return self.digest(request.method, request.path, authHeader)
|
|
36795
|
+
}
|
|
36796
|
+
}
|
|
36942
36797
|
|
|
36943
|
-
|
|
36798
|
+
exports.g = Auth
|
|
36944
36799
|
|
|
36945
36800
|
|
|
36946
36801
|
/***/ }),
|
|
36947
36802
|
|
|
36948
|
-
/***/
|
|
36949
|
-
/***/ ((
|
|
36803
|
+
/***/ 77225:
|
|
36804
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
36950
36805
|
|
|
36951
36806
|
"use strict";
|
|
36952
|
-
// Copyright 2010-2012 Mikeal Rogers
|
|
36953
|
-
//
|
|
36954
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
36955
|
-
// you may not use this file except in compliance with the License.
|
|
36956
|
-
// You may obtain a copy of the License at
|
|
36957
|
-
//
|
|
36958
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
36959
|
-
//
|
|
36960
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
36961
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
36962
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36963
|
-
// See the License for the specific language governing permissions and
|
|
36964
|
-
// limitations under the License.
|
|
36965
|
-
|
|
36966
36807
|
|
|
36967
36808
|
|
|
36968
|
-
var
|
|
36969
|
-
var cookies = __webpack_require__(77225)
|
|
36970
|
-
var helpers = __webpack_require__(73093)
|
|
36809
|
+
var tough = __webpack_require__(98913)
|
|
36971
36810
|
|
|
36972
|
-
var
|
|
36811
|
+
var Cookie = tough.Cookie
|
|
36812
|
+
var CookieJar = tough.CookieJar
|
|
36973
36813
|
|
|
36974
|
-
|
|
36975
|
-
|
|
36976
|
-
|
|
36977
|
-
callback = options
|
|
36814
|
+
exports.parse = function (str) {
|
|
36815
|
+
if (str && str.uri) {
|
|
36816
|
+
str = str.uri
|
|
36978
36817
|
}
|
|
36979
|
-
|
|
36980
|
-
|
|
36981
|
-
if (options !== null && typeof options === 'object') {
|
|
36982
|
-
extend(params, options, {uri: uri})
|
|
36983
|
-
} else if (typeof uri === 'string') {
|
|
36984
|
-
extend(params, {uri: uri})
|
|
36985
|
-
} else {
|
|
36986
|
-
extend(params, uri)
|
|
36818
|
+
if (typeof str !== 'string') {
|
|
36819
|
+
throw new Error('The cookie function only accepts STRING as param')
|
|
36987
36820
|
}
|
|
36821
|
+
return Cookie.parse(str, {loose: true})
|
|
36822
|
+
}
|
|
36988
36823
|
|
|
36989
|
-
|
|
36990
|
-
|
|
36824
|
+
// Adapt the sometimes-Async api of tough.CookieJar to our requirements
|
|
36825
|
+
function RequestJar (store) {
|
|
36826
|
+
var self = this
|
|
36827
|
+
self._jar = new CookieJar(store, {looseMode: true})
|
|
36828
|
+
}
|
|
36829
|
+
RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) {
|
|
36830
|
+
var self = this
|
|
36831
|
+
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
|
|
36832
|
+
}
|
|
36833
|
+
RequestJar.prototype.getCookieString = function (uri) {
|
|
36834
|
+
var self = this
|
|
36835
|
+
return self._jar.getCookieStringSync(uri)
|
|
36836
|
+
}
|
|
36837
|
+
RequestJar.prototype.getCookies = function (uri) {
|
|
36838
|
+
var self = this
|
|
36839
|
+
return self._jar.getCookiesSync(uri)
|
|
36991
36840
|
}
|
|
36992
36841
|
|
|
36993
|
-
function
|
|
36994
|
-
|
|
36995
|
-
|
|
36996
|
-
}
|
|
36842
|
+
exports.jar = function (store) {
|
|
36843
|
+
return new RequestJar(store)
|
|
36844
|
+
}
|
|
36997
36845
|
|
|
36998
|
-
var params = initParams(uri, options, callback)
|
|
36999
36846
|
|
|
37000
|
-
|
|
37001
|
-
throw new Error('HTTP HEAD requests MUST NOT include a request body.')
|
|
37002
|
-
}
|
|
36847
|
+
/***/ }),
|
|
37003
36848
|
|
|
37004
|
-
|
|
37005
|
-
|
|
36849
|
+
/***/ 22533:
|
|
36850
|
+
/***/ ((module) => {
|
|
37006
36851
|
|
|
37007
|
-
|
|
37008
|
-
var method = verb.toUpperCase()
|
|
37009
|
-
return function (uri, options, callback) {
|
|
37010
|
-
var params = initParams(uri, options, callback)
|
|
37011
|
-
params.method = method
|
|
37012
|
-
return request(params, params.callback)
|
|
37013
|
-
}
|
|
37014
|
-
}
|
|
36852
|
+
"use strict";
|
|
37015
36853
|
|
|
37016
|
-
// define like this to please codeintel/intellisense IDEs
|
|
37017
|
-
request.get = verbFunc('get')
|
|
37018
|
-
request.head = verbFunc('head')
|
|
37019
|
-
request.options = verbFunc('options')
|
|
37020
|
-
request.post = verbFunc('post')
|
|
37021
|
-
request.put = verbFunc('put')
|
|
37022
|
-
request.patch = verbFunc('patch')
|
|
37023
|
-
request.del = verbFunc('delete')
|
|
37024
|
-
request['delete'] = verbFunc('delete')
|
|
37025
36854
|
|
|
37026
|
-
|
|
37027
|
-
|
|
36855
|
+
function formatHostname (hostname) {
|
|
36856
|
+
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
|
|
36857
|
+
return hostname.replace(/^\.*/, '.').toLowerCase()
|
|
37028
36858
|
}
|
|
37029
36859
|
|
|
37030
|
-
|
|
37031
|
-
|
|
37032
|
-
}
|
|
36860
|
+
function parseNoProxyZone (zone) {
|
|
36861
|
+
zone = zone.trim().toLowerCase()
|
|
37033
36862
|
|
|
37034
|
-
|
|
37035
|
-
|
|
37036
|
-
|
|
36863
|
+
var zoneParts = zone.split(':', 2)
|
|
36864
|
+
var zoneHost = formatHostname(zoneParts[0])
|
|
36865
|
+
var zonePort = zoneParts[1]
|
|
36866
|
+
var hasPort = zone.indexOf(':') > -1
|
|
37037
36867
|
|
|
37038
|
-
|
|
37039
|
-
|
|
36868
|
+
return {hostname: zoneHost, port: zonePort, hasPort: hasPort}
|
|
36869
|
+
}
|
|
37040
36870
|
|
|
37041
|
-
|
|
36871
|
+
function uriInNoProxy (uri, noProxy) {
|
|
36872
|
+
var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')
|
|
36873
|
+
var hostname = formatHostname(uri.hostname)
|
|
36874
|
+
var noProxyList = noProxy.split(',')
|
|
37042
36875
|
|
|
37043
|
-
|
|
37044
|
-
|
|
37045
|
-
|
|
36876
|
+
// iterate through the noProxyList until it finds a match.
|
|
36877
|
+
return noProxyList.map(parseNoProxyZone).some(function (noProxyZone) {
|
|
36878
|
+
var isMatchedAt = hostname.indexOf(noProxyZone.hostname)
|
|
36879
|
+
var hostnameMatched = (
|
|
36880
|
+
isMatchedAt > -1 &&
|
|
36881
|
+
(isMatchedAt === hostname.length - noProxyZone.hostname.length)
|
|
36882
|
+
)
|
|
37046
36883
|
|
|
37047
|
-
if (
|
|
37048
|
-
|
|
36884
|
+
if (noProxyZone.hasPort) {
|
|
36885
|
+
return (port === noProxyZone.port) && hostnameMatched
|
|
37049
36886
|
}
|
|
37050
36887
|
|
|
37051
|
-
return
|
|
37052
|
-
}
|
|
36888
|
+
return hostnameMatched
|
|
36889
|
+
})
|
|
37053
36890
|
}
|
|
37054
36891
|
|
|
37055
|
-
|
|
37056
|
-
|
|
36892
|
+
function getProxyFromURI (uri) {
|
|
36893
|
+
// Decide the proper request proxy to use based on the request URI object and the
|
|
36894
|
+
// environmental variables (NO_PROXY, HTTP_PROXY, etc.)
|
|
36895
|
+
// respect NO_PROXY environment variables (see: https://lynx.invisible-island.net/lynx2.8.7/breakout/lynx_help/keystrokes/environments.html)
|
|
37057
36896
|
|
|
37058
|
-
|
|
36897
|
+
var noProxy = process.env.NO_PROXY || process.env.no_proxy || ''
|
|
37059
36898
|
|
|
37060
|
-
if
|
|
37061
|
-
|
|
37062
|
-
|
|
36899
|
+
// if the noProxy is a wildcard then return null
|
|
36900
|
+
|
|
36901
|
+
if (noProxy === '*') {
|
|
36902
|
+
return null
|
|
37063
36903
|
}
|
|
37064
36904
|
|
|
37065
|
-
|
|
36905
|
+
// if the noProxy is not empty and the uri is found return null
|
|
37066
36906
|
|
|
37067
|
-
|
|
37068
|
-
|
|
37069
|
-
|
|
37070
|
-
})
|
|
36907
|
+
if (noProxy !== '' && uriInNoProxy(uri, noProxy)) {
|
|
36908
|
+
return null
|
|
36909
|
+
}
|
|
37071
36910
|
|
|
37072
|
-
|
|
37073
|
-
defaults.jar = self.jar
|
|
37074
|
-
defaults.defaults = self.defaults
|
|
37075
|
-
return defaults
|
|
37076
|
-
}
|
|
36911
|
+
// Check for HTTP or HTTPS Proxy in environment Else default to null
|
|
37077
36912
|
|
|
37078
|
-
|
|
37079
|
-
|
|
37080
|
-
|
|
37081
|
-
extend(options, optionsArg)
|
|
37082
|
-
}
|
|
37083
|
-
if (agentOptions) {
|
|
37084
|
-
options.agentOptions = agentOptions
|
|
36913
|
+
if (uri.protocol === 'http:') {
|
|
36914
|
+
return process.env.HTTP_PROXY ||
|
|
36915
|
+
process.env.http_proxy || null
|
|
37085
36916
|
}
|
|
37086
36917
|
|
|
37087
|
-
|
|
37088
|
-
|
|
37089
|
-
|
|
36918
|
+
if (uri.protocol === 'https:') {
|
|
36919
|
+
return process.env.HTTPS_PROXY ||
|
|
36920
|
+
process.env.https_proxy ||
|
|
36921
|
+
process.env.HTTP_PROXY ||
|
|
36922
|
+
process.env.http_proxy || null
|
|
36923
|
+
}
|
|
37090
36924
|
|
|
37091
|
-
//
|
|
36925
|
+
// if none of that works, return null
|
|
36926
|
+
// (What uri protocol are you using then?)
|
|
37092
36927
|
|
|
37093
|
-
|
|
37094
|
-
|
|
37095
|
-
request.initParams = initParams
|
|
36928
|
+
return null
|
|
36929
|
+
}
|
|
37096
36930
|
|
|
37097
|
-
|
|
37098
|
-
Object.defineProperty(request, 'debug', {
|
|
37099
|
-
enumerable: true,
|
|
37100
|
-
get: function () {
|
|
37101
|
-
return request.Request.debug
|
|
37102
|
-
},
|
|
37103
|
-
set: function (debug) {
|
|
37104
|
-
request.Request.debug = debug
|
|
37105
|
-
}
|
|
37106
|
-
})
|
|
36931
|
+
module.exports = getProxyFromURI
|
|
37107
36932
|
|
|
37108
36933
|
|
|
37109
36934
|
/***/ }),
|
|
37110
36935
|
|
|
37111
|
-
/***/
|
|
36936
|
+
/***/ 34304:
|
|
37112
36937
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37113
36938
|
|
|
37114
36939
|
"use strict";
|
|
37115
36940
|
|
|
37116
36941
|
|
|
37117
|
-
var
|
|
37118
|
-
var
|
|
37119
|
-
var
|
|
37120
|
-
|
|
37121
|
-
var md5 = helpers.md5
|
|
37122
|
-
var toBase64 = helpers.toBase64
|
|
36942
|
+
var fs = __webpack_require__(35747)
|
|
36943
|
+
var qs = __webpack_require__(71191)
|
|
36944
|
+
var validate = __webpack_require__(25856)
|
|
36945
|
+
var extend = __webpack_require__(51302)
|
|
37123
36946
|
|
|
37124
|
-
function
|
|
37125
|
-
// define all public properties here
|
|
36947
|
+
function Har (request) {
|
|
37126
36948
|
this.request = request
|
|
37127
|
-
this.hasAuth = false
|
|
37128
|
-
this.sentAuth = false
|
|
37129
|
-
this.bearerToken = null
|
|
37130
|
-
this.user = null
|
|
37131
|
-
this.pass = null
|
|
37132
36949
|
}
|
|
37133
36950
|
|
|
37134
|
-
|
|
37135
|
-
|
|
37136
|
-
if (
|
|
37137
|
-
|
|
37138
|
-
|
|
37139
|
-
self.user = user
|
|
37140
|
-
self.pass = pass
|
|
37141
|
-
self.hasAuth = true
|
|
37142
|
-
var header = user + ':' + (pass || '')
|
|
37143
|
-
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
|
37144
|
-
var authHeader = 'Basic ' + toBase64(header)
|
|
37145
|
-
self.sentAuth = true
|
|
37146
|
-
return authHeader
|
|
36951
|
+
Har.prototype.reducer = function (obj, pair) {
|
|
36952
|
+
// new property ?
|
|
36953
|
+
if (obj[pair.name] === undefined) {
|
|
36954
|
+
obj[pair.name] = pair.value
|
|
36955
|
+
return obj
|
|
37147
36956
|
}
|
|
37148
|
-
}
|
|
37149
36957
|
|
|
37150
|
-
|
|
37151
|
-
var
|
|
37152
|
-
|
|
37153
|
-
|
|
37154
|
-
|
|
37155
|
-
|
|
37156
|
-
|
|
37157
|
-
|
|
37158
|
-
|
|
37159
|
-
self.sentAuth = true
|
|
37160
|
-
return authHeader
|
|
37161
|
-
}
|
|
36958
|
+
// existing? convert to array
|
|
36959
|
+
var arr = [
|
|
36960
|
+
obj[pair.name],
|
|
36961
|
+
pair.value
|
|
36962
|
+
]
|
|
36963
|
+
|
|
36964
|
+
obj[pair.name] = arr
|
|
36965
|
+
|
|
36966
|
+
return obj
|
|
37162
36967
|
}
|
|
37163
36968
|
|
|
37164
|
-
|
|
37165
|
-
//
|
|
37166
|
-
|
|
37167
|
-
|
|
37168
|
-
|
|
37169
|
-
|
|
37170
|
-
// - increase nc (not necessarily?)
|
|
37171
|
-
// For reference:
|
|
37172
|
-
// http://tools.ietf.org/html/rfc2617#section-3
|
|
37173
|
-
// https://github.com/bagder/curl/blob/master/lib/http_digest.c
|
|
36969
|
+
Har.prototype.prep = function (data) {
|
|
36970
|
+
// construct utility properties
|
|
36971
|
+
data.queryObj = {}
|
|
36972
|
+
data.headersObj = {}
|
|
36973
|
+
data.postData.jsonObj = false
|
|
36974
|
+
data.postData.paramsObj = false
|
|
37174
36975
|
|
|
37175
|
-
|
|
36976
|
+
// construct query objects
|
|
36977
|
+
if (data.queryString && data.queryString.length) {
|
|
36978
|
+
data.queryObj = data.queryString.reduce(this.reducer, {})
|
|
36979
|
+
}
|
|
37176
36980
|
|
|
37177
|
-
|
|
37178
|
-
|
|
37179
|
-
|
|
37180
|
-
|
|
37181
|
-
|
|
37182
|
-
|
|
37183
|
-
}
|
|
37184
|
-
challenge[match[1]] = match[2] || match[3]
|
|
36981
|
+
// construct headers objects
|
|
36982
|
+
if (data.headers && data.headers.length) {
|
|
36983
|
+
// loweCase header keys
|
|
36984
|
+
data.headersObj = data.headers.reduceRight(function (headers, header) {
|
|
36985
|
+
headers[header.name] = header.value
|
|
36986
|
+
return headers
|
|
36987
|
+
}, {})
|
|
37185
36988
|
}
|
|
37186
36989
|
|
|
37187
|
-
|
|
37188
|
-
|
|
37189
|
-
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
|
|
37193
|
-
|
|
37194
|
-
|
|
37195
|
-
var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) {
|
|
37196
|
-
var ha1 = md5(user + ':' + realm + ':' + pass)
|
|
37197
|
-
if (algorithm && algorithm.toLowerCase() === 'md5-sess') {
|
|
37198
|
-
return md5(ha1 + ':' + nonce + ':' + cnonce)
|
|
37199
|
-
} else {
|
|
37200
|
-
return ha1
|
|
36990
|
+
// construct Cookie header
|
|
36991
|
+
if (data.cookies && data.cookies.length) {
|
|
36992
|
+
var cookies = data.cookies.map(function (cookie) {
|
|
36993
|
+
return cookie.name + '=' + cookie.value
|
|
36994
|
+
})
|
|
36995
|
+
|
|
36996
|
+
if (cookies.length) {
|
|
36997
|
+
data.headersObj.cookie = cookies.join('; ')
|
|
37201
36998
|
}
|
|
37202
36999
|
}
|
|
37203
37000
|
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
var digestResponse = qop
|
|
37210
|
-
? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2)
|
|
37211
|
-
: md5(ha1 + ':' + challenge.nonce + ':' + ha2)
|
|
37212
|
-
var authValues = {
|
|
37213
|
-
username: self.user,
|
|
37214
|
-
realm: challenge.realm,
|
|
37215
|
-
nonce: challenge.nonce,
|
|
37216
|
-
uri: path,
|
|
37217
|
-
qop: qop,
|
|
37218
|
-
response: digestResponse,
|
|
37219
|
-
nc: nc,
|
|
37220
|
-
cnonce: cnonce,
|
|
37221
|
-
algorithm: challenge.algorithm,
|
|
37222
|
-
opaque: challenge.opaque
|
|
37001
|
+
// prep body
|
|
37002
|
+
function some (arr) {
|
|
37003
|
+
return arr.some(function (type) {
|
|
37004
|
+
return data.postData.mimeType.indexOf(type) === 0
|
|
37005
|
+
})
|
|
37223
37006
|
}
|
|
37224
37007
|
|
|
37225
|
-
|
|
37226
|
-
|
|
37227
|
-
|
|
37228
|
-
|
|
37229
|
-
|
|
37230
|
-
|
|
37231
|
-
|
|
37008
|
+
if (some([
|
|
37009
|
+
'multipart/mixed',
|
|
37010
|
+
'multipart/related',
|
|
37011
|
+
'multipart/form-data',
|
|
37012
|
+
'multipart/alternative'])) {
|
|
37013
|
+
// reset values
|
|
37014
|
+
data.postData.mimeType = 'multipart/form-data'
|
|
37015
|
+
} else if (some([
|
|
37016
|
+
'application/x-www-form-urlencoded'])) {
|
|
37017
|
+
if (!data.postData.params) {
|
|
37018
|
+
data.postData.text = ''
|
|
37019
|
+
} else {
|
|
37020
|
+
data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
|
|
37021
|
+
|
|
37022
|
+
// always overwrite
|
|
37023
|
+
data.postData.text = qs.stringify(data.postData.paramsObj)
|
|
37024
|
+
}
|
|
37025
|
+
} else if (some([
|
|
37026
|
+
'text/json',
|
|
37027
|
+
'text/x-json',
|
|
37028
|
+
'application/json',
|
|
37029
|
+
'application/x-json'])) {
|
|
37030
|
+
data.postData.mimeType = 'application/json'
|
|
37031
|
+
|
|
37032
|
+
if (data.postData.text) {
|
|
37033
|
+
try {
|
|
37034
|
+
data.postData.jsonObj = JSON.parse(data.postData.text)
|
|
37035
|
+
} catch (e) {
|
|
37036
|
+
this.request.debug(e)
|
|
37037
|
+
|
|
37038
|
+
// force back to text/plain
|
|
37039
|
+
data.postData.mimeType = 'text/plain'
|
|
37232
37040
|
}
|
|
37233
37041
|
}
|
|
37234
37042
|
}
|
|
37235
|
-
authHeader = 'Digest ' + authHeader.join(', ')
|
|
37236
|
-
self.sentAuth = true
|
|
37237
|
-
return authHeader
|
|
37238
|
-
}
|
|
37239
37043
|
|
|
37240
|
-
|
|
37241
|
-
|
|
37242
|
-
var request = self.request
|
|
37044
|
+
return data
|
|
37045
|
+
}
|
|
37243
37046
|
|
|
37244
|
-
|
|
37245
|
-
|
|
37246
|
-
|
|
37247
|
-
|
|
37248
|
-
authHeader = self.bearer(bearer, sendImmediately)
|
|
37249
|
-
} else {
|
|
37250
|
-
authHeader = self.basic(user, pass, sendImmediately)
|
|
37251
|
-
}
|
|
37252
|
-
if (authHeader) {
|
|
37253
|
-
request.setHeader('authorization', authHeader)
|
|
37047
|
+
Har.prototype.options = function (options) {
|
|
37048
|
+
// skip if no har property defined
|
|
37049
|
+
if (!options.har) {
|
|
37050
|
+
return options
|
|
37254
37051
|
}
|
|
37255
|
-
}
|
|
37256
37052
|
|
|
37257
|
-
|
|
37258
|
-
|
|
37259
|
-
var request = self.request
|
|
37053
|
+
var har = {}
|
|
37054
|
+
extend(har, options.har)
|
|
37260
37055
|
|
|
37261
|
-
|
|
37056
|
+
// only process the first entry
|
|
37057
|
+
if (har.log && har.log.entries) {
|
|
37058
|
+
har = har.log.entries[0]
|
|
37059
|
+
}
|
|
37262
37060
|
|
|
37263
|
-
|
|
37061
|
+
// add optional properties to make validation successful
|
|
37062
|
+
har.url = har.url || options.url || options.uri || options.baseUrl || '/'
|
|
37063
|
+
har.httpVersion = har.httpVersion || 'HTTP/1.1'
|
|
37064
|
+
har.queryString = har.queryString || []
|
|
37065
|
+
har.headers = har.headers || []
|
|
37066
|
+
har.cookies = har.cookies || []
|
|
37067
|
+
har.postData = har.postData || {}
|
|
37068
|
+
har.postData.mimeType = har.postData.mimeType || 'application/octet-stream'
|
|
37264
37069
|
|
|
37265
|
-
|
|
37266
|
-
|
|
37267
|
-
|
|
37070
|
+
har.bodySize = 0
|
|
37071
|
+
har.headersSize = 0
|
|
37072
|
+
har.postData.size = 0
|
|
37268
37073
|
|
|
37269
|
-
|
|
37270
|
-
|
|
37271
|
-
|
|
37074
|
+
if (!validate.request(har)) {
|
|
37075
|
+
return options
|
|
37076
|
+
}
|
|
37272
37077
|
|
|
37273
|
-
|
|
37274
|
-
|
|
37078
|
+
// clean up and get some utility properties
|
|
37079
|
+
var req = this.prep(har)
|
|
37275
37080
|
|
|
37276
|
-
|
|
37277
|
-
|
|
37081
|
+
// construct new options
|
|
37082
|
+
if (req.url) {
|
|
37083
|
+
options.url = req.url
|
|
37278
37084
|
}
|
|
37279
|
-
}
|
|
37280
37085
|
|
|
37281
|
-
|
|
37086
|
+
if (req.method) {
|
|
37087
|
+
options.method = req.method
|
|
37088
|
+
}
|
|
37282
37089
|
|
|
37090
|
+
if (Object.keys(req.queryObj).length) {
|
|
37091
|
+
options.qs = req.queryObj
|
|
37092
|
+
}
|
|
37283
37093
|
|
|
37284
|
-
|
|
37094
|
+
if (Object.keys(req.headersObj).length) {
|
|
37095
|
+
options.headers = req.headersObj
|
|
37096
|
+
}
|
|
37285
37097
|
|
|
37286
|
-
|
|
37287
|
-
|
|
37098
|
+
function test (type) {
|
|
37099
|
+
return req.postData.mimeType.indexOf(type) === 0
|
|
37100
|
+
}
|
|
37101
|
+
if (test('application/x-www-form-urlencoded')) {
|
|
37102
|
+
options.form = req.postData.paramsObj
|
|
37103
|
+
} else if (test('application/json')) {
|
|
37104
|
+
if (req.postData.jsonObj) {
|
|
37105
|
+
options.body = req.postData.jsonObj
|
|
37106
|
+
options.json = true
|
|
37107
|
+
}
|
|
37108
|
+
} else if (test('multipart/form-data')) {
|
|
37109
|
+
options.formData = {}
|
|
37288
37110
|
|
|
37289
|
-
|
|
37111
|
+
req.postData.params.forEach(function (param) {
|
|
37112
|
+
var attachment = {}
|
|
37290
37113
|
|
|
37114
|
+
if (!param.fileName && !param.contentType) {
|
|
37115
|
+
options.formData[param.name] = param.value
|
|
37116
|
+
return
|
|
37117
|
+
}
|
|
37291
37118
|
|
|
37292
|
-
|
|
37119
|
+
// attempt to read from disk!
|
|
37120
|
+
if (param.fileName && !param.value) {
|
|
37121
|
+
attachment.value = fs.createReadStream(param.fileName)
|
|
37122
|
+
} else if (param.value) {
|
|
37123
|
+
attachment.value = param.value
|
|
37124
|
+
}
|
|
37293
37125
|
|
|
37294
|
-
|
|
37295
|
-
|
|
37126
|
+
if (param.fileName) {
|
|
37127
|
+
attachment.options = {
|
|
37128
|
+
filename: param.fileName,
|
|
37129
|
+
contentType: param.contentType ? param.contentType : null
|
|
37130
|
+
}
|
|
37131
|
+
}
|
|
37296
37132
|
|
|
37297
|
-
|
|
37298
|
-
|
|
37299
|
-
|
|
37300
|
-
|
|
37301
|
-
|
|
37302
|
-
|
|
37133
|
+
options.formData[param.name] = attachment
|
|
37134
|
+
})
|
|
37135
|
+
} else {
|
|
37136
|
+
if (req.postData.text) {
|
|
37137
|
+
options.body = req.postData.text
|
|
37138
|
+
}
|
|
37303
37139
|
}
|
|
37304
|
-
return Cookie.parse(str, {loose: true})
|
|
37305
|
-
}
|
|
37306
37140
|
|
|
37307
|
-
|
|
37308
|
-
function RequestJar (store) {
|
|
37309
|
-
var self = this
|
|
37310
|
-
self._jar = new CookieJar(store, {looseMode: true})
|
|
37311
|
-
}
|
|
37312
|
-
RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) {
|
|
37313
|
-
var self = this
|
|
37314
|
-
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
|
|
37315
|
-
}
|
|
37316
|
-
RequestJar.prototype.getCookieString = function (uri) {
|
|
37317
|
-
var self = this
|
|
37318
|
-
return self._jar.getCookieStringSync(uri)
|
|
37319
|
-
}
|
|
37320
|
-
RequestJar.prototype.getCookies = function (uri) {
|
|
37321
|
-
var self = this
|
|
37322
|
-
return self._jar.getCookiesSync(uri)
|
|
37141
|
+
return options
|
|
37323
37142
|
}
|
|
37324
37143
|
|
|
37325
|
-
exports.
|
|
37326
|
-
return new RequestJar(store)
|
|
37327
|
-
}
|
|
37144
|
+
exports.t = Har
|
|
37328
37145
|
|
|
37329
37146
|
|
|
37330
37147
|
/***/ }),
|
|
37331
37148
|
|
|
37332
|
-
/***/
|
|
37333
|
-
/***/ ((
|
|
37149
|
+
/***/ 57372:
|
|
37150
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37334
37151
|
|
|
37335
37152
|
"use strict";
|
|
37336
37153
|
|
|
37337
37154
|
|
|
37338
|
-
|
|
37339
|
-
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
|
|
37340
|
-
return hostname.replace(/^\.*/, '.').toLowerCase()
|
|
37341
|
-
}
|
|
37342
|
-
|
|
37343
|
-
function parseNoProxyZone (zone) {
|
|
37344
|
-
zone = zone.trim().toLowerCase()
|
|
37345
|
-
|
|
37346
|
-
var zoneParts = zone.split(':', 2)
|
|
37347
|
-
var zoneHost = formatHostname(zoneParts[0])
|
|
37348
|
-
var zonePort = zoneParts[1]
|
|
37349
|
-
var hasPort = zone.indexOf(':') > -1
|
|
37155
|
+
var crypto = __webpack_require__(76417)
|
|
37350
37156
|
|
|
37351
|
-
|
|
37157
|
+
function randomString (size) {
|
|
37158
|
+
var bits = (size + 1) * 6
|
|
37159
|
+
var buffer = crypto.randomBytes(Math.ceil(bits / 8))
|
|
37160
|
+
var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
|
|
37161
|
+
return string.slice(0, size)
|
|
37352
37162
|
}
|
|
37353
37163
|
|
|
37354
|
-
function
|
|
37355
|
-
var
|
|
37356
|
-
|
|
37357
|
-
|
|
37164
|
+
function calculatePayloadHash (payload, algorithm, contentType) {
|
|
37165
|
+
var hash = crypto.createHash(algorithm)
|
|
37166
|
+
hash.update('hawk.1.payload\n')
|
|
37167
|
+
hash.update((contentType ? contentType.split(';')[0].trim().toLowerCase() : '') + '\n')
|
|
37168
|
+
hash.update(payload || '')
|
|
37169
|
+
hash.update('\n')
|
|
37170
|
+
return hash.digest('base64')
|
|
37171
|
+
}
|
|
37358
37172
|
|
|
37359
|
-
|
|
37360
|
-
|
|
37361
|
-
|
|
37362
|
-
|
|
37363
|
-
|
|
37364
|
-
|
|
37365
|
-
)
|
|
37173
|
+
exports.calculateMac = function (credentials, opts) {
|
|
37174
|
+
var normalized = 'hawk.1.header\n' +
|
|
37175
|
+
opts.ts + '\n' +
|
|
37176
|
+
opts.nonce + '\n' +
|
|
37177
|
+
(opts.method || '').toUpperCase() + '\n' +
|
|
37178
|
+
opts.resource + '\n' +
|
|
37179
|
+
opts.host.toLowerCase() + '\n' +
|
|
37180
|
+
opts.port + '\n' +
|
|
37181
|
+
(opts.hash || '') + '\n'
|
|
37366
37182
|
|
|
37367
|
-
|
|
37368
|
-
|
|
37369
|
-
|
|
37183
|
+
if (opts.ext) {
|
|
37184
|
+
normalized = normalized + opts.ext.replace('\\', '\\\\').replace('\n', '\\n')
|
|
37185
|
+
}
|
|
37370
37186
|
|
|
37371
|
-
|
|
37372
|
-
})
|
|
37373
|
-
}
|
|
37187
|
+
normalized = normalized + '\n'
|
|
37374
37188
|
|
|
37375
|
-
|
|
37376
|
-
|
|
37377
|
-
|
|
37378
|
-
// respect NO_PROXY environment variables (see: https://lynx.invisible-island.net/lynx2.8.7/breakout/lynx_help/keystrokes/environments.html)
|
|
37189
|
+
if (opts.app) {
|
|
37190
|
+
normalized = normalized + opts.app + '\n' + (opts.dlg || '') + '\n'
|
|
37191
|
+
}
|
|
37379
37192
|
|
|
37380
|
-
var
|
|
37193
|
+
var hmac = crypto.createHmac(credentials.algorithm, credentials.key).update(normalized)
|
|
37194
|
+
var digest = hmac.digest('base64')
|
|
37195
|
+
return digest
|
|
37196
|
+
}
|
|
37381
37197
|
|
|
37382
|
-
|
|
37198
|
+
exports.header = function (uri, method, opts) {
|
|
37199
|
+
var timestamp = opts.timestamp || Math.floor((Date.now() + (opts.localtimeOffsetMsec || 0)) / 1000)
|
|
37200
|
+
var credentials = opts.credentials
|
|
37201
|
+
if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
|
|
37202
|
+
return ''
|
|
37203
|
+
}
|
|
37383
37204
|
|
|
37384
|
-
if (
|
|
37385
|
-
return
|
|
37205
|
+
if (['sha1', 'sha256'].indexOf(credentials.algorithm) === -1) {
|
|
37206
|
+
return ''
|
|
37386
37207
|
}
|
|
37387
37208
|
|
|
37388
|
-
|
|
37209
|
+
var artifacts = {
|
|
37210
|
+
ts: timestamp,
|
|
37211
|
+
nonce: opts.nonce || randomString(6),
|
|
37212
|
+
method: method,
|
|
37213
|
+
resource: uri.pathname + (uri.search || ''),
|
|
37214
|
+
host: uri.hostname,
|
|
37215
|
+
port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
|
|
37216
|
+
hash: opts.hash,
|
|
37217
|
+
ext: opts.ext,
|
|
37218
|
+
app: opts.app,
|
|
37219
|
+
dlg: opts.dlg
|
|
37220
|
+
}
|
|
37389
37221
|
|
|
37390
|
-
if (
|
|
37391
|
-
|
|
37222
|
+
if (!artifacts.hash && (opts.payload || opts.payload === '')) {
|
|
37223
|
+
artifacts.hash = calculatePayloadHash(opts.payload, credentials.algorithm, opts.contentType)
|
|
37392
37224
|
}
|
|
37393
37225
|
|
|
37394
|
-
|
|
37226
|
+
var mac = exports.calculateMac(credentials, artifacts)
|
|
37395
37227
|
|
|
37396
|
-
|
|
37397
|
-
|
|
37398
|
-
|
|
37399
|
-
|
|
37228
|
+
var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''
|
|
37229
|
+
var header = 'Hawk id="' + credentials.id +
|
|
37230
|
+
'", ts="' + artifacts.ts +
|
|
37231
|
+
'", nonce="' + artifacts.nonce +
|
|
37232
|
+
(artifacts.hash ? '", hash="' + artifacts.hash : '') +
|
|
37233
|
+
(hasExt ? '", ext="' + artifacts.ext.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : '') +
|
|
37234
|
+
'", mac="' + mac + '"'
|
|
37400
37235
|
|
|
37401
|
-
if (
|
|
37402
|
-
|
|
37403
|
-
process.env.https_proxy ||
|
|
37404
|
-
process.env.HTTP_PROXY ||
|
|
37405
|
-
process.env.http_proxy || null
|
|
37236
|
+
if (artifacts.app) {
|
|
37237
|
+
header = header + ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'
|
|
37406
37238
|
}
|
|
37407
37239
|
|
|
37408
|
-
|
|
37409
|
-
// (What uri protocol are you using then?)
|
|
37410
|
-
|
|
37411
|
-
return null
|
|
37240
|
+
return header
|
|
37412
37241
|
}
|
|
37413
37242
|
|
|
37414
|
-
module.exports = getProxyFromURI
|
|
37415
|
-
|
|
37416
37243
|
|
|
37417
37244
|
/***/ }),
|
|
37418
37245
|
|
|
37419
|
-
/***/
|
|
37246
|
+
/***/ 73093:
|
|
37420
37247
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37421
37248
|
|
|
37422
37249
|
"use strict";
|
|
37423
37250
|
|
|
37424
37251
|
|
|
37425
|
-
var
|
|
37426
|
-
var
|
|
37427
|
-
var
|
|
37428
|
-
var extend = __webpack_require__(51302)
|
|
37252
|
+
var jsonSafeStringify = __webpack_require__(37474)
|
|
37253
|
+
var crypto = __webpack_require__(76417)
|
|
37254
|
+
var Buffer = __webpack_require__(59105).Buffer
|
|
37429
37255
|
|
|
37430
|
-
|
|
37431
|
-
|
|
37256
|
+
var defer = typeof setImmediate === 'undefined'
|
|
37257
|
+
? process.nextTick
|
|
37258
|
+
: setImmediate
|
|
37259
|
+
|
|
37260
|
+
function paramsHaveRequestBody (params) {
|
|
37261
|
+
return (
|
|
37262
|
+
params.body ||
|
|
37263
|
+
params.requestBodyStream ||
|
|
37264
|
+
(params.json && typeof params.json !== 'boolean') ||
|
|
37265
|
+
params.multipart
|
|
37266
|
+
)
|
|
37432
37267
|
}
|
|
37433
37268
|
|
|
37434
|
-
|
|
37435
|
-
|
|
37436
|
-
|
|
37437
|
-
|
|
37438
|
-
|
|
37269
|
+
function safeStringify (obj, replacer) {
|
|
37270
|
+
var ret
|
|
37271
|
+
try {
|
|
37272
|
+
ret = JSON.stringify(obj, replacer)
|
|
37273
|
+
} catch (e) {
|
|
37274
|
+
ret = jsonSafeStringify(obj, replacer)
|
|
37439
37275
|
}
|
|
37276
|
+
return ret
|
|
37277
|
+
}
|
|
37440
37278
|
|
|
37441
|
-
|
|
37442
|
-
|
|
37443
|
-
|
|
37444
|
-
pair.value
|
|
37445
|
-
]
|
|
37446
|
-
|
|
37447
|
-
obj[pair.name] = arr
|
|
37279
|
+
function md5 (str) {
|
|
37280
|
+
return crypto.createHash('md5').update(str).digest('hex')
|
|
37281
|
+
}
|
|
37448
37282
|
|
|
37449
|
-
|
|
37283
|
+
function isReadStream (rs) {
|
|
37284
|
+
return rs.readable && rs.path && rs.mode
|
|
37450
37285
|
}
|
|
37451
37286
|
|
|
37452
|
-
|
|
37453
|
-
|
|
37454
|
-
|
|
37455
|
-
data.headersObj = {}
|
|
37456
|
-
data.postData.jsonObj = false
|
|
37457
|
-
data.postData.paramsObj = false
|
|
37287
|
+
function toBase64 (str) {
|
|
37288
|
+
return Buffer.from(str || '', 'utf8').toString('base64')
|
|
37289
|
+
}
|
|
37458
37290
|
|
|
37459
|
-
|
|
37460
|
-
|
|
37461
|
-
|
|
37462
|
-
|
|
37291
|
+
function copy (obj) {
|
|
37292
|
+
var o = {}
|
|
37293
|
+
Object.keys(obj).forEach(function (i) {
|
|
37294
|
+
o[i] = obj[i]
|
|
37295
|
+
})
|
|
37296
|
+
return o
|
|
37297
|
+
}
|
|
37463
37298
|
|
|
37464
|
-
|
|
37465
|
-
|
|
37466
|
-
|
|
37467
|
-
|
|
37468
|
-
|
|
37469
|
-
|
|
37470
|
-
}, {})
|
|
37299
|
+
function version () {
|
|
37300
|
+
var numbers = process.version.replace('v', '').split('.')
|
|
37301
|
+
return {
|
|
37302
|
+
major: parseInt(numbers[0], 10),
|
|
37303
|
+
minor: parseInt(numbers[1], 10),
|
|
37304
|
+
patch: parseInt(numbers[2], 10)
|
|
37471
37305
|
}
|
|
37306
|
+
}
|
|
37472
37307
|
|
|
37473
|
-
|
|
37474
|
-
|
|
37475
|
-
|
|
37476
|
-
|
|
37477
|
-
|
|
37308
|
+
exports.paramsHaveRequestBody = paramsHaveRequestBody
|
|
37309
|
+
exports.safeStringify = safeStringify
|
|
37310
|
+
exports.md5 = md5
|
|
37311
|
+
exports.isReadStream = isReadStream
|
|
37312
|
+
exports.toBase64 = toBase64
|
|
37313
|
+
exports.copy = copy
|
|
37314
|
+
exports.version = version
|
|
37315
|
+
exports.defer = defer
|
|
37478
37316
|
|
|
37479
|
-
if (cookies.length) {
|
|
37480
|
-
data.headersObj.cookie = cookies.join('; ')
|
|
37481
|
-
}
|
|
37482
|
-
}
|
|
37483
37317
|
|
|
37484
|
-
|
|
37485
|
-
function some (arr) {
|
|
37486
|
-
return arr.some(function (type) {
|
|
37487
|
-
return data.postData.mimeType.indexOf(type) === 0
|
|
37488
|
-
})
|
|
37489
|
-
}
|
|
37318
|
+
/***/ }),
|
|
37490
37319
|
|
|
37491
|
-
|
|
37492
|
-
|
|
37493
|
-
'multipart/related',
|
|
37494
|
-
'multipart/form-data',
|
|
37495
|
-
'multipart/alternative'])) {
|
|
37496
|
-
// reset values
|
|
37497
|
-
data.postData.mimeType = 'multipart/form-data'
|
|
37498
|
-
} else if (some([
|
|
37499
|
-
'application/x-www-form-urlencoded'])) {
|
|
37500
|
-
if (!data.postData.params) {
|
|
37501
|
-
data.postData.text = ''
|
|
37502
|
-
} else {
|
|
37503
|
-
data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
|
|
37320
|
+
/***/ 38460:
|
|
37321
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37504
37322
|
|
|
37505
|
-
|
|
37506
|
-
data.postData.text = qs.stringify(data.postData.paramsObj)
|
|
37507
|
-
}
|
|
37508
|
-
} else if (some([
|
|
37509
|
-
'text/json',
|
|
37510
|
-
'text/x-json',
|
|
37511
|
-
'application/json',
|
|
37512
|
-
'application/x-json'])) {
|
|
37513
|
-
data.postData.mimeType = 'application/json'
|
|
37323
|
+
"use strict";
|
|
37514
37324
|
|
|
37515
|
-
if (data.postData.text) {
|
|
37516
|
-
try {
|
|
37517
|
-
data.postData.jsonObj = JSON.parse(data.postData.text)
|
|
37518
|
-
} catch (e) {
|
|
37519
|
-
this.request.debug(e)
|
|
37520
37325
|
|
|
37521
|
-
|
|
37522
|
-
|
|
37523
|
-
|
|
37524
|
-
|
|
37525
|
-
}
|
|
37326
|
+
var uuid = __webpack_require__(69355)
|
|
37327
|
+
var CombinedStream = __webpack_require__(74041)
|
|
37328
|
+
var isstream = __webpack_require__(92104)
|
|
37329
|
+
var Buffer = __webpack_require__(59105).Buffer
|
|
37526
37330
|
|
|
37527
|
-
|
|
37331
|
+
function Multipart (request) {
|
|
37332
|
+
this.request = request
|
|
37333
|
+
this.boundary = uuid()
|
|
37334
|
+
this.chunked = false
|
|
37335
|
+
this.body = null
|
|
37528
37336
|
}
|
|
37529
37337
|
|
|
37530
|
-
|
|
37531
|
-
|
|
37532
|
-
|
|
37533
|
-
|
|
37534
|
-
}
|
|
37535
|
-
|
|
37536
|
-
var har = {}
|
|
37537
|
-
extend(har, options.har)
|
|
37338
|
+
Multipart.prototype.isChunked = function (options) {
|
|
37339
|
+
var self = this
|
|
37340
|
+
var chunked = false
|
|
37341
|
+
var parts = options.data || options
|
|
37538
37342
|
|
|
37539
|
-
|
|
37540
|
-
|
|
37541
|
-
har = har.log.entries[0]
|
|
37343
|
+
if (!parts.forEach) {
|
|
37344
|
+
self.request.emit('error', new Error('Argument error, options.multipart.'))
|
|
37542
37345
|
}
|
|
37543
37346
|
|
|
37544
|
-
|
|
37545
|
-
|
|
37546
|
-
|
|
37547
|
-
har.queryString = har.queryString || []
|
|
37548
|
-
har.headers = har.headers || []
|
|
37549
|
-
har.cookies = har.cookies || []
|
|
37550
|
-
har.postData = har.postData || {}
|
|
37551
|
-
har.postData.mimeType = har.postData.mimeType || 'application/octet-stream'
|
|
37347
|
+
if (options.chunked !== undefined) {
|
|
37348
|
+
chunked = options.chunked
|
|
37349
|
+
}
|
|
37552
37350
|
|
|
37553
|
-
|
|
37554
|
-
|
|
37555
|
-
|
|
37351
|
+
if (self.request.getHeader('transfer-encoding') === 'chunked') {
|
|
37352
|
+
chunked = true
|
|
37353
|
+
}
|
|
37556
37354
|
|
|
37557
|
-
if (!
|
|
37558
|
-
|
|
37355
|
+
if (!chunked) {
|
|
37356
|
+
parts.forEach(function (part) {
|
|
37357
|
+
if (typeof part.body === 'undefined') {
|
|
37358
|
+
self.request.emit('error', new Error('Body attribute missing in multipart.'))
|
|
37359
|
+
}
|
|
37360
|
+
if (isstream(part.body)) {
|
|
37361
|
+
chunked = true
|
|
37362
|
+
}
|
|
37363
|
+
})
|
|
37559
37364
|
}
|
|
37560
37365
|
|
|
37561
|
-
|
|
37562
|
-
|
|
37366
|
+
return chunked
|
|
37367
|
+
}
|
|
37563
37368
|
|
|
37564
|
-
|
|
37565
|
-
|
|
37566
|
-
options.url = req.url
|
|
37567
|
-
}
|
|
37369
|
+
Multipart.prototype.setHeaders = function (chunked) {
|
|
37370
|
+
var self = this
|
|
37568
37371
|
|
|
37569
|
-
if (
|
|
37570
|
-
|
|
37372
|
+
if (chunked && !self.request.hasHeader('transfer-encoding')) {
|
|
37373
|
+
self.request.setHeader('transfer-encoding', 'chunked')
|
|
37571
37374
|
}
|
|
37572
37375
|
|
|
37573
|
-
|
|
37574
|
-
|
|
37376
|
+
var header = self.request.getHeader('content-type')
|
|
37377
|
+
|
|
37378
|
+
if (!header || header.indexOf('multipart') === -1) {
|
|
37379
|
+
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
|
|
37380
|
+
} else {
|
|
37381
|
+
if (header.indexOf('boundary') !== -1) {
|
|
37382
|
+
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
|
|
37383
|
+
} else {
|
|
37384
|
+
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
|
|
37385
|
+
}
|
|
37575
37386
|
}
|
|
37387
|
+
}
|
|
37576
37388
|
|
|
37577
|
-
|
|
37578
|
-
|
|
37389
|
+
Multipart.prototype.build = function (parts, chunked) {
|
|
37390
|
+
var self = this
|
|
37391
|
+
var body = chunked ? new CombinedStream() : []
|
|
37392
|
+
|
|
37393
|
+
function add (part) {
|
|
37394
|
+
if (typeof part === 'number') {
|
|
37395
|
+
part = part.toString()
|
|
37396
|
+
}
|
|
37397
|
+
return chunked ? body.append(part) : body.push(Buffer.from(part))
|
|
37579
37398
|
}
|
|
37580
37399
|
|
|
37581
|
-
|
|
37582
|
-
|
|
37400
|
+
if (self.request.preambleCRLF) {
|
|
37401
|
+
add('\r\n')
|
|
37583
37402
|
}
|
|
37584
|
-
if (test('application/x-www-form-urlencoded')) {
|
|
37585
|
-
options.form = req.postData.paramsObj
|
|
37586
|
-
} else if (test('application/json')) {
|
|
37587
|
-
if (req.postData.jsonObj) {
|
|
37588
|
-
options.body = req.postData.jsonObj
|
|
37589
|
-
options.json = true
|
|
37590
|
-
}
|
|
37591
|
-
} else if (test('multipart/form-data')) {
|
|
37592
|
-
options.formData = {}
|
|
37593
37403
|
|
|
37594
|
-
|
|
37595
|
-
|
|
37404
|
+
parts.forEach(function (part) {
|
|
37405
|
+
var preamble = '--' + self.boundary + '\r\n'
|
|
37406
|
+
Object.keys(part).forEach(function (key) {
|
|
37407
|
+
if (key === 'body') { return }
|
|
37408
|
+
preamble += key + ': ' + part[key] + '\r\n'
|
|
37409
|
+
})
|
|
37410
|
+
preamble += '\r\n'
|
|
37411
|
+
add(preamble)
|
|
37412
|
+
add(part.body)
|
|
37413
|
+
add('\r\n')
|
|
37414
|
+
})
|
|
37415
|
+
add('--' + self.boundary + '--')
|
|
37596
37416
|
|
|
37597
|
-
|
|
37598
|
-
|
|
37599
|
-
|
|
37600
|
-
}
|
|
37417
|
+
if (self.request.postambleCRLF) {
|
|
37418
|
+
add('\r\n')
|
|
37419
|
+
}
|
|
37601
37420
|
|
|
37602
|
-
|
|
37603
|
-
|
|
37604
|
-
attachment.value = fs.createReadStream(param.fileName)
|
|
37605
|
-
} else if (param.value) {
|
|
37606
|
-
attachment.value = param.value
|
|
37607
|
-
}
|
|
37421
|
+
return body
|
|
37422
|
+
}
|
|
37608
37423
|
|
|
37609
|
-
|
|
37610
|
-
|
|
37611
|
-
filename: param.fileName,
|
|
37612
|
-
contentType: param.contentType ? param.contentType : null
|
|
37613
|
-
}
|
|
37614
|
-
}
|
|
37424
|
+
Multipart.prototype.onRequest = function (options) {
|
|
37425
|
+
var self = this
|
|
37615
37426
|
|
|
37616
|
-
|
|
37617
|
-
|
|
37618
|
-
} else {
|
|
37619
|
-
if (req.postData.text) {
|
|
37620
|
-
options.body = req.postData.text
|
|
37621
|
-
}
|
|
37622
|
-
}
|
|
37427
|
+
var chunked = self.isChunked(options)
|
|
37428
|
+
var parts = options.data || options
|
|
37623
37429
|
|
|
37624
|
-
|
|
37430
|
+
self.setHeaders(chunked)
|
|
37431
|
+
self.chunked = chunked
|
|
37432
|
+
self.body = self.build(parts, chunked)
|
|
37625
37433
|
}
|
|
37626
37434
|
|
|
37627
|
-
exports
|
|
37435
|
+
exports.$ = Multipart
|
|
37628
37436
|
|
|
37629
37437
|
|
|
37630
37438
|
/***/ }),
|
|
37631
37439
|
|
|
37632
|
-
/***/
|
|
37440
|
+
/***/ 63055:
|
|
37633
37441
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37634
37442
|
|
|
37635
37443
|
"use strict";
|
|
37636
37444
|
|
|
37637
37445
|
|
|
37446
|
+
var url = __webpack_require__(78835)
|
|
37447
|
+
var qs = __webpack_require__(88889)
|
|
37448
|
+
var caseless = __webpack_require__(72464)
|
|
37449
|
+
var uuid = __webpack_require__(69355)
|
|
37450
|
+
var oauth = __webpack_require__(14094)
|
|
37638
37451
|
var crypto = __webpack_require__(76417)
|
|
37452
|
+
var Buffer = __webpack_require__(59105).Buffer
|
|
37639
37453
|
|
|
37640
|
-
function
|
|
37641
|
-
|
|
37642
|
-
|
|
37643
|
-
var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
|
|
37644
|
-
return string.slice(0, size)
|
|
37454
|
+
function OAuth (request) {
|
|
37455
|
+
this.request = request
|
|
37456
|
+
this.params = null
|
|
37645
37457
|
}
|
|
37646
37458
|
|
|
37647
|
-
function
|
|
37648
|
-
var
|
|
37649
|
-
|
|
37650
|
-
|
|
37651
|
-
|
|
37652
|
-
|
|
37653
|
-
|
|
37654
|
-
}
|
|
37459
|
+
OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) {
|
|
37460
|
+
var oa = {}
|
|
37461
|
+
for (var i in _oauth) {
|
|
37462
|
+
oa['oauth_' + i] = _oauth[i]
|
|
37463
|
+
}
|
|
37464
|
+
if (!oa.oauth_version) {
|
|
37465
|
+
oa.oauth_version = '1.0'
|
|
37466
|
+
}
|
|
37467
|
+
if (!oa.oauth_timestamp) {
|
|
37468
|
+
oa.oauth_timestamp = Math.floor(Date.now() / 1000).toString()
|
|
37469
|
+
}
|
|
37470
|
+
if (!oa.oauth_nonce) {
|
|
37471
|
+
oa.oauth_nonce = uuid().replace(/-/g, '')
|
|
37472
|
+
}
|
|
37473
|
+
if (!oa.oauth_signature_method) {
|
|
37474
|
+
oa.oauth_signature_method = 'HMAC-SHA1'
|
|
37475
|
+
}
|
|
37655
37476
|
|
|
37656
|
-
|
|
37657
|
-
|
|
37658
|
-
|
|
37659
|
-
opts.nonce + '\n' +
|
|
37660
|
-
(opts.method || '').toUpperCase() + '\n' +
|
|
37661
|
-
opts.resource + '\n' +
|
|
37662
|
-
opts.host.toLowerCase() + '\n' +
|
|
37663
|
-
opts.port + '\n' +
|
|
37664
|
-
(opts.hash || '') + '\n'
|
|
37477
|
+
var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key // eslint-disable-line camelcase
|
|
37478
|
+
delete oa.oauth_consumer_secret
|
|
37479
|
+
delete oa.oauth_private_key
|
|
37665
37480
|
|
|
37666
|
-
|
|
37667
|
-
|
|
37668
|
-
}
|
|
37481
|
+
var token_secret = oa.oauth_token_secret // eslint-disable-line camelcase
|
|
37482
|
+
delete oa.oauth_token_secret
|
|
37669
37483
|
|
|
37670
|
-
|
|
37484
|
+
var realm = oa.oauth_realm
|
|
37485
|
+
delete oa.oauth_realm
|
|
37486
|
+
delete oa.oauth_transport_method
|
|
37671
37487
|
|
|
37672
|
-
|
|
37673
|
-
|
|
37488
|
+
var baseurl = uri.protocol + '//' + uri.host + uri.pathname
|
|
37489
|
+
var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&'))
|
|
37490
|
+
|
|
37491
|
+
oa.oauth_signature = oauth.sign(
|
|
37492
|
+
oa.oauth_signature_method,
|
|
37493
|
+
method,
|
|
37494
|
+
baseurl,
|
|
37495
|
+
params,
|
|
37496
|
+
consumer_secret_or_private_key, // eslint-disable-line camelcase
|
|
37497
|
+
token_secret // eslint-disable-line camelcase
|
|
37498
|
+
)
|
|
37499
|
+
|
|
37500
|
+
if (realm) {
|
|
37501
|
+
oa.realm = realm
|
|
37674
37502
|
}
|
|
37675
37503
|
|
|
37676
|
-
|
|
37677
|
-
var digest = hmac.digest('base64')
|
|
37678
|
-
return digest
|
|
37504
|
+
return oa
|
|
37679
37505
|
}
|
|
37680
37506
|
|
|
37681
|
-
|
|
37682
|
-
|
|
37683
|
-
|
|
37684
|
-
|
|
37685
|
-
return ''
|
|
37507
|
+
OAuth.prototype.buildBodyHash = function (_oauth, body) {
|
|
37508
|
+
if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) {
|
|
37509
|
+
this.request.emit('error', new Error('oauth: ' + _oauth.signature_method +
|
|
37510
|
+
' signature_method not supported with body_hash signing.'))
|
|
37686
37511
|
}
|
|
37687
37512
|
|
|
37688
|
-
|
|
37689
|
-
|
|
37513
|
+
var shasum = crypto.createHash('sha1')
|
|
37514
|
+
shasum.update(body || '')
|
|
37515
|
+
var sha1 = shasum.digest('hex')
|
|
37516
|
+
|
|
37517
|
+
return Buffer.from(sha1, 'hex').toString('base64')
|
|
37518
|
+
}
|
|
37519
|
+
|
|
37520
|
+
OAuth.prototype.concatParams = function (oa, sep, wrap) {
|
|
37521
|
+
wrap = wrap || ''
|
|
37522
|
+
|
|
37523
|
+
var params = Object.keys(oa).filter(function (i) {
|
|
37524
|
+
return i !== 'realm' && i !== 'oauth_signature'
|
|
37525
|
+
}).sort()
|
|
37526
|
+
|
|
37527
|
+
if (oa.realm) {
|
|
37528
|
+
params.splice(0, 0, 'realm')
|
|
37690
37529
|
}
|
|
37530
|
+
params.push('oauth_signature')
|
|
37691
37531
|
|
|
37692
|
-
|
|
37693
|
-
|
|
37694
|
-
|
|
37695
|
-
|
|
37696
|
-
|
|
37697
|
-
|
|
37698
|
-
|
|
37699
|
-
|
|
37700
|
-
|
|
37701
|
-
|
|
37702
|
-
|
|
37532
|
+
return params.map(function (i) {
|
|
37533
|
+
return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap
|
|
37534
|
+
}).join(sep)
|
|
37535
|
+
}
|
|
37536
|
+
|
|
37537
|
+
OAuth.prototype.onRequest = function (_oauth) {
|
|
37538
|
+
var self = this
|
|
37539
|
+
self.params = _oauth
|
|
37540
|
+
|
|
37541
|
+
var uri = self.request.uri || {}
|
|
37542
|
+
var method = self.request.method || ''
|
|
37543
|
+
var headers = caseless(self.request.headers)
|
|
37544
|
+
var body = self.request.body || ''
|
|
37545
|
+
var qsLib = self.request.qsLib || qs
|
|
37546
|
+
|
|
37547
|
+
var form
|
|
37548
|
+
var query
|
|
37549
|
+
var contentType = headers.get('content-type') || ''
|
|
37550
|
+
var formContentType = 'application/x-www-form-urlencoded'
|
|
37551
|
+
var transport = _oauth.transport_method || 'header'
|
|
37552
|
+
|
|
37553
|
+
if (contentType.slice(0, formContentType.length) === formContentType) {
|
|
37554
|
+
contentType = formContentType
|
|
37555
|
+
form = body
|
|
37556
|
+
}
|
|
37557
|
+
if (uri.query) {
|
|
37558
|
+
query = uri.query
|
|
37559
|
+
}
|
|
37560
|
+
if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) {
|
|
37561
|
+
self.request.emit('error', new Error('oauth: transport_method of body requires POST ' +
|
|
37562
|
+
'and content-type ' + formContentType))
|
|
37703
37563
|
}
|
|
37704
37564
|
|
|
37705
|
-
if (!
|
|
37706
|
-
|
|
37565
|
+
if (!form && typeof _oauth.body_hash === 'boolean') {
|
|
37566
|
+
_oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString())
|
|
37707
37567
|
}
|
|
37708
37568
|
|
|
37709
|
-
var
|
|
37569
|
+
var oa = self.buildParams(_oauth, uri, method, query, form, qsLib)
|
|
37570
|
+
|
|
37571
|
+
switch (transport) {
|
|
37572
|
+
case 'header':
|
|
37573
|
+
self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"'))
|
|
37574
|
+
break
|
|
37575
|
+
|
|
37576
|
+
case 'query':
|
|
37577
|
+
var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&')
|
|
37578
|
+
self.request.uri = url.parse(href)
|
|
37579
|
+
self.request.path = self.request.uri.path
|
|
37580
|
+
break
|
|
37710
37581
|
|
|
37711
|
-
|
|
37712
|
-
|
|
37713
|
-
|
|
37714
|
-
'", nonce="' + artifacts.nonce +
|
|
37715
|
-
(artifacts.hash ? '", hash="' + artifacts.hash : '') +
|
|
37716
|
-
(hasExt ? '", ext="' + artifacts.ext.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : '') +
|
|
37717
|
-
'", mac="' + mac + '"'
|
|
37582
|
+
case 'body':
|
|
37583
|
+
self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&')
|
|
37584
|
+
break
|
|
37718
37585
|
|
|
37719
|
-
|
|
37720
|
-
|
|
37586
|
+
default:
|
|
37587
|
+
self.request.emit('error', new Error('oauth: transport_method invalid'))
|
|
37721
37588
|
}
|
|
37722
|
-
|
|
37723
|
-
return header
|
|
37724
37589
|
}
|
|
37725
37590
|
|
|
37591
|
+
exports.f = OAuth
|
|
37592
|
+
|
|
37726
37593
|
|
|
37727
37594
|
/***/ }),
|
|
37728
37595
|
|
|
37729
|
-
/***/
|
|
37596
|
+
/***/ 84395:
|
|
37730
37597
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37731
37598
|
|
|
37732
37599
|
"use strict";
|
|
37733
37600
|
|
|
37734
37601
|
|
|
37735
|
-
var
|
|
37736
|
-
var
|
|
37737
|
-
var Buffer = __webpack_require__(59105).Buffer
|
|
37738
|
-
|
|
37739
|
-
var defer = typeof setImmediate === 'undefined'
|
|
37740
|
-
? process.nextTick
|
|
37741
|
-
: setImmediate
|
|
37602
|
+
var qs = __webpack_require__(88889)
|
|
37603
|
+
var querystring = __webpack_require__(71191)
|
|
37742
37604
|
|
|
37743
|
-
function
|
|
37744
|
-
|
|
37745
|
-
|
|
37746
|
-
|
|
37747
|
-
|
|
37748
|
-
|
|
37749
|
-
)
|
|
37605
|
+
function Querystring (request) {
|
|
37606
|
+
this.request = request
|
|
37607
|
+
this.lib = null
|
|
37608
|
+
this.useQuerystring = null
|
|
37609
|
+
this.parseOptions = null
|
|
37610
|
+
this.stringifyOptions = null
|
|
37750
37611
|
}
|
|
37751
37612
|
|
|
37752
|
-
function
|
|
37753
|
-
|
|
37754
|
-
try {
|
|
37755
|
-
ret = JSON.stringify(obj, replacer)
|
|
37756
|
-
} catch (e) {
|
|
37757
|
-
ret = jsonSafeStringify(obj, replacer)
|
|
37758
|
-
}
|
|
37759
|
-
return ret
|
|
37760
|
-
}
|
|
37613
|
+
Querystring.prototype.init = function (options) {
|
|
37614
|
+
if (this.lib) { return }
|
|
37761
37615
|
|
|
37762
|
-
|
|
37763
|
-
|
|
37616
|
+
this.useQuerystring = options.useQuerystring
|
|
37617
|
+
this.lib = (this.useQuerystring ? querystring : qs)
|
|
37618
|
+
|
|
37619
|
+
this.parseOptions = options.qsParseOptions || {}
|
|
37620
|
+
this.stringifyOptions = options.qsStringifyOptions || {}
|
|
37764
37621
|
}
|
|
37765
37622
|
|
|
37766
|
-
function
|
|
37767
|
-
return
|
|
37623
|
+
Querystring.prototype.stringify = function (obj) {
|
|
37624
|
+
return (this.useQuerystring)
|
|
37625
|
+
? this.rfc3986(this.lib.stringify(obj,
|
|
37626
|
+
this.stringifyOptions.sep || null,
|
|
37627
|
+
this.stringifyOptions.eq || null,
|
|
37628
|
+
this.stringifyOptions))
|
|
37629
|
+
: this.lib.stringify(obj, this.stringifyOptions)
|
|
37768
37630
|
}
|
|
37769
37631
|
|
|
37770
|
-
function
|
|
37771
|
-
return
|
|
37632
|
+
Querystring.prototype.parse = function (str) {
|
|
37633
|
+
return (this.useQuerystring)
|
|
37634
|
+
? this.lib.parse(str,
|
|
37635
|
+
this.parseOptions.sep || null,
|
|
37636
|
+
this.parseOptions.eq || null,
|
|
37637
|
+
this.parseOptions)
|
|
37638
|
+
: this.lib.parse(str, this.parseOptions)
|
|
37772
37639
|
}
|
|
37773
37640
|
|
|
37774
|
-
function
|
|
37775
|
-
|
|
37776
|
-
|
|
37777
|
-
o[i] = obj[i]
|
|
37641
|
+
Querystring.prototype.rfc3986 = function (str) {
|
|
37642
|
+
return str.replace(/[!'()*]/g, function (c) {
|
|
37643
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
37778
37644
|
})
|
|
37779
|
-
return o
|
|
37780
37645
|
}
|
|
37781
37646
|
|
|
37782
|
-
|
|
37783
|
-
var numbers = process.version.replace('v', '').split('.')
|
|
37784
|
-
return {
|
|
37785
|
-
major: parseInt(numbers[0], 10),
|
|
37786
|
-
minor: parseInt(numbers[1], 10),
|
|
37787
|
-
patch: parseInt(numbers[2], 10)
|
|
37788
|
-
}
|
|
37789
|
-
}
|
|
37647
|
+
Querystring.prototype.unescape = querystring.unescape
|
|
37790
37648
|
|
|
37791
|
-
exports.
|
|
37792
|
-
exports.safeStringify = safeStringify
|
|
37793
|
-
exports.md5 = md5
|
|
37794
|
-
exports.isReadStream = isReadStream
|
|
37795
|
-
exports.toBase64 = toBase64
|
|
37796
|
-
exports.copy = copy
|
|
37797
|
-
exports.version = version
|
|
37798
|
-
exports.defer = defer
|
|
37649
|
+
exports.h = Querystring
|
|
37799
37650
|
|
|
37800
37651
|
|
|
37801
37652
|
/***/ }),
|
|
37802
37653
|
|
|
37803
|
-
/***/
|
|
37654
|
+
/***/ 29935:
|
|
37804
37655
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37805
37656
|
|
|
37806
37657
|
"use strict";
|
|
37807
37658
|
|
|
37808
37659
|
|
|
37809
|
-
var
|
|
37810
|
-
var
|
|
37811
|
-
var isstream = __webpack_require__(92104)
|
|
37812
|
-
var Buffer = __webpack_require__(59105).Buffer
|
|
37660
|
+
var url = __webpack_require__(78835)
|
|
37661
|
+
var isUrl = /^https?:/
|
|
37813
37662
|
|
|
37814
|
-
function
|
|
37663
|
+
function Redirect (request) {
|
|
37815
37664
|
this.request = request
|
|
37816
|
-
this.
|
|
37817
|
-
this.
|
|
37818
|
-
this.
|
|
37665
|
+
this.followRedirect = true
|
|
37666
|
+
this.followRedirects = true
|
|
37667
|
+
this.followAllRedirects = false
|
|
37668
|
+
this.followOriginalHttpMethod = false
|
|
37669
|
+
this.allowRedirect = function () { return true }
|
|
37670
|
+
this.maxRedirects = 10
|
|
37671
|
+
this.redirects = []
|
|
37672
|
+
this.redirectsFollowed = 0
|
|
37673
|
+
this.removeRefererHeader = false
|
|
37819
37674
|
}
|
|
37820
37675
|
|
|
37821
|
-
|
|
37676
|
+
Redirect.prototype.onRequest = function (options) {
|
|
37822
37677
|
var self = this
|
|
37823
|
-
var chunked = false
|
|
37824
|
-
var parts = options.data || options
|
|
37825
37678
|
|
|
37826
|
-
if (
|
|
37827
|
-
self.
|
|
37679
|
+
if (options.maxRedirects !== undefined) {
|
|
37680
|
+
self.maxRedirects = options.maxRedirects
|
|
37681
|
+
}
|
|
37682
|
+
if (typeof options.followRedirect === 'function') {
|
|
37683
|
+
self.allowRedirect = options.followRedirect
|
|
37684
|
+
}
|
|
37685
|
+
if (options.followRedirect !== undefined) {
|
|
37686
|
+
self.followRedirects = !!options.followRedirect
|
|
37687
|
+
}
|
|
37688
|
+
if (options.followAllRedirects !== undefined) {
|
|
37689
|
+
self.followAllRedirects = options.followAllRedirects
|
|
37690
|
+
}
|
|
37691
|
+
if (self.followRedirects || self.followAllRedirects) {
|
|
37692
|
+
self.redirects = self.redirects || []
|
|
37693
|
+
}
|
|
37694
|
+
if (options.removeRefererHeader !== undefined) {
|
|
37695
|
+
self.removeRefererHeader = options.removeRefererHeader
|
|
37696
|
+
}
|
|
37697
|
+
if (options.followOriginalHttpMethod !== undefined) {
|
|
37698
|
+
self.followOriginalHttpMethod = options.followOriginalHttpMethod
|
|
37699
|
+
}
|
|
37700
|
+
}
|
|
37701
|
+
|
|
37702
|
+
Redirect.prototype.redirectTo = function (response) {
|
|
37703
|
+
var self = this
|
|
37704
|
+
var request = self.request
|
|
37705
|
+
|
|
37706
|
+
var redirectTo = null
|
|
37707
|
+
if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
|
|
37708
|
+
var location = response.caseless.get('location')
|
|
37709
|
+
request.debug('redirect', location)
|
|
37710
|
+
|
|
37711
|
+
if (self.followAllRedirects) {
|
|
37712
|
+
redirectTo = location
|
|
37713
|
+
} else if (self.followRedirects) {
|
|
37714
|
+
switch (request.method) {
|
|
37715
|
+
case 'PATCH':
|
|
37716
|
+
case 'PUT':
|
|
37717
|
+
case 'POST':
|
|
37718
|
+
case 'DELETE':
|
|
37719
|
+
// Do not follow redirects
|
|
37720
|
+
break
|
|
37721
|
+
default:
|
|
37722
|
+
redirectTo = location
|
|
37723
|
+
break
|
|
37724
|
+
}
|
|
37725
|
+
}
|
|
37726
|
+
} else if (response.statusCode === 401) {
|
|
37727
|
+
var authHeader = request._auth.onResponse(response)
|
|
37728
|
+
if (authHeader) {
|
|
37729
|
+
request.setHeader('authorization', authHeader)
|
|
37730
|
+
redirectTo = request.uri
|
|
37731
|
+
}
|
|
37732
|
+
}
|
|
37733
|
+
return redirectTo
|
|
37734
|
+
}
|
|
37735
|
+
|
|
37736
|
+
Redirect.prototype.onResponse = function (response) {
|
|
37737
|
+
var self = this
|
|
37738
|
+
var request = self.request
|
|
37739
|
+
|
|
37740
|
+
var redirectTo = self.redirectTo(response)
|
|
37741
|
+
if (!redirectTo || !self.allowRedirect.call(request, response)) {
|
|
37742
|
+
return false
|
|
37743
|
+
}
|
|
37744
|
+
|
|
37745
|
+
request.debug('redirect to', redirectTo)
|
|
37746
|
+
|
|
37747
|
+
// ignore any potential response body. it cannot possibly be useful
|
|
37748
|
+
// to us at this point.
|
|
37749
|
+
// response.resume should be defined, but check anyway before calling. Workaround for browserify.
|
|
37750
|
+
if (response.resume) {
|
|
37751
|
+
response.resume()
|
|
37752
|
+
}
|
|
37753
|
+
|
|
37754
|
+
if (self.redirectsFollowed >= self.maxRedirects) {
|
|
37755
|
+
request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href))
|
|
37756
|
+
return false
|
|
37757
|
+
}
|
|
37758
|
+
self.redirectsFollowed += 1
|
|
37759
|
+
|
|
37760
|
+
if (!isUrl.test(redirectTo)) {
|
|
37761
|
+
redirectTo = url.resolve(request.uri.href, redirectTo)
|
|
37762
|
+
}
|
|
37763
|
+
|
|
37764
|
+
var uriPrev = request.uri
|
|
37765
|
+
request.uri = url.parse(redirectTo)
|
|
37766
|
+
|
|
37767
|
+
// handle the case where we change protocol from https to http or vice versa
|
|
37768
|
+
if (request.uri.protocol !== uriPrev.protocol) {
|
|
37769
|
+
delete request.agent
|
|
37770
|
+
}
|
|
37771
|
+
|
|
37772
|
+
self.redirects.push({ statusCode: response.statusCode, redirectUri: redirectTo })
|
|
37773
|
+
|
|
37774
|
+
if (self.followAllRedirects && request.method !== 'HEAD' &&
|
|
37775
|
+
response.statusCode !== 401 && response.statusCode !== 307) {
|
|
37776
|
+
request.method = self.followOriginalHttpMethod ? request.method : 'GET'
|
|
37777
|
+
}
|
|
37778
|
+
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
|
|
37779
|
+
delete request.src
|
|
37780
|
+
delete request.req
|
|
37781
|
+
delete request._started
|
|
37782
|
+
if (response.statusCode !== 401 && response.statusCode !== 307) {
|
|
37783
|
+
// Remove parameters from the previous response, unless this is the second request
|
|
37784
|
+
// for a server that requires digest authentication.
|
|
37785
|
+
delete request.body
|
|
37786
|
+
delete request._form
|
|
37787
|
+
if (request.headers) {
|
|
37788
|
+
request.removeHeader('host')
|
|
37789
|
+
request.removeHeader('content-type')
|
|
37790
|
+
request.removeHeader('content-length')
|
|
37791
|
+
if (request.uri.hostname !== request.originalHost.split(':')[0]) {
|
|
37792
|
+
// Remove authorization if changing hostnames (but not if just
|
|
37793
|
+
// changing ports or protocols). This matches the behavior of curl:
|
|
37794
|
+
// https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710
|
|
37795
|
+
request.removeHeader('authorization')
|
|
37796
|
+
}
|
|
37797
|
+
}
|
|
37828
37798
|
}
|
|
37829
37799
|
|
|
37830
|
-
if (
|
|
37831
|
-
|
|
37800
|
+
if (!self.removeRefererHeader) {
|
|
37801
|
+
request.setHeader('referer', uriPrev.href)
|
|
37832
37802
|
}
|
|
37833
37803
|
|
|
37834
|
-
|
|
37835
|
-
chunked = true
|
|
37836
|
-
}
|
|
37804
|
+
request.emit('redirect')
|
|
37837
37805
|
|
|
37838
|
-
|
|
37839
|
-
parts.forEach(function (part) {
|
|
37840
|
-
if (typeof part.body === 'undefined') {
|
|
37841
|
-
self.request.emit('error', new Error('Body attribute missing in multipart.'))
|
|
37842
|
-
}
|
|
37843
|
-
if (isstream(part.body)) {
|
|
37844
|
-
chunked = true
|
|
37845
|
-
}
|
|
37846
|
-
})
|
|
37847
|
-
}
|
|
37806
|
+
request.init()
|
|
37848
37807
|
|
|
37849
|
-
return
|
|
37808
|
+
return true
|
|
37850
37809
|
}
|
|
37851
37810
|
|
|
37852
|
-
|
|
37853
|
-
var self = this
|
|
37854
|
-
|
|
37855
|
-
if (chunked && !self.request.hasHeader('transfer-encoding')) {
|
|
37856
|
-
self.request.setHeader('transfer-encoding', 'chunked')
|
|
37857
|
-
}
|
|
37811
|
+
exports.l = Redirect
|
|
37858
37812
|
|
|
37859
|
-
var header = self.request.getHeader('content-type')
|
|
37860
37813
|
|
|
37861
|
-
|
|
37862
|
-
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
|
|
37863
|
-
} else {
|
|
37864
|
-
if (header.indexOf('boundary') !== -1) {
|
|
37865
|
-
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
|
|
37866
|
-
} else {
|
|
37867
|
-
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
|
|
37868
|
-
}
|
|
37869
|
-
}
|
|
37870
|
-
}
|
|
37814
|
+
/***/ }),
|
|
37871
37815
|
|
|
37872
|
-
|
|
37873
|
-
|
|
37874
|
-
var body = chunked ? new CombinedStream() : []
|
|
37816
|
+
/***/ 7141:
|
|
37817
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
37875
37818
|
|
|
37876
|
-
|
|
37877
|
-
if (typeof part === 'number') {
|
|
37878
|
-
part = part.toString()
|
|
37879
|
-
}
|
|
37880
|
-
return chunked ? body.append(part) : body.push(Buffer.from(part))
|
|
37881
|
-
}
|
|
37819
|
+
"use strict";
|
|
37882
37820
|
|
|
37883
|
-
if (self.request.preambleCRLF) {
|
|
37884
|
-
add('\r\n')
|
|
37885
|
-
}
|
|
37886
37821
|
|
|
37887
|
-
|
|
37888
|
-
|
|
37889
|
-
Object.keys(part).forEach(function (key) {
|
|
37890
|
-
if (key === 'body') { return }
|
|
37891
|
-
preamble += key + ': ' + part[key] + '\r\n'
|
|
37892
|
-
})
|
|
37893
|
-
preamble += '\r\n'
|
|
37894
|
-
add(preamble)
|
|
37895
|
-
add(part.body)
|
|
37896
|
-
add('\r\n')
|
|
37897
|
-
})
|
|
37898
|
-
add('--' + self.boundary + '--')
|
|
37822
|
+
var url = __webpack_require__(78835)
|
|
37823
|
+
var tunnel = __webpack_require__(2429)
|
|
37899
37824
|
|
|
37900
|
-
|
|
37901
|
-
|
|
37902
|
-
|
|
37825
|
+
var defaultProxyHeaderWhiteList = [
|
|
37826
|
+
'accept',
|
|
37827
|
+
'accept-charset',
|
|
37828
|
+
'accept-encoding',
|
|
37829
|
+
'accept-language',
|
|
37830
|
+
'accept-ranges',
|
|
37831
|
+
'cache-control',
|
|
37832
|
+
'content-encoding',
|
|
37833
|
+
'content-language',
|
|
37834
|
+
'content-location',
|
|
37835
|
+
'content-md5',
|
|
37836
|
+
'content-range',
|
|
37837
|
+
'content-type',
|
|
37838
|
+
'connection',
|
|
37839
|
+
'date',
|
|
37840
|
+
'expect',
|
|
37841
|
+
'max-forwards',
|
|
37842
|
+
'pragma',
|
|
37843
|
+
'referer',
|
|
37844
|
+
'te',
|
|
37845
|
+
'user-agent',
|
|
37846
|
+
'via'
|
|
37847
|
+
]
|
|
37903
37848
|
|
|
37904
|
-
|
|
37905
|
-
|
|
37849
|
+
var defaultProxyHeaderExclusiveList = [
|
|
37850
|
+
'proxy-authorization'
|
|
37851
|
+
]
|
|
37906
37852
|
|
|
37907
|
-
|
|
37908
|
-
var
|
|
37853
|
+
function constructProxyHost (uriObject) {
|
|
37854
|
+
var port = uriObject.port
|
|
37855
|
+
var protocol = uriObject.protocol
|
|
37856
|
+
var proxyHost = uriObject.hostname + ':'
|
|
37909
37857
|
|
|
37910
|
-
|
|
37911
|
-
|
|
37858
|
+
if (port) {
|
|
37859
|
+
proxyHost += port
|
|
37860
|
+
} else if (protocol === 'https:') {
|
|
37861
|
+
proxyHost += '443'
|
|
37862
|
+
} else {
|
|
37863
|
+
proxyHost += '80'
|
|
37864
|
+
}
|
|
37912
37865
|
|
|
37913
|
-
|
|
37914
|
-
self.chunked = chunked
|
|
37915
|
-
self.body = self.build(parts, chunked)
|
|
37866
|
+
return proxyHost
|
|
37916
37867
|
}
|
|
37917
37868
|
|
|
37918
|
-
|
|
37869
|
+
function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) {
|
|
37870
|
+
var whiteList = proxyHeaderWhiteList
|
|
37871
|
+
.reduce(function (set, header) {
|
|
37872
|
+
set[header.toLowerCase()] = true
|
|
37873
|
+
return set
|
|
37874
|
+
}, {})
|
|
37919
37875
|
|
|
37876
|
+
return Object.keys(headers)
|
|
37877
|
+
.filter(function (header) {
|
|
37878
|
+
return whiteList[header.toLowerCase()]
|
|
37879
|
+
})
|
|
37880
|
+
.reduce(function (set, header) {
|
|
37881
|
+
set[header] = headers[header]
|
|
37882
|
+
return set
|
|
37883
|
+
}, {})
|
|
37884
|
+
}
|
|
37920
37885
|
|
|
37921
|
-
|
|
37886
|
+
function constructTunnelOptions (request, proxyHeaders) {
|
|
37887
|
+
var proxy = request.proxy
|
|
37922
37888
|
|
|
37923
|
-
|
|
37924
|
-
|
|
37889
|
+
var tunnelOptions = {
|
|
37890
|
+
proxy: {
|
|
37891
|
+
host: proxy.hostname,
|
|
37892
|
+
port: +proxy.port,
|
|
37893
|
+
proxyAuth: proxy.auth,
|
|
37894
|
+
headers: proxyHeaders
|
|
37895
|
+
},
|
|
37896
|
+
headers: request.headers,
|
|
37897
|
+
ca: request.ca,
|
|
37898
|
+
cert: request.cert,
|
|
37899
|
+
key: request.key,
|
|
37900
|
+
passphrase: request.passphrase,
|
|
37901
|
+
pfx: request.pfx,
|
|
37902
|
+
ciphers: request.ciphers,
|
|
37903
|
+
rejectUnauthorized: request.rejectUnauthorized,
|
|
37904
|
+
secureOptions: request.secureOptions,
|
|
37905
|
+
secureProtocol: request.secureProtocol
|
|
37906
|
+
}
|
|
37925
37907
|
|
|
37926
|
-
|
|
37908
|
+
return tunnelOptions
|
|
37909
|
+
}
|
|
37927
37910
|
|
|
37911
|
+
function constructTunnelFnName (uri, proxy) {
|
|
37912
|
+
var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http')
|
|
37913
|
+
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
|
|
37914
|
+
return [uriProtocol, proxyProtocol].join('Over')
|
|
37915
|
+
}
|
|
37928
37916
|
|
|
37929
|
-
|
|
37930
|
-
var
|
|
37931
|
-
var
|
|
37932
|
-
var
|
|
37933
|
-
|
|
37934
|
-
|
|
37935
|
-
var Buffer = __webpack_require__(59105).Buffer
|
|
37917
|
+
function getTunnelFn (request) {
|
|
37918
|
+
var uri = request.uri
|
|
37919
|
+
var proxy = request.proxy
|
|
37920
|
+
var tunnelFnName = constructTunnelFnName(uri, proxy)
|
|
37921
|
+
return tunnel[tunnelFnName]
|
|
37922
|
+
}
|
|
37936
37923
|
|
|
37937
|
-
function
|
|
37924
|
+
function Tunnel (request) {
|
|
37938
37925
|
this.request = request
|
|
37939
|
-
this.
|
|
37926
|
+
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
|
37927
|
+
this.proxyHeaderExclusiveList = []
|
|
37928
|
+
if (typeof request.tunnel !== 'undefined') {
|
|
37929
|
+
this.tunnelOverride = request.tunnel
|
|
37930
|
+
}
|
|
37940
37931
|
}
|
|
37941
37932
|
|
|
37942
|
-
|
|
37943
|
-
var
|
|
37944
|
-
|
|
37945
|
-
|
|
37946
|
-
|
|
37947
|
-
|
|
37948
|
-
|
|
37949
|
-
|
|
37950
|
-
if (!oa.oauth_timestamp) {
|
|
37951
|
-
oa.oauth_timestamp = Math.floor(Date.now() / 1000).toString()
|
|
37952
|
-
}
|
|
37953
|
-
if (!oa.oauth_nonce) {
|
|
37954
|
-
oa.oauth_nonce = uuid().replace(/-/g, '')
|
|
37933
|
+
Tunnel.prototype.isEnabled = function () {
|
|
37934
|
+
var self = this
|
|
37935
|
+
var request = self.request
|
|
37936
|
+
// Tunnel HTTPS by default. Allow the user to override this setting.
|
|
37937
|
+
|
|
37938
|
+
// If self.tunnelOverride is set (the user specified a value), use it.
|
|
37939
|
+
if (typeof self.tunnelOverride !== 'undefined') {
|
|
37940
|
+
return self.tunnelOverride
|
|
37955
37941
|
}
|
|
37956
|
-
|
|
37957
|
-
|
|
37942
|
+
|
|
37943
|
+
// If the destination is HTTPS, tunnel.
|
|
37944
|
+
if (request.uri.protocol === 'https:') {
|
|
37945
|
+
return true
|
|
37958
37946
|
}
|
|
37959
37947
|
|
|
37960
|
-
|
|
37961
|
-
|
|
37962
|
-
|
|
37948
|
+
// Otherwise, do not use tunnel.
|
|
37949
|
+
return false
|
|
37950
|
+
}
|
|
37963
37951
|
|
|
37964
|
-
|
|
37965
|
-
|
|
37952
|
+
Tunnel.prototype.setup = function (options) {
|
|
37953
|
+
var self = this
|
|
37954
|
+
var request = self.request
|
|
37966
37955
|
|
|
37967
|
-
|
|
37968
|
-
delete oa.oauth_realm
|
|
37969
|
-
delete oa.oauth_transport_method
|
|
37956
|
+
options = options || {}
|
|
37970
37957
|
|
|
37971
|
-
|
|
37972
|
-
|
|
37958
|
+
if (typeof request.proxy === 'string') {
|
|
37959
|
+
request.proxy = url.parse(request.proxy)
|
|
37960
|
+
}
|
|
37973
37961
|
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
37977
|
-
baseurl,
|
|
37978
|
-
params,
|
|
37979
|
-
consumer_secret_or_private_key, // eslint-disable-line camelcase
|
|
37980
|
-
token_secret // eslint-disable-line camelcase
|
|
37981
|
-
)
|
|
37962
|
+
if (!request.proxy || !request.tunnel) {
|
|
37963
|
+
return false
|
|
37964
|
+
}
|
|
37982
37965
|
|
|
37983
|
-
|
|
37984
|
-
|
|
37966
|
+
// Setup Proxy Header Exclusive List and White List
|
|
37967
|
+
if (options.proxyHeaderWhiteList) {
|
|
37968
|
+
self.proxyHeaderWhiteList = options.proxyHeaderWhiteList
|
|
37969
|
+
}
|
|
37970
|
+
if (options.proxyHeaderExclusiveList) {
|
|
37971
|
+
self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList
|
|
37985
37972
|
}
|
|
37986
37973
|
|
|
37987
|
-
|
|
37988
|
-
|
|
37974
|
+
var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList)
|
|
37975
|
+
var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList)
|
|
37989
37976
|
|
|
37990
|
-
|
|
37991
|
-
|
|
37992
|
-
|
|
37993
|
-
|
|
37994
|
-
}
|
|
37977
|
+
// Setup Proxy Headers and Proxy Headers Host
|
|
37978
|
+
// Only send the Proxy White Listed Header names
|
|
37979
|
+
var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList)
|
|
37980
|
+
proxyHeaders.host = constructProxyHost(request.uri)
|
|
37995
37981
|
|
|
37996
|
-
|
|
37997
|
-
shasum.update(body || '')
|
|
37998
|
-
var sha1 = shasum.digest('hex')
|
|
37982
|
+
proxyHeaderExclusiveList.forEach(request.removeHeader, request)
|
|
37999
37983
|
|
|
38000
|
-
|
|
37984
|
+
// Set Agent from Tunnel Data
|
|
37985
|
+
var tunnelFn = getTunnelFn(request)
|
|
37986
|
+
var tunnelOptions = constructTunnelOptions(request, proxyHeaders)
|
|
37987
|
+
request.agent = tunnelFn(tunnelOptions)
|
|
37988
|
+
|
|
37989
|
+
return true
|
|
38001
37990
|
}
|
|
38002
37991
|
|
|
38003
|
-
|
|
38004
|
-
|
|
37992
|
+
Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
|
37993
|
+
Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList
|
|
37994
|
+
exports.n = Tunnel
|
|
38005
37995
|
|
|
38006
|
-
var params = Object.keys(oa).filter(function (i) {
|
|
38007
|
-
return i !== 'realm' && i !== 'oauth_signature'
|
|
38008
|
-
}).sort()
|
|
38009
37996
|
|
|
38010
|
-
|
|
38011
|
-
params.splice(0, 0, 'realm')
|
|
38012
|
-
}
|
|
38013
|
-
params.push('oauth_signature')
|
|
37997
|
+
/***/ }),
|
|
38014
37998
|
|
|
38015
|
-
|
|
38016
|
-
|
|
38017
|
-
}).join(sep)
|
|
38018
|
-
}
|
|
37999
|
+
/***/ 97501:
|
|
38000
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
38019
38001
|
|
|
38020
|
-
|
|
38021
|
-
|
|
38022
|
-
|
|
38002
|
+
var CombinedStream = __webpack_require__(74041);
|
|
38003
|
+
var util = __webpack_require__(31669);
|
|
38004
|
+
var path = __webpack_require__(85622);
|
|
38005
|
+
var http = __webpack_require__(98605);
|
|
38006
|
+
var https = __webpack_require__(57211);
|
|
38007
|
+
var parseUrl = __webpack_require__(78835).parse;
|
|
38008
|
+
var fs = __webpack_require__(35747);
|
|
38009
|
+
var mime = __webpack_require__(19010);
|
|
38010
|
+
var asynckit = __webpack_require__(48564);
|
|
38011
|
+
var populate = __webpack_require__(97631);
|
|
38023
38012
|
|
|
38024
|
-
|
|
38025
|
-
|
|
38026
|
-
var headers = caseless(self.request.headers)
|
|
38027
|
-
var body = self.request.body || ''
|
|
38028
|
-
var qsLib = self.request.qsLib || qs
|
|
38013
|
+
// Public API
|
|
38014
|
+
module.exports = FormData;
|
|
38029
38015
|
|
|
38030
|
-
|
|
38031
|
-
|
|
38032
|
-
var contentType = headers.get('content-type') || ''
|
|
38033
|
-
var formContentType = 'application/x-www-form-urlencoded'
|
|
38034
|
-
var transport = _oauth.transport_method || 'header'
|
|
38016
|
+
// make it a Stream
|
|
38017
|
+
util.inherits(FormData, CombinedStream);
|
|
38035
38018
|
|
|
38036
|
-
|
|
38037
|
-
|
|
38038
|
-
|
|
38039
|
-
|
|
38040
|
-
|
|
38041
|
-
|
|
38042
|
-
|
|
38043
|
-
|
|
38044
|
-
|
|
38045
|
-
|
|
38019
|
+
/**
|
|
38020
|
+
* Create readable "multipart/form-data" streams.
|
|
38021
|
+
* Can be used to submit forms
|
|
38022
|
+
* and file uploads to other web applications.
|
|
38023
|
+
*
|
|
38024
|
+
* @constructor
|
|
38025
|
+
* @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
38026
|
+
*/
|
|
38027
|
+
function FormData(options) {
|
|
38028
|
+
if (!(this instanceof FormData)) {
|
|
38029
|
+
return new FormData();
|
|
38046
38030
|
}
|
|
38047
38031
|
|
|
38048
|
-
|
|
38049
|
-
|
|
38032
|
+
this._overheadLength = 0;
|
|
38033
|
+
this._valueLength = 0;
|
|
38034
|
+
this._valuesToMeasure = [];
|
|
38035
|
+
|
|
38036
|
+
CombinedStream.call(this);
|
|
38037
|
+
|
|
38038
|
+
options = options || {};
|
|
38039
|
+
for (var option in options) {
|
|
38040
|
+
this[option] = options[option];
|
|
38050
38041
|
}
|
|
38042
|
+
}
|
|
38051
38043
|
|
|
38052
|
-
|
|
38044
|
+
FormData.LINE_BREAK = '\r\n';
|
|
38045
|
+
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
38053
38046
|
|
|
38054
|
-
|
|
38055
|
-
case 'header':
|
|
38056
|
-
self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"'))
|
|
38057
|
-
break
|
|
38047
|
+
FormData.prototype.append = function(field, value, options) {
|
|
38058
38048
|
|
|
38059
|
-
|
|
38060
|
-
var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&')
|
|
38061
|
-
self.request.uri = url.parse(href)
|
|
38062
|
-
self.request.path = self.request.uri.path
|
|
38063
|
-
break
|
|
38049
|
+
options = options || {};
|
|
38064
38050
|
|
|
38065
|
-
|
|
38066
|
-
|
|
38067
|
-
|
|
38051
|
+
// allow filename as single option
|
|
38052
|
+
if (typeof options == 'string') {
|
|
38053
|
+
options = {filename: options};
|
|
38054
|
+
}
|
|
38068
38055
|
|
|
38069
|
-
|
|
38070
|
-
|
|
38056
|
+
var append = CombinedStream.prototype.append.bind(this);
|
|
38057
|
+
|
|
38058
|
+
// all that streamy business can't handle numbers
|
|
38059
|
+
if (typeof value == 'number') {
|
|
38060
|
+
value = '' + value;
|
|
38071
38061
|
}
|
|
38072
|
-
}
|
|
38073
38062
|
|
|
38074
|
-
|
|
38063
|
+
// https://github.com/felixge/node-form-data/issues/38
|
|
38064
|
+
if (util.isArray(value)) {
|
|
38065
|
+
// Please convert your array into string
|
|
38066
|
+
// the way web server expects it
|
|
38067
|
+
this._error(new Error('Arrays are not supported.'));
|
|
38068
|
+
return;
|
|
38069
|
+
}
|
|
38075
38070
|
|
|
38071
|
+
var header = this._multiPartHeader(field, value, options);
|
|
38072
|
+
var footer = this._multiPartFooter();
|
|
38076
38073
|
|
|
38077
|
-
|
|
38074
|
+
append(header);
|
|
38075
|
+
append(value);
|
|
38076
|
+
append(footer);
|
|
38078
38077
|
|
|
38079
|
-
|
|
38080
|
-
|
|
38078
|
+
// pass along options.knownLength
|
|
38079
|
+
this._trackLength(header, value, options);
|
|
38080
|
+
};
|
|
38081
38081
|
|
|
38082
|
-
|
|
38082
|
+
FormData.prototype._trackLength = function(header, value, options) {
|
|
38083
|
+
var valueLength = 0;
|
|
38083
38084
|
|
|
38085
|
+
// used w/ getLengthSync(), when length is known.
|
|
38086
|
+
// e.g. for streaming directly from a remote server,
|
|
38087
|
+
// w/ a known file a size, and not wanting to wait for
|
|
38088
|
+
// incoming file to finish to get its size.
|
|
38089
|
+
if (options.knownLength != null) {
|
|
38090
|
+
valueLength += +options.knownLength;
|
|
38091
|
+
} else if (Buffer.isBuffer(value)) {
|
|
38092
|
+
valueLength = value.length;
|
|
38093
|
+
} else if (typeof value === 'string') {
|
|
38094
|
+
valueLength = Buffer.byteLength(value);
|
|
38095
|
+
}
|
|
38084
38096
|
|
|
38085
|
-
|
|
38086
|
-
var querystring = __webpack_require__(71191)
|
|
38097
|
+
this._valueLength += valueLength;
|
|
38087
38098
|
|
|
38088
|
-
|
|
38089
|
-
this.
|
|
38090
|
-
|
|
38091
|
-
|
|
38092
|
-
this.parseOptions = null
|
|
38093
|
-
this.stringifyOptions = null
|
|
38094
|
-
}
|
|
38099
|
+
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
|
38100
|
+
this._overheadLength +=
|
|
38101
|
+
Buffer.byteLength(header) +
|
|
38102
|
+
FormData.LINE_BREAK.length;
|
|
38095
38103
|
|
|
38096
|
-
|
|
38097
|
-
if (
|
|
38104
|
+
// empty or either doesn't have path or not an http response
|
|
38105
|
+
if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) {
|
|
38106
|
+
return;
|
|
38107
|
+
}
|
|
38098
38108
|
|
|
38099
|
-
|
|
38100
|
-
|
|
38109
|
+
// no need to bother with the length
|
|
38110
|
+
if (!options.knownLength) {
|
|
38111
|
+
this._valuesToMeasure.push(value);
|
|
38112
|
+
}
|
|
38113
|
+
};
|
|
38101
38114
|
|
|
38102
|
-
|
|
38103
|
-
this.stringifyOptions = options.qsStringifyOptions || {}
|
|
38104
|
-
}
|
|
38115
|
+
FormData.prototype._lengthRetriever = function(value, callback) {
|
|
38105
38116
|
|
|
38106
|
-
|
|
38107
|
-
return (this.useQuerystring)
|
|
38108
|
-
? this.rfc3986(this.lib.stringify(obj,
|
|
38109
|
-
this.stringifyOptions.sep || null,
|
|
38110
|
-
this.stringifyOptions.eq || null,
|
|
38111
|
-
this.stringifyOptions))
|
|
38112
|
-
: this.lib.stringify(obj, this.stringifyOptions)
|
|
38113
|
-
}
|
|
38117
|
+
if (value.hasOwnProperty('fd')) {
|
|
38114
38118
|
|
|
38115
|
-
|
|
38116
|
-
|
|
38117
|
-
|
|
38118
|
-
|
|
38119
|
-
|
|
38120
|
-
|
|
38121
|
-
|
|
38122
|
-
|
|
38119
|
+
// take read range into a account
|
|
38120
|
+
// `end` = Infinity –> read file till the end
|
|
38121
|
+
//
|
|
38122
|
+
// TODO: Looks like there is bug in Node fs.createReadStream
|
|
38123
|
+
// it doesn't respect `end` options without `start` options
|
|
38124
|
+
// Fix it when node fixes it.
|
|
38125
|
+
// https://github.com/joyent/node/issues/7819
|
|
38126
|
+
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
38123
38127
|
|
|
38124
|
-
|
|
38125
|
-
|
|
38126
|
-
|
|
38127
|
-
|
|
38128
|
-
}
|
|
38128
|
+
// when end specified
|
|
38129
|
+
// no need to calculate range
|
|
38130
|
+
// inclusive, starts with 0
|
|
38131
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
38129
38132
|
|
|
38130
|
-
|
|
38133
|
+
// not that fast snoopy
|
|
38134
|
+
} else {
|
|
38135
|
+
// still need to fetch file size from fs
|
|
38136
|
+
fs.stat(value.path, function(err, stat) {
|
|
38131
38137
|
|
|
38132
|
-
|
|
38138
|
+
var fileSize;
|
|
38133
38139
|
|
|
38140
|
+
if (err) {
|
|
38141
|
+
callback(err);
|
|
38142
|
+
return;
|
|
38143
|
+
}
|
|
38134
38144
|
|
|
38135
|
-
|
|
38145
|
+
// update final size based on the range options
|
|
38146
|
+
fileSize = stat.size - (value.start ? value.start : 0);
|
|
38147
|
+
callback(null, fileSize);
|
|
38148
|
+
});
|
|
38149
|
+
}
|
|
38136
38150
|
|
|
38137
|
-
|
|
38138
|
-
|
|
38151
|
+
// or http response
|
|
38152
|
+
} else if (value.hasOwnProperty('httpVersion')) {
|
|
38153
|
+
callback(null, +value.headers['content-length']);
|
|
38139
38154
|
|
|
38140
|
-
|
|
38155
|
+
// or request stream http://github.com/mikeal/request
|
|
38156
|
+
} else if (value.hasOwnProperty('httpModule')) {
|
|
38157
|
+
// wait till response come back
|
|
38158
|
+
value.on('response', function(response) {
|
|
38159
|
+
value.pause();
|
|
38160
|
+
callback(null, +response.headers['content-length']);
|
|
38161
|
+
});
|
|
38162
|
+
value.resume();
|
|
38141
38163
|
|
|
38164
|
+
// something else
|
|
38165
|
+
} else {
|
|
38166
|
+
callback('Unknown stream');
|
|
38167
|
+
}
|
|
38168
|
+
};
|
|
38142
38169
|
|
|
38143
|
-
|
|
38144
|
-
|
|
38170
|
+
FormData.prototype._multiPartHeader = function(field, value, options) {
|
|
38171
|
+
// custom header specified (as string)?
|
|
38172
|
+
// it becomes responsible for boundary
|
|
38173
|
+
// (e.g. to handle extra CRLFs on .NET servers)
|
|
38174
|
+
if (typeof options.header == 'string') {
|
|
38175
|
+
return options.header;
|
|
38176
|
+
}
|
|
38145
38177
|
|
|
38146
|
-
|
|
38147
|
-
this.
|
|
38148
|
-
this.followRedirect = true
|
|
38149
|
-
this.followRedirects = true
|
|
38150
|
-
this.followAllRedirects = false
|
|
38151
|
-
this.followOriginalHttpMethod = false
|
|
38152
|
-
this.allowRedirect = function () { return true }
|
|
38153
|
-
this.maxRedirects = 10
|
|
38154
|
-
this.redirects = []
|
|
38155
|
-
this.redirectsFollowed = 0
|
|
38156
|
-
this.removeRefererHeader = false
|
|
38157
|
-
}
|
|
38178
|
+
var contentDisposition = this._getContentDisposition(value, options);
|
|
38179
|
+
var contentType = this._getContentType(value, options);
|
|
38158
38180
|
|
|
38159
|
-
|
|
38160
|
-
var
|
|
38181
|
+
var contents = '';
|
|
38182
|
+
var headers = {
|
|
38183
|
+
// add custom disposition as third element or keep it two elements if not
|
|
38184
|
+
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
38185
|
+
// if no content type. allow it to be empty array
|
|
38186
|
+
'Content-Type': [].concat(contentType || [])
|
|
38187
|
+
};
|
|
38161
38188
|
|
|
38162
|
-
|
|
38163
|
-
|
|
38164
|
-
|
|
38165
|
-
if (typeof options.followRedirect === 'function') {
|
|
38166
|
-
self.allowRedirect = options.followRedirect
|
|
38167
|
-
}
|
|
38168
|
-
if (options.followRedirect !== undefined) {
|
|
38169
|
-
self.followRedirects = !!options.followRedirect
|
|
38170
|
-
}
|
|
38171
|
-
if (options.followAllRedirects !== undefined) {
|
|
38172
|
-
self.followAllRedirects = options.followAllRedirects
|
|
38173
|
-
}
|
|
38174
|
-
if (self.followRedirects || self.followAllRedirects) {
|
|
38175
|
-
self.redirects = self.redirects || []
|
|
38176
|
-
}
|
|
38177
|
-
if (options.removeRefererHeader !== undefined) {
|
|
38178
|
-
self.removeRefererHeader = options.removeRefererHeader
|
|
38179
|
-
}
|
|
38180
|
-
if (options.followOriginalHttpMethod !== undefined) {
|
|
38181
|
-
self.followOriginalHttpMethod = options.followOriginalHttpMethod
|
|
38189
|
+
// allow custom headers.
|
|
38190
|
+
if (typeof options.header == 'object') {
|
|
38191
|
+
populate(headers, options.header);
|
|
38182
38192
|
}
|
|
38183
|
-
}
|
|
38184
38193
|
|
|
38185
|
-
|
|
38186
|
-
var
|
|
38187
|
-
|
|
38194
|
+
var header;
|
|
38195
|
+
for (var prop in headers) {
|
|
38196
|
+
if (!headers.hasOwnProperty(prop)) continue;
|
|
38197
|
+
header = headers[prop];
|
|
38188
38198
|
|
|
38189
|
-
|
|
38190
|
-
|
|
38191
|
-
|
|
38192
|
-
|
|
38199
|
+
// skip nullish headers.
|
|
38200
|
+
if (header == null) {
|
|
38201
|
+
continue;
|
|
38202
|
+
}
|
|
38193
38203
|
|
|
38194
|
-
|
|
38195
|
-
|
|
38196
|
-
|
|
38197
|
-
switch (request.method) {
|
|
38198
|
-
case 'PATCH':
|
|
38199
|
-
case 'PUT':
|
|
38200
|
-
case 'POST':
|
|
38201
|
-
case 'DELETE':
|
|
38202
|
-
// Do not follow redirects
|
|
38203
|
-
break
|
|
38204
|
-
default:
|
|
38205
|
-
redirectTo = location
|
|
38206
|
-
break
|
|
38207
|
-
}
|
|
38204
|
+
// convert all headers to arrays.
|
|
38205
|
+
if (!Array.isArray(header)) {
|
|
38206
|
+
header = [header];
|
|
38208
38207
|
}
|
|
38209
|
-
|
|
38210
|
-
|
|
38211
|
-
if (
|
|
38212
|
-
|
|
38213
|
-
redirectTo = request.uri
|
|
38208
|
+
|
|
38209
|
+
// add non-empty headers.
|
|
38210
|
+
if (header.length) {
|
|
38211
|
+
contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK;
|
|
38214
38212
|
}
|
|
38215
38213
|
}
|
|
38216
|
-
return redirectTo
|
|
38217
|
-
}
|
|
38218
|
-
|
|
38219
|
-
Redirect.prototype.onResponse = function (response) {
|
|
38220
|
-
var self = this
|
|
38221
|
-
var request = self.request
|
|
38222
38214
|
|
|
38223
|
-
|
|
38224
|
-
|
|
38225
|
-
return false
|
|
38226
|
-
}
|
|
38215
|
+
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
|
38216
|
+
};
|
|
38227
38217
|
|
|
38228
|
-
|
|
38218
|
+
FormData.prototype._getContentDisposition = function(value, options) {
|
|
38229
38219
|
|
|
38230
|
-
|
|
38231
|
-
|
|
38232
|
-
|
|
38233
|
-
if (response.resume) {
|
|
38234
|
-
response.resume()
|
|
38235
|
-
}
|
|
38220
|
+
var filename
|
|
38221
|
+
, contentDisposition
|
|
38222
|
+
;
|
|
38236
38223
|
|
|
38237
|
-
if (
|
|
38238
|
-
|
|
38239
|
-
|
|
38224
|
+
if (typeof options.filepath === 'string') {
|
|
38225
|
+
// custom filepath for relative paths
|
|
38226
|
+
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
38227
|
+
} else if (options.filename || value.name || value.path) {
|
|
38228
|
+
// custom filename take precedence
|
|
38229
|
+
// formidable and the browser add a name property
|
|
38230
|
+
// fs- and request- streams have path property
|
|
38231
|
+
filename = path.basename(options.filename || value.name || value.path);
|
|
38232
|
+
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
|
38233
|
+
// or try http response
|
|
38234
|
+
filename = path.basename(value.client._httpMessage.path);
|
|
38240
38235
|
}
|
|
38241
|
-
self.redirectsFollowed += 1
|
|
38242
38236
|
|
|
38243
|
-
if (
|
|
38244
|
-
|
|
38237
|
+
if (filename) {
|
|
38238
|
+
contentDisposition = 'filename="' + filename + '"';
|
|
38245
38239
|
}
|
|
38246
38240
|
|
|
38247
|
-
|
|
38248
|
-
|
|
38241
|
+
return contentDisposition;
|
|
38242
|
+
};
|
|
38249
38243
|
|
|
38250
|
-
|
|
38251
|
-
if (request.uri.protocol !== uriPrev.protocol) {
|
|
38252
|
-
delete request.agent
|
|
38253
|
-
}
|
|
38244
|
+
FormData.prototype._getContentType = function(value, options) {
|
|
38254
38245
|
|
|
38255
|
-
|
|
38246
|
+
// use custom content-type above all
|
|
38247
|
+
var contentType = options.contentType;
|
|
38256
38248
|
|
|
38257
|
-
|
|
38258
|
-
|
|
38259
|
-
|
|
38260
|
-
}
|
|
38261
|
-
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
|
|
38262
|
-
delete request.src
|
|
38263
|
-
delete request.req
|
|
38264
|
-
delete request._started
|
|
38265
|
-
if (response.statusCode !== 401 && response.statusCode !== 307) {
|
|
38266
|
-
// Remove parameters from the previous response, unless this is the second request
|
|
38267
|
-
// for a server that requires digest authentication.
|
|
38268
|
-
delete request.body
|
|
38269
|
-
delete request._form
|
|
38270
|
-
if (request.headers) {
|
|
38271
|
-
request.removeHeader('host')
|
|
38272
|
-
request.removeHeader('content-type')
|
|
38273
|
-
request.removeHeader('content-length')
|
|
38274
|
-
if (request.uri.hostname !== request.originalHost.split(':')[0]) {
|
|
38275
|
-
// Remove authorization if changing hostnames (but not if just
|
|
38276
|
-
// changing ports or protocols). This matches the behavior of curl:
|
|
38277
|
-
// https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710
|
|
38278
|
-
request.removeHeader('authorization')
|
|
38279
|
-
}
|
|
38280
|
-
}
|
|
38249
|
+
// or try `name` from formidable, browser
|
|
38250
|
+
if (!contentType && value.name) {
|
|
38251
|
+
contentType = mime.lookup(value.name);
|
|
38281
38252
|
}
|
|
38282
38253
|
|
|
38283
|
-
|
|
38284
|
-
|
|
38254
|
+
// or try `path` from fs-, request- streams
|
|
38255
|
+
if (!contentType && value.path) {
|
|
38256
|
+
contentType = mime.lookup(value.path);
|
|
38285
38257
|
}
|
|
38286
38258
|
|
|
38287
|
-
|
|
38288
|
-
|
|
38289
|
-
|
|
38290
|
-
|
|
38291
|
-
return true
|
|
38292
|
-
}
|
|
38259
|
+
// or if it's http-reponse
|
|
38260
|
+
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
|
|
38261
|
+
contentType = value.headers['content-type'];
|
|
38262
|
+
}
|
|
38293
38263
|
|
|
38294
|
-
|
|
38264
|
+
// or guess it from the filepath or filename
|
|
38265
|
+
if (!contentType && (options.filepath || options.filename)) {
|
|
38266
|
+
contentType = mime.lookup(options.filepath || options.filename);
|
|
38267
|
+
}
|
|
38295
38268
|
|
|
38269
|
+
// fallback to the default content type if `value` is not simple value
|
|
38270
|
+
if (!contentType && typeof value == 'object') {
|
|
38271
|
+
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
|
38272
|
+
}
|
|
38296
38273
|
|
|
38297
|
-
|
|
38274
|
+
return contentType;
|
|
38275
|
+
};
|
|
38298
38276
|
|
|
38299
|
-
|
|
38300
|
-
|
|
38277
|
+
FormData.prototype._multiPartFooter = function() {
|
|
38278
|
+
return function(next) {
|
|
38279
|
+
var footer = FormData.LINE_BREAK;
|
|
38301
38280
|
|
|
38302
|
-
|
|
38281
|
+
var lastPart = (this._streams.length === 0);
|
|
38282
|
+
if (lastPart) {
|
|
38283
|
+
footer += this._lastBoundary();
|
|
38284
|
+
}
|
|
38303
38285
|
|
|
38286
|
+
next(footer);
|
|
38287
|
+
}.bind(this);
|
|
38288
|
+
};
|
|
38304
38289
|
|
|
38305
|
-
|
|
38306
|
-
|
|
38290
|
+
FormData.prototype._lastBoundary = function() {
|
|
38291
|
+
return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
|
|
38292
|
+
};
|
|
38307
38293
|
|
|
38308
|
-
|
|
38309
|
-
|
|
38310
|
-
|
|
38311
|
-
|
|
38312
|
-
|
|
38313
|
-
'accept-ranges',
|
|
38314
|
-
'cache-control',
|
|
38315
|
-
'content-encoding',
|
|
38316
|
-
'content-language',
|
|
38317
|
-
'content-location',
|
|
38318
|
-
'content-md5',
|
|
38319
|
-
'content-range',
|
|
38320
|
-
'content-type',
|
|
38321
|
-
'connection',
|
|
38322
|
-
'date',
|
|
38323
|
-
'expect',
|
|
38324
|
-
'max-forwards',
|
|
38325
|
-
'pragma',
|
|
38326
|
-
'referer',
|
|
38327
|
-
'te',
|
|
38328
|
-
'user-agent',
|
|
38329
|
-
'via'
|
|
38330
|
-
]
|
|
38294
|
+
FormData.prototype.getHeaders = function(userHeaders) {
|
|
38295
|
+
var header;
|
|
38296
|
+
var formHeaders = {
|
|
38297
|
+
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
38298
|
+
};
|
|
38331
38299
|
|
|
38332
|
-
|
|
38333
|
-
|
|
38334
|
-
]
|
|
38300
|
+
for (header in userHeaders) {
|
|
38301
|
+
if (userHeaders.hasOwnProperty(header)) {
|
|
38302
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
38303
|
+
}
|
|
38304
|
+
}
|
|
38335
38305
|
|
|
38336
|
-
|
|
38337
|
-
|
|
38338
|
-
var protocol = uriObject.protocol
|
|
38339
|
-
var proxyHost = uriObject.hostname + ':'
|
|
38306
|
+
return formHeaders;
|
|
38307
|
+
};
|
|
38340
38308
|
|
|
38341
|
-
|
|
38342
|
-
|
|
38343
|
-
|
|
38344
|
-
proxyHost += '443'
|
|
38345
|
-
} else {
|
|
38346
|
-
proxyHost += '80'
|
|
38309
|
+
FormData.prototype.getBoundary = function() {
|
|
38310
|
+
if (!this._boundary) {
|
|
38311
|
+
this._generateBoundary();
|
|
38347
38312
|
}
|
|
38348
38313
|
|
|
38349
|
-
return
|
|
38350
|
-
}
|
|
38314
|
+
return this._boundary;
|
|
38315
|
+
};
|
|
38351
38316
|
|
|
38352
|
-
|
|
38353
|
-
|
|
38354
|
-
|
|
38355
|
-
|
|
38356
|
-
|
|
38357
|
-
|
|
38317
|
+
FormData.prototype._generateBoundary = function() {
|
|
38318
|
+
// This generates a 50 character boundary similar to those used by Firefox.
|
|
38319
|
+
// They are optimized for boyer-moore parsing.
|
|
38320
|
+
var boundary = '--------------------------';
|
|
38321
|
+
for (var i = 0; i < 24; i++) {
|
|
38322
|
+
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
38323
|
+
}
|
|
38358
38324
|
|
|
38359
|
-
|
|
38360
|
-
|
|
38361
|
-
return whiteList[header.toLowerCase()]
|
|
38362
|
-
})
|
|
38363
|
-
.reduce(function (set, header) {
|
|
38364
|
-
set[header] = headers[header]
|
|
38365
|
-
return set
|
|
38366
|
-
}, {})
|
|
38367
|
-
}
|
|
38325
|
+
this._boundary = boundary;
|
|
38326
|
+
};
|
|
38368
38327
|
|
|
38369
|
-
|
|
38370
|
-
|
|
38328
|
+
// Note: getLengthSync DOESN'T calculate streams length
|
|
38329
|
+
// As workaround one can calculate file size manually
|
|
38330
|
+
// and add it as knownLength option
|
|
38331
|
+
FormData.prototype.getLengthSync = function() {
|
|
38332
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
38371
38333
|
|
|
38372
|
-
|
|
38373
|
-
|
|
38374
|
-
|
|
38375
|
-
|
|
38376
|
-
proxyAuth: proxy.auth,
|
|
38377
|
-
headers: proxyHeaders
|
|
38378
|
-
},
|
|
38379
|
-
headers: request.headers,
|
|
38380
|
-
ca: request.ca,
|
|
38381
|
-
cert: request.cert,
|
|
38382
|
-
key: request.key,
|
|
38383
|
-
passphrase: request.passphrase,
|
|
38384
|
-
pfx: request.pfx,
|
|
38385
|
-
ciphers: request.ciphers,
|
|
38386
|
-
rejectUnauthorized: request.rejectUnauthorized,
|
|
38387
|
-
secureOptions: request.secureOptions,
|
|
38388
|
-
secureProtocol: request.secureProtocol
|
|
38334
|
+
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
38335
|
+
// so it basically checks if there is any value added to the form
|
|
38336
|
+
if (this._streams.length) {
|
|
38337
|
+
knownLength += this._lastBoundary().length;
|
|
38389
38338
|
}
|
|
38390
38339
|
|
|
38391
|
-
|
|
38392
|
-
|
|
38340
|
+
// https://github.com/form-data/form-data/issues/40
|
|
38341
|
+
if (!this.hasKnownLength()) {
|
|
38342
|
+
// Some async length retrievers are present
|
|
38343
|
+
// therefore synchronous length calculation is false.
|
|
38344
|
+
// Please use getLength(callback) to get proper length
|
|
38345
|
+
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
38346
|
+
}
|
|
38393
38347
|
|
|
38394
|
-
|
|
38395
|
-
|
|
38396
|
-
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
|
|
38397
|
-
return [uriProtocol, proxyProtocol].join('Over')
|
|
38398
|
-
}
|
|
38348
|
+
return knownLength;
|
|
38349
|
+
};
|
|
38399
38350
|
|
|
38400
|
-
|
|
38401
|
-
|
|
38402
|
-
|
|
38403
|
-
|
|
38404
|
-
|
|
38405
|
-
}
|
|
38351
|
+
// Public API to check if length of added values is known
|
|
38352
|
+
// https://github.com/form-data/form-data/issues/196
|
|
38353
|
+
// https://github.com/form-data/form-data/issues/262
|
|
38354
|
+
FormData.prototype.hasKnownLength = function() {
|
|
38355
|
+
var hasKnownLength = true;
|
|
38406
38356
|
|
|
38407
|
-
|
|
38408
|
-
|
|
38409
|
-
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
|
38410
|
-
this.proxyHeaderExclusiveList = []
|
|
38411
|
-
if (typeof request.tunnel !== 'undefined') {
|
|
38412
|
-
this.tunnelOverride = request.tunnel
|
|
38357
|
+
if (this._valuesToMeasure.length) {
|
|
38358
|
+
hasKnownLength = false;
|
|
38413
38359
|
}
|
|
38414
|
-
}
|
|
38415
38360
|
|
|
38416
|
-
|
|
38417
|
-
|
|
38418
|
-
var request = self.request
|
|
38419
|
-
// Tunnel HTTPS by default. Allow the user to override this setting.
|
|
38361
|
+
return hasKnownLength;
|
|
38362
|
+
};
|
|
38420
38363
|
|
|
38421
|
-
|
|
38422
|
-
|
|
38423
|
-
|
|
38364
|
+
FormData.prototype.getLength = function(cb) {
|
|
38365
|
+
var knownLength = this._overheadLength + this._valueLength;
|
|
38366
|
+
|
|
38367
|
+
if (this._streams.length) {
|
|
38368
|
+
knownLength += this._lastBoundary().length;
|
|
38424
38369
|
}
|
|
38425
38370
|
|
|
38426
|
-
|
|
38427
|
-
|
|
38428
|
-
return
|
|
38371
|
+
if (!this._valuesToMeasure.length) {
|
|
38372
|
+
process.nextTick(cb.bind(this, null, knownLength));
|
|
38373
|
+
return;
|
|
38429
38374
|
}
|
|
38430
38375
|
|
|
38431
|
-
|
|
38432
|
-
|
|
38433
|
-
|
|
38376
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
38377
|
+
if (err) {
|
|
38378
|
+
cb(err);
|
|
38379
|
+
return;
|
|
38380
|
+
}
|
|
38434
38381
|
|
|
38435
|
-
|
|
38436
|
-
|
|
38437
|
-
|
|
38382
|
+
values.forEach(function(length) {
|
|
38383
|
+
knownLength += length;
|
|
38384
|
+
});
|
|
38438
38385
|
|
|
38439
|
-
|
|
38386
|
+
cb(null, knownLength);
|
|
38387
|
+
});
|
|
38388
|
+
};
|
|
38440
38389
|
|
|
38441
|
-
|
|
38442
|
-
|
|
38443
|
-
|
|
38390
|
+
FormData.prototype.submit = function(params, cb) {
|
|
38391
|
+
var request
|
|
38392
|
+
, options
|
|
38393
|
+
, defaults = {method: 'post'}
|
|
38394
|
+
;
|
|
38444
38395
|
|
|
38445
|
-
|
|
38446
|
-
|
|
38396
|
+
// parse provided url if it's string
|
|
38397
|
+
// or treat it as options object
|
|
38398
|
+
if (typeof params == 'string') {
|
|
38399
|
+
|
|
38400
|
+
params = parseUrl(params);
|
|
38401
|
+
options = populate({
|
|
38402
|
+
port: params.port,
|
|
38403
|
+
path: params.pathname,
|
|
38404
|
+
host: params.hostname,
|
|
38405
|
+
protocol: params.protocol
|
|
38406
|
+
}, defaults);
|
|
38407
|
+
|
|
38408
|
+
// use custom params
|
|
38409
|
+
} else {
|
|
38410
|
+
|
|
38411
|
+
options = populate(params, defaults);
|
|
38412
|
+
// if no port provided use default one
|
|
38413
|
+
if (!options.port) {
|
|
38414
|
+
options.port = options.protocol == 'https:' ? 443 : 80;
|
|
38415
|
+
}
|
|
38447
38416
|
}
|
|
38448
38417
|
|
|
38449
|
-
//
|
|
38450
|
-
|
|
38451
|
-
|
|
38418
|
+
// put that good code in getHeaders to some use
|
|
38419
|
+
options.headers = this.getHeaders(params.headers);
|
|
38420
|
+
|
|
38421
|
+
// https if specified, fallback to http in any other case
|
|
38422
|
+
if (options.protocol == 'https:') {
|
|
38423
|
+
request = https.request(options);
|
|
38424
|
+
} else {
|
|
38425
|
+
request = http.request(options);
|
|
38452
38426
|
}
|
|
38453
|
-
|
|
38454
|
-
|
|
38427
|
+
|
|
38428
|
+
// get content length and fire away
|
|
38429
|
+
this.getLength(function(err, length) {
|
|
38430
|
+
if (err) {
|
|
38431
|
+
this._error(err);
|
|
38432
|
+
return;
|
|
38433
|
+
}
|
|
38434
|
+
|
|
38435
|
+
// add content length
|
|
38436
|
+
request.setHeader('Content-Length', length);
|
|
38437
|
+
|
|
38438
|
+
this.pipe(request);
|
|
38439
|
+
if (cb) {
|
|
38440
|
+
request.on('error', cb);
|
|
38441
|
+
request.on('response', cb.bind(this, null));
|
|
38442
|
+
}
|
|
38443
|
+
}.bind(this));
|
|
38444
|
+
|
|
38445
|
+
return request;
|
|
38446
|
+
};
|
|
38447
|
+
|
|
38448
|
+
FormData.prototype._error = function(err) {
|
|
38449
|
+
if (!this.error) {
|
|
38450
|
+
this.error = err;
|
|
38451
|
+
this.pause();
|
|
38452
|
+
this.emit('error', err);
|
|
38455
38453
|
}
|
|
38454
|
+
};
|
|
38456
38455
|
|
|
38457
|
-
|
|
38458
|
-
|
|
38456
|
+
FormData.prototype.toString = function () {
|
|
38457
|
+
return '[object FormData]';
|
|
38458
|
+
};
|
|
38459
38459
|
|
|
38460
|
-
// Setup Proxy Headers and Proxy Headers Host
|
|
38461
|
-
// Only send the Proxy White Listed Header names
|
|
38462
|
-
var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList)
|
|
38463
|
-
proxyHeaders.host = constructProxyHost(request.uri)
|
|
38464
38460
|
|
|
38465
|
-
|
|
38461
|
+
/***/ }),
|
|
38466
38462
|
|
|
38467
|
-
|
|
38468
|
-
|
|
38469
|
-
var tunnelOptions = constructTunnelOptions(request, proxyHeaders)
|
|
38470
|
-
request.agent = tunnelFn(tunnelOptions)
|
|
38463
|
+
/***/ 97631:
|
|
38464
|
+
/***/ ((module) => {
|
|
38471
38465
|
|
|
38472
|
-
|
|
38473
|
-
|
|
38466
|
+
// populates missing values
|
|
38467
|
+
module.exports = function(dst, src) {
|
|
38474
38468
|
|
|
38475
|
-
|
|
38476
|
-
|
|
38477
|
-
|
|
38469
|
+
Object.keys(src).forEach(function(prop)
|
|
38470
|
+
{
|
|
38471
|
+
dst[prop] = dst[prop] || src[prop];
|
|
38472
|
+
});
|
|
38473
|
+
|
|
38474
|
+
return dst;
|
|
38475
|
+
};
|
|
38478
38476
|
|
|
38479
38477
|
|
|
38480
38478
|
/***/ }),
|
|
@@ -39163,7 +39161,7 @@ var httpSignature = __webpack_require__(31689)
|
|
|
39163
39161
|
var mime = __webpack_require__(19010)
|
|
39164
39162
|
var caseless = __webpack_require__(72464)
|
|
39165
39163
|
var ForeverAgent = __webpack_require__(68880)
|
|
39166
|
-
var FormData = __webpack_require__(
|
|
39164
|
+
var FormData = __webpack_require__(97501)
|
|
39167
39165
|
var extend = __webpack_require__(51302)
|
|
39168
39166
|
var isstream = __webpack_require__(92104)
|
|
39169
39167
|
var isTypedArray = __webpack_require__(27721).strict
|