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.

Files changed (107) hide show
  1. package/README.md +3 -3
  2. package/config/dev.env.js +37 -0
  3. package/config/hap.amend.js +29 -0
  4. package/config/index.js +8 -0
  5. package/config/prod.env.js +28 -0
  6. package/index.d.ts +130 -0
  7. package/index.js +1 -0
  8. package/package.json +44 -3
  9. package/src/index.html +12 -0
  10. package/src/lib/app.js +103 -0
  11. package/src/lib/axios/CHANGELOG.md +245 -0
  12. package/src/lib/axios/LICENSE +19 -0
  13. package/src/lib/axios/README.md +625 -0
  14. package/src/lib/axios/UPGRADE_GUIDE.md +162 -0
  15. package/src/lib/axios/dist/axios.js +1603 -0
  16. package/src/lib/axios/dist/axios.map +1 -0
  17. package/src/lib/axios/dist/axios.min.js +9 -0
  18. package/src/lib/axios/dist/axios.min.map +1 -0
  19. package/src/lib/axios/index.d.ts +131 -0
  20. package/src/lib/axios/index.js +1 -0
  21. package/src/lib/axios/lib/adapters/README.md +37 -0
  22. package/src/lib/axios/lib/adapters/http.js +237 -0
  23. package/src/lib/axios/lib/adapters/xhr.js +180 -0
  24. package/src/lib/axios/lib/axios.js +52 -0
  25. package/src/lib/axios/lib/cancel/Cancel.js +19 -0
  26. package/src/lib/axios/lib/cancel/CancelToken.js +57 -0
  27. package/src/lib/axios/lib/cancel/isCancel.js +5 -0
  28. package/src/lib/axios/lib/core/Axios.js +79 -0
  29. package/src/lib/axios/lib/core/InterceptorManager.js +52 -0
  30. package/src/lib/axios/lib/core/README.md +7 -0
  31. package/src/lib/axios/lib/core/createError.js +18 -0
  32. package/src/lib/axios/lib/core/dispatchRequest.js +86 -0
  33. package/src/lib/axios/lib/core/enhanceError.js +21 -0
  34. package/src/lib/axios/lib/core/settle.js +26 -0
  35. package/src/lib/axios/lib/core/transformData.js +20 -0
  36. package/src/lib/axios/lib/defaults.js +96 -0
  37. package/src/lib/axios/lib/helpers/README.md +7 -0
  38. package/src/lib/axios/lib/helpers/bind.js +11 -0
  39. package/src/lib/axios/lib/helpers/btoa.js +36 -0
  40. package/src/lib/axios/lib/helpers/buildURL.js +66 -0
  41. package/src/lib/axios/lib/helpers/combineURLs.js +14 -0
  42. package/src/lib/axios/lib/helpers/cookies.js +53 -0
  43. package/src/lib/axios/lib/helpers/deprecatedMethod.js +24 -0
  44. package/src/lib/axios/lib/helpers/isAbsoluteURL.js +14 -0
  45. package/src/lib/axios/lib/helpers/isURLSameOrigin.js +68 -0
  46. package/src/lib/axios/lib/helpers/normalizeHeaderName.js +12 -0
  47. package/src/lib/axios/lib/helpers/parseHeaders.js +53 -0
  48. package/src/lib/axios/lib/helpers/spread.js +27 -0
  49. package/src/lib/axios/lib/utils.js +303 -0
  50. package/src/lib/axios/modules/debug/CHANGELOG.md +395 -0
  51. package/src/lib/axios/modules/debug/LICENSE +19 -0
  52. package/src/lib/axios/modules/debug/README.md +437 -0
  53. package/src/lib/axios/modules/debug/dist/debug.js +886 -0
  54. package/src/lib/axios/modules/debug/node.js +1 -0
  55. package/src/lib/axios/modules/debug/package.json +96 -0
  56. package/src/lib/axios/modules/debug/src/browser.js +180 -0
  57. package/src/lib/axios/modules/debug/src/common.js +249 -0
  58. package/src/lib/axios/modules/debug/src/index.js +12 -0
  59. package/src/lib/axios/modules/debug/src/node.js +174 -0
  60. package/src/lib/axios/modules/follow-redirects/LICENSE +18 -0
  61. package/src/lib/axios/modules/follow-redirects/README.md +145 -0
  62. package/src/lib/axios/modules/follow-redirects/http.js +1 -0
  63. package/src/lib/axios/modules/follow-redirects/https.js +1 -0
  64. package/src/lib/axios/modules/follow-redirects/index.js +452 -0
  65. package/src/lib/axios/modules/follow-redirects/package.json +92 -0
  66. package/src/lib/axios/modules/is-buffer/LICENSE +21 -0
  67. package/src/lib/axios/modules/is-buffer/README.md +53 -0
  68. package/src/lib/axios/modules/is-buffer/index.js +21 -0
  69. package/src/lib/axios/modules/is-buffer/package.json +90 -0
  70. package/src/lib/axios/modules/is-buffer/test/basic.js +24 -0
  71. package/src/lib/axios/modules/ms/index.js +162 -0
  72. package/src/lib/axios/modules/ms/license.md +21 -0
  73. package/src/lib/axios/modules/ms/package.json +72 -0
  74. package/src/lib/axios/modules/ms/readme.md +60 -0
  75. package/src/lib/axios/package-lock.json +10437 -0
  76. package/src/lib/axios/package.json +111 -0
  77. package/src/lib/axios.min.js +10 -0
  78. package/src/lib/axiosRequest.js +84 -0
  79. package/src/lib/bmob.js +36 -0
  80. package/src/lib/common.js +227 -0
  81. package/src/lib/config.dev.js +62 -0
  82. package/src/lib/config.js +69 -0
  83. package/src/lib/dataType.js +17 -0
  84. package/src/lib/error.js +32 -0
  85. package/src/lib/file.js +250 -0
  86. package/src/lib/hapRequest.js +68 -0
  87. package/src/lib/hapStorage.js +62 -0
  88. package/src/lib/init.js +0 -0
  89. package/src/lib/nodestorage.js +14 -0
  90. package/src/lib/pay.js +19 -0
  91. package/src/lib/pointer.js +18 -0
  92. package/src/lib/query.js +689 -0
  93. package/src/lib/relation.js +45 -0
  94. package/src/lib/request.js +21 -0
  95. package/src/lib/sms.js +40 -0
  96. package/src/lib/socket.js +292 -0
  97. package/src/lib/storage.js +21 -0
  98. package/src/lib/user.js +225 -0
  99. package/src/lib/utf8md5.js +205 -0
  100. package/src/lib/utils.js +61 -0
  101. package/src/lib/webstorage.js +32 -0
  102. package/src/lib/wxRequest.js +88 -0
  103. package/src/lib/wxstorage.js +27 -0
  104. package/src/main.js +27 -0
  105. package/test/index.html +15 -0
  106. package/test/index.js +12 -0
  107. package/tsconfig.json +100 -0
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Module dependencies.
5
+ */
6
+ var tty = require('tty');
7
+
8
+ var util = require('util');
9
+ /**
10
+ * This is the Node.js implementation of `debug()`.
11
+ */
12
+
13
+
14
+ exports.init = init;
15
+ exports.log = log;
16
+ exports.formatArgs = formatArgs;
17
+ exports.save = save;
18
+ exports.load = load;
19
+ exports.useColors = useColors;
20
+ /**
21
+ * Colors.
22
+ */
23
+
24
+ exports.colors = [6, 2, 3, 4, 5, 1];
25
+
26
+ try {
27
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
28
+ // eslint-disable-next-line import/no-extraneous-dependencies
29
+ var supportsColor = require('supports-color');
30
+
31
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
32
+ exports.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
33
+ }
34
+ } catch (error) {} // Swallow - we only care if `supports-color` is available; it doesn't have to be.
35
+
36
+ /**
37
+ * Build up the default `inspectOpts` object from the environment variables.
38
+ *
39
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
40
+ */
41
+
42
+
43
+ exports.inspectOpts = Object.keys(process.env).filter(function (key) {
44
+ return /^debug_/i.test(key);
45
+ }).reduce(function (obj, key) {
46
+ // Camel-case
47
+ var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
48
+ return k.toUpperCase();
49
+ }); // Coerce string value into JS value
50
+
51
+ var val = process.env[key];
52
+
53
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
54
+ val = true;
55
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
56
+ val = false;
57
+ } else if (val === 'null') {
58
+ val = null;
59
+ } else {
60
+ val = Number(val);
61
+ }
62
+
63
+ obj[prop] = val;
64
+ return obj;
65
+ }, {});
66
+ /**
67
+ * Is stdout a TTY? Colored output is enabled when `true`.
68
+ */
69
+
70
+ function useColors() {
71
+ return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
72
+ }
73
+ /**
74
+ * Adds ANSI color escape codes if enabled.
75
+ *
76
+ * @api public
77
+ */
78
+
79
+
80
+ function formatArgs(args) {
81
+ var name = this.namespace,
82
+ useColors = this.useColors;
83
+
84
+ if (useColors) {
85
+ var c = this.color;
86
+ var colorCode = "\x1B[3" + (c < 8 ? c : '8;5;' + c);
87
+ var prefix = " ".concat(colorCode, ";1m").concat(name, " \x1B[0m");
88
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
89
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + "\x1B[0m");
90
+ } else {
91
+ args[0] = getDate() + name + ' ' + args[0];
92
+ }
93
+ }
94
+
95
+ function getDate() {
96
+ if (exports.inspectOpts.hideDate) {
97
+ return '';
98
+ }
99
+
100
+ return new Date().toISOString() + ' ';
101
+ }
102
+ /**
103
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
104
+ */
105
+
106
+
107
+ function log() {
108
+ return process.stderr.write(util.format.apply(util, arguments) + '\n');
109
+ }
110
+ /**
111
+ * Save `namespaces`.
112
+ *
113
+ * @param {String} namespaces
114
+ * @api private
115
+ */
116
+
117
+
118
+ function save(namespaces) {
119
+ if (namespaces) {
120
+ process.env.DEBUG = namespaces;
121
+ } else {
122
+ // If you set a process.env field to null or undefined, it gets cast to the
123
+ // string 'null' or 'undefined'. Just delete instead.
124
+ delete process.env.DEBUG;
125
+ }
126
+ }
127
+ /**
128
+ * Load `namespaces`.
129
+ *
130
+ * @return {String} returns the previously persisted debug modes
131
+ * @api private
132
+ */
133
+
134
+
135
+ function load() {
136
+ return process.env.DEBUG;
137
+ }
138
+ /**
139
+ * Init logic for `debug` instances.
140
+ *
141
+ * Create a new `inspectOpts` object in case `useColors` is set
142
+ * differently for a particular `debug` instance.
143
+ */
144
+
145
+
146
+ function init(debug) {
147
+ debug.inspectOpts = {};
148
+ var keys = Object.keys(exports.inspectOpts);
149
+
150
+ for (var i = 0; i < keys.length; i++) {
151
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
152
+ }
153
+ }
154
+
155
+ module.exports = require('./common')(exports);
156
+ var formatters = module.exports.formatters;
157
+ /**
158
+ * Map %o to `util.inspect()`, all on a single line.
159
+ */
160
+
161
+ formatters.o = function (v) {
162
+ this.inspectOpts.colors = this.useColors;
163
+ return util.inspect(v, this.inspectOpts).replace(/\s*\n\s*/g, ' ');
164
+ };
165
+ /**
166
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
167
+ */
168
+
169
+
170
+ formatters.O = function (v) {
171
+ this.inspectOpts.colors = this.useColors;
172
+ return util.inspect(v, this.inspectOpts);
173
+ };
174
+
@@ -0,0 +1,18 @@
1
+ Copyright 2014–present Olivier Lalonde <olalonde@gmail.com>, James Talmage <james@talmage.io>, Ruben Verborgh
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
18
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,145 @@
1
+ ## Follow Redirects
2
+
3
+ Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects)
6
+ [![Build Status](https://travis-ci.org/follow-redirects/follow-redirects.svg?branch=master)](https://travis-ci.org/follow-redirects/follow-redirects)
7
+ [![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master)
8
+ [![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects)
9
+
10
+ `follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback)
11
+ methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback)
12
+ modules, with the exception that they will seamlessly follow redirects.
13
+
14
+ ```javascript
15
+ const { http, https } = require('follow-redirects');
16
+
17
+ http.get('http://bit.ly/900913', response => {
18
+ response.on('data', chunk => {
19
+ console.log(chunk);
20
+ });
21
+ }).on('error', err => {
22
+ console.error(err);
23
+ });
24
+ ```
25
+
26
+ You can inspect the final redirected URL through the `responseUrl` property on the `response`.
27
+ If no redirection happened, `responseUrl` is the original request URL.
28
+
29
+ ```javascript
30
+ https.request({
31
+ host: 'bitly.com',
32
+ path: '/UHfDGO',
33
+ }, response => {
34
+ console.log(response.responseUrl);
35
+ // 'http://duckduckgo.com/robots.txt'
36
+ });
37
+ ```
38
+
39
+ ## Options
40
+ ### Global options
41
+ Global options are set directly on the `follow-redirects` module:
42
+
43
+ ```javascript
44
+ const followRedirects = require('follow-redirects');
45
+ followRedirects.maxRedirects = 10;
46
+ followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB
47
+ ```
48
+
49
+ The following global options are supported:
50
+
51
+ - `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
52
+
53
+ - `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
54
+
55
+ ### Per-request options
56
+ Per-request options are set by passing an `options` object:
57
+
58
+ ```javascript
59
+ const url = require('url');
60
+ const { http, https } = require('follow-redirects');
61
+
62
+ const options = url.parse('http://bit.ly/900913');
63
+ options.maxRedirects = 10;
64
+ options.beforeRedirect = options => {
65
+ // Use this function to adjust the options upon redirecting,
66
+ // or to cancel the request by throwing an error
67
+ if (options.hostname === "example.com") {
68
+ options.auth = "user:password";
69
+ }
70
+ };
71
+ http.request(options);
72
+ ```
73
+
74
+ In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback),
75
+ the following per-request options are supported:
76
+ - `followRedirects` (default: `true`) – whether redirects should be followed.
77
+
78
+ - `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted.
79
+
80
+ - `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted.
81
+
82
+ - `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error.
83
+
84
+ - `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }`
85
+
86
+ - `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object.
87
+
88
+
89
+ ### Advanced usage
90
+ By default, `follow-redirects` will use the Node.js default implementations
91
+ of [`http`](https://nodejs.org/api/http.html)
92
+ and [`https`](https://nodejs.org/api/https.html).
93
+ To enable features such as caching and/or intermediate request tracking,
94
+ you might instead want to wrap `follow-redirects` around custom protocol implementations:
95
+
96
+ ```javascript
97
+ const { http, https } = require('follow-redirects').wrap({
98
+ http: require('your-custom-http'),
99
+ https: require('your-custom-https'),
100
+ });
101
+ ```
102
+
103
+ Such custom protocols only need an implementation of the `request` method.
104
+
105
+ ## Browser Usage
106
+
107
+ Due to the way the browser works,
108
+ the `http` and `https` browser equivalents perform redirects by default.
109
+
110
+ By requiring `follow-redirects` this way:
111
+ ```javascript
112
+ const http = require('follow-redirects/http');
113
+ const https = require('follow-redirects/https');
114
+ ```
115
+ you can easily tell webpack and friends to replace
116
+ `follow-redirect` by the built-in versions:
117
+
118
+ ```json
119
+ {
120
+ "follow-redirects/http" : "http",
121
+ "follow-redirects/https" : "https"
122
+ }
123
+ ```
124
+
125
+ ## Contributing
126
+
127
+ Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues)
128
+ detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied
129
+ by tests. You can run the test suite locally with a simple `npm test` command.
130
+
131
+ ## Debug Logging
132
+
133
+ `follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging
134
+ set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test
135
+ suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well.
136
+
137
+ ## Authors
138
+
139
+ - [Ruben Verborgh](https://ruben.verborgh.org/)
140
+ - Olivier Lalonde (olalonde@gmail.com)
141
+ - James Talmage (james@talmage.io)
142
+
143
+ ## License
144
+
145
+ [MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE)
@@ -0,0 +1 @@
1
+ module.exports = require("./").http;
@@ -0,0 +1 @@
1
+ module.exports = require("./").https;