Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@fresh-data/framework
Advanced tools
Fresh Data Framework is a declarative data API framework for JavaScript apps.
Fresh Data is new. Very new. As such it should not be used in production just yet! This code will be changing still.
Try it out on something noncritical and provide some feedback!
npm install --save @fresh-data/framework
There is support for React applications using Redux for an internal cache available from @fresh-data/react-redux
Each API Specification can be kept in your application or a separate module.
import { compact, startsWith } from 'lodash';
const URL_ROOT = 'http://example.com/';
const get( endpointPath, params ) => {
const uri = URL_ROOT + endpointPath.join( '/' );
const queryString = qs.stringify( params );
return fetch( `${ uri }?${ query }` );
}
const put( endpointPath, params ) => {
const uri = URL_ROOT + endpointPath.join( '/' );
const { data } = params;
return fetch( uri, { method: 'PUT', body: JSON.stringify( data ) } );
}
const apiSpec = {
operations: {
read: ( resourceNames ) => {
return compact( resourceNames.map( resourceName => {
if ( startsWith( resourceName, 'thing:' ) ) {
const thingNumber = resourceName.substr( resourceName.indexOf( ':' ) + 1 );
const request = get( [ 'things' ] ).then( responseData => {
return { [ resourceName ]: { data: responseData } };
} );
return request;
}
} ) );
},
update: ( resourceNames, resourceData ) => {
return compact( resourceNames.map( resourceName => {
if ( startsWith( resourceName, 'thing:' ) ) {
const thingNumber = resourceName.substr( resourceName.indexOf( ':' ) + 1 );
const data = resourceData[ resourceName ];
const request = put( [ 'things' ], { data } ).then( responseData => {
return { [ resourceName ]: { data: responseData } };
} );
return request;
}
} ) );
}
},
mutations: {
updateThing: ( operations ) => ( thingId, data ) => {
const resourceName = `thing:${ thingId }`;
const resourceNames = [ resourceName ];
const resourceData = { [ resourceName ]: data };
return operations.update( resourceNames, resourceData );
}
},
selectors: {
getThing: ( getResource, requireResource ) => ( requirement, thingId ) => {
const resourceName = `thing:${ thingId }`;
return requireResource( requirement, resourceName );
}
}
};
export apiSpec;
Your own API depends on the operations, methods, and selectors you define.
Fresh Data is functional, but still a work in progress. Here's what's next on the list:
FAQs
Describe the data you need and simply use it in your app.
We found that @fresh-data/framework 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.