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,162 @@
|
|
1
|
+
# Upgrade Guide
|
2
|
+
|
3
|
+
### 0.15.x -> 0.16.0
|
4
|
+
|
5
|
+
#### `Promise` Type Declarations
|
6
|
+
|
7
|
+
The `Promise` type declarations have been removed from the axios typings in favor of the built-in type declarations. If you use axios in a TypeScript project that targets `ES5`, please make sure to include the `es2015.promise` lib. Please see [this post](https://blog.mariusschulz.com/2016/11/25/typescript-2-0-built-in-type-declarations) for details.
|
8
|
+
|
9
|
+
### 0.13.x -> 0.14.0
|
10
|
+
|
11
|
+
#### TypeScript Definitions
|
12
|
+
|
13
|
+
The axios TypeScript definitions have been updated to match the axios API and use the ES2015 module syntax.
|
14
|
+
|
15
|
+
Please use the following `import` statement to import axios in TypeScript:
|
16
|
+
|
17
|
+
```typescript
|
18
|
+
import axios from 'axios';
|
19
|
+
|
20
|
+
axios.get('/foo')
|
21
|
+
.then(response => console.log(response))
|
22
|
+
.catch(error => console.log(error));
|
23
|
+
```
|
24
|
+
|
25
|
+
#### `agent` Config Option
|
26
|
+
|
27
|
+
The `agent` config option has been replaced with two new options: `httpAgent` and `httpsAgent`. Please use them instead.
|
28
|
+
|
29
|
+
```js
|
30
|
+
{
|
31
|
+
// Define a custom agent for HTTP
|
32
|
+
httpAgent: new http.Agent({ keepAlive: true }),
|
33
|
+
// Define a custom agent for HTTPS
|
34
|
+
httpsAgent: new https.Agent({ keepAlive: true })
|
35
|
+
}
|
36
|
+
```
|
37
|
+
|
38
|
+
#### `progress` Config Option
|
39
|
+
|
40
|
+
The `progress` config option has been replaced with the `onUploadProgress` and `onDownloadProgress` options.
|
41
|
+
|
42
|
+
```js
|
43
|
+
{
|
44
|
+
// Define a handler for upload progress events
|
45
|
+
onUploadProgress: function (progressEvent) {
|
46
|
+
// ...
|
47
|
+
},
|
48
|
+
|
49
|
+
// Define a handler for download progress events
|
50
|
+
onDownloadProgress: function (progressEvent) {
|
51
|
+
// ...
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
### 0.12.x -> 0.13.0
|
57
|
+
|
58
|
+
The `0.13.0` release contains several changes to custom adapters and error handling.
|
59
|
+
|
60
|
+
#### Error Handling
|
61
|
+
|
62
|
+
Previous to this release an error could either be a server response with bad status code or an actual `Error`. With this release Promise will always reject with an `Error`. In the case that a response was received, the `Error` will also include the response.
|
63
|
+
|
64
|
+
```js
|
65
|
+
axios.get('/user/12345')
|
66
|
+
.catch((error) => {
|
67
|
+
console.log(error.message);
|
68
|
+
console.log(error.code); // Not always specified
|
69
|
+
console.log(error.config); // The config that was used to make the request
|
70
|
+
console.log(error.response); // Only available if response was received from the server
|
71
|
+
});
|
72
|
+
```
|
73
|
+
|
74
|
+
#### Request Adapters
|
75
|
+
|
76
|
+
This release changes a few things about how request adapters work. Please take note if you are using your own custom adapter.
|
77
|
+
|
78
|
+
1. Response transformer is now called outside of adapter.
|
79
|
+
2. Request adapter returns a `Promise`.
|
80
|
+
|
81
|
+
This means that you no longer need to invoke `transformData` on response data. You will also no longer receive `resolve` and `reject` as arguments in your adapter.
|
82
|
+
|
83
|
+
Previous code:
|
84
|
+
|
85
|
+
```js
|
86
|
+
function myAdapter(resolve, reject, config) {
|
87
|
+
var response = {
|
88
|
+
data: transformData(
|
89
|
+
responseData,
|
90
|
+
responseHeaders,
|
91
|
+
config.transformResponse
|
92
|
+
),
|
93
|
+
status: request.status,
|
94
|
+
statusText: request.statusText,
|
95
|
+
headers: responseHeaders
|
96
|
+
};
|
97
|
+
settle(resolve, reject, response);
|
98
|
+
}
|
99
|
+
```
|
100
|
+
|
101
|
+
New code:
|
102
|
+
|
103
|
+
```js
|
104
|
+
function myAdapter(config) {
|
105
|
+
return new Promise(function (resolve, reject) {
|
106
|
+
var response = {
|
107
|
+
data: responseData,
|
108
|
+
status: request.status,
|
109
|
+
statusText: request.statusText,
|
110
|
+
headers: responseHeaders
|
111
|
+
};
|
112
|
+
settle(resolve, reject, response);
|
113
|
+
});
|
114
|
+
}
|
115
|
+
```
|
116
|
+
|
117
|
+
See the related commits for more details:
|
118
|
+
- [Response transformers](https://github.com/axios/axios/commit/10eb23865101f9347570552c04e9d6211376e25e)
|
119
|
+
- [Request adapter Promise](https://github.com/axios/axios/commit/157efd5615890301824e3121cc6c9d2f9b21f94a)
|
120
|
+
|
121
|
+
### 0.5.x -> 0.6.0
|
122
|
+
|
123
|
+
The `0.6.0` release contains mostly bug fixes, but there are a couple things to be aware of when upgrading.
|
124
|
+
|
125
|
+
#### ES6 Promise Polyfill
|
126
|
+
|
127
|
+
Up until the `0.6.0` release ES6 `Promise` was being polyfilled using [es6-promise](https://github.com/jakearchibald/es6-promise). With this release, the polyfill has been removed, and you will need to supply it yourself if your environment needs it.
|
128
|
+
|
129
|
+
```js
|
130
|
+
require('es6-promise').polyfill();
|
131
|
+
var axios = require('axios');
|
132
|
+
```
|
133
|
+
|
134
|
+
This will polyfill the global environment, and only needs to be done once.
|
135
|
+
|
136
|
+
#### `axios.success`/`axios.error`
|
137
|
+
|
138
|
+
The `success`, and `error` aliases were deprectated in [0.4.0](https://github.com/axios/axios/blob/master/CHANGELOG.md#040-oct-03-2014). As of this release they have been removed entirely. Instead please use `axios.then`, and `axios.catch` respectively.
|
139
|
+
|
140
|
+
```js
|
141
|
+
axios.get('some/url')
|
142
|
+
.then(function (res) {
|
143
|
+
/* ... */
|
144
|
+
})
|
145
|
+
.catch(function (err) {
|
146
|
+
/* ... */
|
147
|
+
});
|
148
|
+
```
|
149
|
+
|
150
|
+
#### UMD
|
151
|
+
|
152
|
+
Previous versions of axios shipped with an AMD, CommonJS, and Global build. This has all been rolled into a single UMD build.
|
153
|
+
|
154
|
+
```js
|
155
|
+
// AMD
|
156
|
+
require(['bower_components/axios/dist/axios'], function (axios) {
|
157
|
+
/* ... */
|
158
|
+
});
|
159
|
+
|
160
|
+
// CommonJS
|
161
|
+
var axios = require('axios/dist/axios');
|
162
|
+
```
|