Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@drieam/api
Advanced tools
@drieam/api is middelware for redux. This library handles async AJAX request against Drieam or Canvas Restful APIs.
$ yarn add @drieam/api redux
import { Base } from '@drieam/api';
class User { public id: number; public name: string; }
export type API = { users: User };
const apiRoutes: ApiRoutes<API> = {
users: {
path: '/lti/proxy/api/v1/users/:id?',
mapper: User,
list: true,
options: {
onError: (action) => { console.error(action.response.error) },
}
},
};
import * as api from '@drieam/api';
import { combineReducers } from 'redux';
import { apiRoutes, API } from './api';
export const rootReducer = combineReducers({
api: api.reducers.connect<API>(apiRoutess),
});
import { createStore, applyMiddleware } from 'redux';
import * as api from '@drieam/api';
import { apiRoutes } from './api';
import rootReducer from './reducers/index';
const store = createStore(rootReducer, applyMiddleware([...api.apiMiddlewares(apiRoutes, /* options */)]));
import * as api from '@drieam/api';
import { API } from './api';
const base = api.actions.connect<API>(apiRoutes, options);
dispatch(base.users.fetchEntity(1))
Routing Structure is base of a key-value object where you can configure your basic reducer structure for use cases where you need to fetch data from Rest APIs. This structure is base on a type and a Hash object from that type.
{ path: '/lti/proxy/api/v1/users/:id?' }
{
path: path => [
'/api/v1/categories',
path.id && path.id,
path.sorting && 'sort'
].filter(Boolean).join('/');
}
}
{ mapper: User } // User is a class
{ mapper: data => data }
Note: Whether
list
orentity
should be defined. If both are not defined or false,redux
will complaint with an error.
{ entity: true, list: true }
{ list: (state, action) => { return state } }
'id'
): collection's unique key.'append'
) Order of insertion a listState.'PUT'
) Set the default update method.'same-origin'
) The request credentials you want to use for the request: omit
, same-origin
, or include
. To automatically send cookies for the current domain, this option must be provided.'Attributes'
) A string to transform the collection name before sending.{}
) HTTP headers allow the client and the server to pass additional information with the request or the response. An HTTP header consists of its case-insensitive name.redux-form
) Return a specific submission error format.
antd
: Antd Forms error format.final-form
: Final-form error format.redux-form
: Redux-form error format. (Deprecated)false
: default by the api.Creates an object
structure with all the redux actions needed for each resource definition.
const actions = api.actions.connect<{ users: any }>(api);
This action refresh the data in the reducer.
This page is added in the reducer.
fetchPage({ page: 'next' })
.attributes
can be one or many and it will be update per id position. Ex: actions.user.saveList([1, 2], { name: 'Peter' });
Creates an object
structure with all the redux actions needed for each resource definition.
const apiReducers = api.reducers.connect<{ users: any }>(api);
{
pending: boolean = false // True if data is still being loaded for the first time.
fulfilled: boolean = false // True if data was loaded successfully.
rejected: boolean; = false // True if data was loaded unsuccessfully.
settled: boolean; = false // True if the data load completed, if successfully or unsuccessfully.
value: T | null = null // Value of successfully loaded data; otherwise, null.
reason: string = null // Error of unsuccessfully loaded data; otherwise, null
status: number = null // Last HTTP [status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes).
}
We welcome all contributors who abide by our Code of Conduct. Please see the Contributors Guide for more details on submitting a PR, setting up a local dev environment, running tests, etc...
Until this project reaches a 1.0 milestone, minor version numbers will simply be incremented during each release. The Changelog will continue to document the different types of updates, including any "breaking changes".
After the 1.0 milestone, this project will follow SemVer.
FAQs
Default Drieam api wrapper
The npm package @drieam/api receives a total of 3 weekly downloads. As such, @drieam/api popularity was classified as not popular.
We found that @drieam/api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.