
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
npm install --save api-wrappy
// contentType is for the Request header's 'Content-Type'
// responseType is for the Response header's 'Content-Type'
// cf: https://developer.mozilla.org/en-US/docs/Web/API/Response#Methods
// works for fetch or any other http client
const def = {
basePath: 'http://api.example.com',
prefix: '/v0', // not required
routes: {
'getUser': { // call name
uri: '/user/:id', // :id auto processed by 'call' and it's parameters
method: 'get',
responseType: 'json',
},
'createUser': {
uri: '/user',
method: 'post',
contentType: 'application/xml', // I know xml sucks, it's just an example
responseType: 'json',
},
...
},
};
// app.config.js
import Wrappy from 'api-wrappy'; // wrapper inside node_modules
import def from './def.js';
const wrapper = new Wrappy(def);
// OR directly define, whatever
const wrapper = new Wrappy({...});
export default wrapper;
import wrapper from './app.config.js';
async function apiCalls() {
try {
wrapper.call('getUser', {id: 24}).then((user) => {
...
});
} catch (err) {
// handle error
console.log('Error: ', err);
}
// OR
wrapper.call('getUser', {id: 24}) // still works as async returns a promise
.then((user) => {...})
.catch((e) => {
// handle not found or whatever
console.log('Error: ', err);
});
// OR
try {
const user = await wrapper.call('getUser', {id: 24});
const userList = await wrapper.call('createUser', {
headers: {Authorization: 'Bearer <ANiceToken>'},
body: {name: 'Foo'},
});
//OR
const ret = wrapper.callMultiple([
wrapper.call('getUser', {id: 24}),
wrapper.call('createUser', {...}),
...
]); // ret = [response for getUser, response for createUser, ...]; <- Very powerful
} catch(err) {
console.log('Error: ', err); // Errors are caught, allelujah!
}
}
FAQs
Just a simple flexible webservice wrapper
We found that api-wrappy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.