comprodls-sdk 2.46.0 → 2.47.0
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/dist/comprodls-sdk.js +1102 -1304
- package/dist/comprodls-sdk.min.js +20 -20
- package/lib/services/analytics/index.js +5 -3
- package/lib/services/auth/index.js +1 -0
- package/package.json +1 -1
- package/getLogs.log +0 -115944
- package/test.js +0 -84
- package/test1.js +0 -52
- package/test3.js +0 -42
package/dist/comprodls-sdk.js
CHANGED
|
@@ -799,7 +799,7 @@ function addClassIdQueryParam(url, classId) {
|
|
|
799
799
|
function setupAPIToken(request, token) {
|
|
800
800
|
return request.set('Authorization', token.access_token);
|
|
801
801
|
};
|
|
802
|
-
},{"../../../config":2,"../../../helpers":3,"../errors":7,"./validations":6,"q":58,"string-template":
|
|
802
|
+
},{"../../../config":2,"../../../helpers":3,"../errors":7,"./validations":6,"q":58,"string-template":84,"superagent":85}],6:[function(require,module,exports){
|
|
803
803
|
/*************************************************************************
|
|
804
804
|
*
|
|
805
805
|
* COMPRO CONFIDENTIAL
|
|
@@ -1131,7 +1131,7 @@ validator.validators.contains = function(value, options) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
};
|
|
1134
|
-
},{"./errors":7,"validate.js":
|
|
1134
|
+
},{"./errors":7,"validate.js":90}],10:[function(require,module,exports){
|
|
1135
1135
|
/*************************************************************************
|
|
1136
1136
|
*
|
|
1137
1137
|
* COMPRO CONFIDENTIAL
|
|
@@ -1254,7 +1254,7 @@ function getSingleInvitation(organizationId, options) {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
|
|
1256
1256
|
|
|
1257
|
-
},{"../helpers":3,"q":58,"superagent":
|
|
1257
|
+
},{"../helpers":3,"q":58,"superagent":85}],11:[function(require,module,exports){
|
|
1258
1258
|
/*************************************************************************
|
|
1259
1259
|
*
|
|
1260
1260
|
* COMPRO CONFIDENTIAL
|
|
@@ -1465,7 +1465,7 @@ Activity.prototype.getQuestionsCount = function () {
|
|
|
1465
1465
|
return dfd.promise;
|
|
1466
1466
|
}
|
|
1467
1467
|
|
|
1468
|
-
},{"../../helpers":3,"./attempt":12,"extend":
|
|
1468
|
+
},{"../../helpers":3,"./attempt":12,"extend":44,"q":58,"superagent":85}],12:[function(require,module,exports){
|
|
1469
1469
|
/*************************************************************************
|
|
1470
1470
|
*
|
|
1471
1471
|
* COMPRO CONFIDENTIAL
|
|
@@ -1898,7 +1898,7 @@ Attempt.prototype.submit = function (userresponse) {
|
|
|
1898
1898
|
return dfd.promise;
|
|
1899
1899
|
};
|
|
1900
1900
|
|
|
1901
|
-
},{"../../helpers":3,"extend":
|
|
1901
|
+
},{"../../helpers":3,"extend":44,"q":58,"superagent":85}],13:[function(require,module,exports){
|
|
1902
1902
|
/*************************************************************************
|
|
1903
1903
|
*
|
|
1904
1904
|
* COMPRO CONFIDENTIAL
|
|
@@ -3461,7 +3461,8 @@ function getAllAssignedPathsOfClass(options) {
|
|
|
3461
3461
|
|
|
3462
3462
|
/* options = {
|
|
3463
3463
|
"classid": "string", // required
|
|
3464
|
-
"assignedPathId" : "string",
|
|
3464
|
+
"assignedPathId" : "string",
|
|
3465
|
+
"ext_assignedpathid" : "string",
|
|
3465
3466
|
"productcode" : "string" //required
|
|
3466
3467
|
};
|
|
3467
3468
|
*/
|
|
@@ -3472,7 +3473,7 @@ function getAssignedPathAnalytics(options) {
|
|
|
3472
3473
|
var err = helpers.validations.isAuthenticated(self.orgId, self.token);
|
|
3473
3474
|
if(err) { dfd.reject(err); }
|
|
3474
3475
|
else {
|
|
3475
|
-
if(options && options.classid && options.
|
|
3476
|
+
if(options && options.classid && options.productcode) {
|
|
3476
3477
|
// Passed all validations, Contruct API url
|
|
3477
3478
|
var url = self.config.DEFAULT_HOSTS.ANALYTICS + self.config.ANALYTICS_API_URLS.getAssignedPathAnalytics;
|
|
3478
3479
|
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
@@ -3480,6 +3481,7 @@ function getAssignedPathAnalytics(options) {
|
|
|
3480
3481
|
var queryParams = {
|
|
3481
3482
|
classid: options.classid,
|
|
3482
3483
|
assignedpathid: options.assignedPathId,
|
|
3484
|
+
ext_assignedpathid: options.ext_assignedpathid,
|
|
3483
3485
|
productcode: options.productcode
|
|
3484
3486
|
};
|
|
3485
3487
|
// Setup request with URL and Params
|
|
@@ -3501,7 +3503,7 @@ function getAssignedPathAnalytics(options) {
|
|
|
3501
3503
|
}
|
|
3502
3504
|
else {
|
|
3503
3505
|
err = {};
|
|
3504
|
-
err.message = err.description = 'Mandatory params - classid or
|
|
3506
|
+
err.message = err.description = 'Mandatory params - classid or productcode not found in request options.';
|
|
3505
3507
|
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
3506
3508
|
dfd.reject(err);
|
|
3507
3509
|
}
|
|
@@ -3822,7 +3824,7 @@ function postProgressTimeseries(options) {
|
|
|
3822
3824
|
return dfd.promise;
|
|
3823
3825
|
}
|
|
3824
3826
|
|
|
3825
|
-
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":
|
|
3827
|
+
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":85}],15:[function(require,module,exports){
|
|
3826
3828
|
/*************************************************************************
|
|
3827
3829
|
*
|
|
3828
3830
|
* COMPRO CONFIDENTIAL
|
|
@@ -4262,7 +4264,7 @@ function getUserActivityMeta(options) {
|
|
|
4262
4264
|
}
|
|
4263
4265
|
return dfd.promise;
|
|
4264
4266
|
}
|
|
4265
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
4267
|
+
},{"../../helpers":3,"q":58,"superagent":85}],16:[function(require,module,exports){
|
|
4266
4268
|
/*************************************************************************
|
|
4267
4269
|
*
|
|
4268
4270
|
* COMPRO CONFIDENTIAL
|
|
@@ -6406,6 +6408,7 @@ options = {
|
|
|
6406
6408
|
"classid": "classid", //mandatory
|
|
6407
6409
|
"data": {
|
|
6408
6410
|
"title": "assigned path title", //mandatory
|
|
6411
|
+
"ext_assignedpathid": 'string', //optional
|
|
6409
6412
|
"duedate": "epoch due date", //mandatory
|
|
6410
6413
|
"startdate": "epoch start date", //optional
|
|
6411
6414
|
"shared_progress": true, //optional, default=true
|
|
@@ -8336,7 +8339,7 @@ function getAllCustomComponents(options) {
|
|
|
8336
8339
|
return deferred.promise;
|
|
8337
8340
|
}
|
|
8338
8341
|
|
|
8339
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":36,"q":58,"superagent":
|
|
8342
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":36,"q":58,"superagent":85}],17:[function(require,module,exports){
|
|
8340
8343
|
/*************************************************************************
|
|
8341
8344
|
*
|
|
8342
8345
|
* COMPRO CONFIDENTIAL
|
|
@@ -9047,7 +9050,7 @@ function getClassesOfAGradeformat(options) {
|
|
|
9047
9050
|
return deferred.promise;
|
|
9048
9051
|
}
|
|
9049
9052
|
|
|
9050
|
-
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":
|
|
9053
|
+
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":85}],18:[function(require,module,exports){
|
|
9051
9054
|
/*************************************************************************
|
|
9052
9055
|
*
|
|
9053
9056
|
* COMPRO CONFIDENTIAL
|
|
@@ -9517,7 +9520,7 @@ function updateConnectionForUser(orgid, token, config, options, action) {
|
|
|
9517
9520
|
return dfd.promise;
|
|
9518
9521
|
}
|
|
9519
9522
|
|
|
9520
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
9523
|
+
},{"../../helpers":3,"q":58,"superagent":85}],19:[function(require,module,exports){
|
|
9521
9524
|
/*************************************************************************
|
|
9522
9525
|
*
|
|
9523
9526
|
* COMPRO CONFIDENTIAL
|
|
@@ -9829,7 +9832,7 @@ function getAllDataSyncManagersOfAGroup(options) {
|
|
|
9829
9832
|
return deferred.promise;
|
|
9830
9833
|
}
|
|
9831
9834
|
|
|
9832
|
-
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":
|
|
9835
|
+
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":85}],20:[function(require,module,exports){
|
|
9833
9836
|
/*************************************************************************
|
|
9834
9837
|
*
|
|
9835
9838
|
* COMPRO CONFIDENTIAL
|
|
@@ -9975,7 +9978,7 @@ function getAllDocumentsInAFolder(options) {
|
|
|
9975
9978
|
return dfd.promise;
|
|
9976
9979
|
}
|
|
9977
9980
|
|
|
9978
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
9981
|
+
},{"../../helpers":3,"q":58,"superagent":85}],21:[function(require,module,exports){
|
|
9979
9982
|
/*************************************************************************
|
|
9980
9983
|
*
|
|
9981
9984
|
* COMPRO CONFIDENTIAL
|
|
@@ -10532,7 +10535,7 @@ function deleteSchedule(options) {
|
|
|
10532
10535
|
return deferred.promise;
|
|
10533
10536
|
}
|
|
10534
10537
|
|
|
10535
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":36,"q":58,"superagent":
|
|
10538
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":36,"q":58,"superagent":85}],22:[function(require,module,exports){
|
|
10536
10539
|
/*************************************************************************
|
|
10537
10540
|
*
|
|
10538
10541
|
* COMPRO CONFIDENTIAL
|
|
@@ -10857,7 +10860,7 @@ function resendSingleInvitation(options) {
|
|
|
10857
10860
|
return dfd.promise;
|
|
10858
10861
|
}
|
|
10859
10862
|
|
|
10860
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
10863
|
+
},{"../../helpers":3,"q":58,"superagent":85}],23:[function(require,module,exports){
|
|
10861
10864
|
/*************************************************************************
|
|
10862
10865
|
*
|
|
10863
10866
|
* COMPRO CONFIDENTIAL
|
|
@@ -11318,7 +11321,7 @@ function createStatement(options) {
|
|
|
11318
11321
|
}*/
|
|
11319
11322
|
|
|
11320
11323
|
|
|
11321
|
-
},{"../../helpers":3,"q":58,"tincanjs":
|
|
11324
|
+
},{"../../helpers":3,"q":58,"tincanjs":87}],24:[function(require,module,exports){
|
|
11322
11325
|
/*************************************************************************
|
|
11323
11326
|
*
|
|
11324
11327
|
* COMPRO CONFIDENTIAL
|
|
@@ -11666,7 +11669,7 @@ function getSingleProductFamily(options) {
|
|
|
11666
11669
|
return dfd.promise;
|
|
11667
11670
|
}
|
|
11668
11671
|
|
|
11669
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
11672
|
+
},{"../../helpers":3,"q":58,"superagent":85}],25:[function(require,module,exports){
|
|
11670
11673
|
/*************************************************************************
|
|
11671
11674
|
*
|
|
11672
11675
|
* COMPRO CONFIDENTIAL
|
|
@@ -12266,7 +12269,7 @@ function getAllProductFamilies(options) {
|
|
|
12266
12269
|
return dfd.promise;
|
|
12267
12270
|
}
|
|
12268
12271
|
|
|
12269
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
12272
|
+
},{"../../helpers":3,"q":58,"superagent":85}],26:[function(require,module,exports){
|
|
12270
12273
|
/*************************************************************************
|
|
12271
12274
|
*
|
|
12272
12275
|
* COMPRO CONFIDENTIAL
|
|
@@ -12466,7 +12469,7 @@ function grantByAccountIdOnExtUserId(options) {
|
|
|
12466
12469
|
}
|
|
12467
12470
|
|
|
12468
12471
|
|
|
12469
|
-
},{"../../helpers":3,"./pubnubClientWrapper":27,"q":58,"superagent":
|
|
12472
|
+
},{"../../helpers":3,"./pubnubClientWrapper":27,"q":58,"superagent":85}],27:[function(require,module,exports){
|
|
12470
12473
|
var pubNub = require("pubnub");
|
|
12471
12474
|
var EventEmitter = require("events").EventEmitter;
|
|
12472
12475
|
var helpers = require('../../helpers');
|
|
@@ -12679,7 +12682,7 @@ module.exports = function () {
|
|
|
12679
12682
|
|
|
12680
12683
|
}; //End of Client Wrapper module
|
|
12681
12684
|
|
|
12682
|
-
},{"../../helpers":3,"events":
|
|
12685
|
+
},{"../../helpers":3,"events":43,"pubnub":56}],28:[function(require,module,exports){
|
|
12683
12686
|
/*************************************************************************
|
|
12684
12687
|
*
|
|
12685
12688
|
* COMPRO CONFIDENTIAL
|
|
@@ -13146,7 +13149,7 @@ function deleteRule(options) {
|
|
|
13146
13149
|
return dfd.promise;
|
|
13147
13150
|
}
|
|
13148
13151
|
|
|
13149
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
13152
|
+
},{"../../helpers":3,"q":58,"superagent":85}],29:[function(require,module,exports){
|
|
13150
13153
|
/*************************************************************************
|
|
13151
13154
|
*
|
|
13152
13155
|
* COMPRO CONFIDENTIAL
|
|
@@ -14302,7 +14305,7 @@ function updateInstituteTitle(options){
|
|
|
14302
14305
|
return dfd.promise;
|
|
14303
14306
|
}
|
|
14304
14307
|
|
|
14305
|
-
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":
|
|
14308
|
+
},{"../../helpers":3,"agentkeepalive":36,"q":58,"superagent":85}],30:[function(require,module,exports){
|
|
14306
14309
|
/*************************************************************************
|
|
14307
14310
|
*
|
|
14308
14311
|
* COMPRO CONFIDENTIAL
|
|
@@ -14479,7 +14482,7 @@ function provisionSpacesToSuperAdmin(options) {
|
|
|
14479
14482
|
return dfd.promise;
|
|
14480
14483
|
}
|
|
14481
14484
|
|
|
14482
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
14485
|
+
},{"../../helpers":3,"q":58,"superagent":85}],31:[function(require,module,exports){
|
|
14483
14486
|
/*************************************************************************
|
|
14484
14487
|
*
|
|
14485
14488
|
* COMPRO CONFIDENTIAL
|
|
@@ -14916,7 +14919,7 @@ function getAllTags(options) {
|
|
|
14916
14919
|
return dfd.promise;
|
|
14917
14920
|
}
|
|
14918
14921
|
|
|
14919
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
14922
|
+
},{"../../helpers":3,"q":58,"superagent":85}],32:[function(require,module,exports){
|
|
14920
14923
|
/*************************************************************************
|
|
14921
14924
|
*
|
|
14922
14925
|
* COMPRO CONFIDENTIAL
|
|
@@ -15382,7 +15385,7 @@ function updateWorkflowRequest(options) {
|
|
|
15382
15385
|
}
|
|
15383
15386
|
return dfd.promise;
|
|
15384
15387
|
}
|
|
15385
|
-
},{"./../../helpers":3,"q":58,"superagent":
|
|
15388
|
+
},{"./../../helpers":3,"q":58,"superagent":85}],33:[function(require,module,exports){
|
|
15386
15389
|
/*************************************************************************
|
|
15387
15390
|
*
|
|
15388
15391
|
* COMPRO CONFIDENTIAL
|
|
@@ -15659,7 +15662,7 @@ function resetUserProductProgress(options) {
|
|
|
15659
15662
|
return dfd.promise;
|
|
15660
15663
|
}
|
|
15661
15664
|
|
|
15662
|
-
},{"../../helpers":3,"q":58,"superagent":
|
|
15665
|
+
},{"../../helpers":3,"q":58,"superagent":85}],34:[function(require,module,exports){
|
|
15663
15666
|
/*************************************************************************
|
|
15664
15667
|
*
|
|
15665
15668
|
* COMPRO CONFIDENTIAL
|
|
@@ -15775,7 +15778,7 @@ function authWithToken(organizationId, token, options) {
|
|
|
15775
15778
|
return dfd.promise;
|
|
15776
15779
|
};
|
|
15777
15780
|
|
|
15778
|
-
},{"../helpers":3,"./validations":35,"q":58,"superagent":
|
|
15781
|
+
},{"../helpers":3,"./validations":35,"q":58,"superagent":85}],35:[function(require,module,exports){
|
|
15779
15782
|
/*************************************************************************
|
|
15780
15783
|
*
|
|
15781
15784
|
* COMPRO CONFIDENTIAL
|
|
@@ -15873,6 +15876,8 @@ module.exports.HttpsAgent = noop;
|
|
|
15873
15876
|
function noop () {}
|
|
15874
15877
|
|
|
15875
15878
|
},{}],37:[function(require,module,exports){
|
|
15879
|
+
|
|
15880
|
+
},{}],38:[function(require,module,exports){
|
|
15876
15881
|
var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
15877
15882
|
|
|
15878
15883
|
;(function (exports) {
|
|
@@ -15998,8 +16003,6 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
|
15998
16003
|
exports.fromByteArray = uint8ToBase64
|
|
15999
16004
|
}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
|
|
16000
16005
|
|
|
16001
|
-
},{}],38:[function(require,module,exports){
|
|
16002
|
-
|
|
16003
16006
|
},{}],39:[function(require,module,exports){
|
|
16004
16007
|
(function (global){
|
|
16005
16008
|
/*!
|
|
@@ -17552,7 +17555,7 @@ function blitBuffer (src, dst, offset, length) {
|
|
|
17552
17555
|
}
|
|
17553
17556
|
|
|
17554
17557
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
17555
|
-
},{"base64-js":
|
|
17558
|
+
},{"base64-js":38,"ieee754":47,"isarray":40}],40:[function(require,module,exports){
|
|
17556
17559
|
var toString = {}.toString;
|
|
17557
17560
|
|
|
17558
17561
|
module.exports = Array.isArray || function (arr) {
|
|
@@ -17621,292 +17624,115 @@ module.exports = {
|
|
|
17621
17624
|
}
|
|
17622
17625
|
|
|
17623
17626
|
},{}],42:[function(require,module,exports){
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
|
|
17629
|
-
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
|
|
17633
|
-
|
|
17634
|
-
|
|
17635
|
-
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
|
|
17639
|
-
|
|
17640
|
-
|
|
17641
|
-
|
|
17642
|
-
|
|
17643
|
-
|
|
17644
|
-
|
|
17645
|
-
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
|
|
17651
|
-
|
|
17652
|
-
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
|
|
17656
|
-
|
|
17657
|
-
|
|
17658
|
-
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
|
|
17662
|
-
|
|
17663
|
-
|
|
17664
|
-
|
|
17665
|
-
|
|
17666
|
-
|
|
17667
|
-
|
|
17668
|
-
|
|
17669
|
-
|
|
17670
|
-
|
|
17671
|
-
|
|
17672
|
-
return
|
|
17673
|
-
}
|
|
17674
|
-
|
|
17675
|
-
|
|
17676
|
-
|
|
17677
|
-
|
|
17678
|
-
|
|
17679
|
-
|
|
17680
|
-
|
|
17681
|
-
|
|
17682
|
-
|
|
17683
|
-
|
|
17684
|
-
|
|
17685
|
-
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17708
|
-
|
|
17709
|
-
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
|
|
17715
|
-
|
|
17716
|
-
|
|
17717
|
-
|
|
17718
|
-
|
|
17719
|
-
|
|
17720
|
-
|
|
17721
|
-
|
|
17722
|
-
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17726
|
-
|
|
17727
|
-
|
|
17728
|
-
|
|
17729
|
-
|
|
17730
|
-
|
|
17731
|
-
cb = callbacks[i];
|
|
17732
|
-
if (cb === fn || cb.fn === fn) {
|
|
17733
|
-
callbacks.splice(i, 1);
|
|
17734
|
-
break;
|
|
17735
|
-
}
|
|
17736
|
-
}
|
|
17737
|
-
|
|
17738
|
-
// Remove event specific arrays for event types that no
|
|
17739
|
-
// one is subscribed for to avoid memory leak.
|
|
17740
|
-
if (callbacks.length === 0) {
|
|
17741
|
-
delete this._callbacks['$' + event];
|
|
17742
|
-
}
|
|
17743
|
-
|
|
17744
|
-
return this;
|
|
17745
|
-
};
|
|
17746
|
-
|
|
17747
|
-
/**
|
|
17748
|
-
* Emit `event` with the given args.
|
|
17749
|
-
*
|
|
17750
|
-
* @param {String} event
|
|
17751
|
-
* @param {Mixed} ...
|
|
17752
|
-
* @return {Emitter}
|
|
17753
|
-
*/
|
|
17754
|
-
|
|
17755
|
-
Emitter.prototype.emit = function(event){
|
|
17756
|
-
this._callbacks = this._callbacks || {};
|
|
17757
|
-
|
|
17758
|
-
var args = new Array(arguments.length - 1)
|
|
17759
|
-
, callbacks = this._callbacks['$' + event];
|
|
17760
|
-
|
|
17761
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
17762
|
-
args[i - 1] = arguments[i];
|
|
17763
|
-
}
|
|
17764
|
-
|
|
17765
|
-
if (callbacks) {
|
|
17766
|
-
callbacks = callbacks.slice(0);
|
|
17767
|
-
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
|
17768
|
-
callbacks[i].apply(this, args);
|
|
17769
|
-
}
|
|
17770
|
-
}
|
|
17771
|
-
|
|
17772
|
-
return this;
|
|
17773
|
-
};
|
|
17774
|
-
|
|
17775
|
-
/**
|
|
17776
|
-
* Return array of callbacks for `event`.
|
|
17777
|
-
*
|
|
17778
|
-
* @param {String} event
|
|
17779
|
-
* @return {Array}
|
|
17780
|
-
* @api public
|
|
17781
|
-
*/
|
|
17782
|
-
|
|
17783
|
-
Emitter.prototype.listeners = function(event){
|
|
17784
|
-
this._callbacks = this._callbacks || {};
|
|
17785
|
-
return this._callbacks['$' + event] || [];
|
|
17786
|
-
};
|
|
17787
|
-
|
|
17788
|
-
/**
|
|
17789
|
-
* Check if this emitter has `event` handlers.
|
|
17790
|
-
*
|
|
17791
|
-
* @param {String} event
|
|
17792
|
-
* @return {Boolean}
|
|
17793
|
-
* @api public
|
|
17794
|
-
*/
|
|
17795
|
-
|
|
17796
|
-
Emitter.prototype.hasListeners = function(event){
|
|
17797
|
-
return !! this.listeners(event).length;
|
|
17798
|
-
};
|
|
17627
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
17628
|
+
//
|
|
17629
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
17630
|
+
// copy of this software and associated documentation files (the
|
|
17631
|
+
// "Software"), to deal in the Software without restriction, including
|
|
17632
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
17633
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
17634
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
17635
|
+
// following conditions:
|
|
17636
|
+
//
|
|
17637
|
+
// The above copyright notice and this permission notice shall be included
|
|
17638
|
+
// in all copies or substantial portions of the Software.
|
|
17639
|
+
//
|
|
17640
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17641
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17642
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17643
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
17644
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
17645
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
17646
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17647
|
+
|
|
17648
|
+
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
17649
|
+
// because it is fragile and can be easily faked with `Object.create()`.
|
|
17650
|
+
|
|
17651
|
+
function isArray(arg) {
|
|
17652
|
+
if (Array.isArray) {
|
|
17653
|
+
return Array.isArray(arg);
|
|
17654
|
+
}
|
|
17655
|
+
return objectToString(arg) === '[object Array]';
|
|
17656
|
+
}
|
|
17657
|
+
exports.isArray = isArray;
|
|
17658
|
+
|
|
17659
|
+
function isBoolean(arg) {
|
|
17660
|
+
return typeof arg === 'boolean';
|
|
17661
|
+
}
|
|
17662
|
+
exports.isBoolean = isBoolean;
|
|
17663
|
+
|
|
17664
|
+
function isNull(arg) {
|
|
17665
|
+
return arg === null;
|
|
17666
|
+
}
|
|
17667
|
+
exports.isNull = isNull;
|
|
17668
|
+
|
|
17669
|
+
function isNullOrUndefined(arg) {
|
|
17670
|
+
return arg == null;
|
|
17671
|
+
}
|
|
17672
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
17673
|
+
|
|
17674
|
+
function isNumber(arg) {
|
|
17675
|
+
return typeof arg === 'number';
|
|
17676
|
+
}
|
|
17677
|
+
exports.isNumber = isNumber;
|
|
17678
|
+
|
|
17679
|
+
function isString(arg) {
|
|
17680
|
+
return typeof arg === 'string';
|
|
17681
|
+
}
|
|
17682
|
+
exports.isString = isString;
|
|
17683
|
+
|
|
17684
|
+
function isSymbol(arg) {
|
|
17685
|
+
return typeof arg === 'symbol';
|
|
17686
|
+
}
|
|
17687
|
+
exports.isSymbol = isSymbol;
|
|
17688
|
+
|
|
17689
|
+
function isUndefined(arg) {
|
|
17690
|
+
return arg === void 0;
|
|
17691
|
+
}
|
|
17692
|
+
exports.isUndefined = isUndefined;
|
|
17693
|
+
|
|
17694
|
+
function isRegExp(re) {
|
|
17695
|
+
return objectToString(re) === '[object RegExp]';
|
|
17696
|
+
}
|
|
17697
|
+
exports.isRegExp = isRegExp;
|
|
17698
|
+
|
|
17699
|
+
function isObject(arg) {
|
|
17700
|
+
return typeof arg === 'object' && arg !== null;
|
|
17701
|
+
}
|
|
17702
|
+
exports.isObject = isObject;
|
|
17703
|
+
|
|
17704
|
+
function isDate(d) {
|
|
17705
|
+
return objectToString(d) === '[object Date]';
|
|
17706
|
+
}
|
|
17707
|
+
exports.isDate = isDate;
|
|
17708
|
+
|
|
17709
|
+
function isError(e) {
|
|
17710
|
+
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
|
17711
|
+
}
|
|
17712
|
+
exports.isError = isError;
|
|
17713
|
+
|
|
17714
|
+
function isFunction(arg) {
|
|
17715
|
+
return typeof arg === 'function';
|
|
17716
|
+
}
|
|
17717
|
+
exports.isFunction = isFunction;
|
|
17718
|
+
|
|
17719
|
+
function isPrimitive(arg) {
|
|
17720
|
+
return arg === null ||
|
|
17721
|
+
typeof arg === 'boolean' ||
|
|
17722
|
+
typeof arg === 'number' ||
|
|
17723
|
+
typeof arg === 'string' ||
|
|
17724
|
+
typeof arg === 'symbol' || // ES6 symbol
|
|
17725
|
+
typeof arg === 'undefined';
|
|
17726
|
+
}
|
|
17727
|
+
exports.isPrimitive = isPrimitive;
|
|
17728
|
+
|
|
17729
|
+
exports.isBuffer = require('buffer').Buffer.isBuffer;
|
|
17730
|
+
|
|
17731
|
+
function objectToString(o) {
|
|
17732
|
+
return Object.prototype.toString.call(o);
|
|
17733
|
+
}
|
|
17799
17734
|
|
|
17800
|
-
},{}],43:[function(require,module,exports){
|
|
17801
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
17802
|
-
//
|
|
17803
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
17804
|
-
// copy of this software and associated documentation files (the
|
|
17805
|
-
// "Software"), to deal in the Software without restriction, including
|
|
17806
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
17807
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
17808
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
17809
|
-
// following conditions:
|
|
17810
|
-
//
|
|
17811
|
-
// The above copyright notice and this permission notice shall be included
|
|
17812
|
-
// in all copies or substantial portions of the Software.
|
|
17813
|
-
//
|
|
17814
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17815
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17816
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17817
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
17818
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
17819
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
17820
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
17821
|
-
|
|
17822
|
-
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
17823
|
-
// because it is fragile and can be easily faked with `Object.create()`.
|
|
17824
|
-
|
|
17825
|
-
function isArray(arg) {
|
|
17826
|
-
if (Array.isArray) {
|
|
17827
|
-
return Array.isArray(arg);
|
|
17828
|
-
}
|
|
17829
|
-
return objectToString(arg) === '[object Array]';
|
|
17830
|
-
}
|
|
17831
|
-
exports.isArray = isArray;
|
|
17832
|
-
|
|
17833
|
-
function isBoolean(arg) {
|
|
17834
|
-
return typeof arg === 'boolean';
|
|
17835
|
-
}
|
|
17836
|
-
exports.isBoolean = isBoolean;
|
|
17837
|
-
|
|
17838
|
-
function isNull(arg) {
|
|
17839
|
-
return arg === null;
|
|
17840
|
-
}
|
|
17841
|
-
exports.isNull = isNull;
|
|
17842
|
-
|
|
17843
|
-
function isNullOrUndefined(arg) {
|
|
17844
|
-
return arg == null;
|
|
17845
|
-
}
|
|
17846
|
-
exports.isNullOrUndefined = isNullOrUndefined;
|
|
17847
|
-
|
|
17848
|
-
function isNumber(arg) {
|
|
17849
|
-
return typeof arg === 'number';
|
|
17850
|
-
}
|
|
17851
|
-
exports.isNumber = isNumber;
|
|
17852
|
-
|
|
17853
|
-
function isString(arg) {
|
|
17854
|
-
return typeof arg === 'string';
|
|
17855
|
-
}
|
|
17856
|
-
exports.isString = isString;
|
|
17857
|
-
|
|
17858
|
-
function isSymbol(arg) {
|
|
17859
|
-
return typeof arg === 'symbol';
|
|
17860
|
-
}
|
|
17861
|
-
exports.isSymbol = isSymbol;
|
|
17862
|
-
|
|
17863
|
-
function isUndefined(arg) {
|
|
17864
|
-
return arg === void 0;
|
|
17865
|
-
}
|
|
17866
|
-
exports.isUndefined = isUndefined;
|
|
17867
|
-
|
|
17868
|
-
function isRegExp(re) {
|
|
17869
|
-
return objectToString(re) === '[object RegExp]';
|
|
17870
|
-
}
|
|
17871
|
-
exports.isRegExp = isRegExp;
|
|
17872
|
-
|
|
17873
|
-
function isObject(arg) {
|
|
17874
|
-
return typeof arg === 'object' && arg !== null;
|
|
17875
|
-
}
|
|
17876
|
-
exports.isObject = isObject;
|
|
17877
|
-
|
|
17878
|
-
function isDate(d) {
|
|
17879
|
-
return objectToString(d) === '[object Date]';
|
|
17880
|
-
}
|
|
17881
|
-
exports.isDate = isDate;
|
|
17882
|
-
|
|
17883
|
-
function isError(e) {
|
|
17884
|
-
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
|
17885
|
-
}
|
|
17886
|
-
exports.isError = isError;
|
|
17887
|
-
|
|
17888
|
-
function isFunction(arg) {
|
|
17889
|
-
return typeof arg === 'function';
|
|
17890
|
-
}
|
|
17891
|
-
exports.isFunction = isFunction;
|
|
17892
|
-
|
|
17893
|
-
function isPrimitive(arg) {
|
|
17894
|
-
return arg === null ||
|
|
17895
|
-
typeof arg === 'boolean' ||
|
|
17896
|
-
typeof arg === 'number' ||
|
|
17897
|
-
typeof arg === 'string' ||
|
|
17898
|
-
typeof arg === 'symbol' || // ES6 symbol
|
|
17899
|
-
typeof arg === 'undefined';
|
|
17900
|
-
}
|
|
17901
|
-
exports.isPrimitive = isPrimitive;
|
|
17902
|
-
|
|
17903
|
-
exports.isBuffer = require('buffer').Buffer.isBuffer;
|
|
17904
|
-
|
|
17905
|
-
function objectToString(o) {
|
|
17906
|
-
return Object.prototype.toString.call(o);
|
|
17907
|
-
}
|
|
17908
|
-
|
|
17909
|
-
},{"buffer":39}],44:[function(require,module,exports){
|
|
17735
|
+
},{"buffer":39}],43:[function(require,module,exports){
|
|
17910
17736
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
17911
17737
|
//
|
|
17912
17738
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -18209,9 +18035,7 @@ function isUndefined(arg) {
|
|
|
18209
18035
|
return arg === void 0;
|
|
18210
18036
|
}
|
|
18211
18037
|
|
|
18212
|
-
},{}],
|
|
18213
|
-
'use strict';
|
|
18214
|
-
|
|
18038
|
+
},{}],44:[function(require,module,exports){
|
|
18215
18039
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
18216
18040
|
var toStr = Object.prototype.toString;
|
|
18217
18041
|
var defineProperty = Object.defineProperty;
|
|
@@ -18226,6 +18050,8 @@ var isArray = function isArray(arr) {
|
|
|
18226
18050
|
};
|
|
18227
18051
|
|
|
18228
18052
|
var isPlainObject = function isPlainObject(obj) {
|
|
18053
|
+
'use strict';
|
|
18054
|
+
|
|
18229
18055
|
if (!obj || toStr.call(obj) !== '[object Object]') {
|
|
18230
18056
|
return false;
|
|
18231
18057
|
}
|
|
@@ -18275,6 +18101,8 @@ var getProperty = function getProperty(obj, name) {
|
|
|
18275
18101
|
};
|
|
18276
18102
|
|
|
18277
18103
|
module.exports = function extend() {
|
|
18104
|
+
'use strict';
|
|
18105
|
+
|
|
18278
18106
|
var options, name, src, copy, copyIsArray, clone;
|
|
18279
18107
|
var target = arguments[0];
|
|
18280
18108
|
var i = 1;
|
|
@@ -18328,7 +18156,7 @@ module.exports = function extend() {
|
|
|
18328
18156
|
return target;
|
|
18329
18157
|
};
|
|
18330
18158
|
|
|
18331
|
-
},{}],
|
|
18159
|
+
},{}],45:[function(require,module,exports){
|
|
18332
18160
|
|
|
18333
18161
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
18334
18162
|
var toString = Object.prototype.toString;
|
|
@@ -18352,7 +18180,7 @@ module.exports = function forEach (obj, fn, ctx) {
|
|
|
18352
18180
|
};
|
|
18353
18181
|
|
|
18354
18182
|
|
|
18355
|
-
},{}],
|
|
18183
|
+
},{}],46:[function(require,module,exports){
|
|
18356
18184
|
var http = require('http');
|
|
18357
18185
|
|
|
18358
18186
|
var https = module.exports;
|
|
@@ -18368,7 +18196,7 @@ https.request = function (params, cb) {
|
|
|
18368
18196
|
return http.request.call(this, params, cb);
|
|
18369
18197
|
}
|
|
18370
18198
|
|
|
18371
|
-
},{"http":
|
|
18199
|
+
},{"http":80}],47:[function(require,module,exports){
|
|
18372
18200
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18373
18201
|
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
|
|
18374
18202
|
var e, m
|
|
@@ -18455,7 +18283,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
|
|
|
18455
18283
|
buffer[offset + i - d] |= s * 128
|
|
18456
18284
|
}
|
|
18457
18285
|
|
|
18458
|
-
},{}],
|
|
18286
|
+
},{}],48:[function(require,module,exports){
|
|
18459
18287
|
|
|
18460
18288
|
var indexOf = [].indexOf;
|
|
18461
18289
|
|
|
@@ -18466,6 +18294,35 @@ module.exports = function(arr, obj){
|
|
|
18466
18294
|
}
|
|
18467
18295
|
return -1;
|
|
18468
18296
|
};
|
|
18297
|
+
},{}],49:[function(require,module,exports){
|
|
18298
|
+
if (typeof Object.create === 'function') {
|
|
18299
|
+
// implementation from standard node.js 'util' module
|
|
18300
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
18301
|
+
if (superCtor) {
|
|
18302
|
+
ctor.super_ = superCtor
|
|
18303
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
18304
|
+
constructor: {
|
|
18305
|
+
value: ctor,
|
|
18306
|
+
enumerable: false,
|
|
18307
|
+
writable: true,
|
|
18308
|
+
configurable: true
|
|
18309
|
+
}
|
|
18310
|
+
})
|
|
18311
|
+
}
|
|
18312
|
+
};
|
|
18313
|
+
} else {
|
|
18314
|
+
// old school shim for old browsers
|
|
18315
|
+
module.exports = function inherits(ctor, superCtor) {
|
|
18316
|
+
if (superCtor) {
|
|
18317
|
+
ctor.super_ = superCtor
|
|
18318
|
+
var TempCtor = function () {}
|
|
18319
|
+
TempCtor.prototype = superCtor.prototype
|
|
18320
|
+
ctor.prototype = new TempCtor()
|
|
18321
|
+
ctor.prototype.constructor = ctor
|
|
18322
|
+
}
|
|
18323
|
+
}
|
|
18324
|
+
}
|
|
18325
|
+
|
|
18469
18326
|
},{}],50:[function(require,module,exports){
|
|
18470
18327
|
'use strict';
|
|
18471
18328
|
|
|
@@ -21715,141 +21572,297 @@ exports.decode = exports.parse = require('./decode');
|
|
|
21715
21572
|
exports.encode = exports.stringify = require('./encode');
|
|
21716
21573
|
|
|
21717
21574
|
},{"./decode":59,"./encode":60}],62:[function(require,module,exports){
|
|
21718
|
-
module.exports = require('./lib/_stream_duplex.js');
|
|
21719
|
-
|
|
21720
|
-
},{"./lib/_stream_duplex.js":63}],63:[function(require,module,exports){
|
|
21721
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
21722
|
-
//
|
|
21723
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
21724
|
-
// copy of this software and associated documentation files (the
|
|
21725
|
-
// "Software"), to deal in the Software without restriction, including
|
|
21726
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
21727
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
21728
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
21729
|
-
// following conditions:
|
|
21730
|
-
//
|
|
21731
|
-
// The above copyright notice and this permission notice shall be included
|
|
21732
|
-
// in all copies or substantial portions of the Software.
|
|
21733
|
-
//
|
|
21734
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
21735
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21736
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
21737
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
21738
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21739
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
21740
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21741
|
-
|
|
21742
|
-
// a duplex stream is just a stream that is both readable and writable.
|
|
21743
|
-
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
21744
|
-
// prototypally inherits from Readable, and then parasitically from
|
|
21745
|
-
// Writable.
|
|
21746
|
-
|
|
21747
|
-
'use strict';
|
|
21748
|
-
|
|
21749
|
-
/*<replacement>*/
|
|
21750
|
-
|
|
21751
|
-
var pna = require('process-nextick-args');
|
|
21752
|
-
/*</replacement>*/
|
|
21753
|
-
|
|
21754
|
-
/*<replacement>*/
|
|
21755
|
-
var objectKeys = Object.keys || function (obj) {
|
|
21756
|
-
var keys = [];
|
|
21757
|
-
for (var key in obj) {
|
|
21758
|
-
keys.push(key);
|
|
21759
|
-
}return keys;
|
|
21760
|
-
};
|
|
21761
|
-
/*</replacement>*/
|
|
21762
|
-
|
|
21763
|
-
module.exports = Duplex;
|
|
21764
|
-
|
|
21765
|
-
/*<replacement>*/
|
|
21766
|
-
var util = Object.create(require('core-util-is'));
|
|
21767
|
-
util.inherits = require('inherits');
|
|
21768
|
-
/*</replacement>*/
|
|
21769
|
-
|
|
21770
|
-
var Readable = require('./_stream_readable');
|
|
21771
|
-
var Writable = require('./_stream_writable');
|
|
21772
|
-
|
|
21773
|
-
util.inherits(Duplex, Readable);
|
|
21774
|
-
|
|
21775
|
-
{
|
|
21776
|
-
// avoid scope creep, the keys array can then be collected
|
|
21777
|
-
var keys = objectKeys(Writable.prototype);
|
|
21778
|
-
for (var v = 0; v < keys.length; v++) {
|
|
21779
|
-
var method = keys[v];
|
|
21780
|
-
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
|
21781
|
-
}
|
|
21782
|
-
}
|
|
21783
|
-
|
|
21784
|
-
function Duplex(options) {
|
|
21785
|
-
if (!(this instanceof Duplex)) return new Duplex(options);
|
|
21786
|
-
|
|
21787
|
-
Readable.call(this, options);
|
|
21788
|
-
Writable.call(this, options);
|
|
21789
|
-
|
|
21790
|
-
if (options && options.readable === false) this.readable = false;
|
|
21791
|
-
|
|
21792
|
-
if (options && options.writable === false) this.writable = false;
|
|
21793
21575
|
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
}
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
// userland will fail
|
|
21804
|
-
enumerable: false,
|
|
21805
|
-
get: function () {
|
|
21806
|
-
return this._writableState.highWaterMark;
|
|
21807
|
-
}
|
|
21808
|
-
});
|
|
21809
|
-
|
|
21810
|
-
// the no-half-open enforcer
|
|
21811
|
-
function onend() {
|
|
21812
|
-
// if we allow half-open state, or if the writable side ended,
|
|
21813
|
-
// then we're ok.
|
|
21814
|
-
if (this.allowHalfOpen || this._writableState.ended) return;
|
|
21815
|
-
|
|
21816
|
-
// no more data can be written.
|
|
21817
|
-
// But allow more writes to happen in this tick.
|
|
21818
|
-
pna.nextTick(onEndNT, this);
|
|
21819
|
-
}
|
|
21820
|
-
|
|
21821
|
-
function onEndNT(self) {
|
|
21822
|
-
self.end();
|
|
21823
|
-
}
|
|
21576
|
+
/**
|
|
21577
|
+
* Reduce `arr` with `fn`.
|
|
21578
|
+
*
|
|
21579
|
+
* @param {Array} arr
|
|
21580
|
+
* @param {Function} fn
|
|
21581
|
+
* @param {Mixed} initial
|
|
21582
|
+
*
|
|
21583
|
+
* TODO: combatible error handling?
|
|
21584
|
+
*/
|
|
21824
21585
|
|
|
21825
|
-
|
|
21826
|
-
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
},
|
|
21832
|
-
set: function (value) {
|
|
21833
|
-
// we ignore the value if the stream
|
|
21834
|
-
// has not been initialized yet
|
|
21835
|
-
if (this._readableState === undefined || this._writableState === undefined) {
|
|
21836
|
-
return;
|
|
21837
|
-
}
|
|
21586
|
+
module.exports = function(arr, fn, initial){
|
|
21587
|
+
var idx = 0;
|
|
21588
|
+
var len = arr.length;
|
|
21589
|
+
var curr = arguments.length == 3
|
|
21590
|
+
? initial
|
|
21591
|
+
: arr[idx++];
|
|
21838
21592
|
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
this._readableState.destroyed = value;
|
|
21842
|
-
this._writableState.destroyed = value;
|
|
21593
|
+
while (idx < len) {
|
|
21594
|
+
curr = fn.call(null, curr, arr[idx], ++idx, arr);
|
|
21843
21595
|
}
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
Duplex.prototype._destroy = function (err, cb) {
|
|
21847
|
-
this.push(null);
|
|
21848
|
-
this.end();
|
|
21849
|
-
|
|
21850
|
-
pna.nextTick(cb, err);
|
|
21596
|
+
|
|
21597
|
+
return curr;
|
|
21851
21598
|
};
|
|
21852
|
-
},{
|
|
21599
|
+
},{}],63:[function(require,module,exports){
|
|
21600
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
21601
|
+
//
|
|
21602
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
21603
|
+
// copy of this software and associated documentation files (the
|
|
21604
|
+
// "Software"), to deal in the Software without restriction, including
|
|
21605
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
21606
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
21607
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
21608
|
+
// following conditions:
|
|
21609
|
+
//
|
|
21610
|
+
// The above copyright notice and this permission notice shall be included
|
|
21611
|
+
// in all copies or substantial portions of the Software.
|
|
21612
|
+
//
|
|
21613
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
21614
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21615
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
21616
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
21617
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21618
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
21619
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21620
|
+
|
|
21621
|
+
module.exports = Stream;
|
|
21622
|
+
|
|
21623
|
+
var EE = require('events').EventEmitter;
|
|
21624
|
+
var inherits = require('inherits');
|
|
21625
|
+
|
|
21626
|
+
inherits(Stream, EE);
|
|
21627
|
+
Stream.Readable = require('readable-stream/readable.js');
|
|
21628
|
+
Stream.Writable = require('readable-stream/writable.js');
|
|
21629
|
+
Stream.Duplex = require('readable-stream/duplex.js');
|
|
21630
|
+
Stream.Transform = require('readable-stream/transform.js');
|
|
21631
|
+
Stream.PassThrough = require('readable-stream/passthrough.js');
|
|
21632
|
+
|
|
21633
|
+
// Backwards-compat with node 0.4.x
|
|
21634
|
+
Stream.Stream = Stream;
|
|
21635
|
+
|
|
21636
|
+
|
|
21637
|
+
|
|
21638
|
+
// old-style streams. Note that the pipe method (the only relevant
|
|
21639
|
+
// part of this class) is overridden in the Readable class.
|
|
21640
|
+
|
|
21641
|
+
function Stream() {
|
|
21642
|
+
EE.call(this);
|
|
21643
|
+
}
|
|
21644
|
+
|
|
21645
|
+
Stream.prototype.pipe = function(dest, options) {
|
|
21646
|
+
var source = this;
|
|
21647
|
+
|
|
21648
|
+
function ondata(chunk) {
|
|
21649
|
+
if (dest.writable) {
|
|
21650
|
+
if (false === dest.write(chunk) && source.pause) {
|
|
21651
|
+
source.pause();
|
|
21652
|
+
}
|
|
21653
|
+
}
|
|
21654
|
+
}
|
|
21655
|
+
|
|
21656
|
+
source.on('data', ondata);
|
|
21657
|
+
|
|
21658
|
+
function ondrain() {
|
|
21659
|
+
if (source.readable && source.resume) {
|
|
21660
|
+
source.resume();
|
|
21661
|
+
}
|
|
21662
|
+
}
|
|
21663
|
+
|
|
21664
|
+
dest.on('drain', ondrain);
|
|
21665
|
+
|
|
21666
|
+
// If the 'end' option is not supplied, dest.end() will be called when
|
|
21667
|
+
// source gets the 'end' or 'close' events. Only dest.end() once.
|
|
21668
|
+
if (!dest._isStdio && (!options || options.end !== false)) {
|
|
21669
|
+
source.on('end', onend);
|
|
21670
|
+
source.on('close', onclose);
|
|
21671
|
+
}
|
|
21672
|
+
|
|
21673
|
+
var didOnEnd = false;
|
|
21674
|
+
function onend() {
|
|
21675
|
+
if (didOnEnd) return;
|
|
21676
|
+
didOnEnd = true;
|
|
21677
|
+
|
|
21678
|
+
dest.end();
|
|
21679
|
+
}
|
|
21680
|
+
|
|
21681
|
+
|
|
21682
|
+
function onclose() {
|
|
21683
|
+
if (didOnEnd) return;
|
|
21684
|
+
didOnEnd = true;
|
|
21685
|
+
|
|
21686
|
+
if (typeof dest.destroy === 'function') dest.destroy();
|
|
21687
|
+
}
|
|
21688
|
+
|
|
21689
|
+
// don't leave dangling pipes when there are errors.
|
|
21690
|
+
function onerror(er) {
|
|
21691
|
+
cleanup();
|
|
21692
|
+
if (EE.listenerCount(this, 'error') === 0) {
|
|
21693
|
+
throw er; // Unhandled stream error in pipe.
|
|
21694
|
+
}
|
|
21695
|
+
}
|
|
21696
|
+
|
|
21697
|
+
source.on('error', onerror);
|
|
21698
|
+
dest.on('error', onerror);
|
|
21699
|
+
|
|
21700
|
+
// remove all the event listeners that were added.
|
|
21701
|
+
function cleanup() {
|
|
21702
|
+
source.removeListener('data', ondata);
|
|
21703
|
+
dest.removeListener('drain', ondrain);
|
|
21704
|
+
|
|
21705
|
+
source.removeListener('end', onend);
|
|
21706
|
+
source.removeListener('close', onclose);
|
|
21707
|
+
|
|
21708
|
+
source.removeListener('error', onerror);
|
|
21709
|
+
dest.removeListener('error', onerror);
|
|
21710
|
+
|
|
21711
|
+
source.removeListener('end', cleanup);
|
|
21712
|
+
source.removeListener('close', cleanup);
|
|
21713
|
+
|
|
21714
|
+
dest.removeListener('close', cleanup);
|
|
21715
|
+
}
|
|
21716
|
+
|
|
21717
|
+
source.on('end', cleanup);
|
|
21718
|
+
source.on('close', cleanup);
|
|
21719
|
+
|
|
21720
|
+
dest.on('close', cleanup);
|
|
21721
|
+
|
|
21722
|
+
dest.emit('pipe', source);
|
|
21723
|
+
|
|
21724
|
+
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
|
21725
|
+
return dest;
|
|
21726
|
+
};
|
|
21727
|
+
|
|
21728
|
+
},{"events":43,"inherits":49,"readable-stream/duplex.js":65,"readable-stream/passthrough.js":74,"readable-stream/readable.js":75,"readable-stream/transform.js":76,"readable-stream/writable.js":77}],64:[function(require,module,exports){
|
|
21729
|
+
arguments[4][40][0].apply(exports,arguments)
|
|
21730
|
+
},{"dup":40}],65:[function(require,module,exports){
|
|
21731
|
+
module.exports = require('./lib/_stream_duplex.js');
|
|
21732
|
+
|
|
21733
|
+
},{"./lib/_stream_duplex.js":66}],66:[function(require,module,exports){
|
|
21734
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
21735
|
+
//
|
|
21736
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
21737
|
+
// copy of this software and associated documentation files (the
|
|
21738
|
+
// "Software"), to deal in the Software without restriction, including
|
|
21739
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
21740
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
21741
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
21742
|
+
// following conditions:
|
|
21743
|
+
//
|
|
21744
|
+
// The above copyright notice and this permission notice shall be included
|
|
21745
|
+
// in all copies or substantial portions of the Software.
|
|
21746
|
+
//
|
|
21747
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
21748
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21749
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
21750
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
21751
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21752
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
21753
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21754
|
+
|
|
21755
|
+
// a duplex stream is just a stream that is both readable and writable.
|
|
21756
|
+
// Since JS doesn't have multiple prototypal inheritance, this class
|
|
21757
|
+
// prototypally inherits from Readable, and then parasitically from
|
|
21758
|
+
// Writable.
|
|
21759
|
+
|
|
21760
|
+
'use strict';
|
|
21761
|
+
|
|
21762
|
+
/*<replacement>*/
|
|
21763
|
+
|
|
21764
|
+
var pna = require('process-nextick-args');
|
|
21765
|
+
/*</replacement>*/
|
|
21766
|
+
|
|
21767
|
+
/*<replacement>*/
|
|
21768
|
+
var objectKeys = Object.keys || function (obj) {
|
|
21769
|
+
var keys = [];
|
|
21770
|
+
for (var key in obj) {
|
|
21771
|
+
keys.push(key);
|
|
21772
|
+
}return keys;
|
|
21773
|
+
};
|
|
21774
|
+
/*</replacement>*/
|
|
21775
|
+
|
|
21776
|
+
module.exports = Duplex;
|
|
21777
|
+
|
|
21778
|
+
/*<replacement>*/
|
|
21779
|
+
var util = Object.create(require('core-util-is'));
|
|
21780
|
+
util.inherits = require('inherits');
|
|
21781
|
+
/*</replacement>*/
|
|
21782
|
+
|
|
21783
|
+
var Readable = require('./_stream_readable');
|
|
21784
|
+
var Writable = require('./_stream_writable');
|
|
21785
|
+
|
|
21786
|
+
util.inherits(Duplex, Readable);
|
|
21787
|
+
|
|
21788
|
+
{
|
|
21789
|
+
// avoid scope creep, the keys array can then be collected
|
|
21790
|
+
var keys = objectKeys(Writable.prototype);
|
|
21791
|
+
for (var v = 0; v < keys.length; v++) {
|
|
21792
|
+
var method = keys[v];
|
|
21793
|
+
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
|
|
21794
|
+
}
|
|
21795
|
+
}
|
|
21796
|
+
|
|
21797
|
+
function Duplex(options) {
|
|
21798
|
+
if (!(this instanceof Duplex)) return new Duplex(options);
|
|
21799
|
+
|
|
21800
|
+
Readable.call(this, options);
|
|
21801
|
+
Writable.call(this, options);
|
|
21802
|
+
|
|
21803
|
+
if (options && options.readable === false) this.readable = false;
|
|
21804
|
+
|
|
21805
|
+
if (options && options.writable === false) this.writable = false;
|
|
21806
|
+
|
|
21807
|
+
this.allowHalfOpen = true;
|
|
21808
|
+
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
|
|
21809
|
+
|
|
21810
|
+
this.once('end', onend);
|
|
21811
|
+
}
|
|
21812
|
+
|
|
21813
|
+
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
|
|
21814
|
+
// making it explicit this property is not enumerable
|
|
21815
|
+
// because otherwise some prototype manipulation in
|
|
21816
|
+
// userland will fail
|
|
21817
|
+
enumerable: false,
|
|
21818
|
+
get: function () {
|
|
21819
|
+
return this._writableState.highWaterMark;
|
|
21820
|
+
}
|
|
21821
|
+
});
|
|
21822
|
+
|
|
21823
|
+
// the no-half-open enforcer
|
|
21824
|
+
function onend() {
|
|
21825
|
+
// if we allow half-open state, or if the writable side ended,
|
|
21826
|
+
// then we're ok.
|
|
21827
|
+
if (this.allowHalfOpen || this._writableState.ended) return;
|
|
21828
|
+
|
|
21829
|
+
// no more data can be written.
|
|
21830
|
+
// But allow more writes to happen in this tick.
|
|
21831
|
+
pna.nextTick(onEndNT, this);
|
|
21832
|
+
}
|
|
21833
|
+
|
|
21834
|
+
function onEndNT(self) {
|
|
21835
|
+
self.end();
|
|
21836
|
+
}
|
|
21837
|
+
|
|
21838
|
+
Object.defineProperty(Duplex.prototype, 'destroyed', {
|
|
21839
|
+
get: function () {
|
|
21840
|
+
if (this._readableState === undefined || this._writableState === undefined) {
|
|
21841
|
+
return false;
|
|
21842
|
+
}
|
|
21843
|
+
return this._readableState.destroyed && this._writableState.destroyed;
|
|
21844
|
+
},
|
|
21845
|
+
set: function (value) {
|
|
21846
|
+
// we ignore the value if the stream
|
|
21847
|
+
// has not been initialized yet
|
|
21848
|
+
if (this._readableState === undefined || this._writableState === undefined) {
|
|
21849
|
+
return;
|
|
21850
|
+
}
|
|
21851
|
+
|
|
21852
|
+
// backward compatibility, the user is explicitly
|
|
21853
|
+
// managing destroyed
|
|
21854
|
+
this._readableState.destroyed = value;
|
|
21855
|
+
this._writableState.destroyed = value;
|
|
21856
|
+
}
|
|
21857
|
+
});
|
|
21858
|
+
|
|
21859
|
+
Duplex.prototype._destroy = function (err, cb) {
|
|
21860
|
+
this.push(null);
|
|
21861
|
+
this.end();
|
|
21862
|
+
|
|
21863
|
+
pna.nextTick(cb, err);
|
|
21864
|
+
};
|
|
21865
|
+
},{"./_stream_readable":68,"./_stream_writable":70,"core-util-is":42,"inherits":49,"process-nextick-args":54}],67:[function(require,module,exports){
|
|
21853
21866
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
21854
21867
|
//
|
|
21855
21868
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -21897,7 +21910,7 @@ function PassThrough(options) {
|
|
|
21897
21910
|
PassThrough.prototype._transform = function (chunk, encoding, cb) {
|
|
21898
21911
|
cb(null, chunk);
|
|
21899
21912
|
};
|
|
21900
|
-
},{"./_stream_transform":
|
|
21913
|
+
},{"./_stream_transform":69,"core-util-is":42,"inherits":49}],68:[function(require,module,exports){
|
|
21901
21914
|
(function (process,global){
|
|
21902
21915
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
21903
21916
|
//
|
|
@@ -21954,7 +21967,7 @@ var Stream = require('./internal/streams/stream');
|
|
|
21954
21967
|
/*<replacement>*/
|
|
21955
21968
|
|
|
21956
21969
|
var Buffer = require('safe-buffer').Buffer;
|
|
21957
|
-
var OurUint8Array =
|
|
21970
|
+
var OurUint8Array = global.Uint8Array || function () {};
|
|
21958
21971
|
function _uint8ArrayToBuffer(chunk) {
|
|
21959
21972
|
return Buffer.from(chunk);
|
|
21960
21973
|
}
|
|
@@ -22524,8 +22537,8 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
|
|
|
22524
22537
|
// also returned false.
|
|
22525
22538
|
// => Check whether `dest` is still a piping destination.
|
|
22526
22539
|
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
|
|
22527
|
-
debug('false write response, pause',
|
|
22528
|
-
|
|
22540
|
+
debug('false write response, pause', src._readableState.awaitDrain);
|
|
22541
|
+
src._readableState.awaitDrain++;
|
|
22529
22542
|
increasedAwaitDrain = true;
|
|
22530
22543
|
}
|
|
22531
22544
|
src.pause();
|
|
@@ -22619,7 +22632,7 @@ Readable.prototype.unpipe = function (dest) {
|
|
|
22619
22632
|
state.flowing = false;
|
|
22620
22633
|
|
|
22621
22634
|
for (var i = 0; i < len; i++) {
|
|
22622
|
-
dests[i].emit('unpipe', this,
|
|
22635
|
+
dests[i].emit('unpipe', this, unpipeInfo);
|
|
22623
22636
|
}return this;
|
|
22624
22637
|
}
|
|
22625
22638
|
|
|
@@ -22919,7 +22932,7 @@ function indexOf(xs, x) {
|
|
|
22919
22932
|
return -1;
|
|
22920
22933
|
}
|
|
22921
22934
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
22922
|
-
},{"./_stream_duplex":
|
|
22935
|
+
},{"./_stream_duplex":66,"./internal/streams/BufferList":71,"./internal/streams/destroy":72,"./internal/streams/stream":73,"_process":55,"core-util-is":42,"events":43,"inherits":49,"isarray":64,"process-nextick-args":54,"safe-buffer":78,"string_decoder/":79,"util":37}],69:[function(require,module,exports){
|
|
22923
22936
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
22924
22937
|
//
|
|
22925
22938
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -23134,7 +23147,7 @@ function done(stream, er, data) {
|
|
|
23134
23147
|
|
|
23135
23148
|
return stream.push(null);
|
|
23136
23149
|
}
|
|
23137
|
-
},{"./_stream_duplex":
|
|
23150
|
+
},{"./_stream_duplex":66,"core-util-is":42,"inherits":49}],70:[function(require,module,exports){
|
|
23138
23151
|
(function (process,global){
|
|
23139
23152
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
23140
23153
|
//
|
|
@@ -23219,7 +23232,7 @@ var Stream = require('./internal/streams/stream');
|
|
|
23219
23232
|
/*<replacement>*/
|
|
23220
23233
|
|
|
23221
23234
|
var Buffer = require('safe-buffer').Buffer;
|
|
23222
|
-
var OurUint8Array =
|
|
23235
|
+
var OurUint8Array = global.Uint8Array || function () {};
|
|
23223
23236
|
function _uint8ArrayToBuffer(chunk) {
|
|
23224
23237
|
return Buffer.from(chunk);
|
|
23225
23238
|
}
|
|
@@ -23487,7 +23500,7 @@ Writable.prototype.uncork = function () {
|
|
|
23487
23500
|
if (state.corked) {
|
|
23488
23501
|
state.corked--;
|
|
23489
23502
|
|
|
23490
|
-
if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
23503
|
+
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
|
23491
23504
|
}
|
|
23492
23505
|
};
|
|
23493
23506
|
|
|
@@ -23729,7 +23742,7 @@ Writable.prototype.end = function (chunk, encoding, cb) {
|
|
|
23729
23742
|
}
|
|
23730
23743
|
|
|
23731
23744
|
// ignore unnecessary end() calls.
|
|
23732
|
-
if (!state.ending) endWritable(this, state, cb);
|
|
23745
|
+
if (!state.ending && !state.finished) endWritable(this, state, cb);
|
|
23733
23746
|
};
|
|
23734
23747
|
|
|
23735
23748
|
function needFinish(state) {
|
|
@@ -23790,9 +23803,11 @@ function onCorkedFinish(corkReq, state, err) {
|
|
|
23790
23803
|
cb(err);
|
|
23791
23804
|
entry = entry.next;
|
|
23792
23805
|
}
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23806
|
+
if (state.corkedRequestsFree) {
|
|
23807
|
+
state.corkedRequestsFree.next = corkReq;
|
|
23808
|
+
} else {
|
|
23809
|
+
state.corkedRequestsFree = corkReq;
|
|
23810
|
+
}
|
|
23796
23811
|
}
|
|
23797
23812
|
|
|
23798
23813
|
Object.defineProperty(Writable.prototype, 'destroyed', {
|
|
@@ -23822,7 +23837,7 @@ Writable.prototype._destroy = function (err, cb) {
|
|
|
23822
23837
|
cb(err);
|
|
23823
23838
|
};
|
|
23824
23839
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
23825
|
-
},{"./_stream_duplex":
|
|
23840
|
+
},{"./_stream_duplex":66,"./internal/streams/destroy":72,"./internal/streams/stream":73,"_process":55,"core-util-is":42,"inherits":49,"process-nextick-args":54,"safe-buffer":78,"util-deprecate":89}],71:[function(require,module,exports){
|
|
23826
23841
|
'use strict';
|
|
23827
23842
|
|
|
23828
23843
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -23881,6 +23896,7 @@ module.exports = function () {
|
|
|
23881
23896
|
|
|
23882
23897
|
BufferList.prototype.concat = function concat(n) {
|
|
23883
23898
|
if (this.length === 0) return Buffer.alloc(0);
|
|
23899
|
+
if (this.length === 1) return this.head.data;
|
|
23884
23900
|
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
23885
23901
|
var p = this.head;
|
|
23886
23902
|
var i = 0;
|
|
@@ -23901,7 +23917,7 @@ if (util && util.inspect && util.inspect.custom) {
|
|
|
23901
23917
|
return this.constructor.name + ' ' + obj;
|
|
23902
23918
|
};
|
|
23903
23919
|
}
|
|
23904
|
-
},{"safe-buffer":
|
|
23920
|
+
},{"safe-buffer":78,"util":37}],72:[function(require,module,exports){
|
|
23905
23921
|
'use strict';
|
|
23906
23922
|
|
|
23907
23923
|
/*<replacement>*/
|
|
@@ -23919,15 +23935,9 @@ function destroy(err, cb) {
|
|
|
23919
23935
|
if (readableDestroyed || writableDestroyed) {
|
|
23920
23936
|
if (cb) {
|
|
23921
23937
|
cb(err);
|
|
23922
|
-
} else if (err) {
|
|
23923
|
-
|
|
23924
|
-
pna.nextTick(emitErrorNT, this, err);
|
|
23925
|
-
} else if (!this._writableState.errorEmitted) {
|
|
23926
|
-
this._writableState.errorEmitted = true;
|
|
23927
|
-
pna.nextTick(emitErrorNT, this, err);
|
|
23928
|
-
}
|
|
23938
|
+
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
|
23939
|
+
pna.nextTick(emitErrorNT, this, err);
|
|
23929
23940
|
}
|
|
23930
|
-
|
|
23931
23941
|
return this;
|
|
23932
23942
|
}
|
|
23933
23943
|
|
|
@@ -23945,11 +23955,9 @@ function destroy(err, cb) {
|
|
|
23945
23955
|
|
|
23946
23956
|
this._destroy(err || null, function (err) {
|
|
23947
23957
|
if (!cb && err) {
|
|
23948
|
-
|
|
23949
|
-
|
|
23950
|
-
} else if (!_this._writableState.errorEmitted) {
|
|
23958
|
+
pna.nextTick(emitErrorNT, _this, err);
|
|
23959
|
+
if (_this._writableState) {
|
|
23951
23960
|
_this._writableState.errorEmitted = true;
|
|
23952
|
-
pna.nextTick(emitErrorNT, _this, err);
|
|
23953
23961
|
}
|
|
23954
23962
|
} else if (cb) {
|
|
23955
23963
|
cb(err);
|
|
@@ -23971,8 +23979,6 @@ function undestroy() {
|
|
|
23971
23979
|
this._writableState.destroyed = false;
|
|
23972
23980
|
this._writableState.ended = false;
|
|
23973
23981
|
this._writableState.ending = false;
|
|
23974
|
-
this._writableState.finalCalled = false;
|
|
23975
|
-
this._writableState.prefinished = false;
|
|
23976
23982
|
this._writableState.finished = false;
|
|
23977
23983
|
this._writableState.errorEmitted = false;
|
|
23978
23984
|
}
|
|
@@ -23986,41 +23992,28 @@ module.exports = {
|
|
|
23986
23992
|
destroy: destroy,
|
|
23987
23993
|
undestroy: undestroy
|
|
23988
23994
|
};
|
|
23989
|
-
},{"process-nextick-args":54}],
|
|
23995
|
+
},{"process-nextick-args":54}],73:[function(require,module,exports){
|
|
23990
23996
|
module.exports = require('events').EventEmitter;
|
|
23991
23997
|
|
|
23992
|
-
},{"events":
|
|
23993
|
-
|
|
23994
|
-
// implementation from standard node.js 'util' module
|
|
23995
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
23996
|
-
if (superCtor) {
|
|
23997
|
-
ctor.super_ = superCtor
|
|
23998
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
23999
|
-
constructor: {
|
|
24000
|
-
value: ctor,
|
|
24001
|
-
enumerable: false,
|
|
24002
|
-
writable: true,
|
|
24003
|
-
configurable: true
|
|
24004
|
-
}
|
|
24005
|
-
})
|
|
24006
|
-
}
|
|
24007
|
-
};
|
|
24008
|
-
} else {
|
|
24009
|
-
// old school shim for old browsers
|
|
24010
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
24011
|
-
if (superCtor) {
|
|
24012
|
-
ctor.super_ = superCtor
|
|
24013
|
-
var TempCtor = function () {}
|
|
24014
|
-
TempCtor.prototype = superCtor.prototype
|
|
24015
|
-
ctor.prototype = new TempCtor()
|
|
24016
|
-
ctor.prototype.constructor = ctor
|
|
24017
|
-
}
|
|
24018
|
-
}
|
|
24019
|
-
}
|
|
23998
|
+
},{"events":43}],74:[function(require,module,exports){
|
|
23999
|
+
module.exports = require('./readable').PassThrough
|
|
24020
24000
|
|
|
24021
|
-
},{}],
|
|
24022
|
-
|
|
24023
|
-
|
|
24001
|
+
},{"./readable":75}],75:[function(require,module,exports){
|
|
24002
|
+
exports = module.exports = require('./lib/_stream_readable.js');
|
|
24003
|
+
exports.Stream = exports;
|
|
24004
|
+
exports.Readable = exports;
|
|
24005
|
+
exports.Writable = require('./lib/_stream_writable.js');
|
|
24006
|
+
exports.Duplex = require('./lib/_stream_duplex.js');
|
|
24007
|
+
exports.Transform = require('./lib/_stream_transform.js');
|
|
24008
|
+
exports.PassThrough = require('./lib/_stream_passthrough.js');
|
|
24009
|
+
|
|
24010
|
+
},{"./lib/_stream_duplex.js":66,"./lib/_stream_passthrough.js":67,"./lib/_stream_readable.js":68,"./lib/_stream_transform.js":69,"./lib/_stream_writable.js":70}],76:[function(require,module,exports){
|
|
24011
|
+
module.exports = require('./readable').Transform
|
|
24012
|
+
|
|
24013
|
+
},{"./readable":75}],77:[function(require,module,exports){
|
|
24014
|
+
module.exports = require('./lib/_stream_writable.js');
|
|
24015
|
+
|
|
24016
|
+
},{"./lib/_stream_writable.js":70}],78:[function(require,module,exports){
|
|
24024
24017
|
/* eslint-disable node/no-deprecated-api */
|
|
24025
24018
|
var buffer = require('buffer')
|
|
24026
24019
|
var Buffer = buffer.Buffer
|
|
@@ -24084,7 +24077,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
|
|
|
24084
24077
|
return buffer.SlowBuffer(size)
|
|
24085
24078
|
}
|
|
24086
24079
|
|
|
24087
|
-
},{"buffer":39}],
|
|
24080
|
+
},{"buffer":39}],79:[function(require,module,exports){
|
|
24088
24081
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
24089
24082
|
//
|
|
24090
24083
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -24381,181 +24374,7 @@ function simpleWrite(buf) {
|
|
|
24381
24374
|
function simpleEnd(buf) {
|
|
24382
24375
|
return buf && buf.length ? this.write(buf) : '';
|
|
24383
24376
|
}
|
|
24384
|
-
},{"safe-buffer":
|
|
24385
|
-
module.exports = require('./readable').PassThrough
|
|
24386
|
-
|
|
24387
|
-
},{"./readable":76}],76:[function(require,module,exports){
|
|
24388
|
-
exports = module.exports = require('./lib/_stream_readable.js');
|
|
24389
|
-
exports.Stream = exports;
|
|
24390
|
-
exports.Readable = exports;
|
|
24391
|
-
exports.Writable = require('./lib/_stream_writable.js');
|
|
24392
|
-
exports.Duplex = require('./lib/_stream_duplex.js');
|
|
24393
|
-
exports.Transform = require('./lib/_stream_transform.js');
|
|
24394
|
-
exports.PassThrough = require('./lib/_stream_passthrough.js');
|
|
24395
|
-
|
|
24396
|
-
},{"./lib/_stream_duplex.js":63,"./lib/_stream_passthrough.js":64,"./lib/_stream_readable.js":65,"./lib/_stream_transform.js":66,"./lib/_stream_writable.js":67}],77:[function(require,module,exports){
|
|
24397
|
-
module.exports = require('./readable').Transform
|
|
24398
|
-
|
|
24399
|
-
},{"./readable":76}],78:[function(require,module,exports){
|
|
24400
|
-
module.exports = require('./lib/_stream_writable.js');
|
|
24401
|
-
|
|
24402
|
-
},{"./lib/_stream_writable.js":67}],79:[function(require,module,exports){
|
|
24403
|
-
|
|
24404
|
-
/**
|
|
24405
|
-
* Reduce `arr` with `fn`.
|
|
24406
|
-
*
|
|
24407
|
-
* @param {Array} arr
|
|
24408
|
-
* @param {Function} fn
|
|
24409
|
-
* @param {Mixed} initial
|
|
24410
|
-
*
|
|
24411
|
-
* TODO: combatible error handling?
|
|
24412
|
-
*/
|
|
24413
|
-
|
|
24414
|
-
module.exports = function(arr, fn, initial){
|
|
24415
|
-
var idx = 0;
|
|
24416
|
-
var len = arr.length;
|
|
24417
|
-
var curr = arguments.length == 3
|
|
24418
|
-
? initial
|
|
24419
|
-
: arr[idx++];
|
|
24420
|
-
|
|
24421
|
-
while (idx < len) {
|
|
24422
|
-
curr = fn.call(null, curr, arr[idx], ++idx, arr);
|
|
24423
|
-
}
|
|
24424
|
-
|
|
24425
|
-
return curr;
|
|
24426
|
-
};
|
|
24427
|
-
},{}],80:[function(require,module,exports){
|
|
24428
|
-
// Copyright Joyent, Inc. and other Node contributors.
|
|
24429
|
-
//
|
|
24430
|
-
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
24431
|
-
// copy of this software and associated documentation files (the
|
|
24432
|
-
// "Software"), to deal in the Software without restriction, including
|
|
24433
|
-
// without limitation the rights to use, copy, modify, merge, publish,
|
|
24434
|
-
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
24435
|
-
// persons to whom the Software is furnished to do so, subject to the
|
|
24436
|
-
// following conditions:
|
|
24437
|
-
//
|
|
24438
|
-
// The above copyright notice and this permission notice shall be included
|
|
24439
|
-
// in all copies or substantial portions of the Software.
|
|
24440
|
-
//
|
|
24441
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
24442
|
-
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
24443
|
-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
24444
|
-
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
24445
|
-
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
24446
|
-
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
24447
|
-
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24448
|
-
|
|
24449
|
-
module.exports = Stream;
|
|
24450
|
-
|
|
24451
|
-
var EE = require('events').EventEmitter;
|
|
24452
|
-
var inherits = require('inherits');
|
|
24453
|
-
|
|
24454
|
-
inherits(Stream, EE);
|
|
24455
|
-
Stream.Readable = require('readable-stream/readable.js');
|
|
24456
|
-
Stream.Writable = require('readable-stream/writable.js');
|
|
24457
|
-
Stream.Duplex = require('readable-stream/duplex.js');
|
|
24458
|
-
Stream.Transform = require('readable-stream/transform.js');
|
|
24459
|
-
Stream.PassThrough = require('readable-stream/passthrough.js');
|
|
24460
|
-
|
|
24461
|
-
// Backwards-compat with node 0.4.x
|
|
24462
|
-
Stream.Stream = Stream;
|
|
24463
|
-
|
|
24464
|
-
|
|
24465
|
-
|
|
24466
|
-
// old-style streams. Note that the pipe method (the only relevant
|
|
24467
|
-
// part of this class) is overridden in the Readable class.
|
|
24468
|
-
|
|
24469
|
-
function Stream() {
|
|
24470
|
-
EE.call(this);
|
|
24471
|
-
}
|
|
24472
|
-
|
|
24473
|
-
Stream.prototype.pipe = function(dest, options) {
|
|
24474
|
-
var source = this;
|
|
24475
|
-
|
|
24476
|
-
function ondata(chunk) {
|
|
24477
|
-
if (dest.writable) {
|
|
24478
|
-
if (false === dest.write(chunk) && source.pause) {
|
|
24479
|
-
source.pause();
|
|
24480
|
-
}
|
|
24481
|
-
}
|
|
24482
|
-
}
|
|
24483
|
-
|
|
24484
|
-
source.on('data', ondata);
|
|
24485
|
-
|
|
24486
|
-
function ondrain() {
|
|
24487
|
-
if (source.readable && source.resume) {
|
|
24488
|
-
source.resume();
|
|
24489
|
-
}
|
|
24490
|
-
}
|
|
24491
|
-
|
|
24492
|
-
dest.on('drain', ondrain);
|
|
24493
|
-
|
|
24494
|
-
// If the 'end' option is not supplied, dest.end() will be called when
|
|
24495
|
-
// source gets the 'end' or 'close' events. Only dest.end() once.
|
|
24496
|
-
if (!dest._isStdio && (!options || options.end !== false)) {
|
|
24497
|
-
source.on('end', onend);
|
|
24498
|
-
source.on('close', onclose);
|
|
24499
|
-
}
|
|
24500
|
-
|
|
24501
|
-
var didOnEnd = false;
|
|
24502
|
-
function onend() {
|
|
24503
|
-
if (didOnEnd) return;
|
|
24504
|
-
didOnEnd = true;
|
|
24505
|
-
|
|
24506
|
-
dest.end();
|
|
24507
|
-
}
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
function onclose() {
|
|
24511
|
-
if (didOnEnd) return;
|
|
24512
|
-
didOnEnd = true;
|
|
24513
|
-
|
|
24514
|
-
if (typeof dest.destroy === 'function') dest.destroy();
|
|
24515
|
-
}
|
|
24516
|
-
|
|
24517
|
-
// don't leave dangling pipes when there are errors.
|
|
24518
|
-
function onerror(er) {
|
|
24519
|
-
cleanup();
|
|
24520
|
-
if (EE.listenerCount(this, 'error') === 0) {
|
|
24521
|
-
throw er; // Unhandled stream error in pipe.
|
|
24522
|
-
}
|
|
24523
|
-
}
|
|
24524
|
-
|
|
24525
|
-
source.on('error', onerror);
|
|
24526
|
-
dest.on('error', onerror);
|
|
24527
|
-
|
|
24528
|
-
// remove all the event listeners that were added.
|
|
24529
|
-
function cleanup() {
|
|
24530
|
-
source.removeListener('data', ondata);
|
|
24531
|
-
dest.removeListener('drain', ondrain);
|
|
24532
|
-
|
|
24533
|
-
source.removeListener('end', onend);
|
|
24534
|
-
source.removeListener('close', onclose);
|
|
24535
|
-
|
|
24536
|
-
source.removeListener('error', onerror);
|
|
24537
|
-
dest.removeListener('error', onerror);
|
|
24538
|
-
|
|
24539
|
-
source.removeListener('end', cleanup);
|
|
24540
|
-
source.removeListener('close', cleanup);
|
|
24541
|
-
|
|
24542
|
-
dest.removeListener('close', cleanup);
|
|
24543
|
-
}
|
|
24544
|
-
|
|
24545
|
-
source.on('end', cleanup);
|
|
24546
|
-
source.on('close', cleanup);
|
|
24547
|
-
|
|
24548
|
-
dest.on('close', cleanup);
|
|
24549
|
-
|
|
24550
|
-
dest.emit('pipe', source);
|
|
24551
|
-
|
|
24552
|
-
// Allow for unix-like usage: A.pipe(B).pipe(C)
|
|
24553
|
-
return dest;
|
|
24554
|
-
};
|
|
24555
|
-
|
|
24556
|
-
},{"events":44,"inherits":81,"readable-stream/duplex.js":62,"readable-stream/passthrough.js":75,"readable-stream/readable.js":76,"readable-stream/transform.js":77,"readable-stream/writable.js":78}],81:[function(require,module,exports){
|
|
24557
|
-
arguments[4][71][0].apply(exports,arguments)
|
|
24558
|
-
},{"dup":71}],82:[function(require,module,exports){
|
|
24377
|
+
},{"safe-buffer":78}],80:[function(require,module,exports){
|
|
24559
24378
|
var ClientRequest = require('./lib/request')
|
|
24560
24379
|
var extend = require('xtend')
|
|
24561
24380
|
var statusCodes = require('builtin-status-codes')
|
|
@@ -24630,7 +24449,7 @@ http.METHODS = [
|
|
|
24630
24449
|
'UNLOCK',
|
|
24631
24450
|
'UNSUBSCRIBE'
|
|
24632
24451
|
]
|
|
24633
|
-
},{"./lib/request":
|
|
24452
|
+
},{"./lib/request":82,"builtin-status-codes":41,"url":88,"xtend":92}],81:[function(require,module,exports){
|
|
24634
24453
|
(function (global){
|
|
24635
24454
|
exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableByteStream)
|
|
24636
24455
|
|
|
@@ -24674,7 +24493,7 @@ function isFunction (value) {
|
|
|
24674
24493
|
xhr = null // Help gc
|
|
24675
24494
|
|
|
24676
24495
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
24677
|
-
},{}],
|
|
24496
|
+
},{}],82:[function(require,module,exports){
|
|
24678
24497
|
(function (process,global,Buffer){
|
|
24679
24498
|
// var Base64 = require('Base64')
|
|
24680
24499
|
var capability = require('./capability')
|
|
@@ -24956,7 +24775,7 @@ var unsafeHeaders = [
|
|
|
24956
24775
|
]
|
|
24957
24776
|
|
|
24958
24777
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
|
24959
|
-
},{"./capability":
|
|
24778
|
+
},{"./capability":81,"./response":83,"_process":55,"buffer":39,"foreach":45,"indexof":48,"inherits":49,"object-keys":51,"stream":63}],83:[function(require,module,exports){
|
|
24960
24779
|
(function (process,global,Buffer){
|
|
24961
24780
|
var capability = require('./capability')
|
|
24962
24781
|
var foreach = require('foreach')
|
|
@@ -25133,9 +24952,7 @@ IncomingMessage.prototype._onXHRProgress = function () {
|
|
|
25133
24952
|
}
|
|
25134
24953
|
|
|
25135
24954
|
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
|
|
25136
|
-
},{"./capability":
|
|
25137
|
-
arguments[4][71][0].apply(exports,arguments)
|
|
25138
|
-
},{"dup":71}],87:[function(require,module,exports){
|
|
24955
|
+
},{"./capability":81,"_process":55,"buffer":39,"foreach":45,"inherits":49,"stream":63}],84:[function(require,module,exports){
|
|
25139
24956
|
var nargs = /\{([0-9a-zA-Z_]+)\}/g
|
|
25140
24957
|
|
|
25141
24958
|
module.exports = template
|
|
@@ -25173,15 +24990,13 @@ function template(string) {
|
|
|
25173
24990
|
})
|
|
25174
24991
|
}
|
|
25175
24992
|
|
|
25176
|
-
},{}],
|
|
24993
|
+
},{}],85:[function(require,module,exports){
|
|
25177
24994
|
/**
|
|
25178
24995
|
* Module dependencies.
|
|
25179
24996
|
*/
|
|
25180
24997
|
|
|
25181
24998
|
var Emitter = require('emitter');
|
|
25182
24999
|
var reduce = require('reduce');
|
|
25183
|
-
var requestBase = require('./request-base');
|
|
25184
|
-
var isObject = require('./is-object');
|
|
25185
25000
|
|
|
25186
25001
|
/**
|
|
25187
25002
|
* Root reference for iframes.
|
|
@@ -25203,10 +25018,28 @@ if (typeof window !== 'undefined') { // Browser window
|
|
|
25203
25018
|
function noop(){};
|
|
25204
25019
|
|
|
25205
25020
|
/**
|
|
25206
|
-
*
|
|
25021
|
+
* Check if `obj` is a host object,
|
|
25022
|
+
* we don't want to serialize these :)
|
|
25023
|
+
*
|
|
25024
|
+
* TODO: future proof, move to compoent land
|
|
25025
|
+
*
|
|
25026
|
+
* @param {Object} obj
|
|
25027
|
+
* @return {Boolean}
|
|
25028
|
+
* @api private
|
|
25207
25029
|
*/
|
|
25208
25030
|
|
|
25209
|
-
|
|
25031
|
+
function isHost(obj) {
|
|
25032
|
+
var str = {}.toString.call(obj);
|
|
25033
|
+
|
|
25034
|
+
switch (str) {
|
|
25035
|
+
case '[object File]':
|
|
25036
|
+
case '[object Blob]':
|
|
25037
|
+
case '[object FormData]':
|
|
25038
|
+
return true;
|
|
25039
|
+
default:
|
|
25040
|
+
return false;
|
|
25041
|
+
}
|
|
25042
|
+
}
|
|
25210
25043
|
|
|
25211
25044
|
/**
|
|
25212
25045
|
* Determine XHR.
|
|
@@ -25238,6 +25071,18 @@ var trim = ''.trim
|
|
|
25238
25071
|
? function(s) { return s.trim(); }
|
|
25239
25072
|
: function(s) { return s.replace(/(^\s*|\s*$)/g, ''); };
|
|
25240
25073
|
|
|
25074
|
+
/**
|
|
25075
|
+
* Check if `obj` is an object.
|
|
25076
|
+
*
|
|
25077
|
+
* @param {Object} obj
|
|
25078
|
+
* @return {Boolean}
|
|
25079
|
+
* @api private
|
|
25080
|
+
*/
|
|
25081
|
+
|
|
25082
|
+
function isObject(obj) {
|
|
25083
|
+
return obj === Object(obj);
|
|
25084
|
+
}
|
|
25085
|
+
|
|
25241
25086
|
/**
|
|
25242
25087
|
* Serialize the given `obj`.
|
|
25243
25088
|
*
|
|
@@ -25252,8 +25097,8 @@ function serialize(obj) {
|
|
|
25252
25097
|
for (var key in obj) {
|
|
25253
25098
|
if (null != obj[key]) {
|
|
25254
25099
|
pushEncodedKeyValuePair(pairs, key, obj[key]);
|
|
25255
|
-
|
|
25256
|
-
|
|
25100
|
+
}
|
|
25101
|
+
}
|
|
25257
25102
|
return pairs.join('&');
|
|
25258
25103
|
}
|
|
25259
25104
|
|
|
@@ -25271,11 +25116,6 @@ function pushEncodedKeyValuePair(pairs, key, val) {
|
|
|
25271
25116
|
return val.forEach(function(v) {
|
|
25272
25117
|
pushEncodedKeyValuePair(pairs, key, v);
|
|
25273
25118
|
});
|
|
25274
|
-
} else if (isObject(val)) {
|
|
25275
|
-
for(var subkey in val) {
|
|
25276
|
-
pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]);
|
|
25277
|
-
}
|
|
25278
|
-
return;
|
|
25279
25119
|
}
|
|
25280
25120
|
pairs.push(encodeURIComponent(key)
|
|
25281
25121
|
+ '=' + encodeURIComponent(val));
|
|
@@ -25298,18 +25138,13 @@ function pushEncodedKeyValuePair(pairs, key, val) {
|
|
|
25298
25138
|
function parseString(str) {
|
|
25299
25139
|
var obj = {};
|
|
25300
25140
|
var pairs = str.split('&');
|
|
25141
|
+
var parts;
|
|
25301
25142
|
var pair;
|
|
25302
|
-
var pos;
|
|
25303
25143
|
|
|
25304
25144
|
for (var i = 0, len = pairs.length; i < len; ++i) {
|
|
25305
25145
|
pair = pairs[i];
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
obj[decodeURIComponent(pair)] = '';
|
|
25309
|
-
} else {
|
|
25310
|
-
obj[decodeURIComponent(pair.slice(0, pos))] =
|
|
25311
|
-
decodeURIComponent(pair.slice(pos + 1));
|
|
25312
|
-
}
|
|
25146
|
+
parts = pair.split('=');
|
|
25147
|
+
obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);
|
|
25313
25148
|
}
|
|
25314
25149
|
|
|
25315
25150
|
return obj;
|
|
@@ -25493,15 +25328,15 @@ function Response(req, options) {
|
|
|
25493
25328
|
? this.xhr.responseText
|
|
25494
25329
|
: null;
|
|
25495
25330
|
this.statusText = this.req.xhr.statusText;
|
|
25496
|
-
this.
|
|
25331
|
+
this.setStatusProperties(this.xhr.status);
|
|
25497
25332
|
this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());
|
|
25498
25333
|
// getAllResponseHeaders sometimes falsely returns "" for CORS requests, but
|
|
25499
25334
|
// getResponseHeader still works. so we get content-type even if getting
|
|
25500
25335
|
// other headers fails.
|
|
25501
25336
|
this.header['content-type'] = this.xhr.getResponseHeader('content-type');
|
|
25502
|
-
this.
|
|
25337
|
+
this.setHeaderProperties(this.header);
|
|
25503
25338
|
this.body = this.req.method != 'HEAD'
|
|
25504
|
-
? this.
|
|
25339
|
+
? this.parseBody(this.text ? this.text : this.xhr.response)
|
|
25505
25340
|
: null;
|
|
25506
25341
|
}
|
|
25507
25342
|
|
|
@@ -25529,7 +25364,7 @@ Response.prototype.get = function(field){
|
|
|
25529
25364
|
* @api private
|
|
25530
25365
|
*/
|
|
25531
25366
|
|
|
25532
|
-
Response.prototype.
|
|
25367
|
+
Response.prototype.setHeaderProperties = function(header){
|
|
25533
25368
|
// content-type
|
|
25534
25369
|
var ct = this.header['content-type'] || '';
|
|
25535
25370
|
this.type = type(ct);
|
|
@@ -25550,11 +25385,8 @@ Response.prototype._setHeaderProperties = function(header){
|
|
|
25550
25385
|
* @api private
|
|
25551
25386
|
*/
|
|
25552
25387
|
|
|
25553
|
-
Response.prototype.
|
|
25388
|
+
Response.prototype.parseBody = function(str){
|
|
25554
25389
|
var parse = request.parse[this.type];
|
|
25555
|
-
if (!parse && isJSON(this.type)) {
|
|
25556
|
-
parse = request.parse['application/json'];
|
|
25557
|
-
}
|
|
25558
25390
|
return parse && str && (str.length || str instanceof Object)
|
|
25559
25391
|
? parse(str)
|
|
25560
25392
|
: null;
|
|
@@ -25581,7 +25413,7 @@ Response.prototype._parseBody = function(str){
|
|
|
25581
25413
|
* @api private
|
|
25582
25414
|
*/
|
|
25583
25415
|
|
|
25584
|
-
Response.prototype.
|
|
25416
|
+
Response.prototype.setStatusProperties = function(status){
|
|
25585
25417
|
// handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request
|
|
25586
25418
|
if (status === 1223) {
|
|
25587
25419
|
status = 204;
|
|
@@ -25649,11 +25481,12 @@ request.Response = Response;
|
|
|
25649
25481
|
|
|
25650
25482
|
function Request(method, url) {
|
|
25651
25483
|
var self = this;
|
|
25484
|
+
Emitter.call(this);
|
|
25652
25485
|
this._query = this._query || [];
|
|
25653
25486
|
this.method = method;
|
|
25654
25487
|
this.url = url;
|
|
25655
|
-
this.header = {};
|
|
25656
|
-
this._header = {};
|
|
25488
|
+
this.header = {};
|
|
25489
|
+
this._header = {};
|
|
25657
25490
|
this.on('end', function(){
|
|
25658
25491
|
var err = null;
|
|
25659
25492
|
var res = null;
|
|
@@ -25666,8 +25499,6 @@ function Request(method, url) {
|
|
|
25666
25499
|
err.original = e;
|
|
25667
25500
|
// issue #675: return the raw response if the response parsing fails
|
|
25668
25501
|
err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null;
|
|
25669
|
-
// issue #876: return the http status code if the response parsing fails
|
|
25670
|
-
err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : null;
|
|
25671
25502
|
return self.callback(err);
|
|
25672
25503
|
}
|
|
25673
25504
|
|
|
@@ -25677,32 +25508,140 @@ function Request(method, url) {
|
|
|
25677
25508
|
return self.callback(err, res);
|
|
25678
25509
|
}
|
|
25679
25510
|
|
|
25680
|
-
|
|
25681
|
-
|
|
25682
|
-
|
|
25683
|
-
}
|
|
25511
|
+
if (res.status >= 200 && res.status < 300) {
|
|
25512
|
+
return self.callback(err, res);
|
|
25513
|
+
}
|
|
25684
25514
|
|
|
25685
|
-
|
|
25686
|
-
|
|
25687
|
-
|
|
25688
|
-
|
|
25515
|
+
var new_err = new Error(res.statusText || 'Unsuccessful HTTP response');
|
|
25516
|
+
new_err.original = err;
|
|
25517
|
+
new_err.response = res;
|
|
25518
|
+
new_err.status = res.status;
|
|
25689
25519
|
|
|
25690
|
-
|
|
25691
|
-
} catch(e) {
|
|
25692
|
-
self.callback(e); // #985 touching res may cause INVALID_STATE_ERR on old Android
|
|
25693
|
-
}
|
|
25520
|
+
self.callback(new_err, res);
|
|
25694
25521
|
});
|
|
25695
25522
|
}
|
|
25696
25523
|
|
|
25697
25524
|
/**
|
|
25698
|
-
* Mixin `Emitter
|
|
25525
|
+
* Mixin `Emitter`.
|
|
25699
25526
|
*/
|
|
25700
25527
|
|
|
25701
25528
|
Emitter(Request.prototype);
|
|
25702
|
-
|
|
25703
|
-
|
|
25529
|
+
|
|
25530
|
+
/**
|
|
25531
|
+
* Allow for extension
|
|
25532
|
+
*/
|
|
25533
|
+
|
|
25534
|
+
Request.prototype.use = function(fn) {
|
|
25535
|
+
fn(this);
|
|
25536
|
+
return this;
|
|
25704
25537
|
}
|
|
25705
25538
|
|
|
25539
|
+
/**
|
|
25540
|
+
* Set timeout to `ms`.
|
|
25541
|
+
*
|
|
25542
|
+
* @param {Number} ms
|
|
25543
|
+
* @return {Request} for chaining
|
|
25544
|
+
* @api public
|
|
25545
|
+
*/
|
|
25546
|
+
|
|
25547
|
+
Request.prototype.timeout = function(ms){
|
|
25548
|
+
this._timeout = ms;
|
|
25549
|
+
return this;
|
|
25550
|
+
};
|
|
25551
|
+
|
|
25552
|
+
/**
|
|
25553
|
+
* Clear previous timeout.
|
|
25554
|
+
*
|
|
25555
|
+
* @return {Request} for chaining
|
|
25556
|
+
* @api public
|
|
25557
|
+
*/
|
|
25558
|
+
|
|
25559
|
+
Request.prototype.clearTimeout = function(){
|
|
25560
|
+
this._timeout = 0;
|
|
25561
|
+
clearTimeout(this._timer);
|
|
25562
|
+
return this;
|
|
25563
|
+
};
|
|
25564
|
+
|
|
25565
|
+
/**
|
|
25566
|
+
* Abort the request, and clear potential timeout.
|
|
25567
|
+
*
|
|
25568
|
+
* @return {Request}
|
|
25569
|
+
* @api public
|
|
25570
|
+
*/
|
|
25571
|
+
|
|
25572
|
+
Request.prototype.abort = function(){
|
|
25573
|
+
if (this.aborted) return;
|
|
25574
|
+
this.aborted = true;
|
|
25575
|
+
this.xhr.abort();
|
|
25576
|
+
this.clearTimeout();
|
|
25577
|
+
this.emit('abort');
|
|
25578
|
+
return this;
|
|
25579
|
+
};
|
|
25580
|
+
|
|
25581
|
+
/**
|
|
25582
|
+
* Set header `field` to `val`, or multiple fields with one object.
|
|
25583
|
+
*
|
|
25584
|
+
* Examples:
|
|
25585
|
+
*
|
|
25586
|
+
* req.get('/')
|
|
25587
|
+
* .set('Accept', 'application/json')
|
|
25588
|
+
* .set('X-API-Key', 'foobar')
|
|
25589
|
+
* .end(callback);
|
|
25590
|
+
*
|
|
25591
|
+
* req.get('/')
|
|
25592
|
+
* .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
|
|
25593
|
+
* .end(callback);
|
|
25594
|
+
*
|
|
25595
|
+
* @param {String|Object} field
|
|
25596
|
+
* @param {String} val
|
|
25597
|
+
* @return {Request} for chaining
|
|
25598
|
+
* @api public
|
|
25599
|
+
*/
|
|
25600
|
+
|
|
25601
|
+
Request.prototype.set = function(field, val){
|
|
25602
|
+
if (isObject(field)) {
|
|
25603
|
+
for (var key in field) {
|
|
25604
|
+
this.set(key, field[key]);
|
|
25605
|
+
}
|
|
25606
|
+
return this;
|
|
25607
|
+
}
|
|
25608
|
+
this._header[field.toLowerCase()] = val;
|
|
25609
|
+
this.header[field] = val;
|
|
25610
|
+
return this;
|
|
25611
|
+
};
|
|
25612
|
+
|
|
25613
|
+
/**
|
|
25614
|
+
* Remove header `field`.
|
|
25615
|
+
*
|
|
25616
|
+
* Example:
|
|
25617
|
+
*
|
|
25618
|
+
* req.get('/')
|
|
25619
|
+
* .unset('User-Agent')
|
|
25620
|
+
* .end(callback);
|
|
25621
|
+
*
|
|
25622
|
+
* @param {String} field
|
|
25623
|
+
* @return {Request} for chaining
|
|
25624
|
+
* @api public
|
|
25625
|
+
*/
|
|
25626
|
+
|
|
25627
|
+
Request.prototype.unset = function(field){
|
|
25628
|
+
delete this._header[field.toLowerCase()];
|
|
25629
|
+
delete this.header[field];
|
|
25630
|
+
return this;
|
|
25631
|
+
};
|
|
25632
|
+
|
|
25633
|
+
/**
|
|
25634
|
+
* Get case-insensitive header `field` value.
|
|
25635
|
+
*
|
|
25636
|
+
* @param {String} field
|
|
25637
|
+
* @return {String}
|
|
25638
|
+
* @api private
|
|
25639
|
+
*/
|
|
25640
|
+
|
|
25641
|
+
Request.prototype.getHeader = function(field){
|
|
25642
|
+
return this._header[field.toLowerCase()];
|
|
25643
|
+
};
|
|
25644
|
+
|
|
25706
25645
|
/**
|
|
25707
25646
|
* Set Content-Type to `type`, mapping values from `request.types`.
|
|
25708
25647
|
*
|
|
@@ -25731,22 +25670,16 @@ Request.prototype.type = function(type){
|
|
|
25731
25670
|
};
|
|
25732
25671
|
|
|
25733
25672
|
/**
|
|
25734
|
-
*
|
|
25735
|
-
* 'arraybuffer'.
|
|
25673
|
+
* Force given parser
|
|
25736
25674
|
*
|
|
25737
|
-
*
|
|
25675
|
+
* Sets the body parser no matter type.
|
|
25738
25676
|
*
|
|
25739
|
-
*
|
|
25740
|
-
* .responseType('blob')
|
|
25741
|
-
* .end(callback);
|
|
25742
|
-
*
|
|
25743
|
-
* @param {String} val
|
|
25744
|
-
* @return {Request} for chaining
|
|
25677
|
+
* @param {Function}
|
|
25745
25678
|
* @api public
|
|
25746
25679
|
*/
|
|
25747
25680
|
|
|
25748
|
-
Request.prototype.
|
|
25749
|
-
this.
|
|
25681
|
+
Request.prototype.parse = function(fn){
|
|
25682
|
+
this._parser = fn;
|
|
25750
25683
|
return this;
|
|
25751
25684
|
};
|
|
25752
25685
|
|
|
@@ -25780,29 +25713,13 @@ Request.prototype.accept = function(type){
|
|
|
25780
25713
|
*
|
|
25781
25714
|
* @param {String} user
|
|
25782
25715
|
* @param {String} pass
|
|
25783
|
-
* @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic')
|
|
25784
25716
|
* @return {Request} for chaining
|
|
25785
25717
|
* @api public
|
|
25786
25718
|
*/
|
|
25787
25719
|
|
|
25788
|
-
Request.prototype.auth = function(user, pass
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
type: 'basic'
|
|
25792
|
-
}
|
|
25793
|
-
}
|
|
25794
|
-
|
|
25795
|
-
switch (options.type) {
|
|
25796
|
-
case 'basic':
|
|
25797
|
-
var str = btoa(user + ':' + pass);
|
|
25798
|
-
this.set('Authorization', 'Basic ' + str);
|
|
25799
|
-
break;
|
|
25800
|
-
|
|
25801
|
-
case 'auto':
|
|
25802
|
-
this.username = user;
|
|
25803
|
-
this.password = pass;
|
|
25804
|
-
break;
|
|
25805
|
-
}
|
|
25720
|
+
Request.prototype.auth = function(user, pass){
|
|
25721
|
+
var str = btoa(user + ':' + pass);
|
|
25722
|
+
this.set('Authorization', 'Basic ' + str);
|
|
25806
25723
|
return this;
|
|
25807
25724
|
};
|
|
25808
25725
|
|
|
@@ -25826,13 +25743,35 @@ Request.prototype.query = function(val){
|
|
|
25826
25743
|
return this;
|
|
25827
25744
|
};
|
|
25828
25745
|
|
|
25746
|
+
/**
|
|
25747
|
+
* Write the field `name` and `val` for "multipart/form-data"
|
|
25748
|
+
* request bodies.
|
|
25749
|
+
*
|
|
25750
|
+
* ``` js
|
|
25751
|
+
* request.post('/upload')
|
|
25752
|
+
* .field('foo', 'bar')
|
|
25753
|
+
* .end(callback);
|
|
25754
|
+
* ```
|
|
25755
|
+
*
|
|
25756
|
+
* @param {String} name
|
|
25757
|
+
* @param {String|Blob|File} val
|
|
25758
|
+
* @return {Request} for chaining
|
|
25759
|
+
* @api public
|
|
25760
|
+
*/
|
|
25761
|
+
|
|
25762
|
+
Request.prototype.field = function(name, val){
|
|
25763
|
+
if (!this._formData) this._formData = new root.FormData();
|
|
25764
|
+
this._formData.append(name, val);
|
|
25765
|
+
return this;
|
|
25766
|
+
};
|
|
25767
|
+
|
|
25829
25768
|
/**
|
|
25830
25769
|
* Queue the given `file` as an attachment to the specified `field`,
|
|
25831
25770
|
* with optional `filename`.
|
|
25832
25771
|
*
|
|
25833
25772
|
* ``` js
|
|
25834
25773
|
* request.post('/upload')
|
|
25835
|
-
* .attach(
|
|
25774
|
+
* .attach(new Blob(['<a id="a"><b id="b">hey!</b></a>'], { type: "text/html"}))
|
|
25836
25775
|
* .end(callback);
|
|
25837
25776
|
* ```
|
|
25838
25777
|
*
|
|
@@ -25844,15 +25783,77 @@ Request.prototype.query = function(val){
|
|
|
25844
25783
|
*/
|
|
25845
25784
|
|
|
25846
25785
|
Request.prototype.attach = function(field, file, filename){
|
|
25847
|
-
this.
|
|
25786
|
+
if (!this._formData) this._formData = new root.FormData();
|
|
25787
|
+
this._formData.append(field, file, filename || file.name);
|
|
25848
25788
|
return this;
|
|
25849
25789
|
};
|
|
25850
25790
|
|
|
25851
|
-
|
|
25852
|
-
|
|
25853
|
-
|
|
25791
|
+
/**
|
|
25792
|
+
* Send `data` as the request body, defaulting the `.type()` to "json" when
|
|
25793
|
+
* an object is given.
|
|
25794
|
+
*
|
|
25795
|
+
* Examples:
|
|
25796
|
+
*
|
|
25797
|
+
* // manual json
|
|
25798
|
+
* request.post('/user')
|
|
25799
|
+
* .type('json')
|
|
25800
|
+
* .send('{"name":"tj"}')
|
|
25801
|
+
* .end(callback)
|
|
25802
|
+
*
|
|
25803
|
+
* // auto json
|
|
25804
|
+
* request.post('/user')
|
|
25805
|
+
* .send({ name: 'tj' })
|
|
25806
|
+
* .end(callback)
|
|
25807
|
+
*
|
|
25808
|
+
* // manual x-www-form-urlencoded
|
|
25809
|
+
* request.post('/user')
|
|
25810
|
+
* .type('form')
|
|
25811
|
+
* .send('name=tj')
|
|
25812
|
+
* .end(callback)
|
|
25813
|
+
*
|
|
25814
|
+
* // auto x-www-form-urlencoded
|
|
25815
|
+
* request.post('/user')
|
|
25816
|
+
* .type('form')
|
|
25817
|
+
* .send({ name: 'tj' })
|
|
25818
|
+
* .end(callback)
|
|
25819
|
+
*
|
|
25820
|
+
* // defaults to x-www-form-urlencoded
|
|
25821
|
+
* request.post('/user')
|
|
25822
|
+
* .send('name=tobi')
|
|
25823
|
+
* .send('species=ferret')
|
|
25824
|
+
* .end(callback)
|
|
25825
|
+
*
|
|
25826
|
+
* @param {String|Object} data
|
|
25827
|
+
* @return {Request} for chaining
|
|
25828
|
+
* @api public
|
|
25829
|
+
*/
|
|
25830
|
+
|
|
25831
|
+
Request.prototype.send = function(data){
|
|
25832
|
+
var obj = isObject(data);
|
|
25833
|
+
var type = this.getHeader('Content-Type');
|
|
25834
|
+
|
|
25835
|
+
// merge
|
|
25836
|
+
if (obj && isObject(this._data)) {
|
|
25837
|
+
for (var key in data) {
|
|
25838
|
+
this._data[key] = data[key];
|
|
25839
|
+
}
|
|
25840
|
+
} else if ('string' == typeof data) {
|
|
25841
|
+
if (!type) this.type('form');
|
|
25842
|
+
type = this.getHeader('Content-Type');
|
|
25843
|
+
if ('application/x-www-form-urlencoded' == type) {
|
|
25844
|
+
this._data = this._data
|
|
25845
|
+
? this._data + '&' + data
|
|
25846
|
+
: data;
|
|
25847
|
+
} else {
|
|
25848
|
+
this._data = (this._data || '') + data;
|
|
25849
|
+
}
|
|
25850
|
+
} else {
|
|
25851
|
+
this._data = data;
|
|
25854
25852
|
}
|
|
25855
|
-
|
|
25853
|
+
|
|
25854
|
+
if (!obj || isHost(data)) return this;
|
|
25855
|
+
if (!type) this.type('json');
|
|
25856
|
+
return this;
|
|
25856
25857
|
};
|
|
25857
25858
|
|
|
25858
25859
|
/**
|
|
@@ -25893,7 +25894,7 @@ Request.prototype.crossDomainError = function(){
|
|
|
25893
25894
|
* @api private
|
|
25894
25895
|
*/
|
|
25895
25896
|
|
|
25896
|
-
Request.prototype.
|
|
25897
|
+
Request.prototype.timeoutError = function(){
|
|
25897
25898
|
var timeout = this._timeout;
|
|
25898
25899
|
var err = new Error('timeout of ' + timeout + 'ms exceeded');
|
|
25899
25900
|
err.timeout = timeout;
|
|
@@ -25901,18 +25902,19 @@ Request.prototype._timeoutError = function(){
|
|
|
25901
25902
|
};
|
|
25902
25903
|
|
|
25903
25904
|
/**
|
|
25904
|
-
*
|
|
25905
|
+
* Enable transmission of cookies with x-domain requests.
|
|
25905
25906
|
*
|
|
25906
|
-
*
|
|
25907
|
+
* Note that for this to work the origin must not be
|
|
25908
|
+
* using "Access-Control-Allow-Origin" with a wildcard,
|
|
25909
|
+
* and also must set "Access-Control-Allow-Credentials"
|
|
25910
|
+
* to "true".
|
|
25911
|
+
*
|
|
25912
|
+
* @api public
|
|
25907
25913
|
*/
|
|
25908
25914
|
|
|
25909
|
-
Request.prototype.
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
this.url += ~this.url.indexOf('?')
|
|
25913
|
-
? '&' + query
|
|
25914
|
-
: '?' + query;
|
|
25915
|
-
}
|
|
25915
|
+
Request.prototype.withCredentials = function(){
|
|
25916
|
+
this._withCredentials = true;
|
|
25917
|
+
return this;
|
|
25916
25918
|
};
|
|
25917
25919
|
|
|
25918
25920
|
/**
|
|
@@ -25927,6 +25929,7 @@ Request.prototype._appendQueryString = function(){
|
|
|
25927
25929
|
Request.prototype.end = function(fn){
|
|
25928
25930
|
var self = this;
|
|
25929
25931
|
var xhr = this.xhr = request.getXHR();
|
|
25932
|
+
var query = this._query.join('&');
|
|
25930
25933
|
var timeout = this._timeout;
|
|
25931
25934
|
var data = this._formData || this._data;
|
|
25932
25935
|
|
|
@@ -25943,8 +25946,8 @@ Request.prototype.end = function(fn){
|
|
|
25943
25946
|
try { status = xhr.status } catch(e) { status = 0; }
|
|
25944
25947
|
|
|
25945
25948
|
if (0 == status) {
|
|
25946
|
-
if (self.timedout) return self.
|
|
25947
|
-
if (self.
|
|
25949
|
+
if (self.timedout) return self.timeoutError();
|
|
25950
|
+
if (self.aborted) return;
|
|
25948
25951
|
return self.crossDomainError();
|
|
25949
25952
|
}
|
|
25950
25953
|
self.emit('end');
|
|
@@ -25980,23 +25983,24 @@ Request.prototype.end = function(fn){
|
|
|
25980
25983
|
}
|
|
25981
25984
|
|
|
25982
25985
|
// querystring
|
|
25983
|
-
|
|
25986
|
+
if (query) {
|
|
25987
|
+
query = request.serializeObject(query);
|
|
25988
|
+
this.url += ~this.url.indexOf('?')
|
|
25989
|
+
? '&' + query
|
|
25990
|
+
: '?' + query;
|
|
25991
|
+
}
|
|
25984
25992
|
|
|
25985
25993
|
// initiate request
|
|
25986
|
-
|
|
25987
|
-
xhr.open(this.method, this.url, true, this.username, this.password);
|
|
25988
|
-
} else {
|
|
25989
|
-
xhr.open(this.method, this.url, true);
|
|
25990
|
-
}
|
|
25994
|
+
xhr.open(this.method, this.url, true);
|
|
25991
25995
|
|
|
25992
25996
|
// CORS
|
|
25993
25997
|
if (this._withCredentials) xhr.withCredentials = true;
|
|
25994
25998
|
|
|
25995
25999
|
// body
|
|
25996
|
-
if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !
|
|
26000
|
+
if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {
|
|
25997
26001
|
// serialize stuff
|
|
25998
|
-
var contentType = this.
|
|
25999
|
-
var serialize = this.
|
|
26002
|
+
var contentType = this.getHeader('Content-Type');
|
|
26003
|
+
var serialize = this._parser || request.serialize[contentType ? contentType.split(';')[0] : ''];
|
|
26000
26004
|
if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json'];
|
|
26001
26005
|
if (serialize) data = serialize(data);
|
|
26002
26006
|
}
|
|
@@ -26007,10 +26011,6 @@ Request.prototype.end = function(fn){
|
|
|
26007
26011
|
xhr.setRequestHeader(field, this.header[field]);
|
|
26008
26012
|
}
|
|
26009
26013
|
|
|
26010
|
-
if (this._responseType) {
|
|
26011
|
-
xhr.responseType = this._responseType;
|
|
26012
|
-
}
|
|
26013
|
-
|
|
26014
26014
|
// send stuff
|
|
26015
26015
|
this.emit('request', this);
|
|
26016
26016
|
|
|
@@ -26020,505 +26020,26 @@ Request.prototype.end = function(fn){
|
|
|
26020
26020
|
return this;
|
|
26021
26021
|
};
|
|
26022
26022
|
|
|
26023
|
-
|
|
26024
|
-
/**
|
|
26025
|
-
* Expose `Request`.
|
|
26026
|
-
*/
|
|
26027
|
-
|
|
26028
|
-
request.Request = Request;
|
|
26029
|
-
|
|
26030
|
-
/**
|
|
26031
|
-
* GET `url` with optional callback `fn(res)`.
|
|
26032
|
-
*
|
|
26033
|
-
* @param {String} url
|
|
26034
|
-
* @param {Mixed|Function} data or fn
|
|
26035
|
-
* @param {Function} fn
|
|
26036
|
-
* @return {Request}
|
|
26037
|
-
* @api public
|
|
26038
|
-
*/
|
|
26039
|
-
|
|
26040
|
-
request.get = function(url, data, fn){
|
|
26041
|
-
var req = request('GET', url);
|
|
26042
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26043
|
-
if (data) req.query(data);
|
|
26044
|
-
if (fn) req.end(fn);
|
|
26045
|
-
return req;
|
|
26046
|
-
};
|
|
26047
|
-
|
|
26048
|
-
/**
|
|
26049
|
-
* HEAD `url` with optional callback `fn(res)`.
|
|
26050
|
-
*
|
|
26051
|
-
* @param {String} url
|
|
26052
|
-
* @param {Mixed|Function} data or fn
|
|
26053
|
-
* @param {Function} fn
|
|
26054
|
-
* @return {Request}
|
|
26055
|
-
* @api public
|
|
26056
|
-
*/
|
|
26057
|
-
|
|
26058
|
-
request.head = function(url, data, fn){
|
|
26059
|
-
var req = request('HEAD', url);
|
|
26060
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26061
|
-
if (data) req.send(data);
|
|
26062
|
-
if (fn) req.end(fn);
|
|
26063
|
-
return req;
|
|
26064
|
-
};
|
|
26065
|
-
|
|
26066
26023
|
/**
|
|
26067
|
-
*
|
|
26024
|
+
* Faux promise support
|
|
26068
26025
|
*
|
|
26069
|
-
* @param {
|
|
26070
|
-
* @param {Mixed|Function} data or fn
|
|
26071
|
-
* @param {Function} fn
|
|
26072
|
-
* @return {Request}
|
|
26073
|
-
* @api public
|
|
26074
|
-
*/
|
|
26075
|
-
|
|
26076
|
-
request.options = function(url, data, fn){
|
|
26077
|
-
var req = request('OPTIONS', url);
|
|
26078
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26079
|
-
if (data) req.send(data);
|
|
26080
|
-
if (fn) req.end(fn);
|
|
26081
|
-
return req;
|
|
26082
|
-
};
|
|
26083
|
-
|
|
26084
|
-
/**
|
|
26085
|
-
* DELETE `url` with optional callback `fn(res)`.
|
|
26086
|
-
*
|
|
26087
|
-
* @param {String} url
|
|
26088
|
-
* @param {Function} fn
|
|
26089
|
-
* @return {Request}
|
|
26090
|
-
* @api public
|
|
26091
|
-
*/
|
|
26092
|
-
|
|
26093
|
-
function del(url, fn){
|
|
26094
|
-
var req = request('DELETE', url);
|
|
26095
|
-
if (fn) req.end(fn);
|
|
26096
|
-
return req;
|
|
26097
|
-
};
|
|
26098
|
-
|
|
26099
|
-
request['del'] = del;
|
|
26100
|
-
request['delete'] = del;
|
|
26101
|
-
|
|
26102
|
-
/**
|
|
26103
|
-
* PATCH `url` with optional `data` and callback `fn(res)`.
|
|
26104
|
-
*
|
|
26105
|
-
* @param {String} url
|
|
26106
|
-
* @param {Mixed} data
|
|
26107
|
-
* @param {Function} fn
|
|
26108
|
-
* @return {Request}
|
|
26109
|
-
* @api public
|
|
26110
|
-
*/
|
|
26111
|
-
|
|
26112
|
-
request.patch = function(url, data, fn){
|
|
26113
|
-
var req = request('PATCH', url);
|
|
26114
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26115
|
-
if (data) req.send(data);
|
|
26116
|
-
if (fn) req.end(fn);
|
|
26117
|
-
return req;
|
|
26118
|
-
};
|
|
26119
|
-
|
|
26120
|
-
/**
|
|
26121
|
-
* POST `url` with optional `data` and callback `fn(res)`.
|
|
26122
|
-
*
|
|
26123
|
-
* @param {String} url
|
|
26124
|
-
* @param {Mixed} data
|
|
26125
|
-
* @param {Function} fn
|
|
26126
|
-
* @return {Request}
|
|
26127
|
-
* @api public
|
|
26128
|
-
*/
|
|
26129
|
-
|
|
26130
|
-
request.post = function(url, data, fn){
|
|
26131
|
-
var req = request('POST', url);
|
|
26132
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26133
|
-
if (data) req.send(data);
|
|
26134
|
-
if (fn) req.end(fn);
|
|
26135
|
-
return req;
|
|
26136
|
-
};
|
|
26137
|
-
|
|
26138
|
-
/**
|
|
26139
|
-
* PUT `url` with optional `data` and callback `fn(res)`.
|
|
26140
|
-
*
|
|
26141
|
-
* @param {String} url
|
|
26142
|
-
* @param {Mixed|Function} data or fn
|
|
26143
|
-
* @param {Function} fn
|
|
26144
|
-
* @return {Request}
|
|
26145
|
-
* @api public
|
|
26146
|
-
*/
|
|
26147
|
-
|
|
26148
|
-
request.put = function(url, data, fn){
|
|
26149
|
-
var req = request('PUT', url);
|
|
26150
|
-
if ('function' == typeof data) fn = data, data = null;
|
|
26151
|
-
if (data) req.send(data);
|
|
26152
|
-
if (fn) req.end(fn);
|
|
26153
|
-
return req;
|
|
26154
|
-
};
|
|
26155
|
-
|
|
26156
|
-
},{"./is-object":89,"./request":91,"./request-base":90,"emitter":42,"reduce":79}],89:[function(require,module,exports){
|
|
26157
|
-
/**
|
|
26158
|
-
* Check if `obj` is an object.
|
|
26159
|
-
*
|
|
26160
|
-
* @param {Object} obj
|
|
26161
|
-
* @return {Boolean}
|
|
26162
|
-
* @api private
|
|
26163
|
-
*/
|
|
26164
|
-
|
|
26165
|
-
function isObject(obj) {
|
|
26166
|
-
return null !== obj && 'object' === typeof obj;
|
|
26167
|
-
}
|
|
26168
|
-
|
|
26169
|
-
module.exports = isObject;
|
|
26170
|
-
|
|
26171
|
-
},{}],90:[function(require,module,exports){
|
|
26172
|
-
/**
|
|
26173
|
-
* Module of mixed-in functions shared between node and client code
|
|
26174
|
-
*/
|
|
26175
|
-
var isObject = require('./is-object');
|
|
26176
|
-
|
|
26177
|
-
/**
|
|
26178
|
-
* Clear previous timeout.
|
|
26179
|
-
*
|
|
26180
|
-
* @return {Request} for chaining
|
|
26181
|
-
* @api public
|
|
26182
|
-
*/
|
|
26183
|
-
|
|
26184
|
-
exports.clearTimeout = function _clearTimeout(){
|
|
26185
|
-
this._timeout = 0;
|
|
26186
|
-
clearTimeout(this._timer);
|
|
26187
|
-
return this;
|
|
26188
|
-
};
|
|
26189
|
-
|
|
26190
|
-
/**
|
|
26191
|
-
* Override default response body parser
|
|
26192
|
-
*
|
|
26193
|
-
* This function will be called to convert incoming data into request.body
|
|
26194
|
-
*
|
|
26195
|
-
* @param {Function}
|
|
26196
|
-
* @api public
|
|
26197
|
-
*/
|
|
26198
|
-
|
|
26199
|
-
exports.parse = function parse(fn){
|
|
26200
|
-
this._parser = fn;
|
|
26201
|
-
return this;
|
|
26202
|
-
};
|
|
26203
|
-
|
|
26204
|
-
/**
|
|
26205
|
-
* Override default request body serializer
|
|
26206
|
-
*
|
|
26207
|
-
* This function will be called to convert data set via .send or .attach into payload to send
|
|
26208
|
-
*
|
|
26209
|
-
* @param {Function}
|
|
26210
|
-
* @api public
|
|
26211
|
-
*/
|
|
26212
|
-
|
|
26213
|
-
exports.serialize = function serialize(fn){
|
|
26214
|
-
this._serializer = fn;
|
|
26215
|
-
return this;
|
|
26216
|
-
};
|
|
26217
|
-
|
|
26218
|
-
/**
|
|
26219
|
-
* Set timeout to `ms`.
|
|
26220
|
-
*
|
|
26221
|
-
* @param {Number} ms
|
|
26222
|
-
* @return {Request} for chaining
|
|
26223
|
-
* @api public
|
|
26224
|
-
*/
|
|
26225
|
-
|
|
26226
|
-
exports.timeout = function timeout(ms){
|
|
26227
|
-
this._timeout = ms;
|
|
26228
|
-
return this;
|
|
26229
|
-
};
|
|
26230
|
-
|
|
26231
|
-
/**
|
|
26232
|
-
* Promise support
|
|
26233
|
-
*
|
|
26234
|
-
* @param {Function} resolve
|
|
26026
|
+
* @param {Function} fulfill
|
|
26235
26027
|
* @param {Function} reject
|
|
26236
26028
|
* @return {Request}
|
|
26237
26029
|
*/
|
|
26238
26030
|
|
|
26239
|
-
|
|
26240
|
-
|
|
26241
|
-
|
|
26242
|
-
|
|
26243
|
-
self.end(function(err, res){
|
|
26244
|
-
if (err) innerReject(err); else innerResolve(res);
|
|
26245
|
-
});
|
|
26246
|
-
});
|
|
26247
|
-
}
|
|
26248
|
-
return this._fullfilledPromise.then(resolve, reject);
|
|
26249
|
-
}
|
|
26250
|
-
|
|
26251
|
-
/**
|
|
26252
|
-
* Allow for extension
|
|
26253
|
-
*/
|
|
26254
|
-
|
|
26255
|
-
exports.use = function use(fn) {
|
|
26256
|
-
fn(this);
|
|
26257
|
-
return this;
|
|
26258
|
-
}
|
|
26259
|
-
|
|
26260
|
-
|
|
26261
|
-
/**
|
|
26262
|
-
* Get request header `field`.
|
|
26263
|
-
* Case-insensitive.
|
|
26264
|
-
*
|
|
26265
|
-
* @param {String} field
|
|
26266
|
-
* @return {String}
|
|
26267
|
-
* @api public
|
|
26268
|
-
*/
|
|
26269
|
-
|
|
26270
|
-
exports.get = function(field){
|
|
26271
|
-
return this._header[field.toLowerCase()];
|
|
26272
|
-
};
|
|
26273
|
-
|
|
26274
|
-
/**
|
|
26275
|
-
* Get case-insensitive header `field` value.
|
|
26276
|
-
* This is a deprecated internal API. Use `.get(field)` instead.
|
|
26277
|
-
*
|
|
26278
|
-
* (getHeader is no longer used internally by the superagent code base)
|
|
26279
|
-
*
|
|
26280
|
-
* @param {String} field
|
|
26281
|
-
* @return {String}
|
|
26282
|
-
* @api private
|
|
26283
|
-
* @deprecated
|
|
26284
|
-
*/
|
|
26285
|
-
|
|
26286
|
-
exports.getHeader = exports.get;
|
|
26287
|
-
|
|
26288
|
-
/**
|
|
26289
|
-
* Set header `field` to `val`, or multiple fields with one object.
|
|
26290
|
-
* Case-insensitive.
|
|
26291
|
-
*
|
|
26292
|
-
* Examples:
|
|
26293
|
-
*
|
|
26294
|
-
* req.get('/')
|
|
26295
|
-
* .set('Accept', 'application/json')
|
|
26296
|
-
* .set('X-API-Key', 'foobar')
|
|
26297
|
-
* .end(callback);
|
|
26298
|
-
*
|
|
26299
|
-
* req.get('/')
|
|
26300
|
-
* .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
|
|
26301
|
-
* .end(callback);
|
|
26302
|
-
*
|
|
26303
|
-
* @param {String|Object} field
|
|
26304
|
-
* @param {String} val
|
|
26305
|
-
* @return {Request} for chaining
|
|
26306
|
-
* @api public
|
|
26307
|
-
*/
|
|
26308
|
-
|
|
26309
|
-
exports.set = function(field, val){
|
|
26310
|
-
if (isObject(field)) {
|
|
26311
|
-
for (var key in field) {
|
|
26312
|
-
this.set(key, field[key]);
|
|
26313
|
-
}
|
|
26314
|
-
return this;
|
|
26315
|
-
}
|
|
26316
|
-
this._header[field.toLowerCase()] = val;
|
|
26317
|
-
this.header[field] = val;
|
|
26318
|
-
return this;
|
|
26319
|
-
};
|
|
26320
|
-
|
|
26321
|
-
/**
|
|
26322
|
-
* Remove header `field`.
|
|
26323
|
-
* Case-insensitive.
|
|
26324
|
-
*
|
|
26325
|
-
* Example:
|
|
26326
|
-
*
|
|
26327
|
-
* req.get('/')
|
|
26328
|
-
* .unset('User-Agent')
|
|
26329
|
-
* .end(callback);
|
|
26330
|
-
*
|
|
26331
|
-
* @param {String} field
|
|
26332
|
-
*/
|
|
26333
|
-
exports.unset = function(field){
|
|
26334
|
-
delete this._header[field.toLowerCase()];
|
|
26335
|
-
delete this.header[field];
|
|
26336
|
-
return this;
|
|
26337
|
-
};
|
|
26338
|
-
|
|
26339
|
-
/**
|
|
26340
|
-
* Write the field `name` and `val` for "multipart/form-data"
|
|
26341
|
-
* request bodies.
|
|
26342
|
-
*
|
|
26343
|
-
* ``` js
|
|
26344
|
-
* request.post('/upload')
|
|
26345
|
-
* .field('foo', 'bar')
|
|
26346
|
-
* .end(callback);
|
|
26347
|
-
* ```
|
|
26348
|
-
*
|
|
26349
|
-
* @param {String} name
|
|
26350
|
-
* @param {String|Blob|File|Buffer|fs.ReadStream} val
|
|
26351
|
-
* @return {Request} for chaining
|
|
26352
|
-
* @api public
|
|
26353
|
-
*/
|
|
26354
|
-
exports.field = function(name, val) {
|
|
26355
|
-
this._getFormData().append(name, val);
|
|
26356
|
-
return this;
|
|
26357
|
-
};
|
|
26358
|
-
|
|
26359
|
-
/**
|
|
26360
|
-
* Abort the request, and clear potential timeout.
|
|
26361
|
-
*
|
|
26362
|
-
* @return {Request}
|
|
26363
|
-
* @api public
|
|
26364
|
-
*/
|
|
26365
|
-
exports.abort = function(){
|
|
26366
|
-
if (this._aborted) {
|
|
26367
|
-
return this;
|
|
26368
|
-
}
|
|
26369
|
-
this._aborted = true;
|
|
26370
|
-
this.xhr && this.xhr.abort(); // browser
|
|
26371
|
-
this.req && this.req.abort(); // node
|
|
26372
|
-
this.clearTimeout();
|
|
26373
|
-
this.emit('abort');
|
|
26374
|
-
return this;
|
|
26375
|
-
};
|
|
26376
|
-
|
|
26377
|
-
/**
|
|
26378
|
-
* Enable transmission of cookies with x-domain requests.
|
|
26379
|
-
*
|
|
26380
|
-
* Note that for this to work the origin must not be
|
|
26381
|
-
* using "Access-Control-Allow-Origin" with a wildcard,
|
|
26382
|
-
* and also must set "Access-Control-Allow-Credentials"
|
|
26383
|
-
* to "true".
|
|
26384
|
-
*
|
|
26385
|
-
* @api public
|
|
26386
|
-
*/
|
|
26387
|
-
|
|
26388
|
-
exports.withCredentials = function(){
|
|
26389
|
-
// This is browser-only functionality. Node side is no-op.
|
|
26390
|
-
this._withCredentials = true;
|
|
26391
|
-
return this;
|
|
26392
|
-
};
|
|
26393
|
-
|
|
26394
|
-
/**
|
|
26395
|
-
* Set the max redirects to `n`. Does noting in browser XHR implementation.
|
|
26396
|
-
*
|
|
26397
|
-
* @param {Number} n
|
|
26398
|
-
* @return {Request} for chaining
|
|
26399
|
-
* @api public
|
|
26400
|
-
*/
|
|
26401
|
-
|
|
26402
|
-
exports.redirects = function(n){
|
|
26403
|
-
this._maxRedirects = n;
|
|
26404
|
-
return this;
|
|
26405
|
-
};
|
|
26406
|
-
|
|
26407
|
-
/**
|
|
26408
|
-
* Convert to a plain javascript object (not JSON string) of scalar properties.
|
|
26409
|
-
* Note as this method is designed to return a useful non-this value,
|
|
26410
|
-
* it cannot be chained.
|
|
26411
|
-
*
|
|
26412
|
-
* @return {Object} describing method, url, and data of this request
|
|
26413
|
-
* @api public
|
|
26414
|
-
*/
|
|
26415
|
-
|
|
26416
|
-
exports.toJSON = function(){
|
|
26417
|
-
return {
|
|
26418
|
-
method: this.method,
|
|
26419
|
-
url: this.url,
|
|
26420
|
-
data: this._data
|
|
26421
|
-
};
|
|
26422
|
-
};
|
|
26423
|
-
|
|
26424
|
-
/**
|
|
26425
|
-
* Check if `obj` is a host object,
|
|
26426
|
-
* we don't want to serialize these :)
|
|
26427
|
-
*
|
|
26428
|
-
* TODO: future proof, move to compoent land
|
|
26429
|
-
*
|
|
26430
|
-
* @param {Object} obj
|
|
26431
|
-
* @return {Boolean}
|
|
26432
|
-
* @api private
|
|
26433
|
-
*/
|
|
26434
|
-
|
|
26435
|
-
exports._isHost = function _isHost(obj) {
|
|
26436
|
-
var str = {}.toString.call(obj);
|
|
26437
|
-
|
|
26438
|
-
switch (str) {
|
|
26439
|
-
case '[object File]':
|
|
26440
|
-
case '[object Blob]':
|
|
26441
|
-
case '[object FormData]':
|
|
26442
|
-
return true;
|
|
26443
|
-
default:
|
|
26444
|
-
return false;
|
|
26445
|
-
}
|
|
26031
|
+
Request.prototype.then = function (fulfill, reject) {
|
|
26032
|
+
return this.end(function(err, res) {
|
|
26033
|
+
err ? reject(err) : fulfill(res);
|
|
26034
|
+
});
|
|
26446
26035
|
}
|
|
26447
26036
|
|
|
26448
26037
|
/**
|
|
26449
|
-
*
|
|
26450
|
-
* an object is given.
|
|
26451
|
-
*
|
|
26452
|
-
* Examples:
|
|
26453
|
-
*
|
|
26454
|
-
* // manual json
|
|
26455
|
-
* request.post('/user')
|
|
26456
|
-
* .type('json')
|
|
26457
|
-
* .send('{"name":"tj"}')
|
|
26458
|
-
* .end(callback)
|
|
26459
|
-
*
|
|
26460
|
-
* // auto json
|
|
26461
|
-
* request.post('/user')
|
|
26462
|
-
* .send({ name: 'tj' })
|
|
26463
|
-
* .end(callback)
|
|
26464
|
-
*
|
|
26465
|
-
* // manual x-www-form-urlencoded
|
|
26466
|
-
* request.post('/user')
|
|
26467
|
-
* .type('form')
|
|
26468
|
-
* .send('name=tj')
|
|
26469
|
-
* .end(callback)
|
|
26470
|
-
*
|
|
26471
|
-
* // auto x-www-form-urlencoded
|
|
26472
|
-
* request.post('/user')
|
|
26473
|
-
* .type('form')
|
|
26474
|
-
* .send({ name: 'tj' })
|
|
26475
|
-
* .end(callback)
|
|
26476
|
-
*
|
|
26477
|
-
* // defaults to x-www-form-urlencoded
|
|
26478
|
-
* request.post('/user')
|
|
26479
|
-
* .send('name=tobi')
|
|
26480
|
-
* .send('species=ferret')
|
|
26481
|
-
* .end(callback)
|
|
26482
|
-
*
|
|
26483
|
-
* @param {String|Object} data
|
|
26484
|
-
* @return {Request} for chaining
|
|
26485
|
-
* @api public
|
|
26038
|
+
* Expose `Request`.
|
|
26486
26039
|
*/
|
|
26487
26040
|
|
|
26488
|
-
|
|
26489
|
-
var obj = isObject(data);
|
|
26490
|
-
var type = this._header['content-type'];
|
|
26491
|
-
|
|
26492
|
-
// merge
|
|
26493
|
-
if (obj && isObject(this._data)) {
|
|
26494
|
-
for (var key in data) {
|
|
26495
|
-
this._data[key] = data[key];
|
|
26496
|
-
}
|
|
26497
|
-
} else if ('string' == typeof data) {
|
|
26498
|
-
// default to x-www-form-urlencoded
|
|
26499
|
-
if (!type) this.type('form');
|
|
26500
|
-
type = this._header['content-type'];
|
|
26501
|
-
if ('application/x-www-form-urlencoded' == type) {
|
|
26502
|
-
this._data = this._data
|
|
26503
|
-
? this._data + '&' + data
|
|
26504
|
-
: data;
|
|
26505
|
-
} else {
|
|
26506
|
-
this._data = (this._data || '') + data;
|
|
26507
|
-
}
|
|
26508
|
-
} else {
|
|
26509
|
-
this._data = data;
|
|
26510
|
-
}
|
|
26511
|
-
|
|
26512
|
-
if (!obj || this._isHost(data)) return this;
|
|
26513
|
-
|
|
26514
|
-
// default to json
|
|
26515
|
-
if (!type) this.type('json');
|
|
26516
|
-
return this;
|
|
26517
|
-
};
|
|
26041
|
+
request.Request = Request;
|
|
26518
26042
|
|
|
26519
|
-
},{"./is-object":89}],91:[function(require,module,exports){
|
|
26520
|
-
// The node and browser modules expose versions of this with the
|
|
26521
|
-
// appropriate constructor function bound as first argument
|
|
26522
26043
|
/**
|
|
26523
26044
|
* Issue a request:
|
|
26524
26045
|
*
|
|
@@ -26534,23 +26055,300 @@ exports.send = function(data){
|
|
|
26534
26055
|
* @api public
|
|
26535
26056
|
*/
|
|
26536
26057
|
|
|
26537
|
-
function request(
|
|
26058
|
+
function request(method, url) {
|
|
26538
26059
|
// callback
|
|
26539
26060
|
if ('function' == typeof url) {
|
|
26540
|
-
return new
|
|
26061
|
+
return new Request('GET', method).end(url);
|
|
26541
26062
|
}
|
|
26542
26063
|
|
|
26543
26064
|
// url first
|
|
26544
|
-
if (
|
|
26545
|
-
return new
|
|
26065
|
+
if (1 == arguments.length) {
|
|
26066
|
+
return new Request('GET', method);
|
|
26546
26067
|
}
|
|
26547
26068
|
|
|
26548
|
-
return new
|
|
26069
|
+
return new Request(method, url);
|
|
26549
26070
|
}
|
|
26550
26071
|
|
|
26072
|
+
/**
|
|
26073
|
+
* GET `url` with optional callback `fn(res)`.
|
|
26074
|
+
*
|
|
26075
|
+
* @param {String} url
|
|
26076
|
+
* @param {Mixed|Function} data or fn
|
|
26077
|
+
* @param {Function} fn
|
|
26078
|
+
* @return {Request}
|
|
26079
|
+
* @api public
|
|
26080
|
+
*/
|
|
26081
|
+
|
|
26082
|
+
request.get = function(url, data, fn){
|
|
26083
|
+
var req = request('GET', url);
|
|
26084
|
+
if ('function' == typeof data) fn = data, data = null;
|
|
26085
|
+
if (data) req.query(data);
|
|
26086
|
+
if (fn) req.end(fn);
|
|
26087
|
+
return req;
|
|
26088
|
+
};
|
|
26089
|
+
|
|
26090
|
+
/**
|
|
26091
|
+
* HEAD `url` with optional callback `fn(res)`.
|
|
26092
|
+
*
|
|
26093
|
+
* @param {String} url
|
|
26094
|
+
* @param {Mixed|Function} data or fn
|
|
26095
|
+
* @param {Function} fn
|
|
26096
|
+
* @return {Request}
|
|
26097
|
+
* @api public
|
|
26098
|
+
*/
|
|
26099
|
+
|
|
26100
|
+
request.head = function(url, data, fn){
|
|
26101
|
+
var req = request('HEAD', url);
|
|
26102
|
+
if ('function' == typeof data) fn = data, data = null;
|
|
26103
|
+
if (data) req.send(data);
|
|
26104
|
+
if (fn) req.end(fn);
|
|
26105
|
+
return req;
|
|
26106
|
+
};
|
|
26107
|
+
|
|
26108
|
+
/**
|
|
26109
|
+
* DELETE `url` with optional callback `fn(res)`.
|
|
26110
|
+
*
|
|
26111
|
+
* @param {String} url
|
|
26112
|
+
* @param {Function} fn
|
|
26113
|
+
* @return {Request}
|
|
26114
|
+
* @api public
|
|
26115
|
+
*/
|
|
26116
|
+
|
|
26117
|
+
function del(url, fn){
|
|
26118
|
+
var req = request('DELETE', url);
|
|
26119
|
+
if (fn) req.end(fn);
|
|
26120
|
+
return req;
|
|
26121
|
+
};
|
|
26122
|
+
|
|
26123
|
+
request['del'] = del;
|
|
26124
|
+
request['delete'] = del;
|
|
26125
|
+
|
|
26126
|
+
/**
|
|
26127
|
+
* PATCH `url` with optional `data` and callback `fn(res)`.
|
|
26128
|
+
*
|
|
26129
|
+
* @param {String} url
|
|
26130
|
+
* @param {Mixed} data
|
|
26131
|
+
* @param {Function} fn
|
|
26132
|
+
* @return {Request}
|
|
26133
|
+
* @api public
|
|
26134
|
+
*/
|
|
26135
|
+
|
|
26136
|
+
request.patch = function(url, data, fn){
|
|
26137
|
+
var req = request('PATCH', url);
|
|
26138
|
+
if ('function' == typeof data) fn = data, data = null;
|
|
26139
|
+
if (data) req.send(data);
|
|
26140
|
+
if (fn) req.end(fn);
|
|
26141
|
+
return req;
|
|
26142
|
+
};
|
|
26143
|
+
|
|
26144
|
+
/**
|
|
26145
|
+
* POST `url` with optional `data` and callback `fn(res)`.
|
|
26146
|
+
*
|
|
26147
|
+
* @param {String} url
|
|
26148
|
+
* @param {Mixed} data
|
|
26149
|
+
* @param {Function} fn
|
|
26150
|
+
* @return {Request}
|
|
26151
|
+
* @api public
|
|
26152
|
+
*/
|
|
26153
|
+
|
|
26154
|
+
request.post = function(url, data, fn){
|
|
26155
|
+
var req = request('POST', url);
|
|
26156
|
+
if ('function' == typeof data) fn = data, data = null;
|
|
26157
|
+
if (data) req.send(data);
|
|
26158
|
+
if (fn) req.end(fn);
|
|
26159
|
+
return req;
|
|
26160
|
+
};
|
|
26161
|
+
|
|
26162
|
+
/**
|
|
26163
|
+
* PUT `url` with optional `data` and callback `fn(res)`.
|
|
26164
|
+
*
|
|
26165
|
+
* @param {String} url
|
|
26166
|
+
* @param {Mixed|Function} data or fn
|
|
26167
|
+
* @param {Function} fn
|
|
26168
|
+
* @return {Request}
|
|
26169
|
+
* @api public
|
|
26170
|
+
*/
|
|
26171
|
+
|
|
26172
|
+
request.put = function(url, data, fn){
|
|
26173
|
+
var req = request('PUT', url);
|
|
26174
|
+
if ('function' == typeof data) fn = data, data = null;
|
|
26175
|
+
if (data) req.send(data);
|
|
26176
|
+
if (fn) req.end(fn);
|
|
26177
|
+
return req;
|
|
26178
|
+
};
|
|
26179
|
+
|
|
26180
|
+
/**
|
|
26181
|
+
* Expose `request`.
|
|
26182
|
+
*/
|
|
26183
|
+
|
|
26551
26184
|
module.exports = request;
|
|
26552
26185
|
|
|
26553
|
-
},{}],
|
|
26186
|
+
},{"emitter":86,"reduce":62}],86:[function(require,module,exports){
|
|
26187
|
+
|
|
26188
|
+
/**
|
|
26189
|
+
* Expose `Emitter`.
|
|
26190
|
+
*/
|
|
26191
|
+
|
|
26192
|
+
if (typeof module !== 'undefined') {
|
|
26193
|
+
module.exports = Emitter;
|
|
26194
|
+
}
|
|
26195
|
+
|
|
26196
|
+
/**
|
|
26197
|
+
* Initialize a new `Emitter`.
|
|
26198
|
+
*
|
|
26199
|
+
* @api public
|
|
26200
|
+
*/
|
|
26201
|
+
|
|
26202
|
+
function Emitter(obj) {
|
|
26203
|
+
if (obj) return mixin(obj);
|
|
26204
|
+
};
|
|
26205
|
+
|
|
26206
|
+
/**
|
|
26207
|
+
* Mixin the emitter properties.
|
|
26208
|
+
*
|
|
26209
|
+
* @param {Object} obj
|
|
26210
|
+
* @return {Object}
|
|
26211
|
+
* @api private
|
|
26212
|
+
*/
|
|
26213
|
+
|
|
26214
|
+
function mixin(obj) {
|
|
26215
|
+
for (var key in Emitter.prototype) {
|
|
26216
|
+
obj[key] = Emitter.prototype[key];
|
|
26217
|
+
}
|
|
26218
|
+
return obj;
|
|
26219
|
+
}
|
|
26220
|
+
|
|
26221
|
+
/**
|
|
26222
|
+
* Listen on the given `event` with `fn`.
|
|
26223
|
+
*
|
|
26224
|
+
* @param {String} event
|
|
26225
|
+
* @param {Function} fn
|
|
26226
|
+
* @return {Emitter}
|
|
26227
|
+
* @api public
|
|
26228
|
+
*/
|
|
26229
|
+
|
|
26230
|
+
Emitter.prototype.on =
|
|
26231
|
+
Emitter.prototype.addEventListener = function(event, fn){
|
|
26232
|
+
this._callbacks = this._callbacks || {};
|
|
26233
|
+
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
|
|
26234
|
+
.push(fn);
|
|
26235
|
+
return this;
|
|
26236
|
+
};
|
|
26237
|
+
|
|
26238
|
+
/**
|
|
26239
|
+
* Adds an `event` listener that will be invoked a single
|
|
26240
|
+
* time then automatically removed.
|
|
26241
|
+
*
|
|
26242
|
+
* @param {String} event
|
|
26243
|
+
* @param {Function} fn
|
|
26244
|
+
* @return {Emitter}
|
|
26245
|
+
* @api public
|
|
26246
|
+
*/
|
|
26247
|
+
|
|
26248
|
+
Emitter.prototype.once = function(event, fn){
|
|
26249
|
+
function on() {
|
|
26250
|
+
this.off(event, on);
|
|
26251
|
+
fn.apply(this, arguments);
|
|
26252
|
+
}
|
|
26253
|
+
|
|
26254
|
+
on.fn = fn;
|
|
26255
|
+
this.on(event, on);
|
|
26256
|
+
return this;
|
|
26257
|
+
};
|
|
26258
|
+
|
|
26259
|
+
/**
|
|
26260
|
+
* Remove the given callback for `event` or all
|
|
26261
|
+
* registered callbacks.
|
|
26262
|
+
*
|
|
26263
|
+
* @param {String} event
|
|
26264
|
+
* @param {Function} fn
|
|
26265
|
+
* @return {Emitter}
|
|
26266
|
+
* @api public
|
|
26267
|
+
*/
|
|
26268
|
+
|
|
26269
|
+
Emitter.prototype.off =
|
|
26270
|
+
Emitter.prototype.removeListener =
|
|
26271
|
+
Emitter.prototype.removeAllListeners =
|
|
26272
|
+
Emitter.prototype.removeEventListener = function(event, fn){
|
|
26273
|
+
this._callbacks = this._callbacks || {};
|
|
26274
|
+
|
|
26275
|
+
// all
|
|
26276
|
+
if (0 == arguments.length) {
|
|
26277
|
+
this._callbacks = {};
|
|
26278
|
+
return this;
|
|
26279
|
+
}
|
|
26280
|
+
|
|
26281
|
+
// specific event
|
|
26282
|
+
var callbacks = this._callbacks['$' + event];
|
|
26283
|
+
if (!callbacks) return this;
|
|
26284
|
+
|
|
26285
|
+
// remove all handlers
|
|
26286
|
+
if (1 == arguments.length) {
|
|
26287
|
+
delete this._callbacks['$' + event];
|
|
26288
|
+
return this;
|
|
26289
|
+
}
|
|
26290
|
+
|
|
26291
|
+
// remove specific handler
|
|
26292
|
+
var cb;
|
|
26293
|
+
for (var i = 0; i < callbacks.length; i++) {
|
|
26294
|
+
cb = callbacks[i];
|
|
26295
|
+
if (cb === fn || cb.fn === fn) {
|
|
26296
|
+
callbacks.splice(i, 1);
|
|
26297
|
+
break;
|
|
26298
|
+
}
|
|
26299
|
+
}
|
|
26300
|
+
return this;
|
|
26301
|
+
};
|
|
26302
|
+
|
|
26303
|
+
/**
|
|
26304
|
+
* Emit `event` with the given args.
|
|
26305
|
+
*
|
|
26306
|
+
* @param {String} event
|
|
26307
|
+
* @param {Mixed} ...
|
|
26308
|
+
* @return {Emitter}
|
|
26309
|
+
*/
|
|
26310
|
+
|
|
26311
|
+
Emitter.prototype.emit = function(event){
|
|
26312
|
+
this._callbacks = this._callbacks || {};
|
|
26313
|
+
var args = [].slice.call(arguments, 1)
|
|
26314
|
+
, callbacks = this._callbacks['$' + event];
|
|
26315
|
+
|
|
26316
|
+
if (callbacks) {
|
|
26317
|
+
callbacks = callbacks.slice(0);
|
|
26318
|
+
for (var i = 0, len = callbacks.length; i < len; ++i) {
|
|
26319
|
+
callbacks[i].apply(this, args);
|
|
26320
|
+
}
|
|
26321
|
+
}
|
|
26322
|
+
|
|
26323
|
+
return this;
|
|
26324
|
+
};
|
|
26325
|
+
|
|
26326
|
+
/**
|
|
26327
|
+
* Return array of callbacks for `event`.
|
|
26328
|
+
*
|
|
26329
|
+
* @param {String} event
|
|
26330
|
+
* @return {Array}
|
|
26331
|
+
* @api public
|
|
26332
|
+
*/
|
|
26333
|
+
|
|
26334
|
+
Emitter.prototype.listeners = function(event){
|
|
26335
|
+
this._callbacks = this._callbacks || {};
|
|
26336
|
+
return this._callbacks['$' + event] || [];
|
|
26337
|
+
};
|
|
26338
|
+
|
|
26339
|
+
/**
|
|
26340
|
+
* Check if this emitter has `event` handlers.
|
|
26341
|
+
*
|
|
26342
|
+
* @param {String} event
|
|
26343
|
+
* @return {Boolean}
|
|
26344
|
+
* @api public
|
|
26345
|
+
*/
|
|
26346
|
+
|
|
26347
|
+
Emitter.prototype.hasListeners = function(event){
|
|
26348
|
+
return !! this.listeners(event).length;
|
|
26349
|
+
};
|
|
26350
|
+
|
|
26351
|
+
},{}],87:[function(require,module,exports){
|
|
26554
26352
|
(function (Buffer){
|
|
26555
26353
|
"0.50.0";
|
|
26556
26354
|
/*
|
|
@@ -34747,7 +34545,7 @@ TinCan client library
|
|
|
34747
34545
|
}());
|
|
34748
34546
|
|
|
34749
34547
|
}).call(this,require("buffer").Buffer)
|
|
34750
|
-
},{"buffer":39,"querystring":61,"xhr2":
|
|
34548
|
+
},{"buffer":39,"querystring":61,"xhr2":91}],88:[function(require,module,exports){
|
|
34751
34549
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
34752
34550
|
//
|
|
34753
34551
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
@@ -35456,7 +35254,7 @@ function isNullOrUndefined(arg) {
|
|
|
35456
35254
|
return arg == null;
|
|
35457
35255
|
}
|
|
35458
35256
|
|
|
35459
|
-
},{"punycode":57,"querystring":61}],
|
|
35257
|
+
},{"punycode":57,"querystring":61}],89:[function(require,module,exports){
|
|
35460
35258
|
(function (global){
|
|
35461
35259
|
|
|
35462
35260
|
/**
|
|
@@ -35527,7 +35325,7 @@ function config (name) {
|
|
|
35527
35325
|
}
|
|
35528
35326
|
|
|
35529
35327
|
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
35530
|
-
},{}],
|
|
35328
|
+
},{}],90:[function(require,module,exports){
|
|
35531
35329
|
/*!
|
|
35532
35330
|
* validate.js 0.9.0
|
|
35533
35331
|
*
|
|
@@ -36615,7 +36413,7 @@ function config (name) {
|
|
|
36615
36413
|
typeof module !== 'undefined' ? /* istanbul ignore next */ module : null,
|
|
36616
36414
|
typeof define !== 'undefined' ? /* istanbul ignore next */ define : null);
|
|
36617
36415
|
|
|
36618
|
-
},{}],
|
|
36416
|
+
},{}],91:[function(require,module,exports){
|
|
36619
36417
|
(function (process,Buffer){
|
|
36620
36418
|
// Generated by CoffeeScript 1.6.3
|
|
36621
36419
|
(function() {
|
|
@@ -37453,7 +37251,7 @@ function config (name) {
|
|
|
37453
37251
|
}).call(this);
|
|
37454
37252
|
|
|
37455
37253
|
}).call(this,require('_process'),require("buffer").Buffer)
|
|
37456
|
-
},{"_process":55,"buffer":39,"http":
|
|
37254
|
+
},{"_process":55,"buffer":39,"http":80,"https":46,"os":53,"url":88}],92:[function(require,module,exports){
|
|
37457
37255
|
module.exports = extend
|
|
37458
37256
|
|
|
37459
37257
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|