{"id":30797231,"url":"https://github.com/sborrazas/redux-apimap","last_synced_at":"2026-05-07T13:04:19.543Z","repository":{"id":57350211,"uuid":"83356562","full_name":"sborrazas/redux-apimap","owner":"sborrazas","description":"Integrate your Redux application with your RESTful API","archived":false,"fork":false,"pushed_at":"2021-05-24T12:26:42.000Z","size":21,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T22:04:22.358Z","etag":null,"topics":["api","flux","javascript","react","redux","rest","rest-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sborrazas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-27T21:02:34.000Z","updated_at":"2021-05-24T12:26:44.000Z","dependencies_parsed_at":"2022-08-28T19:00:31.990Z","dependency_job_id":null,"html_url":"https://github.com/sborrazas/redux-apimap","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sborrazas/redux-apimap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sborrazas%2Fredux-apimap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sborrazas%2Fredux-apimap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sborrazas%2Fredux-apimap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sborrazas%2Fredux-apimap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sborrazas","download_url":"https://codeload.github.com/sborrazas/redux-apimap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sborrazas%2Fredux-apimap/sbom","scorecard":{"id":802811,"data":{"date":"2025-08-11","repo":{"name":"github.com/sborrazas/redux-apimap","commit":"126a7f80f2988e5c22db35d0de623af3ed6f961b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/25 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T10:57:00.561Z","repository_id":57350211,"created_at":"2025-08-23T10:57:00.561Z","updated_at":"2025-08-23T10:57:00.561Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32738827,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","flux","javascript","react","redux","rest","rest-api"],"created_at":"2025-09-05T17:51:44.515Z","updated_at":"2026-05-07T13:04:19.524Z","avatar_url":"https://github.com/sborrazas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux ApiMap\n\n[![Build Status](https://travis-ci.org/sborrazas/redux-apimap.svg?branch=master)](https://travis-ci.org/sborrazas/redux-apimap)\n\nBuild your API wrapper to dispatch actions, by mapping every action an API\nendpoint.\n\n**Does not create actions or reducers**, instead it provides a simple API\nwrapper built on top of the [fetch API](https://fetch.spec.whatwg.org/), with\nsome additional options for ease of use (JSON/multipart-form wrapper, global\nconfiguration, etc).\n\nRequires [React](https://github.com/facebook/react) to render components.\n\n## Install\n\n```\nnpm install redux-apimap\n```\n\n## Examples\n\n### Quickstart\n\n1. Create the API object with all the endpoints and actions for each endpoint:\n    ```js\n    import { createApi } from 'redux-apimap';\n\n    import store from './store'; // Redux store\n\n    export default createApi(store, {\n      users: {\n        path: '/users',\n        actions: {\n          fetch: {\n            types: [USERS_FETCH, USERS_FETCH_SUCCESS, USERS_FETCH_FAILURE],\n          },\n          create: {\n            types: [USERS_CREATE, USERS_CREATE_SUCCESS, USERS_CREATE_FAILURE],\n            method: 'POST', // Option, submit request with POST\n            multipart: true, // Option, submit request as multipart\n          }\n        }\n      }\n    }, { json: true, CSRFToken: 'a7136f333552c6d4' });\n    ```\n\n2. Make the API object visible through the ApiProvider:\n    ```js\n    import { ApiProvider } from 'redux-apimap';\n    import { Provider } from 'react-redux';\n\n    import api from './api';\n\n    export default class AppWrapper extends React.PureComponent {\n      render() {\n        return (\n          \u003cProvider store={store}\u003e\n            \u003cApiProvider api={api}\u003e\n              \u003cApp /\u003e\n            \u003c/ApiProvider\u003e\n          \u003c/ReduxProvider\u003e\n        );\n      }\n    }\n    ```\n\n3. Dispatch actions with the api throughout the app:\n    ```js\n    const UsersAddButton = ({ api }) =\u003e {\n      return (\n        \u003cbutton\n          onClick={(e) =\u003e {\n            const name = prompt('Enter user name');\n            api.users.create({ name })\n              .then(() =\u003e alert('User created!'))\n              .catch((error) =\u003e alert(error));\n          }}\n        \u003e+ Add new\u003c/button\u003e\n      );\n    };\n\n    export default connectApi(UsersAddButton);\n    ```\n\n  **Note:** `redux-apimap` does not handle the application state or state\n  changes with reducers, **it only does action dispatching**.\n\nThe dispatched actions have the following structure:\n* `type` — The `PENDING`, `SUCCESS` or `FAILURE` type provided on the endpoint\n  action specification.\n* `params` — The parameters sent when calling the API endpoint action (e.g.\n  `api.users.create(params)`).\n* `url` — The URL in which the HTTP request was sent to.\n* `data` — If the `json: true` option was specified, contains the response\n  content. Otherwise, it contains the response itself provided by the\n  [fetch API](https://fetch.spec.whatwg.org/). Only\n  present on the `SUCCESS` and `FAILURE` actions.\n\nSample action set:\n```js\n// PENDING\n{\n  type: 'USER_UPDATE',\n  payload: {\n    params: { name: 'Officer Barbrady' },\n    url: '/users/1'\n  }\n}\n\n// SUCCESS (when json: true)\n{\n  type: 'USER_UPDATE_SUCCESS',\n  payload: {\n    params: { name: 'Officer Barbrady' },\n    url: '/users/1',\n    data: {\n        id: 1,\n        name: 'Officer Barbrady'\n    }\n  }\n}\n\n// FAILURE (when json: true)\n{\n  type: 'USER_UPDATE_FAILURE',\n  payload: {\n    params: { name: '' },\n    url: '/users/1',\n    data: {\n        { name: 'too short' }\n    }\n  }\n}\n```\n\n\n### Full example\n\n```js\nimport { Provider, createStore, connect } from 'react-redux';\nimport {\n  createApi,\n  ApiProvider,\n  connectApi\n} from 'redux-apimap';\nimport store from './store';\n\n// Specify the API endpoints and each action that it allows.\nconst users = {\n  path: '/users',\n  actions: {\n    fetch: {\n      types: [USERS_FETCH, USERS_FETCH_SUCCESS, USERS_FETCH_FAILURE],\n      // method: 'GET' // DEFAULT\n    },\n    create: {\n      types: [USERS_CREATE, USERS_CREATE_SUCCESS, USERS_CREATE_FAILURE],\n      method: 'POST', // Option, submit request with POST\n      multipart: true, // Option, submit request as multipart\n    }\n  }\n};\n\n// Create the API with the previously defined endpoints and any configuration\n// necessary.\nconst api = createApi(store, {\n  users,\n}, { json: true });\n\n// Make the API visible for child components through the \u003cProvider\u003e component.\nexport default class AppWrapper extends React.PureComponent {\n  render() {\n    return (\n      \u003cProvider store={store}\u003e // Redux provider\n        \u003cApiProvider api={api}\u003e\n          \u003cUsers /\u003e\n        \u003c/ApiProvider\u003e\n      \u003c/ReduxProvider\u003e\n    );\n  }\n}\n\nclass UsersList extends React.PureComponent {\n  render() {\n    const { api, users: { isLoading, data } } = this.props;\n    const addUser = () =\u003e {\n      api.users.create({\n        name: prompt('Enter user name')\n      })\n    };\n\n    return (\n      \u003cul\u003e\n        {\n          isLoading \u0026\u0026\n            data.map((user) =\u003e {\n              return (\u003cli\u003e{user.name}\u003c/li\u003e);\n            })\n        }\n        \u003cli\u003e\n          \u003cbutton onClick={addUser}\u003e+ Add new\u003c/button\u003e\n        \u003c/li\u003e\n      \u003c/ul\u003e\n    );\n  }\n}\n\nconst mapStateToProps = (state) =\u003e {\n  return {\n    users: state.users\n  };\n};\n\nUsersList = connect( // Redux connect\n  mapStateToProps\n)(connectApi(UsersList)); // Api connect\n```\n\n## API\n\n### `\u003cApiProvider api\u003e`\n\nThe wrapper React component to allow child components access the API object.\n\n#### Props\n\n* `api` (required) — The [Redux ApiMap API object](#apimap-api).\n* `children` — The React children components.\n\n### createApi(store, endpoints, config)\n\n#### Arguments\n\n* `store` (required) — The\n  [Redux Store](http://redux.js.org/docs/basics/Store.html).\n* `endpoints` (required) — An object mapping all the API endpoints. Each\n  endpoint has the following specification:\n  * `path` (required) — The path of the endpoint. This allows interpolating\n    parameters (e.g. `/users/:id/posts`).\n  * `actions` (required) — The actions this endpoint allows. Each action has the\n    following specification:\n    * `types` (required) — An array of 3 values (`[PENDING, SUCCESS, FAILURE]`)\n      specifying the types for when the API request is made, responds\n      successfully and fails respectively.\n    * Any additional configuration for this specific action. This configuration\n      object has the same values as the `config` configuration from below.\n    * `path` (optional) – If present, appends this path to the endpoint's path.\n* `config` (optional, default `{}`) — Configuration that is used for all\n  actions. Specification:\n  * `fetch` (optional, defaults to the\n    [fetch API](https://fetch.spec.whatwg.org/)) — The\n    function to use to perform the HTTP request.\n  * `method` (optional, default `GET`) — The method of the HTTP request.\n  * `multipart` (optional, default `false`) — If `true`, a multipart HTTP\n    request will be sent (overrides `json` option).\n  * `json` (optional, default `false`) — If true, a JSON-formatted HTTP request\n    will be sent. This also sets the `Accept` header to `application/json`.\n  * `baseUrl` – If present, prefixes every path with this URL.\n  * Any additional options that can be sent to the\n    [fetch API](https://fetch.spec.whatwg.org/) function.\n\n### connectApi(Component)\n\nConnect the React component to get the `api` prop.\n\n#### Arguments\n\n* `Component` (required) — The React component to connect to. Must be nested\n  somewhere inside the `ApiProvider` component.\n\n## Sample configurations\n\n### Include CSRF header\n\n```js\ncreateApi(store, endpoints, {\n  headers: {\n    'X-CSRFToken': document.getElementsByName(\"csrf-token\")[0].content,\n  },\n});\n```\n\n**Note:** `X-CSRF-Token` header is used for Flask/Django applications. Use\n`X-CSRF-Token` for Rack applications.\n\n## Authors\n\n**Sebastián Borrazás**\n\n* [sborrazas.com](http://sborrazas.com)\n\nInspired by [react-redux](https://github.com/reactjs/react-redux) and\n[redux-rest](https://github.com/Kvoti/redux-rest).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsborrazas%2Fredux-apimap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsborrazas%2Fredux-apimap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsborrazas%2Fredux-apimap/lists"}