1.1.1 • Published 6 years ago

hiro-graph-redux v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

hiro-graph-redux: Graph ORM redux middleware

This is middleware/reducer combo, a custom Token, an action creator and some actions for redux that wraps the Graph ORM (hiro-graph-orm).

installation

$ npm install hiro-graph-redux

Documentation

Please see ./docs

Example

import HiroGraphORM from "hiro-graph-orm";
import schema from "path/to/schema/mappings";

import {
    createAction,
    createStoreEnhancer,
    graphReducer,
    createToken
} from "hiro-graph-redux";

import {
    createStore,
    combineReducers
} from "redux";

const endpoint = "http://graph:8888";
// hiro-graph-redux will use the hiro-graph-implicit-oauth,
// `createToken` instantiates a new token handler for the
// redux application.
const token = createToken();
const orm = new HiroGraphORM({ endpoint, token }, schema);

const reducers = combineReducers(reducers, reducer);

//createStore from redux
const store = createStore(
    createReducer(token),
    initialState,
    createStoreEnhancer(orm)
);

//make an action creator.
const myAction = createAction(({ orm, dispatch }, ...args) => {
    return orm.findById(args).then(nodes => {
        //do something with nodes.
        //dispatch(something else)?
    });
});

store.dispatch(actionCreator("id", "id2"));
1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.4.3

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.10

7 years ago

0.2.9

7 years ago

0.2.8

7 years ago

0.2.7

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.7-beta.4

7 years ago

0.1.7-beta.3

7 years ago

0.1.7-beta.2

7 years ago

0.1.7-beta.1

7 years ago

0.1.7-beta.0

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.4-0

7 years ago

0.0.3-0

7 years ago