npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

redux-coreapi

v0.1.1

Published

A minimal interface between Redux and Core API JavaScript clients.

Downloads

4

Readme

redux-coreapi

redux-coreapi is a minimal interface between Redux and Core API JavaScript clients. More specifically, redux-coreapi dispatches Redux actions for Core API action and document request-response cycles, allowing Core API clients to be integrated simply into Redux applications.

Getting Started

Prerequisites

redux-coreapi does not have any prerequisites or direct dependencies, but it is assumed that it will be used alongside redux and coreapi.

Installation

Install with npm

$ npm i redux-coreapi

or yarn

$ yarn add redux-coreapi

Usage

Begin by applying the redux-coreapi middleware to the store. For example:

import { createStore, applyMiddleware } from 'redux'
import { coreapiMiddleware } from 'redux-coreapi'
import reducer from './reducer'

const store = createStore(
  reducer,
  applyMiddleware(coreapiMiddleware)
)

Use the get and action action creators to make Core API document and action requests, respectively.

import coreapi from 'coreapi'
import { action, get } from 'redux-coreapi'
import document from './path/to/existing/document'

const client = new coreapi.Client()

// Load a Core API schema document
store.dispatch(get(client, 'https://example.com/api/v1/schema'))

// Send a request to create a new object
store.dispatch(action(
  client,
  document,
  ['objects', 'create'],
  {
    name: 'Example',
    description: 'redux-coreapi example object',
  }
))

API

Full API documentation is available in docs/api.md file or at https://bitsick.github.io/redux-coreapi/api.md.

get(client, url)

Make a Core API document request.

Parameters

  • client (coreapi.Client) The Core API client instance with which the request will be made.
  • url (string) The URL of the document to request.

Returns

(Object) A Redux action for the Core API get request.

action(client, document, keys, [params])

Make a Core API action request.

Parameters

  • client (coreapi.Client) The Core API client instance with which the request will be made.
  • document (coreapi.Document) The Core API document describing the API to which the request will be sent.
  • keys (string[]) An array of strings describing the action to request. For example, ["users", "list"] or ["widgets", 0, "update"].
  • [params] (Object) Optional data to include with the request. The structure of the object depends on the action being requested.

Returns

(Object) A Redux action for the Core API action request.

Examples

See the example directory for a complete working example.

Contributing

See CONTRIBUTING.md for details on making contributions.

Versioning

This repository uses GitFlow and semantic versioning. See the tags in the master branch for the available versions.

License

Apache License 2.0