@dashevo/dashd-rpc
Advanced tools
Comparing version 2.0.2 to 2.1.0
593
lib/index.js
@@ -1,51 +0,57 @@ | ||
'use strict'; | ||
/* eslint-disable */ | ||
var http = require('http'); | ||
var https = require('https'); | ||
var async = require('async'); | ||
const http = require('http'); | ||
const https = require('https'); | ||
const async = require('async'); | ||
function RpcClient(opts) { | ||
opts = opts || {}; | ||
this.host = opts.host || '127.0.0.1'; | ||
this.port = opts.port || 9998; | ||
this.user = opts.user || 'user'; | ||
this.pass = opts.pass || 'pass'; | ||
this.protocol = opts.protocol === 'http' ? http : https; | ||
this.batchedCalls = null; | ||
this.disableAgent = opts.disableAgent || false; | ||
var queueSize = opts.queue || 16; | ||
opts = opts || {}; | ||
this.host = opts.host || '127.0.0.1'; | ||
this.port = opts.port || 9998; | ||
this.user = opts.user || 'user'; | ||
this.pass = opts.pass || 'pass'; | ||
this.protocol = opts.protocol === 'http' ? http : https; | ||
this.batchedCalls = null; | ||
this.disableAgent = opts.disableAgent || false; | ||
const queueSize = opts.queue || 16; | ||
var isRejectUnauthorized = typeof opts.rejectUnauthorized !== 'undefined'; | ||
this.rejectUnauthorized = isRejectUnauthorized ? opts.rejectUnauthorized : true; | ||
const isRejectUnauthorized = typeof opts.rejectUnauthorized !== 'undefined'; | ||
this.rejectUnauthorized = isRejectUnauthorized ? opts.rejectUnauthorized : true; | ||
if (RpcClient.config.log) { | ||
this.log = RpcClient.config.log; | ||
} else { | ||
this.log = RpcClient.loggers[RpcClient.config.logger || 'normal']; | ||
} | ||
if (RpcClient.config.log) { | ||
this.log = RpcClient.config.log; | ||
} else { | ||
this.log = RpcClient.loggers[RpcClient.config.logger || 'normal']; | ||
} | ||
this.queue = async.queue(function(task, callback) { | ||
task(callback); | ||
}, queueSize); | ||
this.queue = async.queue((task, callback) => { | ||
task(callback); | ||
}, queueSize); | ||
} | ||
var cl = console.log.bind(console); | ||
const cl = console.log.bind(console); | ||
var noop = function () { | ||
const noop = function () { | ||
}; | ||
RpcClient.loggers = { | ||
none: {info: noop, warn: noop, err: noop, debug: noop}, | ||
normal: {info: cl, warn: cl, err: cl, debug: noop}, | ||
debug: {info: cl, warn: cl, err: cl, debug: cl} | ||
none: { | ||
info: noop, warn: noop, err: noop, debug: noop, | ||
}, | ||
normal: { | ||
info: cl, warn: cl, err: cl, debug: noop, | ||
}, | ||
debug: { | ||
info: cl, warn: cl, err: cl, debug: cl, | ||
}, | ||
}; | ||
RpcClient.config = { | ||
logger: 'normal', // none, normal, debug, | ||
logger: 'normal', // none, normal, debug, | ||
}; | ||
function rpc(request, callback) { | ||
var self = this; | ||
var task = function(taskCallback) { | ||
var newCallback = function() { | ||
const self = this; | ||
const task = function (taskCallback) { | ||
const newCallback = function () { | ||
callback.apply(undefined, arguments); | ||
@@ -60,92 +66,93 @@ taskCallback(); | ||
function innerRpc(request, callback) { | ||
const self = this; | ||
request = JSON.stringify(request); | ||
const auth = Buffer.from(`${self.user}:${self.pass}`).toString('base64'); | ||
var self = this; | ||
request = JSON.stringify(request); | ||
var auth = Buffer.from(`${self.user}:${self.pass}`).toString('base64'); | ||
const options = { | ||
host: self.host, | ||
path: '/', | ||
method: 'POST', | ||
port: self.port, | ||
rejectUnauthorized: self.rejectUnauthorized, | ||
agent: self.disableAgent ? false : undefined, | ||
}; | ||
var options = { | ||
host: self.host, | ||
path: '/', | ||
method: 'POST', | ||
port: self.port, | ||
rejectUnauthorized: self.rejectUnauthorized, | ||
agent: self.disableAgent ? false : undefined | ||
}; | ||
if (self.httpOptions) { | ||
for (var k in self.httpOptions) { | ||
options[k] = self.httpOptions[k]; | ||
} | ||
if (self.httpOptions) { | ||
for (const k in self.httpOptions) { | ||
options[k] = self.httpOptions[k]; | ||
} | ||
} | ||
var called = false; | ||
let called = false; | ||
var errorMessage = 'Dash JSON-RPC: '; | ||
const errorMessage = 'Dash JSON-RPC: '; | ||
var req = this.protocol.request(options, function (res) { | ||
const req = this.protocol.request(options, (res) => { | ||
let buf = ''; | ||
res.on('data', (data) => { | ||
buf += data; | ||
}); | ||
var buf = ''; | ||
res.on('data', function (data) { | ||
buf += data; | ||
}); | ||
res.on('end', () => { | ||
if (called) { | ||
return; | ||
} | ||
called = true; | ||
res.on('end', function () { | ||
if (res.statusCode === 401) { | ||
callback(new Error(`${errorMessage}Connection Rejected: 401 Unnauthorized`)); | ||
return; | ||
} | ||
if (res.statusCode === 403) { | ||
callback(new Error(`${errorMessage}Connection Rejected: 403 Forbidden`)); | ||
return; | ||
} | ||
if (res.statusCode === 403) { | ||
callback(new Error(`${errorMessage}Connection Rejected: 403 Forbidden`)); | ||
return; | ||
} | ||
if (called) { | ||
return; | ||
} | ||
called = true; | ||
if (res.statusCode === 500 && buf.toString('utf8') === 'Work queue depth exceeded') { | ||
const exceededError = new Error(`Dash JSON-RPC: ${buf.toString('utf8')}`); | ||
exceededError.code = 429; // Too many requests | ||
callback(exceededError); | ||
return; | ||
} | ||
if (res.statusCode === 401) { | ||
callback(new Error(errorMessage + 'Connection Rejected: 401 Unnauthorized')); | ||
return; | ||
} | ||
if (res.statusCode === 403) { | ||
callback(new Error(errorMessage + 'Connection Rejected: 403 Forbidden')); | ||
return; | ||
} | ||
if (res.statusCode === 500 && buf.toString('utf8') === 'Work queue depth exceeded') { | ||
var exceededError = new Error('Dash JSON-RPC: ' + buf.toString('utf8')); | ||
exceededError.code = 429; // Too many requests | ||
callback(exceededError); | ||
return; | ||
} | ||
let parsedBuf; | ||
try { | ||
parsedBuf = JSON.parse(buf); | ||
} catch (e) { | ||
self.log.err(e.stack); | ||
self.log.err(buf); | ||
self.log.err(`HTTP Status code:${res.statusCode}`); | ||
const err = new Error(`${errorMessage}Error Parsing JSON: ${e.message}`); | ||
callback(err); | ||
return; | ||
} | ||
var parsedBuf; | ||
try { | ||
parsedBuf = JSON.parse(buf); | ||
} catch (e) { | ||
self.log.err(e.stack); | ||
self.log.err(buf); | ||
self.log.err('HTTP Status code:' + res.statusCode); | ||
var err = new Error(errorMessage + 'Error Parsing JSON: ' + e.message); | ||
callback(err); | ||
return; | ||
} | ||
callback(parsedBuf.error, parsedBuf); | ||
}); | ||
callback(parsedBuf.error, parsedBuf); | ||
}); | ||
}); | ||
req.on('error', function (e) { | ||
var err = new Error(errorMessage + 'Request Error: ' + e.message); | ||
if (!called) { | ||
called = true; | ||
callback(err); | ||
} | ||
}); | ||
req.on('error', (e) => { | ||
const err = new Error(`${errorMessage}Request Error: ${e.message}`); | ||
if (!called) { | ||
called = true; | ||
callback(err); | ||
} | ||
}); | ||
req.setHeader('Content-Length', request.length); | ||
req.setHeader('Content-Type', 'application/json'); | ||
req.setHeader('Authorization', 'Basic ' + auth); | ||
req.write(request); | ||
req.end(); | ||
req.setHeader('Content-Length', request.length); | ||
req.setHeader('Content-Type', 'application/json'); | ||
req.setHeader('Authorization', `Basic ${auth}`); | ||
req.write(request); | ||
req.end(); | ||
} | ||
RpcClient.prototype.batch = function (batchCallback, resultCallback) { | ||
this.batchedCalls = []; | ||
batchCallback(); | ||
rpc.call(this, this.batchedCalls, resultCallback); | ||
this.batchedCalls = null; | ||
this.batchedCalls = []; | ||
batchCallback(); | ||
rpc.call(this, this.batchedCalls, resultCallback); | ||
this.batchedCalls = null; | ||
}; | ||
@@ -155,206 +162,206 @@ | ||
RpcClient.callspec = { | ||
abandonTransaction: 'str', | ||
addMultiSigAddress: 'int str str', | ||
addNode: 'str str', | ||
backupWallet: 'str', | ||
clearBanned: '', | ||
createMultiSig: 'int str', | ||
createRawTransaction: 'str str int', | ||
debug: 'str', | ||
decodeRawTransaction: 'str', | ||
decodeScript: 'str', | ||
disconnectNode: 'str', | ||
dumpPrivKey: 'str', | ||
dumpWallet: 'str', | ||
encryptWallet: 'str', | ||
estimateFee: 'int', | ||
estimatePriority: 'int', | ||
estimateSmartFee: 'int', | ||
estimateSmartPriority: 'int', | ||
fundRawTransaction: 'str bool', | ||
generate: 'int', | ||
generateToAddress: 'int str', | ||
getAccount: 'str', | ||
getAccountAddress: 'str', | ||
getAddressMempool: 'obj', | ||
getAddressUtxos: 'obj', | ||
getAddressBalance: 'obj', | ||
getAddressDeltas: 'obj', | ||
getAddressTxids: 'obj', | ||
getAddressesByAccount: '', | ||
getAddedNodeInfo: 'bool str', | ||
getBalance: 'str int bool', | ||
getBestBlockHash: '', | ||
getBestChainLock: '', | ||
getBlock: 'str bool', | ||
getBlockchainInfo: '', | ||
getBlockCount: '', | ||
getBlockHashes: 'int int', | ||
getBlockHash: 'int', | ||
getBlockHeader: 'str bool', | ||
getBlockHeaders: 'str int bool', | ||
getBlockTemplate: '', | ||
getConnectionCount: '', | ||
getChainTips: 'int int', | ||
getDifficulty: '', | ||
getGenerate: '', | ||
getGovernanceInfo: '', | ||
getInfo: '', | ||
getMemPoolInfo: '', | ||
getMerkleBlocks: 'str str int', | ||
getMiningInfo: '', | ||
getNewAddress: '', | ||
getNetTotals: '', | ||
getNetworkInfo: '', | ||
getNetworkHashps: 'int int', | ||
getPeerInfo: '', | ||
getPoolInfo: '', | ||
getRawMemPool: 'bool', | ||
getRawChangeAddress: '', | ||
getRawTransaction: 'str int', | ||
getReceivedByAccount: 'str int', | ||
getReceivedByAddress: 'str int', | ||
getSpentInfo: 'obj', | ||
getSuperBlockBudget: 'int', | ||
getTransaction: '', | ||
getTxOut: 'str int bool', | ||
getTxOutProof: 'str str', | ||
getTxOutSetInfo: '', | ||
getWalletInfo: '', | ||
help: 'str', | ||
importAddress: 'str str bool', | ||
instantSendToAddress: 'str int str str bool', | ||
gobject: 'str str', | ||
invalidateBlock: 'str', | ||
importPrivKey: 'str str bool', | ||
importPubKey: 'str str bool', | ||
importElectrumWallet: 'str int', | ||
importWallet: 'str', | ||
keyPoolRefill: 'int', | ||
listAccounts: 'int bool', | ||
listAddressGroupings: '', | ||
listBanned: '', | ||
listReceivedByAccount: 'int bool', | ||
listReceivedByAddress: 'int bool', | ||
listSinceBlock: 'str int', | ||
listTransactions: 'str int int bool', | ||
listUnspent: 'int int str', | ||
listLockUnspent: 'bool', | ||
lockUnspent: 'bool obj', | ||
masternode: 'str', | ||
masternodeBroadcast: 'str', | ||
masternodelist: 'str str', | ||
mnsync: '', | ||
move: 'str str float int str', | ||
ping: '', | ||
prioritiseTransaction: 'str float int', | ||
privateSend: 'str', | ||
protx: 'str str str', | ||
reconsiderBlock: 'str', | ||
resendWalletTransactions: '', | ||
sendFrom: 'str str float int str str', | ||
sendMany: 'str obj int str str bool bool', | ||
sendRawTransaction: 'str bool bool', | ||
sendToAddress: 'str float str str', | ||
sentinelPing: 'str', | ||
setAccount: '', | ||
setBan: 'str str int bool', | ||
setGenerate: 'bool int', | ||
setTxFee: 'float', | ||
setMockTime: 'int', | ||
spork: 'str str', | ||
signMessage: 'str str', | ||
signRawTransaction: 'str str str str', | ||
stop: '', | ||
submitBlock: 'str str', | ||
validateAddress: 'str', | ||
verifyMessage: 'str str str', | ||
verifyChain: 'int int', | ||
verifyTxOutProof: 'str', | ||
voteRaw: 'str int', | ||
waitForNewBlock: 'int', | ||
walletLock: '', | ||
walletPassPhrase: 'str int bool', | ||
walletPassphraseChange: 'str str', | ||
getUser: 'str' | ||
abandonTransaction: 'str', | ||
addMultiSigAddress: 'int str str', | ||
addNode: 'str str', | ||
backupWallet: 'str', | ||
clearBanned: '', | ||
createMultiSig: 'int str', | ||
createRawTransaction: 'str str int', | ||
debug: 'str', | ||
decodeRawTransaction: 'str', | ||
decodeScript: 'str', | ||
disconnectNode: 'str', | ||
dumpPrivKey: 'str', | ||
dumpWallet: 'str', | ||
encryptWallet: 'str', | ||
estimateFee: 'int', | ||
estimatePriority: 'int', | ||
estimateSmartFee: 'int', | ||
estimateSmartPriority: 'int', | ||
fundRawTransaction: 'str bool', | ||
generate: 'int', | ||
generateToAddress: 'int str', | ||
getAccount: 'str', | ||
getAccountAddress: 'str', | ||
getAddressMempool: 'obj', | ||
getAddressUtxos: 'obj', | ||
getAddressBalance: 'obj', | ||
getAddressDeltas: 'obj', | ||
getAddressTxids: 'obj', | ||
getAddressesByAccount: '', | ||
getAddedNodeInfo: 'bool str', | ||
getBalance: 'str int bool', | ||
getBestBlockHash: '', | ||
getBestChainLock: '', | ||
getBlock: 'str bool', | ||
getBlockchainInfo: '', | ||
getBlockCount: '', | ||
getBlockHashes: 'int int', | ||
getBlockHash: 'int', | ||
getBlockHeader: 'str bool', | ||
getBlockHeaders: 'str int bool', | ||
getBlockTemplate: '', | ||
getConnectionCount: '', | ||
getChainTips: 'int int', | ||
getDifficulty: '', | ||
getGenerate: '', | ||
getGovernanceInfo: '', | ||
getInfo: '', | ||
getMemPoolInfo: '', | ||
getMerkleBlocks: 'str str int', | ||
getMiningInfo: '', | ||
getNewAddress: '', | ||
getNetTotals: '', | ||
getNetworkInfo: '', | ||
getNetworkHashps: 'int int', | ||
getPeerInfo: '', | ||
getPoolInfo: '', | ||
getRawMemPool: 'bool', | ||
getRawChangeAddress: '', | ||
getRawTransaction: 'str int', | ||
getReceivedByAccount: 'str int', | ||
getReceivedByAddress: 'str int', | ||
getSpentInfo: 'obj', | ||
getSuperBlockBudget: 'int', | ||
getTransaction: '', | ||
getTxOut: 'str int bool', | ||
getTxOutProof: 'str str', | ||
getTxOutSetInfo: '', | ||
getWalletInfo: '', | ||
help: 'str', | ||
importAddress: 'str str bool', | ||
instantSendToAddress: 'str int str str bool', | ||
gobject: 'str str', | ||
invalidateBlock: 'str', | ||
importPrivKey: 'str str bool', | ||
importPubKey: 'str str bool', | ||
importElectrumWallet: 'str int', | ||
importWallet: 'str', | ||
keyPoolRefill: 'int', | ||
listAccounts: 'int bool', | ||
listAddressGroupings: '', | ||
listBanned: '', | ||
listReceivedByAccount: 'int bool', | ||
listReceivedByAddress: 'int bool', | ||
listSinceBlock: 'str int', | ||
listTransactions: 'str int int bool', | ||
listUnspent: 'int int str', | ||
listLockUnspent: 'bool', | ||
lockUnspent: 'bool obj', | ||
masternode: 'str', | ||
masternodeBroadcast: 'str', | ||
masternodelist: 'str str', | ||
mnsync: '', | ||
move: 'str str float int str', | ||
ping: '', | ||
prioritiseTransaction: 'str float int', | ||
privateSend: 'str', | ||
protx: 'str str str', | ||
quorum: 'str int str str str str int', | ||
reconsiderBlock: 'str', | ||
resendWalletTransactions: '', | ||
sendFrom: 'str str float int str str', | ||
sendMany: 'str obj int str str bool bool', | ||
sendRawTransaction: 'str bool bool', | ||
sendToAddress: 'str float str str', | ||
sentinelPing: 'str', | ||
setAccount: '', | ||
setBan: 'str str int bool', | ||
setGenerate: 'bool int', | ||
setTxFee: 'float', | ||
setMockTime: 'int', | ||
spork: 'str str', | ||
signMessage: 'str str', | ||
signRawTransaction: 'str str str str', | ||
stop: '', | ||
submitBlock: 'str str', | ||
validateAddress: 'str', | ||
verifyMessage: 'str str str', | ||
verifyChain: 'int int', | ||
verifyIsLock: 'str str str int', | ||
verifyTxOutProof: 'str', | ||
voteRaw: 'str int', | ||
waitForNewBlock: 'int', | ||
walletLock: '', | ||
walletPassPhrase: 'str int bool', | ||
walletPassphraseChange: 'str str', | ||
getUser: 'str', | ||
}; | ||
var slice = function (arr, start, end) { | ||
return Array.prototype.slice.call(arr, start, end); | ||
const slice = function (arr, start, end) { | ||
return Array.prototype.slice.call(arr, start, end); | ||
}; | ||
function generateRPCMethods(constructor, apiCalls, rpc) { | ||
function createRPCMethod(methodName, argMap) { | ||
return function () { | ||
var limit = arguments.length - 1; | ||
function createRPCMethod(methodName, argMap) { | ||
return function () { | ||
let limit = arguments.length - 1; | ||
if (this.batchedCalls) { | ||
limit = arguments.length; | ||
} | ||
if (this.batchedCalls) { | ||
limit = arguments.length; | ||
} | ||
for (var i = 0; i < limit; i++) { | ||
if (argMap[i]) { | ||
arguments[i] = argMap[i](arguments[i]); | ||
} | ||
} | ||
for (let i = 0; i < limit; i++) { | ||
if (argMap[i]) { | ||
arguments[i] = argMap[i](arguments[i]); | ||
} | ||
} | ||
if (this.batchedCalls) { | ||
this.batchedCalls.push({ | ||
jsonrpc: '2.0', | ||
method: methodName, | ||
params: slice(arguments), | ||
id: getRandomId() | ||
}); | ||
} else { | ||
rpc.call(this, { | ||
method: methodName, | ||
params: slice(arguments, 0, arguments.length - 1), | ||
id: getRandomId() | ||
}, arguments[arguments.length - 1]); | ||
} | ||
}; | ||
if (this.batchedCalls) { | ||
this.batchedCalls.push({ | ||
jsonrpc: '2.0', | ||
method: methodName, | ||
params: slice(arguments), | ||
id: getRandomId(), | ||
}); | ||
} else { | ||
rpc.call(this, { | ||
method: methodName, | ||
params: slice(arguments, 0, arguments.length - 1), | ||
id: getRandomId(), | ||
}, arguments[arguments.length - 1]); | ||
} | ||
}; | ||
} | ||
var types = { | ||
str: function (arg) { | ||
return arg.toString(); | ||
}, | ||
int: function (arg) { | ||
return parseFloat(arg); | ||
}, | ||
float: function (arg) { | ||
return parseFloat(arg); | ||
}, | ||
bool: function (arg) { | ||
return (arg === true || arg == '1' || arg == 'true' || arg.toString().toLowerCase() == 'true'); | ||
}, | ||
obj: function (arg) { | ||
if (typeof arg === 'string') { | ||
return JSON.parse(arg); | ||
} | ||
return arg; | ||
} | ||
}; | ||
const types = { | ||
str(arg) { | ||
return arg.toString(); | ||
}, | ||
int(arg) { | ||
return parseFloat(arg); | ||
}, | ||
float(arg) { | ||
return parseFloat(arg); | ||
}, | ||
bool(arg) { | ||
return (arg === true || arg == '1' || arg == 'true' || arg.toString().toLowerCase() == 'true'); | ||
}, | ||
obj(arg) { | ||
if (typeof arg === 'string') { | ||
return JSON.parse(arg); | ||
} | ||
return arg; | ||
}, | ||
}; | ||
for (var k in apiCalls) { | ||
var spec = apiCalls[k].split(' '); | ||
for (var i = 0; i < spec.length; i++) { | ||
if (types[spec[i]]) { | ||
spec[i] = types[spec[i]]; | ||
} else { | ||
spec[i] = types.str; | ||
} | ||
} | ||
var methodName = k.toLowerCase(); | ||
constructor.prototype[k] = createRPCMethod(methodName, spec); | ||
constructor.prototype[methodName] = constructor.prototype[k]; | ||
for (const k in apiCalls) { | ||
const spec = apiCalls[k].split(' '); | ||
for (let i = 0; i < spec.length; i++) { | ||
if (types[spec[i]]) { | ||
spec[i] = types[spec[i]]; | ||
} else { | ||
spec[i] = types.str; | ||
} | ||
} | ||
const methodName = k.toLowerCase(); | ||
constructor.prototype[k] = createRPCMethod(methodName, spec); | ||
constructor.prototype[methodName] = constructor.prototype[k]; | ||
} | ||
constructor.prototype['apiCalls'] = apiCalls; | ||
constructor.prototype.apiCalls = apiCalls; | ||
} | ||
function getRandomId() { | ||
return parseInt(Math.random() * 100000); | ||
return parseInt(Math.random() * 100000); | ||
} | ||
@@ -361,0 +368,0 @@ |
{ | ||
"name": "@dashevo/dashd-rpc", | ||
"description": "Dash Client Library to connect to Dash Core (dashd) via RPC", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"author": { | ||
@@ -42,4 +42,4 @@ "name": "Stephen Pair", | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha test -R spec", | ||
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- --recursive" | ||
"test": "mocha test -R spec", | ||
"coverage": "nyc npm run test" | ||
}, | ||
@@ -52,8 +52,8 @@ "dependencies": { | ||
"chai": "^4.2.0", | ||
"eslint": "^5.8.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^5.2.0", | ||
"sinon": "^7.1.1" | ||
"eslint": "^7.15.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"nyc": "15.1.0", | ||
"mocha": "^8.2.1", | ||
"sinon": "^9.2.2" | ||
}, | ||
@@ -60,0 +60,0 @@ "bugs": { |
@@ -1,17 +0,18 @@ | ||
RPCClient = require('./lib'); | ||
Bluebird = require('bluebird') | ||
const Bluebird = require('bluebird'); | ||
const RPCClient = require('./lib'); | ||
class PromisifyModule { | ||
constructor(options) { | ||
const client = new RPCClient(options); | ||
constructor(options) { | ||
const client = new RPCClient(options); | ||
for (let method in client.apiCalls) { | ||
let promise = Bluebird.promisify(client[method]); | ||
client[method] = promise; | ||
client[method.toLowerCase()] = promise; | ||
} | ||
// eslint-disable-next-line guard-for-in,no-restricted-syntax | ||
for (const method in client.apiCalls) { | ||
const promise = Bluebird.promisify(client[method]); | ||
client[method] = promise; | ||
client[method.toLowerCase()] = promise; | ||
} | ||
return client; | ||
} | ||
return client; | ||
} | ||
} | ||
module.exports = PromisifyModule | ||
module.exports = PromisifyModule; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29541
9
792