mw-common-components 0.0.1-security → 99.99.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of mw-common-components might be problematic. Click here for more details.
- package/README.md +3 -3
- package/config/dev.env.js +37 -0
- package/config/hap.amend.js +29 -0
- package/config/index.js +8 -0
- package/config/prod.env.js +28 -0
- package/index.d.ts +130 -0
- package/index.js +1 -0
- package/package.json +44 -3
- package/src/index.html +12 -0
- package/src/lib/app.js +103 -0
- package/src/lib/axios/CHANGELOG.md +245 -0
- package/src/lib/axios/LICENSE +19 -0
- package/src/lib/axios/README.md +625 -0
- package/src/lib/axios/UPGRADE_GUIDE.md +162 -0
- package/src/lib/axios/dist/axios.js +1603 -0
- package/src/lib/axios/dist/axios.map +1 -0
- package/src/lib/axios/dist/axios.min.js +9 -0
- package/src/lib/axios/dist/axios.min.map +1 -0
- package/src/lib/axios/index.d.ts +131 -0
- package/src/lib/axios/index.js +1 -0
- package/src/lib/axios/lib/adapters/README.md +37 -0
- package/src/lib/axios/lib/adapters/http.js +237 -0
- package/src/lib/axios/lib/adapters/xhr.js +180 -0
- package/src/lib/axios/lib/axios.js +52 -0
- package/src/lib/axios/lib/cancel/Cancel.js +19 -0
- package/src/lib/axios/lib/cancel/CancelToken.js +57 -0
- package/src/lib/axios/lib/cancel/isCancel.js +5 -0
- package/src/lib/axios/lib/core/Axios.js +79 -0
- package/src/lib/axios/lib/core/InterceptorManager.js +52 -0
- package/src/lib/axios/lib/core/README.md +7 -0
- package/src/lib/axios/lib/core/createError.js +18 -0
- package/src/lib/axios/lib/core/dispatchRequest.js +86 -0
- package/src/lib/axios/lib/core/enhanceError.js +21 -0
- package/src/lib/axios/lib/core/settle.js +26 -0
- package/src/lib/axios/lib/core/transformData.js +20 -0
- package/src/lib/axios/lib/defaults.js +96 -0
- package/src/lib/axios/lib/helpers/README.md +7 -0
- package/src/lib/axios/lib/helpers/bind.js +11 -0
- package/src/lib/axios/lib/helpers/btoa.js +36 -0
- package/src/lib/axios/lib/helpers/buildURL.js +66 -0
- package/src/lib/axios/lib/helpers/combineURLs.js +14 -0
- package/src/lib/axios/lib/helpers/cookies.js +53 -0
- package/src/lib/axios/lib/helpers/deprecatedMethod.js +24 -0
- package/src/lib/axios/lib/helpers/isAbsoluteURL.js +14 -0
- package/src/lib/axios/lib/helpers/isURLSameOrigin.js +68 -0
- package/src/lib/axios/lib/helpers/normalizeHeaderName.js +12 -0
- package/src/lib/axios/lib/helpers/parseHeaders.js +53 -0
- package/src/lib/axios/lib/helpers/spread.js +27 -0
- package/src/lib/axios/lib/utils.js +303 -0
- package/src/lib/axios/modules/debug/CHANGELOG.md +395 -0
- package/src/lib/axios/modules/debug/LICENSE +19 -0
- package/src/lib/axios/modules/debug/README.md +437 -0
- package/src/lib/axios/modules/debug/dist/debug.js +886 -0
- package/src/lib/axios/modules/debug/node.js +1 -0
- package/src/lib/axios/modules/debug/package.json +96 -0
- package/src/lib/axios/modules/debug/src/browser.js +180 -0
- package/src/lib/axios/modules/debug/src/common.js +249 -0
- package/src/lib/axios/modules/debug/src/index.js +12 -0
- package/src/lib/axios/modules/debug/src/node.js +174 -0
- package/src/lib/axios/modules/follow-redirects/LICENSE +18 -0
- package/src/lib/axios/modules/follow-redirects/README.md +145 -0
- package/src/lib/axios/modules/follow-redirects/http.js +1 -0
- package/src/lib/axios/modules/follow-redirects/https.js +1 -0
- package/src/lib/axios/modules/follow-redirects/index.js +452 -0
- package/src/lib/axios/modules/follow-redirects/package.json +92 -0
- package/src/lib/axios/modules/is-buffer/LICENSE +21 -0
- package/src/lib/axios/modules/is-buffer/README.md +53 -0
- package/src/lib/axios/modules/is-buffer/index.js +21 -0
- package/src/lib/axios/modules/is-buffer/package.json +90 -0
- package/src/lib/axios/modules/is-buffer/test/basic.js +24 -0
- package/src/lib/axios/modules/ms/index.js +162 -0
- package/src/lib/axios/modules/ms/license.md +21 -0
- package/src/lib/axios/modules/ms/package.json +72 -0
- package/src/lib/axios/modules/ms/readme.md +60 -0
- package/src/lib/axios/package-lock.json +10437 -0
- package/src/lib/axios/package.json +111 -0
- package/src/lib/axios.min.js +10 -0
- package/src/lib/axiosRequest.js +84 -0
- package/src/lib/bmob.js +36 -0
- package/src/lib/common.js +227 -0
- package/src/lib/config.dev.js +62 -0
- package/src/lib/config.js +69 -0
- package/src/lib/dataType.js +17 -0
- package/src/lib/error.js +32 -0
- package/src/lib/file.js +250 -0
- package/src/lib/hapRequest.js +68 -0
- package/src/lib/hapStorage.js +62 -0
- package/src/lib/init.js +0 -0
- package/src/lib/nodestorage.js +14 -0
- package/src/lib/pay.js +19 -0
- package/src/lib/pointer.js +18 -0
- package/src/lib/query.js +689 -0
- package/src/lib/relation.js +45 -0
- package/src/lib/request.js +21 -0
- package/src/lib/sms.js +40 -0
- package/src/lib/socket.js +292 -0
- package/src/lib/storage.js +21 -0
- package/src/lib/user.js +225 -0
- package/src/lib/utf8md5.js +205 -0
- package/src/lib/utils.js +61 -0
- package/src/lib/webstorage.js +32 -0
- package/src/lib/wxRequest.js +88 -0
- package/src/lib/wxstorage.js +27 -0
- package/src/main.js +27 -0
- package/test/index.html +15 -0
- package/test/index.js +12 -0
- package/tsconfig.json +100 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var utils = require('./../utils');
|
4
|
+
|
5
|
+
// Headers whose duplicates are ignored by node
|
6
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
7
|
+
var ignoreDuplicateOf = [
|
8
|
+
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
9
|
+
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
10
|
+
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
11
|
+
'referer', 'retry-after', 'user-agent'
|
12
|
+
];
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Parse headers into an object
|
16
|
+
*
|
17
|
+
* ```
|
18
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
19
|
+
* Content-Type: application/json
|
20
|
+
* Connection: keep-alive
|
21
|
+
* Transfer-Encoding: chunked
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* @param {String} headers Headers needing to be parsed
|
25
|
+
* @returns {Object} Headers parsed into an object
|
26
|
+
*/
|
27
|
+
module.exports = function parseHeaders(headers) {
|
28
|
+
var parsed = {};
|
29
|
+
var key;
|
30
|
+
var val;
|
31
|
+
var i;
|
32
|
+
|
33
|
+
if (!headers) { return parsed; }
|
34
|
+
|
35
|
+
utils.forEach(headers.split('\n'), function parser(line) {
|
36
|
+
i = line.indexOf(':');
|
37
|
+
key = utils.trim(line.substr(0, i)).toLowerCase();
|
38
|
+
val = utils.trim(line.substr(i + 1));
|
39
|
+
|
40
|
+
if (key) {
|
41
|
+
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
if (key === 'set-cookie') {
|
45
|
+
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
46
|
+
} else {
|
47
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
});
|
51
|
+
|
52
|
+
return parsed;
|
53
|
+
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
5
|
+
*
|
6
|
+
* Common use case would be to use `Function.prototype.apply`.
|
7
|
+
*
|
8
|
+
* ```js
|
9
|
+
* function f(x, y, z) {}
|
10
|
+
* var args = [1, 2, 3];
|
11
|
+
* f.apply(null, args);
|
12
|
+
* ```
|
13
|
+
*
|
14
|
+
* With `spread` this example can be re-written.
|
15
|
+
*
|
16
|
+
* ```js
|
17
|
+
* spread(function(x, y, z) {})([1, 2, 3]);
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* @param {Function} callback
|
21
|
+
* @returns {Function}
|
22
|
+
*/
|
23
|
+
module.exports = function spread(callback) {
|
24
|
+
return function wrap(arr) {
|
25
|
+
return callback.apply(null, arr);
|
26
|
+
};
|
27
|
+
};
|
@@ -0,0 +1,303 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var bind = require('./helpers/bind');
|
4
|
+
var isBuffer = require('../modules/is-buffer');
|
5
|
+
|
6
|
+
/*global toString:true*/
|
7
|
+
|
8
|
+
// utils is a library of generic helper functions non-specific to axios
|
9
|
+
|
10
|
+
var toString = Object.prototype.toString;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Determine if a value is an Array
|
14
|
+
*
|
15
|
+
* @param {Object} val The value to test
|
16
|
+
* @returns {boolean} True if value is an Array, otherwise false
|
17
|
+
*/
|
18
|
+
function isArray(val) {
|
19
|
+
return toString.call(val) === '[object Array]';
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Determine if a value is an ArrayBuffer
|
24
|
+
*
|
25
|
+
* @param {Object} val The value to test
|
26
|
+
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
27
|
+
*/
|
28
|
+
function isArrayBuffer(val) {
|
29
|
+
return toString.call(val) === '[object ArrayBuffer]';
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Determine if a value is a FormData
|
34
|
+
*
|
35
|
+
* @param {Object} val The value to test
|
36
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
37
|
+
*/
|
38
|
+
function isFormData(val) {
|
39
|
+
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Determine if a value is a view on an ArrayBuffer
|
44
|
+
*
|
45
|
+
* @param {Object} val The value to test
|
46
|
+
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
47
|
+
*/
|
48
|
+
function isArrayBufferView(val) {
|
49
|
+
var result;
|
50
|
+
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
51
|
+
result = ArrayBuffer.isView(val);
|
52
|
+
} else {
|
53
|
+
result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
|
54
|
+
}
|
55
|
+
return result;
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Determine if a value is a String
|
60
|
+
*
|
61
|
+
* @param {Object} val The value to test
|
62
|
+
* @returns {boolean} True if value is a String, otherwise false
|
63
|
+
*/
|
64
|
+
function isString(val) {
|
65
|
+
return typeof val === 'string';
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Determine if a value is a Number
|
70
|
+
*
|
71
|
+
* @param {Object} val The value to test
|
72
|
+
* @returns {boolean} True if value is a Number, otherwise false
|
73
|
+
*/
|
74
|
+
function isNumber(val) {
|
75
|
+
return typeof val === 'number';
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Determine if a value is undefined
|
80
|
+
*
|
81
|
+
* @param {Object} val The value to test
|
82
|
+
* @returns {boolean} True if the value is undefined, otherwise false
|
83
|
+
*/
|
84
|
+
function isUndefined(val) {
|
85
|
+
return typeof val === 'undefined';
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Determine if a value is an Object
|
90
|
+
*
|
91
|
+
* @param {Object} val The value to test
|
92
|
+
* @returns {boolean} True if value is an Object, otherwise false
|
93
|
+
*/
|
94
|
+
function isObject(val) {
|
95
|
+
return val !== null && typeof val === 'object';
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Determine if a value is a Date
|
100
|
+
*
|
101
|
+
* @param {Object} val The value to test
|
102
|
+
* @returns {boolean} True if value is a Date, otherwise false
|
103
|
+
*/
|
104
|
+
function isDate(val) {
|
105
|
+
return toString.call(val) === '[object Date]';
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Determine if a value is a File
|
110
|
+
*
|
111
|
+
* @param {Object} val The value to test
|
112
|
+
* @returns {boolean} True if value is a File, otherwise false
|
113
|
+
*/
|
114
|
+
function isFile(val) {
|
115
|
+
return toString.call(val) === '[object File]';
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Determine if a value is a Blob
|
120
|
+
*
|
121
|
+
* @param {Object} val The value to test
|
122
|
+
* @returns {boolean} True if value is a Blob, otherwise false
|
123
|
+
*/
|
124
|
+
function isBlob(val) {
|
125
|
+
return toString.call(val) === '[object Blob]';
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Determine if a value is a Function
|
130
|
+
*
|
131
|
+
* @param {Object} val The value to test
|
132
|
+
* @returns {boolean} True if value is a Function, otherwise false
|
133
|
+
*/
|
134
|
+
function isFunction(val) {
|
135
|
+
return toString.call(val) === '[object Function]';
|
136
|
+
}
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Determine if a value is a Stream
|
140
|
+
*
|
141
|
+
* @param {Object} val The value to test
|
142
|
+
* @returns {boolean} True if value is a Stream, otherwise false
|
143
|
+
*/
|
144
|
+
function isStream(val) {
|
145
|
+
return isObject(val) && isFunction(val.pipe);
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Determine if a value is a URLSearchParams object
|
150
|
+
*
|
151
|
+
* @param {Object} val The value to test
|
152
|
+
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
153
|
+
*/
|
154
|
+
function isURLSearchParams(val) {
|
155
|
+
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Trim excess whitespace off the beginning and end of a string
|
160
|
+
*
|
161
|
+
* @param {String} str The String to trim
|
162
|
+
* @returns {String} The String freed of excess whitespace
|
163
|
+
*/
|
164
|
+
function trim(str) {
|
165
|
+
return str.replace(/^\s*/, '').replace(/\s*$/, '');
|
166
|
+
}
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Determine if we're running in a standard browser environment
|
170
|
+
*
|
171
|
+
* This allows axios to run in a web worker, and react-native.
|
172
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
173
|
+
*
|
174
|
+
* web workers:
|
175
|
+
* typeof window -> undefined
|
176
|
+
* typeof document -> undefined
|
177
|
+
*
|
178
|
+
* react-native:
|
179
|
+
* navigator.product -> 'ReactNative'
|
180
|
+
*/
|
181
|
+
function isStandardBrowserEnv() {
|
182
|
+
if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
|
183
|
+
return false;
|
184
|
+
}
|
185
|
+
return (
|
186
|
+
typeof window !== 'undefined' &&
|
187
|
+
typeof document !== 'undefined'
|
188
|
+
);
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Iterate over an Array or an Object invoking a function for each item.
|
193
|
+
*
|
194
|
+
* If `obj` is an Array callback will be called passing
|
195
|
+
* the value, index, and complete array for each item.
|
196
|
+
*
|
197
|
+
* If 'obj' is an Object callback will be called passing
|
198
|
+
* the value, key, and complete object for each property.
|
199
|
+
*
|
200
|
+
* @param {Object|Array} obj The object to iterate
|
201
|
+
* @param {Function} fn The callback to invoke for each item
|
202
|
+
*/
|
203
|
+
function forEach(obj, fn) {
|
204
|
+
// Don't bother if no value provided
|
205
|
+
if (obj === null || typeof obj === 'undefined') {
|
206
|
+
return;
|
207
|
+
}
|
208
|
+
|
209
|
+
// Force an array if not already something iterable
|
210
|
+
if (typeof obj !== 'object') {
|
211
|
+
/*eslint no-param-reassign:0*/
|
212
|
+
obj = [obj];
|
213
|
+
}
|
214
|
+
|
215
|
+
if (isArray(obj)) {
|
216
|
+
// Iterate over array values
|
217
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
218
|
+
fn.call(null, obj[i], i, obj);
|
219
|
+
}
|
220
|
+
} else {
|
221
|
+
// Iterate over object keys
|
222
|
+
for (var key in obj) {
|
223
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
224
|
+
fn.call(null, obj[key], key, obj);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Accepts varargs expecting each argument to be an object, then
|
232
|
+
* immutably merges the properties of each object and returns result.
|
233
|
+
*
|
234
|
+
* When multiple objects contain the same key the later object in
|
235
|
+
* the arguments list will take precedence.
|
236
|
+
*
|
237
|
+
* Example:
|
238
|
+
*
|
239
|
+
* ```js
|
240
|
+
* var result = merge({foo: 123}, {foo: 456});
|
241
|
+
* console.log(result.foo); // outputs 456
|
242
|
+
* ```
|
243
|
+
*
|
244
|
+
* @param {Object} obj1 Object to merge
|
245
|
+
* @returns {Object} Result of all merge properties
|
246
|
+
*/
|
247
|
+
function merge(/* obj1, obj2, obj3, ... */) {
|
248
|
+
var result = {};
|
249
|
+
function assignValue(val, key) {
|
250
|
+
if (typeof result[key] === 'object' && typeof val === 'object') {
|
251
|
+
result[key] = merge(result[key], val);
|
252
|
+
} else {
|
253
|
+
result[key] = val;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
for (var i = 0, l = arguments.length; i < l; i++) {
|
258
|
+
forEach(arguments[i], assignValue);
|
259
|
+
}
|
260
|
+
return result;
|
261
|
+
}
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Extends object a by mutably adding to it the properties of object b.
|
265
|
+
*
|
266
|
+
* @param {Object} a The object to be extended
|
267
|
+
* @param {Object} b The object to copy properties from
|
268
|
+
* @param {Object} thisArg The object to bind function to
|
269
|
+
* @return {Object} The resulting value of object a
|
270
|
+
*/
|
271
|
+
function extend(a, b, thisArg) {
|
272
|
+
forEach(b, function assignValue(val, key) {
|
273
|
+
if (thisArg && typeof val === 'function') {
|
274
|
+
a[key] = bind(val, thisArg);
|
275
|
+
} else {
|
276
|
+
a[key] = val;
|
277
|
+
}
|
278
|
+
});
|
279
|
+
return a;
|
280
|
+
}
|
281
|
+
|
282
|
+
module.exports = {
|
283
|
+
isArray: isArray,
|
284
|
+
isArrayBuffer: isArrayBuffer,
|
285
|
+
isBuffer: isBuffer,
|
286
|
+
isFormData: isFormData,
|
287
|
+
isArrayBufferView: isArrayBufferView,
|
288
|
+
isString: isString,
|
289
|
+
isNumber: isNumber,
|
290
|
+
isObject: isObject,
|
291
|
+
isUndefined: isUndefined,
|
292
|
+
isDate: isDate,
|
293
|
+
isFile: isFile,
|
294
|
+
isBlob: isBlob,
|
295
|
+
isFunction: isFunction,
|
296
|
+
isStream: isStream,
|
297
|
+
isURLSearchParams: isURLSearchParams,
|
298
|
+
isStandardBrowserEnv: isStandardBrowserEnv,
|
299
|
+
forEach: forEach,
|
300
|
+
merge: merge,
|
301
|
+
extend: extend,
|
302
|
+
trim: trim
|
303
|
+
};
|