bfdotcom-theme 0.1.2 → 0.2.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.
- checksums.yaml +4 -4
- data/_includes/comments.html +35 -0
- data/_includes/head.html +22 -0
- data/_layouts/default.html +1 -0
- data/_layouts/post.html +4 -0
- data/assets/auth/signin.html +10 -0
- data/assets/scripts/CryptoJS/components/enc-base64.js +109 -0
- data/assets/scripts/CryptoJS/components/hmac.js +131 -0
- data/assets/scripts/CryptoJS/rollups/hmac-sha256.js +18 -0
- data/assets/scripts/CryptoJS/rollups/sha256.js +16 -0
- data/assets/scripts/apiGatewayCore/apiGatewayClient.js +53 -0
- data/assets/scripts/apiGatewayCore/sigV4Client.js +219 -0
- data/assets/scripts/apiGatewayCore/simpleHttpClient.js +81 -0
- data/assets/scripts/apiGatewayCore/utils.js +80 -0
- data/assets/scripts/axios/dist/axios.standalone.js +1089 -0
- data/assets/scripts/core.js +93 -0
- data/assets/scripts/signin.js +16 -0
- data/assets/scripts/url-template/url-template.js +438 -0
- metadata +16 -2
@@ -0,0 +1,219 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
5
|
+
* You may not use this file except in compliance with the License.
|
6
|
+
* A copy of the License is located at
|
7
|
+
*
|
8
|
+
* http://aws.amazon.com/apache2.0
|
9
|
+
*
|
10
|
+
* or in the "license" file accompanying this file. This file is distributed
|
11
|
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
12
|
+
* express or implied. See the License for the specific language governing
|
13
|
+
* permissions and limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var apiGateway = apiGateway || {};
|
17
|
+
apiGateway.core = apiGateway.core || {};
|
18
|
+
|
19
|
+
apiGateway.core.sigV4ClientFactory = {};
|
20
|
+
apiGateway.core.sigV4ClientFactory.newClient = function (config) {
|
21
|
+
var AWS_SHA_256 = 'AWS4-HMAC-SHA256';
|
22
|
+
var AWS4_REQUEST = 'aws4_request';
|
23
|
+
var AWS4 = 'AWS4';
|
24
|
+
var X_AMZ_DATE = 'x-amz-date';
|
25
|
+
var X_AMZ_SECURITY_TOKEN = 'x-amz-security-token';
|
26
|
+
var HOST = 'host';
|
27
|
+
var AUTHORIZATION = 'Authorization';
|
28
|
+
|
29
|
+
function hash(value) {
|
30
|
+
return CryptoJS.SHA256(value);
|
31
|
+
}
|
32
|
+
|
33
|
+
function hexEncode(value) {
|
34
|
+
return value.toString(CryptoJS.enc.Hex);
|
35
|
+
}
|
36
|
+
|
37
|
+
function hmac(secret, value) {
|
38
|
+
return CryptoJS.HmacSHA256(value, secret, {asBytes: true});
|
39
|
+
}
|
40
|
+
|
41
|
+
function buildCanonicalRequest(method, path, queryParams, headers, payload) {
|
42
|
+
return method + '\n' +
|
43
|
+
buildCanonicalUri(path) + '\n' +
|
44
|
+
buildCanonicalQueryString(queryParams) + '\n' +
|
45
|
+
buildCanonicalHeaders(headers) + '\n' +
|
46
|
+
buildCanonicalSignedHeaders(headers) + '\n' +
|
47
|
+
hexEncode(hash(payload));
|
48
|
+
}
|
49
|
+
|
50
|
+
function hashCanonicalRequest(request) {
|
51
|
+
return hexEncode(hash(request));
|
52
|
+
}
|
53
|
+
|
54
|
+
function buildCanonicalUri(uri) {
|
55
|
+
return encodeURI(uri);
|
56
|
+
}
|
57
|
+
|
58
|
+
function buildCanonicalQueryString(queryParams) {
|
59
|
+
if (Object.keys(queryParams).length < 1) {
|
60
|
+
return '';
|
61
|
+
}
|
62
|
+
|
63
|
+
var sortedQueryParams = [];
|
64
|
+
for (var property in queryParams) {
|
65
|
+
if (queryParams.hasOwnProperty(property)) {
|
66
|
+
sortedQueryParams.push(property);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
sortedQueryParams.sort();
|
70
|
+
|
71
|
+
var canonicalQueryString = '';
|
72
|
+
for (var i = 0; i < sortedQueryParams.length; i++) {
|
73
|
+
canonicalQueryString += sortedQueryParams[i] + '=' + fixedEncodeURIComponent(queryParams[sortedQueryParams[i]]) + '&';
|
74
|
+
}
|
75
|
+
return canonicalQueryString.substr(0, canonicalQueryString.length - 1);
|
76
|
+
}
|
77
|
+
|
78
|
+
function fixedEncodeURIComponent (str) {
|
79
|
+
return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
|
80
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
function buildCanonicalHeaders(headers) {
|
85
|
+
var canonicalHeaders = '';
|
86
|
+
var sortedKeys = [];
|
87
|
+
for (var property in headers) {
|
88
|
+
if (headers.hasOwnProperty(property)) {
|
89
|
+
sortedKeys.push(property);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
sortedKeys.sort();
|
93
|
+
|
94
|
+
for (var i = 0; i < sortedKeys.length; i++) {
|
95
|
+
canonicalHeaders += sortedKeys[i].toLowerCase() + ':' + headers[sortedKeys[i]] + '\n';
|
96
|
+
}
|
97
|
+
return canonicalHeaders;
|
98
|
+
}
|
99
|
+
|
100
|
+
function buildCanonicalSignedHeaders(headers) {
|
101
|
+
var sortedKeys = [];
|
102
|
+
for (var property in headers) {
|
103
|
+
if (headers.hasOwnProperty(property)) {
|
104
|
+
sortedKeys.push(property.toLowerCase());
|
105
|
+
}
|
106
|
+
}
|
107
|
+
sortedKeys.sort();
|
108
|
+
|
109
|
+
return sortedKeys.join(';');
|
110
|
+
}
|
111
|
+
|
112
|
+
function buildStringToSign(datetime, credentialScope, hashedCanonicalRequest) {
|
113
|
+
return AWS_SHA_256 + '\n' +
|
114
|
+
datetime + '\n' +
|
115
|
+
credentialScope + '\n' +
|
116
|
+
hashedCanonicalRequest;
|
117
|
+
}
|
118
|
+
|
119
|
+
function buildCredentialScope(datetime, region, service) {
|
120
|
+
return datetime.substr(0, 8) + '/' + region + '/' + service + '/' + AWS4_REQUEST
|
121
|
+
}
|
122
|
+
|
123
|
+
function calculateSigningKey(secretKey, datetime, region, service) {
|
124
|
+
return hmac(hmac(hmac(hmac(AWS4 + secretKey, datetime.substr(0, 8)), region), service), AWS4_REQUEST);
|
125
|
+
}
|
126
|
+
|
127
|
+
function calculateSignature(key, stringToSign) {
|
128
|
+
return hexEncode(hmac(key, stringToSign));
|
129
|
+
}
|
130
|
+
|
131
|
+
function buildAuthorizationHeader(accessKey, credentialScope, headers, signature) {
|
132
|
+
return AWS_SHA_256 + ' Credential=' + accessKey + '/' + credentialScope + ', SignedHeaders=' + buildCanonicalSignedHeaders(headers) + ', Signature=' + signature;
|
133
|
+
}
|
134
|
+
|
135
|
+
var awsSigV4Client = { };
|
136
|
+
if(config.accessKey === undefined || config.secretKey === undefined) {
|
137
|
+
return awsSigV4Client;
|
138
|
+
}
|
139
|
+
awsSigV4Client.accessKey = apiGateway.core.utils.assertDefined(config.accessKey, 'accessKey');
|
140
|
+
awsSigV4Client.secretKey = apiGateway.core.utils.assertDefined(config.secretKey, 'secretKey');
|
141
|
+
awsSigV4Client.sessionToken = config.sessionToken;
|
142
|
+
awsSigV4Client.serviceName = apiGateway.core.utils.assertDefined(config.serviceName, 'serviceName');
|
143
|
+
awsSigV4Client.region = apiGateway.core.utils.assertDefined(config.region, 'region');
|
144
|
+
awsSigV4Client.endpoint = apiGateway.core.utils.assertDefined(config.endpoint, 'endpoint');
|
145
|
+
|
146
|
+
awsSigV4Client.makeRequest = function (request) {
|
147
|
+
var verb = apiGateway.core.utils.assertDefined(request.verb, 'verb');
|
148
|
+
var path = apiGateway.core.utils.assertDefined(request.path, 'path');
|
149
|
+
var queryParams = apiGateway.core.utils.copy(request.queryParams);
|
150
|
+
if (queryParams === undefined) {
|
151
|
+
queryParams = {};
|
152
|
+
}
|
153
|
+
var headers = apiGateway.core.utils.copy(request.headers);
|
154
|
+
if (headers === undefined) {
|
155
|
+
headers = {};
|
156
|
+
}
|
157
|
+
|
158
|
+
//If the user has not specified an override for Content type the use default
|
159
|
+
if(headers['Content-Type'] === undefined) {
|
160
|
+
headers['Content-Type'] = config.defaultContentType;
|
161
|
+
}
|
162
|
+
|
163
|
+
//If the user has not specified an override for Accept type the use default
|
164
|
+
if(headers['Accept'] === undefined) {
|
165
|
+
headers['Accept'] = config.defaultAcceptType;
|
166
|
+
}
|
167
|
+
|
168
|
+
var body = apiGateway.core.utils.copy(request.body);
|
169
|
+
if (body === undefined || verb === 'GET') { // override request body and set to empty when signing GET requests
|
170
|
+
body = '';
|
171
|
+
} else {
|
172
|
+
body = JSON.stringify(body);
|
173
|
+
}
|
174
|
+
|
175
|
+
//If there is no body remove the content-type header so it is not included in SigV4 calculation
|
176
|
+
if(body === '' || body === undefined || body === null) {
|
177
|
+
delete headers['Content-Type'];
|
178
|
+
}
|
179
|
+
|
180
|
+
var datetime = new Date().toISOString().replace(/\.\d{3}Z$/, 'Z').replace(/[:\-]|\.\d{3}/g, '');
|
181
|
+
headers[X_AMZ_DATE] = datetime;
|
182
|
+
var parser = document.createElement('a');
|
183
|
+
parser.href = awsSigV4Client.endpoint;
|
184
|
+
headers[HOST] = parser.hostname;
|
185
|
+
|
186
|
+
var canonicalRequest = buildCanonicalRequest(verb, path, queryParams, headers, body);
|
187
|
+
var hashedCanonicalRequest = hashCanonicalRequest(canonicalRequest);
|
188
|
+
var credentialScope = buildCredentialScope(datetime, awsSigV4Client.region, awsSigV4Client.serviceName);
|
189
|
+
var stringToSign = buildStringToSign(datetime, credentialScope, hashedCanonicalRequest);
|
190
|
+
var signingKey = calculateSigningKey(awsSigV4Client.secretKey, datetime, awsSigV4Client.region, awsSigV4Client.serviceName);
|
191
|
+
var signature = calculateSignature(signingKey, stringToSign);
|
192
|
+
headers[AUTHORIZATION] = buildAuthorizationHeader(awsSigV4Client.accessKey, credentialScope, headers, signature);
|
193
|
+
if(awsSigV4Client.sessionToken !== undefined && awsSigV4Client.sessionToken !== '') {
|
194
|
+
headers[X_AMZ_SECURITY_TOKEN] = awsSigV4Client.sessionToken;
|
195
|
+
}
|
196
|
+
delete headers[HOST];
|
197
|
+
|
198
|
+
var url = config.endpoint + path;
|
199
|
+
var queryString = buildCanonicalQueryString(queryParams);
|
200
|
+
if (queryString != '') {
|
201
|
+
url += '?' + queryString;
|
202
|
+
}
|
203
|
+
|
204
|
+
//Need to re-attach Content-Type if it is not specified at this point
|
205
|
+
if(headers['Content-Type'] === undefined) {
|
206
|
+
headers['Content-Type'] = config.defaultContentType;
|
207
|
+
}
|
208
|
+
|
209
|
+
var signedRequest = {
|
210
|
+
method: verb,
|
211
|
+
url: url,
|
212
|
+
headers: headers,
|
213
|
+
data: body
|
214
|
+
};
|
215
|
+
return axios(signedRequest);
|
216
|
+
};
|
217
|
+
|
218
|
+
return awsSigV4Client;
|
219
|
+
};
|
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
5
|
+
* You may not use this file except in compliance with the License.
|
6
|
+
* A copy of the License is located at
|
7
|
+
*
|
8
|
+
* http://aws.amazon.com/apache2.0
|
9
|
+
*
|
10
|
+
* or in the "license" file accompanying this file. This file is distributed
|
11
|
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
12
|
+
* express or implied. See the License for the specific language governing
|
13
|
+
* permissions and limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var apiGateway = apiGateway || {};
|
17
|
+
apiGateway.core = apiGateway.core || {};
|
18
|
+
|
19
|
+
apiGateway.core.simpleHttpClientFactory = {};
|
20
|
+
apiGateway.core.simpleHttpClientFactory.newClient = function (config) {
|
21
|
+
function buildCanonicalQueryString(queryParams) {
|
22
|
+
//Build a properly encoded query string from a QueryParam object
|
23
|
+
if (Object.keys(queryParams).length < 1) {
|
24
|
+
return '';
|
25
|
+
}
|
26
|
+
|
27
|
+
var canonicalQueryString = '';
|
28
|
+
for (var property in queryParams) {
|
29
|
+
if (queryParams.hasOwnProperty(property)) {
|
30
|
+
canonicalQueryString += encodeURIComponent(property) + '=' + encodeURIComponent(queryParams[property]) + '&';
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
return canonicalQueryString.substr(0, canonicalQueryString.length - 1);
|
35
|
+
}
|
36
|
+
|
37
|
+
var simpleHttpClient = { };
|
38
|
+
simpleHttpClient.endpoint = apiGateway.core.utils.assertDefined(config.endpoint, 'endpoint');
|
39
|
+
|
40
|
+
simpleHttpClient.makeRequest = function (request) {
|
41
|
+
var verb = apiGateway.core.utils.assertDefined(request.verb, 'verb');
|
42
|
+
var path = apiGateway.core.utils.assertDefined(request.path, 'path');
|
43
|
+
var queryParams = apiGateway.core.utils.copy(request.queryParams);
|
44
|
+
if (queryParams === undefined) {
|
45
|
+
queryParams = {};
|
46
|
+
}
|
47
|
+
var headers = apiGateway.core.utils.copy(request.headers);
|
48
|
+
if (headers === undefined) {
|
49
|
+
headers = {};
|
50
|
+
}
|
51
|
+
|
52
|
+
//If the user has not specified an override for Content type the use default
|
53
|
+
if(headers['Content-Type'] === undefined) {
|
54
|
+
headers['Content-Type'] = config.defaultContentType;
|
55
|
+
}
|
56
|
+
|
57
|
+
//If the user has not specified an override for Accept type the use default
|
58
|
+
if(headers['Accept'] === undefined) {
|
59
|
+
headers['Accept'] = config.defaultAcceptType;
|
60
|
+
}
|
61
|
+
|
62
|
+
var body = apiGateway.core.utils.copy(request.body);
|
63
|
+
if (body === undefined) {
|
64
|
+
body = '';
|
65
|
+
}
|
66
|
+
|
67
|
+
var url = config.endpoint + path;
|
68
|
+
var queryString = buildCanonicalQueryString(queryParams);
|
69
|
+
if (queryString != '') {
|
70
|
+
url += '?' + queryString;
|
71
|
+
}
|
72
|
+
var simpleHttpRequest = {
|
73
|
+
method: verb,
|
74
|
+
url: url,
|
75
|
+
headers: headers,
|
76
|
+
data: body
|
77
|
+
};
|
78
|
+
return axios(simpleHttpRequest);
|
79
|
+
};
|
80
|
+
return simpleHttpClient;
|
81
|
+
};
|
@@ -0,0 +1,80 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License").
|
5
|
+
* You may not use this file except in compliance with the License.
|
6
|
+
* A copy of the License is located at
|
7
|
+
*
|
8
|
+
* http://aws.amazon.com/apache2.0
|
9
|
+
*
|
10
|
+
* or in the "license" file accompanying this file. This file is distributed
|
11
|
+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
12
|
+
* express or implied. See the License for the specific language governing
|
13
|
+
* permissions and limitations under the License.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var apiGateway = apiGateway || {};
|
17
|
+
apiGateway.core = apiGateway.core || {};
|
18
|
+
|
19
|
+
apiGateway.core.utils = {
|
20
|
+
assertDefined: function (object, name) {
|
21
|
+
if (object === undefined) {
|
22
|
+
throw name + ' must be defined';
|
23
|
+
} else {
|
24
|
+
return object;
|
25
|
+
}
|
26
|
+
},
|
27
|
+
assertParametersDefined: function (params, keys, ignore) {
|
28
|
+
if (keys === undefined) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
if (keys.length > 0 && params === undefined) {
|
32
|
+
params = {};
|
33
|
+
}
|
34
|
+
for (var i = 0; i < keys.length; i++) {
|
35
|
+
if(!apiGateway.core.utils.contains(ignore, keys[i])) {
|
36
|
+
apiGateway.core.utils.assertDefined(params[keys[i]], keys[i]);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
},
|
40
|
+
parseParametersToObject: function (params, keys) {
|
41
|
+
if (params === undefined) {
|
42
|
+
return {};
|
43
|
+
}
|
44
|
+
var object = { };
|
45
|
+
for (var i = 0; i < keys.length; i++) {
|
46
|
+
object[keys[i]] = params[keys[i]];
|
47
|
+
}
|
48
|
+
return object;
|
49
|
+
},
|
50
|
+
contains: function(a, obj) {
|
51
|
+
if(a === undefined) { return false;}
|
52
|
+
var i = a.length;
|
53
|
+
while (i--) {
|
54
|
+
if (a[i] === obj) {
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
return false;
|
59
|
+
},
|
60
|
+
copy: function (obj) {
|
61
|
+
if (null == obj || "object" != typeof obj) return obj;
|
62
|
+
var copy = obj.constructor();
|
63
|
+
for (var attr in obj) {
|
64
|
+
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
|
65
|
+
}
|
66
|
+
return copy;
|
67
|
+
},
|
68
|
+
mergeInto: function (baseObj, additionalProps) {
|
69
|
+
if (null == baseObj || "object" != typeof baseObj) return baseObj;
|
70
|
+
var merged = baseObj.constructor();
|
71
|
+
for (var attr in baseObj) {
|
72
|
+
if (baseObj.hasOwnProperty(attr)) merged[attr] = baseObj[attr];
|
73
|
+
}
|
74
|
+
if (null == additionalProps || "object" != typeof additionalProps) return baseObj;
|
75
|
+
for (attr in additionalProps) {
|
76
|
+
if (additionalProps.hasOwnProperty(attr)) merged[attr] = additionalProps[attr];
|
77
|
+
}
|
78
|
+
return merged;
|
79
|
+
}
|
80
|
+
};
|
@@ -0,0 +1,1089 @@
|
|
1
|
+
/*
|
2
|
+
axios v0.7.0
|
3
|
+
Copyright (c) 2014 Matt Zabriskie
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
*/
|
23
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
24
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
25
|
+
module.exports = factory();
|
26
|
+
else if(typeof define === 'function' && define.amd)
|
27
|
+
define([], factory);
|
28
|
+
else if(typeof exports === 'object')
|
29
|
+
exports["axios"] = factory();
|
30
|
+
else
|
31
|
+
root["axios"] = factory();
|
32
|
+
})(this, function() {
|
33
|
+
return /******/ (function(modules) { // webpackBootstrap
|
34
|
+
/******/ // The module cache
|
35
|
+
/******/ var installedModules = {};
|
36
|
+
/******/
|
37
|
+
/******/ // The require function
|
38
|
+
/******/ function __webpack_require__(moduleId) {
|
39
|
+
/******/
|
40
|
+
/******/ // Check if module is in cache
|
41
|
+
/******/ if(installedModules[moduleId])
|
42
|
+
/******/ return installedModules[moduleId].exports;
|
43
|
+
/******/
|
44
|
+
/******/ // Create a new module (and put it into the cache)
|
45
|
+
/******/ var module = installedModules[moduleId] = {
|
46
|
+
/******/ exports: {},
|
47
|
+
/******/ id: moduleId,
|
48
|
+
/******/ loaded: false
|
49
|
+
/******/ };
|
50
|
+
/******/
|
51
|
+
/******/ // Execute the module function
|
52
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
53
|
+
/******/
|
54
|
+
/******/ // Flag the module as loaded
|
55
|
+
/******/ module.loaded = true;
|
56
|
+
/******/
|
57
|
+
/******/ // Return the exports of the module
|
58
|
+
/******/ return module.exports;
|
59
|
+
/******/ }
|
60
|
+
/******/
|
61
|
+
/******/
|
62
|
+
/******/ // expose the modules object (__webpack_modules__)
|
63
|
+
/******/ __webpack_require__.m = modules;
|
64
|
+
/******/
|
65
|
+
/******/ // expose the module cache
|
66
|
+
/******/ __webpack_require__.c = installedModules;
|
67
|
+
/******/
|
68
|
+
/******/ // __webpack_public_path__
|
69
|
+
/******/ __webpack_require__.p = "";
|
70
|
+
/******/
|
71
|
+
/******/ // Load entry module and return exports
|
72
|
+
/******/ return __webpack_require__(0);
|
73
|
+
/******/ })
|
74
|
+
/************************************************************************/
|
75
|
+
/******/ ([
|
76
|
+
/* 0 */
|
77
|
+
/***/ function(module, exports, __webpack_require__) {
|
78
|
+
|
79
|
+
module.exports = __webpack_require__(1);
|
80
|
+
|
81
|
+
/***/ },
|
82
|
+
/* 1 */
|
83
|
+
/***/ function(module, exports, __webpack_require__) {
|
84
|
+
|
85
|
+
'use strict';
|
86
|
+
|
87
|
+
var defaults = __webpack_require__(2);
|
88
|
+
var utils = __webpack_require__(3);
|
89
|
+
var dispatchRequest = __webpack_require__(4);
|
90
|
+
var InterceptorManager = __webpack_require__(12);
|
91
|
+
|
92
|
+
var axios = module.exports = function (config) {
|
93
|
+
// Allow for axios('example/url'[, config]) a la fetch API
|
94
|
+
if (typeof config === 'string') {
|
95
|
+
config = utils.merge({
|
96
|
+
url: arguments[0]
|
97
|
+
}, arguments[1]);
|
98
|
+
}
|
99
|
+
|
100
|
+
config = utils.merge({
|
101
|
+
method: 'get',
|
102
|
+
headers: {},
|
103
|
+
timeout: defaults.timeout,
|
104
|
+
transformRequest: defaults.transformRequest,
|
105
|
+
transformResponse: defaults.transformResponse
|
106
|
+
}, config);
|
107
|
+
|
108
|
+
// Don't allow overriding defaults.withCredentials
|
109
|
+
config.withCredentials = config.withCredentials || defaults.withCredentials;
|
110
|
+
|
111
|
+
// Hook up interceptors middleware
|
112
|
+
var chain = [dispatchRequest, undefined];
|
113
|
+
var promise = Promise.resolve(config);
|
114
|
+
|
115
|
+
axios.interceptors.request.forEach(function (interceptor) {
|
116
|
+
chain.unshift(interceptor.fulfilled, interceptor.rejected);
|
117
|
+
});
|
118
|
+
|
119
|
+
axios.interceptors.response.forEach(function (interceptor) {
|
120
|
+
chain.push(interceptor.fulfilled, interceptor.rejected);
|
121
|
+
});
|
122
|
+
|
123
|
+
while (chain.length) {
|
124
|
+
promise = promise.then(chain.shift(), chain.shift());
|
125
|
+
}
|
126
|
+
|
127
|
+
return promise;
|
128
|
+
};
|
129
|
+
|
130
|
+
// Expose defaults
|
131
|
+
axios.defaults = defaults;
|
132
|
+
|
133
|
+
// Expose all/spread
|
134
|
+
axios.all = function (promises) {
|
135
|
+
return Promise.all(promises);
|
136
|
+
};
|
137
|
+
axios.spread = __webpack_require__(13);
|
138
|
+
|
139
|
+
// Expose interceptors
|
140
|
+
axios.interceptors = {
|
141
|
+
request: new InterceptorManager(),
|
142
|
+
response: new InterceptorManager()
|
143
|
+
};
|
144
|
+
|
145
|
+
// Provide aliases for supported request methods
|
146
|
+
(function () {
|
147
|
+
function createShortMethods() {
|
148
|
+
utils.forEach(arguments, function (method) {
|
149
|
+
axios[method] = function (url, config) {
|
150
|
+
return axios(utils.merge(config || {}, {
|
151
|
+
method: method,
|
152
|
+
url: url
|
153
|
+
}));
|
154
|
+
};
|
155
|
+
});
|
156
|
+
}
|
157
|
+
|
158
|
+
function createShortMethodsWithData() {
|
159
|
+
utils.forEach(arguments, function (method) {
|
160
|
+
axios[method] = function (url, data, config) {
|
161
|
+
return axios(utils.merge(config || {}, {
|
162
|
+
method: method,
|
163
|
+
url: url,
|
164
|
+
data: data
|
165
|
+
}));
|
166
|
+
};
|
167
|
+
});
|
168
|
+
}
|
169
|
+
|
170
|
+
createShortMethods('delete', 'get', 'head');
|
171
|
+
createShortMethodsWithData('post', 'put', 'patch');
|
172
|
+
})();
|
173
|
+
|
174
|
+
|
175
|
+
/***/ },
|
176
|
+
/* 2 */
|
177
|
+
/***/ function(module, exports, __webpack_require__) {
|
178
|
+
|
179
|
+
'use strict';
|
180
|
+
|
181
|
+
var utils = __webpack_require__(3);
|
182
|
+
|
183
|
+
var PROTECTION_PREFIX = /^\)\]\}',?\n/;
|
184
|
+
var DEFAULT_CONTENT_TYPE = {
|
185
|
+
'Content-Type': 'application/json'
|
186
|
+
};
|
187
|
+
|
188
|
+
module.exports = {
|
189
|
+
transformRequest: [function (data, headers) {
|
190
|
+
if(utils.isFormData(data)) {
|
191
|
+
return data;
|
192
|
+
}
|
193
|
+
if (utils.isArrayBuffer(data)) {
|
194
|
+
return data;
|
195
|
+
}
|
196
|
+
if (utils.isArrayBufferView(data)) {
|
197
|
+
return data.buffer;
|
198
|
+
}
|
199
|
+
if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
|
200
|
+
// Set application/json if no Content-Type has been specified
|
201
|
+
if (!utils.isUndefined(headers)) {
|
202
|
+
utils.forEach(headers, function (val, key) {
|
203
|
+
if (key.toLowerCase() === 'content-type') {
|
204
|
+
headers['Content-Type'] = val;
|
205
|
+
}
|
206
|
+
});
|
207
|
+
|
208
|
+
if (utils.isUndefined(headers['Content-Type'])) {
|
209
|
+
headers['Content-Type'] = 'application/json;charset=utf-8';
|
210
|
+
}
|
211
|
+
}
|
212
|
+
return JSON.stringify(data);
|
213
|
+
}
|
214
|
+
return data;
|
215
|
+
}],
|
216
|
+
|
217
|
+
transformResponse: [function (data) {
|
218
|
+
if (typeof data === 'string') {
|
219
|
+
data = data.replace(PROTECTION_PREFIX, '');
|
220
|
+
try {
|
221
|
+
data = JSON.parse(data);
|
222
|
+
} catch (e) { /* Ignore */ }
|
223
|
+
}
|
224
|
+
return data;
|
225
|
+
}],
|
226
|
+
|
227
|
+
headers: {
|
228
|
+
common: {
|
229
|
+
'Accept': 'application/json, text/plain, */*'
|
230
|
+
},
|
231
|
+
patch: utils.merge(DEFAULT_CONTENT_TYPE),
|
232
|
+
post: utils.merge(DEFAULT_CONTENT_TYPE),
|
233
|
+
put: utils.merge(DEFAULT_CONTENT_TYPE)
|
234
|
+
},
|
235
|
+
|
236
|
+
timeout: 0,
|
237
|
+
|
238
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
239
|
+
xsrfHeaderName: 'X-XSRF-TOKEN'
|
240
|
+
};
|
241
|
+
|
242
|
+
|
243
|
+
/***/ },
|
244
|
+
/* 3 */
|
245
|
+
/***/ function(module, exports) {
|
246
|
+
|
247
|
+
'use strict';
|
248
|
+
|
249
|
+
/*global toString:true*/
|
250
|
+
|
251
|
+
// utils is a library of generic helper functions non-specific to axios
|
252
|
+
|
253
|
+
var toString = Object.prototype.toString;
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Determine if a value is an Array
|
257
|
+
*
|
258
|
+
* @param {Object} val The value to test
|
259
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
260
|
+
*/
|
261
|
+
function isArray(val) {
|
262
|
+
return toString.call(val) === '[object Array]';
|
263
|
+
}
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Determine if a value is an ArrayBuffer
|
267
|
+
*
|
268
|
+
* @param {Object} val The value to test
|
269
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
270
|
+
*/
|
271
|
+
function isArrayBuffer(val) {
|
272
|
+
return toString.call(val) === '[object ArrayBuffer]';
|
273
|
+
}
|
274
|
+
|
275
|
+
/**
|
276
|
+
* Determine if a value is a FormData
|
277
|
+
*
|
278
|
+
* @param {Object} val The value to test
|
279
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
280
|
+
*/
|
281
|
+
function isFormData(val) {
|
282
|
+
return toString.call(val) === '[object FormData]';
|
283
|
+
}
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Determine if a value is a view on an ArrayBuffer
|
287
|
+
*
|
288
|
+
* @param {Object} val The value to test
|
289
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
290
|
+
*/
|
291
|
+
function isArrayBufferView(val) {
|
292
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
293
|
+
return ArrayBuffer.isView(val);
|
294
|
+
} else {
|
295
|
+
return (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
/**
|
300
|
+
* Determine if a value is a String
|
301
|
+
*
|
302
|
+
* @param {Object} val The value to test
|
303
|
+
* @returns {boolean} True if value is a String, otherwise false
|
304
|
+
*/
|
305
|
+
function isString(val) {
|
306
|
+
return typeof val === 'string';
|
307
|
+
}
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Determine if a value is a Number
|
311
|
+
*
|
312
|
+
* @param {Object} val The value to test
|
313
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
314
|
+
*/
|
315
|
+
function isNumber(val) {
|
316
|
+
return typeof val === 'number';
|
317
|
+
}
|
318
|
+
|
319
|
+
/**
|
320
|
+
* Determine if a value is undefined
|
321
|
+
*
|
322
|
+
* @param {Object} val The value to test
|
323
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
324
|
+
*/
|
325
|
+
function isUndefined(val) {
|
326
|
+
return typeof val === 'undefined';
|
327
|
+
}
|
328
|
+
|
329
|
+
/**
|
330
|
+
* Determine if a value is an Object
|
331
|
+
*
|
332
|
+
* @param {Object} val The value to test
|
333
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
334
|
+
*/
|
335
|
+
function isObject(val) {
|
336
|
+
return val !== null && typeof val === 'object';
|
337
|
+
}
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Determine if a value is a Date
|
341
|
+
*
|
342
|
+
* @param {Object} val The value to test
|
343
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
344
|
+
*/
|
345
|
+
function isDate(val) {
|
346
|
+
return toString.call(val) === '[object Date]';
|
347
|
+
}
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Determine if a value is a File
|
351
|
+
*
|
352
|
+
* @param {Object} val The value to test
|
353
|
+
* @returns {boolean} True if value is a File, otherwise false
|
354
|
+
*/
|
355
|
+
function isFile(val) {
|
356
|
+
return toString.call(val) === '[object File]';
|
357
|
+
}
|
358
|
+
|
359
|
+
/**
|
360
|
+
* Determine if a value is a Blob
|
361
|
+
*
|
362
|
+
* @param {Object} val The value to test
|
363
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
364
|
+
*/
|
365
|
+
function isBlob(val) {
|
366
|
+
return toString.call(val) === '[object Blob]';
|
367
|
+
}
|
368
|
+
|
369
|
+
/**
|
370
|
+
* Trim excess whitespace off the beginning and end of a string
|
371
|
+
*
|
372
|
+
* @param {String} str The String to trim
|
373
|
+
* @returns {String} The String freed of excess whitespace
|
374
|
+
*/
|
375
|
+
function trim(str) {
|
376
|
+
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
377
|
+
}
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Determine if a value is an Arguments object
|
381
|
+
*
|
382
|
+
* @param {Object} val The value to test
|
383
|
+
* @returns {boolean} True if value is an Arguments object, otherwise false
|
384
|
+
*/
|
385
|
+
function isArguments(val) {
|
386
|
+
return toString.call(val) === '[object Arguments]';
|
387
|
+
}
|
388
|
+
|
389
|
+
/**
|
390
|
+
* Determine if we're running in a standard browser environment
|
391
|
+
*
|
392
|
+
* This allows axios to run in a web worker, and react-native.
|
393
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
394
|
+
*
|
395
|
+
* web workers:
|
396
|
+
* typeof window -> undefined
|
397
|
+
* typeof document -> undefined
|
398
|
+
*
|
399
|
+
* react-native:
|
400
|
+
* typeof document.createelement -> undefined
|
401
|
+
*/
|
402
|
+
function isStandardBrowserEnv() {
|
403
|
+
return (
|
404
|
+
typeof window !== 'undefined' &&
|
405
|
+
typeof document !== 'undefined' &&
|
406
|
+
typeof document.createElement === 'function'
|
407
|
+
);
|
408
|
+
}
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
412
|
+
*
|
413
|
+
* If `obj` is an Array or arguments callback will be called passing
|
414
|
+
* the value, index, and complete array for each item.
|
415
|
+
*
|
416
|
+
* If 'obj' is an Object callback will be called passing
|
417
|
+
* the value, key, and complete object for each property.
|
418
|
+
*
|
419
|
+
* @param {Object|Array} obj The object to iterate
|
420
|
+
* @param {Function} fn The callback to invoke for each item
|
421
|
+
*/
|
422
|
+
function forEach(obj, fn) {
|
423
|
+
// Don't bother if no value provided
|
424
|
+
if (obj === null || typeof obj === 'undefined') {
|
425
|
+
return;
|
426
|
+
}
|
427
|
+
|
428
|
+
// Check if obj is array-like
|
429
|
+
var isArrayLike = isArray(obj) || isArguments(obj);
|
430
|
+
|
431
|
+
// Force an array if not already something iterable
|
432
|
+
if (typeof obj !== 'object' && !isArrayLike) {
|
433
|
+
obj = [obj];
|
434
|
+
}
|
435
|
+
|
436
|
+
// Iterate over array values
|
437
|
+
if (isArrayLike) {
|
438
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
439
|
+
fn.call(null, obj[i], i, obj);
|
440
|
+
}
|
441
|
+
}
|
442
|
+
// Iterate over object keys
|
443
|
+
else {
|
444
|
+
for (var key in obj) {
|
445
|
+
if (obj.hasOwnProperty(key)) {
|
446
|
+
fn.call(null, obj[key], key, obj);
|
447
|
+
}
|
448
|
+
}
|
449
|
+
}
|
450
|
+
}
|
451
|
+
|
452
|
+
/**
|
453
|
+
* Accepts varargs expecting each argument to be an object, then
|
454
|
+
* immutably merges the properties of each object and returns result.
|
455
|
+
*
|
456
|
+
* When multiple objects contain the same key the later object in
|
457
|
+
* the arguments list will take precedence.
|
458
|
+
*
|
459
|
+
* Example:
|
460
|
+
*
|
461
|
+
* ```js
|
462
|
+
* var result = merge({foo: 123}, {foo: 456});
|
463
|
+
* console.log(result.foo); // outputs 456
|
464
|
+
* ```
|
465
|
+
*
|
466
|
+
* @param {Object} obj1 Object to merge
|
467
|
+
* @returns {Object} Result of all merge properties
|
468
|
+
*/
|
469
|
+
function merge(/*obj1, obj2, obj3, ...*/) {
|
470
|
+
var result = {};
|
471
|
+
forEach(arguments, function (obj) {
|
472
|
+
forEach(obj, function (val, key) {
|
473
|
+
result[key] = val;
|
474
|
+
});
|
475
|
+
});
|
476
|
+
return result;
|
477
|
+
}
|
478
|
+
|
479
|
+
module.exports = {
|
480
|
+
isArray: isArray,
|
481
|
+
isArrayBuffer: isArrayBuffer,
|
482
|
+
isFormData: isFormData,
|
483
|
+
isArrayBufferView: isArrayBufferView,
|
484
|
+
isString: isString,
|
485
|
+
isNumber: isNumber,
|
486
|
+
isObject: isObject,
|
487
|
+
isUndefined: isUndefined,
|
488
|
+
isDate: isDate,
|
489
|
+
isFile: isFile,
|
490
|
+
isBlob: isBlob,
|
491
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
492
|
+
forEach: forEach,
|
493
|
+
merge: merge,
|
494
|
+
trim: trim
|
495
|
+
};
|
496
|
+
|
497
|
+
|
498
|
+
/***/ },
|
499
|
+
/* 4 */
|
500
|
+
/***/ function(module, exports, __webpack_require__) {
|
501
|
+
|
502
|
+
/* WEBPACK VAR INJECTION */(function(process) {'use strict';
|
503
|
+
|
504
|
+
/**
|
505
|
+
* Dispatch a request to the server using whichever adapter
|
506
|
+
* is supported by the current environment.
|
507
|
+
*
|
508
|
+
* @param {object} config The config that is to be used for the request
|
509
|
+
* @returns {Promise} The Promise to be fulfilled
|
510
|
+
*/
|
511
|
+
module.exports = function dispatchRequest(config) {
|
512
|
+
return new Promise(function (resolve, reject) {
|
513
|
+
try {
|
514
|
+
// For browsers use XHR adapter
|
515
|
+
if ((typeof XMLHttpRequest !== 'undefined') || (typeof ActiveXObject !== 'undefined')) {
|
516
|
+
__webpack_require__(6)(resolve, reject, config);
|
517
|
+
}
|
518
|
+
// For node use HTTP adapter
|
519
|
+
else if (typeof process !== 'undefined') {
|
520
|
+
__webpack_require__(6)(resolve, reject, config);
|
521
|
+
}
|
522
|
+
} catch (e) {
|
523
|
+
reject(e);
|
524
|
+
}
|
525
|
+
});
|
526
|
+
};
|
527
|
+
|
528
|
+
|
529
|
+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
530
|
+
|
531
|
+
/***/ },
|
532
|
+
/* 5 */
|
533
|
+
/***/ function(module, exports) {
|
534
|
+
|
535
|
+
// shim for using process in browser
|
536
|
+
|
537
|
+
var process = module.exports = {};
|
538
|
+
var queue = [];
|
539
|
+
var draining = false;
|
540
|
+
var currentQueue;
|
541
|
+
var queueIndex = -1;
|
542
|
+
|
543
|
+
function cleanUpNextTick() {
|
544
|
+
draining = false;
|
545
|
+
if (currentQueue.length) {
|
546
|
+
queue = currentQueue.concat(queue);
|
547
|
+
} else {
|
548
|
+
queueIndex = -1;
|
549
|
+
}
|
550
|
+
if (queue.length) {
|
551
|
+
drainQueue();
|
552
|
+
}
|
553
|
+
}
|
554
|
+
|
555
|
+
function drainQueue() {
|
556
|
+
if (draining) {
|
557
|
+
return;
|
558
|
+
}
|
559
|
+
var timeout = setTimeout(cleanUpNextTick);
|
560
|
+
draining = true;
|
561
|
+
|
562
|
+
var len = queue.length;
|
563
|
+
while(len) {
|
564
|
+
currentQueue = queue;
|
565
|
+
queue = [];
|
566
|
+
while (++queueIndex < len) {
|
567
|
+
if (currentQueue) {
|
568
|
+
currentQueue[queueIndex].run();
|
569
|
+
}
|
570
|
+
}
|
571
|
+
queueIndex = -1;
|
572
|
+
len = queue.length;
|
573
|
+
}
|
574
|
+
currentQueue = null;
|
575
|
+
draining = false;
|
576
|
+
clearTimeout(timeout);
|
577
|
+
}
|
578
|
+
|
579
|
+
process.nextTick = function (fun) {
|
580
|
+
var args = new Array(arguments.length - 1);
|
581
|
+
if (arguments.length > 1) {
|
582
|
+
for (var i = 1; i < arguments.length; i++) {
|
583
|
+
args[i - 1] = arguments[i];
|
584
|
+
}
|
585
|
+
}
|
586
|
+
queue.push(new Item(fun, args));
|
587
|
+
if (queue.length === 1 && !draining) {
|
588
|
+
setTimeout(drainQueue, 0);
|
589
|
+
}
|
590
|
+
};
|
591
|
+
|
592
|
+
// v8 likes predictible objects
|
593
|
+
function Item(fun, array) {
|
594
|
+
this.fun = fun;
|
595
|
+
this.array = array;
|
596
|
+
}
|
597
|
+
Item.prototype.run = function () {
|
598
|
+
this.fun.apply(null, this.array);
|
599
|
+
};
|
600
|
+
process.title = 'browser';
|
601
|
+
process.browser = true;
|
602
|
+
process.env = {};
|
603
|
+
process.argv = [];
|
604
|
+
process.version = ''; // empty string to avoid regexp issues
|
605
|
+
process.versions = {};
|
606
|
+
|
607
|
+
function noop() {}
|
608
|
+
|
609
|
+
process.on = noop;
|
610
|
+
process.addListener = noop;
|
611
|
+
process.once = noop;
|
612
|
+
process.off = noop;
|
613
|
+
process.removeListener = noop;
|
614
|
+
process.removeAllListeners = noop;
|
615
|
+
process.emit = noop;
|
616
|
+
|
617
|
+
process.binding = function (name) {
|
618
|
+
throw new Error('process.binding is not supported');
|
619
|
+
};
|
620
|
+
|
621
|
+
process.cwd = function () { return '/' };
|
622
|
+
process.chdir = function (dir) {
|
623
|
+
throw new Error('process.chdir is not supported');
|
624
|
+
};
|
625
|
+
process.umask = function() { return 0; };
|
626
|
+
|
627
|
+
|
628
|
+
/***/ },
|
629
|
+
/* 6 */
|
630
|
+
/***/ function(module, exports, __webpack_require__) {
|
631
|
+
|
632
|
+
'use strict';
|
633
|
+
|
634
|
+
/*global ActiveXObject:true*/
|
635
|
+
|
636
|
+
var defaults = __webpack_require__(2);
|
637
|
+
var utils = __webpack_require__(3);
|
638
|
+
var buildUrl = __webpack_require__(7);
|
639
|
+
var parseHeaders = __webpack_require__(8);
|
640
|
+
var transformData = __webpack_require__(9);
|
641
|
+
|
642
|
+
module.exports = function xhrAdapter(resolve, reject, config) {
|
643
|
+
// Transform request data
|
644
|
+
var data = transformData(
|
645
|
+
config.data,
|
646
|
+
config.headers,
|
647
|
+
config.transformRequest
|
648
|
+
);
|
649
|
+
|
650
|
+
// Merge headers
|
651
|
+
var requestHeaders = utils.merge(
|
652
|
+
defaults.headers.common,
|
653
|
+
defaults.headers[config.method] || {},
|
654
|
+
config.headers || {}
|
655
|
+
);
|
656
|
+
|
657
|
+
if (utils.isFormData(data)) {
|
658
|
+
// Content-Type needs to be sent in all requests so the mapping template can be applied
|
659
|
+
//delete requestHeaders['Content-Type']; // Let the browser set it
|
660
|
+
}
|
661
|
+
|
662
|
+
// Create the request
|
663
|
+
var request = new (XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');
|
664
|
+
request.open(config.method.toUpperCase(), buildUrl(config.url, config.params), true);
|
665
|
+
|
666
|
+
// Set the request timeout in MS
|
667
|
+
request.timeout = config.timeout;
|
668
|
+
|
669
|
+
// Listen for ready state
|
670
|
+
request.onreadystatechange = function () {
|
671
|
+
if (request && request.readyState === 4) {
|
672
|
+
// Prepare the response
|
673
|
+
var responseHeaders = parseHeaders(request.getAllResponseHeaders());
|
674
|
+
var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;
|
675
|
+
var response = {
|
676
|
+
data: transformData(
|
677
|
+
responseData,
|
678
|
+
responseHeaders,
|
679
|
+
config.transformResponse
|
680
|
+
),
|
681
|
+
status: request.status,
|
682
|
+
statusText: request.statusText,
|
683
|
+
headers: responseHeaders,
|
684
|
+
config: config
|
685
|
+
};
|
686
|
+
|
687
|
+
// Resolve or reject the Promise based on the status
|
688
|
+
(request.status >= 200 && request.status < 300 ?
|
689
|
+
resolve :
|
690
|
+
reject)(response);
|
691
|
+
|
692
|
+
// Clean up request
|
693
|
+
request = null;
|
694
|
+
}
|
695
|
+
};
|
696
|
+
|
697
|
+
// Add xsrf header
|
698
|
+
// This is only done if running in a standard browser environment.
|
699
|
+
// Specifically not if we're in a web worker, or react-native.
|
700
|
+
if (utils.isStandardBrowserEnv()) {
|
701
|
+
var cookies = __webpack_require__(10);
|
702
|
+
var urlIsSameOrigin = __webpack_require__(11);
|
703
|
+
|
704
|
+
// Add xsrf header
|
705
|
+
var xsrfValue = urlIsSameOrigin(config.url) ?
|
706
|
+
cookies.read(config.xsrfCookieName || defaults.xsrfCookieName) :
|
707
|
+
undefined;
|
708
|
+
|
709
|
+
if (xsrfValue) {
|
710
|
+
requestHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue;
|
711
|
+
}
|
712
|
+
}
|
713
|
+
|
714
|
+
// Add headers to the request
|
715
|
+
utils.forEach(requestHeaders, function (val, key) {
|
716
|
+
// Remove Content-Type if data is undefined
|
717
|
+
if (!data && key.toLowerCase() === 'content-type') {
|
718
|
+
delete requestHeaders[key];
|
719
|
+
}
|
720
|
+
// Otherwise add header to the request
|
721
|
+
else {
|
722
|
+
request.setRequestHeader(key, val);
|
723
|
+
}
|
724
|
+
});
|
725
|
+
|
726
|
+
// Add withCredentials to request if needed
|
727
|
+
if (config.withCredentials) {
|
728
|
+
request.withCredentials = true;
|
729
|
+
}
|
730
|
+
|
731
|
+
// Add responseType to request if needed
|
732
|
+
if (config.responseType) {
|
733
|
+
try {
|
734
|
+
request.responseType = config.responseType;
|
735
|
+
} catch (e) {
|
736
|
+
if (request.responseType !== 'json') {
|
737
|
+
throw e;
|
738
|
+
}
|
739
|
+
}
|
740
|
+
}
|
741
|
+
|
742
|
+
if (utils.isArrayBuffer(data)) {
|
743
|
+
data = new DataView(data);
|
744
|
+
}
|
745
|
+
|
746
|
+
// Send the request
|
747
|
+
request.send(data);
|
748
|
+
};
|
749
|
+
|
750
|
+
|
751
|
+
/***/ },
|
752
|
+
/* 7 */
|
753
|
+
/***/ function(module, exports, __webpack_require__) {
|
754
|
+
|
755
|
+
'use strict';
|
756
|
+
|
757
|
+
var utils = __webpack_require__(3);
|
758
|
+
|
759
|
+
function encode(val) {
|
760
|
+
return encodeURIComponent(val).
|
761
|
+
replace(/%40/gi, '@').
|
762
|
+
replace(/%3A/gi, ':').
|
763
|
+
replace(/%24/g, '$').
|
764
|
+
replace(/%2C/gi, ',').
|
765
|
+
replace(/%20/g, '+').
|
766
|
+
replace(/%5B/gi, '[').
|
767
|
+
replace(/%5D/gi, ']');
|
768
|
+
}
|
769
|
+
|
770
|
+
/**
|
771
|
+
* Build a URL by appending params to the end
|
772
|
+
*
|
773
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
774
|
+
* @param {object} [params] The params to be appended
|
775
|
+
* @returns {string} The formatted url
|
776
|
+
*/
|
777
|
+
module.exports = function buildUrl(url, params) {
|
778
|
+
if (!params) {
|
779
|
+
return url;
|
780
|
+
}
|
781
|
+
|
782
|
+
var parts = [];
|
783
|
+
|
784
|
+
utils.forEach(params, function (val, key) {
|
785
|
+
if (val === null || typeof val === 'undefined') {
|
786
|
+
return;
|
787
|
+
}
|
788
|
+
|
789
|
+
if (utils.isArray(val)) {
|
790
|
+
key = key + '[]';
|
791
|
+
}
|
792
|
+
|
793
|
+
if (!utils.isArray(val)) {
|
794
|
+
val = [val];
|
795
|
+
}
|
796
|
+
|
797
|
+
utils.forEach(val, function (v) {
|
798
|
+
if (utils.isDate(v)) {
|
799
|
+
v = v.toISOString();
|
800
|
+
}
|
801
|
+
else if (utils.isObject(v)) {
|
802
|
+
v = JSON.stringify(v);
|
803
|
+
}
|
804
|
+
parts.push(encode(key) + '=' + encode(v));
|
805
|
+
});
|
806
|
+
});
|
807
|
+
|
808
|
+
if (parts.length > 0) {
|
809
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
|
810
|
+
}
|
811
|
+
|
812
|
+
return url;
|
813
|
+
};
|
814
|
+
|
815
|
+
|
816
|
+
/***/ },
|
817
|
+
/* 8 */
|
818
|
+
/***/ function(module, exports, __webpack_require__) {
|
819
|
+
|
820
|
+
'use strict';
|
821
|
+
|
822
|
+
var utils = __webpack_require__(3);
|
823
|
+
|
824
|
+
/**
|
825
|
+
* Parse headers into an object
|
826
|
+
*
|
827
|
+
* ```
|
828
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
829
|
+
* Content-Type: application/json
|
830
|
+
* Connection: keep-alive
|
831
|
+
* Transfer-Encoding: chunked
|
832
|
+
* ```
|
833
|
+
*
|
834
|
+
* @param {String} headers Headers needing to be parsed
|
835
|
+
* @returns {Object} Headers parsed into an object
|
836
|
+
*/
|
837
|
+
module.exports = function parseHeaders(headers) {
|
838
|
+
var parsed = {}, key, val, i;
|
839
|
+
|
840
|
+
if (!headers) { return parsed; }
|
841
|
+
|
842
|
+
utils.forEach(headers.split('\n'), function(line) {
|
843
|
+
i = line.indexOf(':');
|
844
|
+
key = utils.trim(line.substr(0, i)).toLowerCase();
|
845
|
+
val = utils.trim(line.substr(i + 1));
|
846
|
+
|
847
|
+
if (key) {
|
848
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
849
|
+
}
|
850
|
+
});
|
851
|
+
|
852
|
+
return parsed;
|
853
|
+
};
|
854
|
+
|
855
|
+
|
856
|
+
/***/ },
|
857
|
+
/* 9 */
|
858
|
+
/***/ function(module, exports, __webpack_require__) {
|
859
|
+
|
860
|
+
'use strict';
|
861
|
+
|
862
|
+
var utils = __webpack_require__(3);
|
863
|
+
|
864
|
+
/**
|
865
|
+
* Transform the data for a request or a response
|
866
|
+
*
|
867
|
+
* @param {Object|String} data The data to be transformed
|
868
|
+
* @param {Array} headers The headers for the request or response
|
869
|
+
* @param {Array|Function} fns A single function or Array of functions
|
870
|
+
* @returns {*} The resulting transformed data
|
871
|
+
*/
|
872
|
+
module.exports = function transformData(data, headers, fns) {
|
873
|
+
utils.forEach(fns, function (fn) {
|
874
|
+
data = fn(data, headers);
|
875
|
+
});
|
876
|
+
|
877
|
+
return data;
|
878
|
+
};
|
879
|
+
|
880
|
+
|
881
|
+
/***/ },
|
882
|
+
/* 10 */
|
883
|
+
/***/ function(module, exports, __webpack_require__) {
|
884
|
+
|
885
|
+
'use strict';
|
886
|
+
|
887
|
+
/**
|
888
|
+
* WARNING:
|
889
|
+
* This file makes references to objects that aren't safe in all environments.
|
890
|
+
* Please see lib/utils.isStandardBrowserEnv before including this file.
|
891
|
+
*/
|
892
|
+
|
893
|
+
var utils = __webpack_require__(3);
|
894
|
+
|
895
|
+
module.exports = {
|
896
|
+
write: function write(name, value, expires, path, domain, secure) {
|
897
|
+
var cookie = [];
|
898
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
899
|
+
|
900
|
+
if (utils.isNumber(expires)) {
|
901
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
902
|
+
}
|
903
|
+
|
904
|
+
if (utils.isString(path)) {
|
905
|
+
cookie.push('path=' + path);
|
906
|
+
}
|
907
|
+
|
908
|
+
if (utils.isString(domain)) {
|
909
|
+
cookie.push('domain=' + domain);
|
910
|
+
}
|
911
|
+
|
912
|
+
if (secure === true) {
|
913
|
+
cookie.push('secure');
|
914
|
+
}
|
915
|
+
|
916
|
+
document.cookie = cookie.join('; ');
|
917
|
+
},
|
918
|
+
|
919
|
+
read: function read(name) {
|
920
|
+
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
921
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
922
|
+
},
|
923
|
+
|
924
|
+
remove: function remove(name) {
|
925
|
+
this.write(name, '', Date.now() - 86400000);
|
926
|
+
}
|
927
|
+
};
|
928
|
+
|
929
|
+
|
930
|
+
/***/ },
|
931
|
+
/* 11 */
|
932
|
+
/***/ function(module, exports, __webpack_require__) {
|
933
|
+
|
934
|
+
'use strict';
|
935
|
+
|
936
|
+
/**
|
937
|
+
* WARNING:
|
938
|
+
* This file makes references to objects that aren't safe in all environments.
|
939
|
+
* Please see lib/utils.isStandardBrowserEnv before including this file.
|
940
|
+
*/
|
941
|
+
|
942
|
+
var utils = __webpack_require__(3);
|
943
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
944
|
+
var urlParsingNode = document.createElement('a');
|
945
|
+
var originUrl;
|
946
|
+
|
947
|
+
/**
|
948
|
+
* Parse a URL to discover it's components
|
949
|
+
*
|
950
|
+
* @param {String} url The URL to be parsed
|
951
|
+
* @returns {Object}
|
952
|
+
*/
|
953
|
+
function urlResolve(url) {
|
954
|
+
var href = url;
|
955
|
+
|
956
|
+
if (msie) {
|
957
|
+
// IE needs attribute set twice to normalize properties
|
958
|
+
urlParsingNode.setAttribute('href', href);
|
959
|
+
href = urlParsingNode.href;
|
960
|
+
}
|
961
|
+
|
962
|
+
urlParsingNode.setAttribute('href', href);
|
963
|
+
|
964
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
965
|
+
return {
|
966
|
+
href: urlParsingNode.href,
|
967
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
968
|
+
host: urlParsingNode.host,
|
969
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
970
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
971
|
+
hostname: urlParsingNode.hostname,
|
972
|
+
port: urlParsingNode.port,
|
973
|
+
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
974
|
+
urlParsingNode.pathname :
|
975
|
+
'/' + urlParsingNode.pathname
|
976
|
+
};
|
977
|
+
}
|
978
|
+
|
979
|
+
originUrl = urlResolve(window.location.href);
|
980
|
+
|
981
|
+
/**
|
982
|
+
* Determine if a URL shares the same origin as the current location
|
983
|
+
*
|
984
|
+
* @param {String} requestUrl The URL to test
|
985
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
986
|
+
*/
|
987
|
+
module.exports = function urlIsSameOrigin(requestUrl) {
|
988
|
+
var parsed = (utils.isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
|
989
|
+
return (parsed.protocol === originUrl.protocol &&
|
990
|
+
parsed.host === originUrl.host);
|
991
|
+
};
|
992
|
+
|
993
|
+
|
994
|
+
/***/ },
|
995
|
+
/* 12 */
|
996
|
+
/***/ function(module, exports, __webpack_require__) {
|
997
|
+
|
998
|
+
'use strict';
|
999
|
+
|
1000
|
+
var utils = __webpack_require__(3);
|
1001
|
+
|
1002
|
+
function InterceptorManager() {
|
1003
|
+
this.handlers = [];
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
/**
|
1007
|
+
* Add a new interceptor to the stack
|
1008
|
+
*
|
1009
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
1010
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
1011
|
+
*
|
1012
|
+
* @return {Number} An ID used to remove interceptor later
|
1013
|
+
*/
|
1014
|
+
InterceptorManager.prototype.use = function (fulfilled, rejected) {
|
1015
|
+
this.handlers.push({
|
1016
|
+
fulfilled: fulfilled,
|
1017
|
+
rejected: rejected
|
1018
|
+
});
|
1019
|
+
return this.handlers.length - 1;
|
1020
|
+
};
|
1021
|
+
|
1022
|
+
/**
|
1023
|
+
* Remove an interceptor from the stack
|
1024
|
+
*
|
1025
|
+
* @param {Number} id The ID that was returned by `use`
|
1026
|
+
*/
|
1027
|
+
InterceptorManager.prototype.eject = function (id) {
|
1028
|
+
if (this.handlers[id]) {
|
1029
|
+
this.handlers[id] = null;
|
1030
|
+
}
|
1031
|
+
};
|
1032
|
+
|
1033
|
+
/**
|
1034
|
+
* Iterate over all the registered interceptors
|
1035
|
+
*
|
1036
|
+
* This method is particularly useful for skipping over any
|
1037
|
+
* interceptors that may have become `null` calling `remove`.
|
1038
|
+
*
|
1039
|
+
* @param {Function} fn The function to call for each interceptor
|
1040
|
+
*/
|
1041
|
+
InterceptorManager.prototype.forEach = function (fn) {
|
1042
|
+
utils.forEach(this.handlers, function (h) {
|
1043
|
+
if (h !== null) {
|
1044
|
+
fn(h);
|
1045
|
+
}
|
1046
|
+
});
|
1047
|
+
};
|
1048
|
+
|
1049
|
+
module.exports = InterceptorManager;
|
1050
|
+
|
1051
|
+
|
1052
|
+
/***/ },
|
1053
|
+
/* 13 */
|
1054
|
+
/***/ function(module, exports) {
|
1055
|
+
|
1056
|
+
'use strict';
|
1057
|
+
|
1058
|
+
/**
|
1059
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
1060
|
+
*
|
1061
|
+
* Common use case would be to use `Function.prototype.apply`.
|
1062
|
+
*
|
1063
|
+
* ```js
|
1064
|
+
* function f(x, y, z) {}
|
1065
|
+
* var args = [1, 2, 3];
|
1066
|
+
* f.apply(null, args);
|
1067
|
+
* ```
|
1068
|
+
*
|
1069
|
+
* With `spread` this example can be re-written.
|
1070
|
+
*
|
1071
|
+
* ```js
|
1072
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
1073
|
+
* ```
|
1074
|
+
*
|
1075
|
+
* @param {Function} callback
|
1076
|
+
* @returns {Function}
|
1077
|
+
*/
|
1078
|
+
module.exports = function spread(callback) {
|
1079
|
+
return function (arr) {
|
1080
|
+
return callback.apply(null, arr);
|
1081
|
+
};
|
1082
|
+
};
|
1083
|
+
|
1084
|
+
|
1085
|
+
/***/ }
|
1086
|
+
/******/ ])
|
1087
|
+
});
|
1088
|
+
;
|
1089
|
+
//# sourceMappingURL=axios.map
|