Gathering detailed insights and metrics for @teamteanpm2024/illo-soluta-voluptate
Gathering detailed insights and metrics for @teamteanpm2024/illo-soluta-voluptate
npm install @teamteanpm2024/illo-soluta-voluptate
Typescript
Module System
Node Version
NPM Version
50.5
Supply Chain
93.5
Quality
78.5
Maintenance
100
Vulnerability
100
License
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Latest Version
2.0.2
Package Id
@teamteanpm2024/illo-soluta-voluptate@2.0.2
Unpacked Size
15.99 kB
Size
5.97 kB
File Count
5
NPM Version
10.5.0
Node Version
20.12.2
Published on
Apr 29, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
41
Simpler Http/s than build in node
npm install @teamteanpm2024/illo-soluta-voluptate --save
const HyperRequest = require('@teamteanpm2024/illo-soluta-voluptate')
let SimpleRestClient = new HyperRequest({
baseUrl : 'http://api.fixer.io/latest',
customLogger : function(){},
rawResponseCaller : function(a, b){
},
failWhenBadCode : true,//fails when >= a 400 code
retryOnFailure:{
fail : function(){},
min : 300.
max : 600,
retries : 5,
backOff : 10 //ms
},
gzip : true,
respondWithObject : true, //returns headers and request as well
respondWithProperty : 'data', //returns response property as top level, if set to false it returns full body
parserFunction : function(data){ return JSON.parse(data) } // optional ( defaults to JSON.parse
timeout : 4000,
maxCacheKeys : 10,
cacheTtl : 500,
enablePipe : false,
highWaterMark : 16000//set the high water mark on the transform stream
cacheByReference : false // if true cache returns back the object returned in itself, does not return a copy, thus is mutable
authorization : ''//raw authorization header if applicable
cacheIgnoreFields : ['headers.request_id']
});
SimpleRestClient.get('/endpoint', {
headers : {},
body : {}
});
const SimpleRestClient = new HyperRequest({
baseUrl : 'http://api.fixer.io/latest',
});
SimpleRestClient.get('/endpoint', {
headers : {},
body : {}
});
#Methods - all http methods support a url and options object (url, { body : {}, headers : {}, etc... }) so you can include body/headers/etc ####Http Methods get post delete put patch
clearCache()
makeRequest(verb, endpoint, opts)
getCookiesFromHeader(headersObj)
getCacheElement(key)
addCacheElement(key, value)
clone(data) - deep clone (json.parse(json.stringify(data))
deepRead(obj, accessorString)
SimpleRestClient.get('?symbols=USD,GBP', {}, succesCallbacks, failCallback);
SimpleRestClient.get('?symbols=USD,GBP', {}).then(function(){
},
function(){
});
SimpleRestClient.get(['?symbols=USD,GBP', '?symbols=GBP,USD'], {}).then(function(array){
});
SimpleRestClient.post([{},{},{},{},{}], { batch : true, batchSize : 2 }).then(function(array){
});
SimpleRestClient.get('?symbols=USD,GBP', {}).pipe(process.stdout;
let client = HyperRequest({
baseUrl : 'http://api.fixer.io/thisdoesnotexist',
customLogger : function(verb, endpoint, time){},
rawResponseCaller : function(a, b){},
debug : true,
timeout : 4000,
respondWithProperty : 'rates',
retryOnFailure : {
fail : (info) => {// a 'global' callback when a failure occurs (good for logging or retry failures)
console.log('error ' , info);
},
min : 400, //min http response code
max : 600, //max http response code
retries : 2, //number of retries
backOff : 100//backoff in ms * by retry count
}
});
let child = client.child({ url = '', headers = {}, audit})
child.get('/thing')
where audit is called on all requests and feeds back rawResponse
This will retry 1 time beyond the initial try with a 100 ms backoff, on any errors between (inclusive) of 400 and 600 http response codes because this endpoint is a 404 it will retry twice, and fail hitting both the failure callback/reject/emit error, and will hit the global fail callback
In this example we have a client which re-auths with its IAM system if it gets a 401-403 error
var dataSystem = new Request({
baseUrl : 'http://currency.svc.mylab.local',
respondWithProperty : 'data',
retryOnFailure : {
min : 401, //min http response code
max : 403, //max http response code
retries : 5, //number of retries
backOff : 100, //backoff in ms * by retry count
retryExtension : (failedResponse) => {
return iamSystem.post('sessions/login', { body : { username : 'user', password :'pass' } }).then((resp) => {
return {
persist : true,
extensions : [
{
accessor :'headers.Authentication',
value : resp.session
}
]
};
});
}
}
});
When a retry happens the retryExtension function
No vulnerabilities found.
No security vulnerabilities found.