Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Bivrost allows to organize a simple interface to asynchronous APIs.
Easiet way to use fetch with interceptros and awesome api endpoint declaration. bivrost/packages/fetch-api-call
The main idea of Bivrost is grouping several API methods into data-sources.
Bivrost full documentation and recipes
yarn add bivrost
That’s it! Create api function for github api.
import api from 'bivrost/http/api'
import fetchAdapter from 'bivrost-fetch-adapter';
const githubApi = api({
protocol: 'https:'
host: 'api.github.com',
adapter: fetchAdapter()
});
//define API method
const repositoryList = githubApi('GET /users/:user/repos'),
//call API method
repositoryList({ user: 'tuchk4' })
.then(repositories => console.log(repositories));
Create data source that contain few github api methods (get repositories list and get repository info) and its invoke chain.
import DataSource from 'bivrost/data/source';
import githubApi from './github-api';
import tcomb from 'tcomb';
class GihtubRepositories extends DataSource {
// define invoke method chain. Default chain is - ['api', 'process']
static steps = ['api', 'immutable'];
// "define "api" step
static api = {
repos: githubApi('GET /users/:user/repos'),
repoInfo: githubApi('GET /repos/:user/:repository'),
};
// step function will be executed for each method
static immutable = response => Immutable.fromJSON(response);
// define data source public methods that invokes steps methods
getRepositories(user) {
return this.invoke('repos', {
user,
});
}
getRepositoryInfo(user, repository) {
return this.invoke('repoInfo', {
user,
repository,
});
}
}
Extends GihtubRepositories and define username. Now all requests will be done for facebook's github group.
import GihtubRepositories from './github-repositories';
const FACEBOOK_GITHUB_ACCOUNT = 'facebook';
class FacebookRepositories extends GihtubRepositories {
getRepositories() {
return super.getRepositories(FACEBOOK_GITHUB_ACCOUNT);
}
getRepositoryInfo(repository) {
return super.getRepositoryInfo(FACEBOOK_GITHUB_ACCOUNT, repository);
}
}
Project is open for new ideas and features:
FAQs
Bivrost allows to organize a simple interface to asynchronous APIs.
We found that bivrost demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
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.