Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@storyous/common-utils
Advanced tools
Prometheus middleware getHttpRequestMetricsMiddleware
is now deprecated, you should remove it, same metrics can be aggregated from getRequestDurationMetricsMiddleware
alone
Added loggly adapter. To use loggly you have to set silent:false
and loggly token via LOGGLY_TOKEN
env or directly in the config.
logger.module returns pure Winston child instance, rename logger calls: log.e -> log.error log.w -> log.warn log.i -> log.info
getMongoCacheFetcher is now async mongoCachedFetcher - supports remote ETag - expose ifNoneMatch - returns result object instead of direct file content
concurrentTask accepts options object as the second parameter allowing configure: noLaterThan, startAttemptsDelay
const collection = mongodb.collection('myCachedFiles');
const fetcher = await getMongoCachedJSOFetcher(collection, /* optional */ {
url: 'https://my.files.com/file1',
cacheLifetime: 60 * 1000, // 60 seconds
fetchOptions: { headers: { Authorization: 'myToken' } }, // options for remote fetch
transform: async (content, key) => content, // allows decorate the fetched content just before its storage
ensureIndexes: true, // it allow's more optimal cache manipulation
logError: (err) => console.error(err)
});
/* optional parameters */
const parameters = {
url: 'https://my.files.com/file2', // url of json content
key: 'file2', // key, under which will be the content cached, url is used by default
metaOnly: false, // boolean, if truthy the content is not returned, useful for finding cache freshness
ifNoneMatch: 'someOldEtag', // saying, we want to get content only if the current etag is not equal to the value
};
const {
content, // file content, null in case of etagMatch=true
isCacheFresh, // boolean saying the content is not after its lifetime
etag, // entity tag (version). If not null, it can be used in future fetcher calls as ifNoneMatch parameter
etagMatch // boolean, truthy if isNoneMatch parameter provided and corresponds with latest cached etag value
} = await fetcher(parameters /* optional */ );
MongoCachedFetcher automatically stores ETag
of remote resource if it is present in response from remote source.
The stored etag is then used for consequent cache-refresh http call to optimise traffic - no data are transferred
when the data didn't change. This functionality assumes the remote source of JSON data supports If-None-Match
request header
and ETag
response header.
On top of that, the fetcher accepts optional ifNoneMatch
parameter. If it is used, and its value matches currently stored (refreshed) etag value,
result object will not contain content
and the etagMatch
will be true
.
FAQs
Common utils for storyous microservices
The npm package @storyous/common-utils receives a total of 23 weekly downloads. As such, @storyous/common-utils popularity was classified as not popular.
We found that @storyous/common-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.