{"id":19195288,"url":"https://github.com/fixate/redux-resx","last_synced_at":"2026-05-03T20:37:11.595Z","repository":{"id":57351393,"uuid":"85171990","full_name":"fixate/redux-resx","owner":"fixate","description":"(Yet another) Redux action creators, a reducer and middleware for resource-based APIs","archived":false,"fork":false,"pushed_at":"2018-05-16T10:55:28.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-16T16:47:53.966Z","etag":null,"topics":["react","redux","resources","rest-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fixate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-16T08:35:32.000Z","updated_at":"2018-05-16T10:55:23.000Z","dependencies_parsed_at":"2022-08-31T06:10:17.792Z","dependency_job_id":null,"html_url":"https://github.com/fixate/redux-resx","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/fixate/redux-resx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixate","download_url":"https://codeload.github.com/fixate/redux-resx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixate%2Fredux-resx/sbom","scorecard":{"id":401868,"data":{"date":"2025-08-11","repo":{"name":"github.com/fixate/redux-resx","commit":"a8ba8a899a29896ea9af64a75993bfd3d3a58ec9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"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":"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":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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":"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":"Vulnerabilities","score":0,"reason":"48 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T20:15:16.994Z","repository_id":57351393,"created_at":"2025-08-18T20:15:16.995Z","updated_at":"2025-08-18T20:15:16.995Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32584482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: 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":["react","redux","resources","rest-api"],"created_at":"2024-11-09T12:09:32.197Z","updated_at":"2026-05-03T20:37:11.574Z","avatar_url":"https://github.com/fixate.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redux API Resource creator (redux-resx)\n\n[![Build Status](https://travis-ci.org/fixate/redux-resx.svg?branch=master)](https://travis-ci.org/fixate/redux-resx)\n\nYet another Redux action creators, a reducer and middleware for resource-based APIs.\n\n`resx = shortening for resource`\n\nBased on the async actions pattern in redux (https://redux.js.org/docs/advanced/AsyncActions.html)\n\n## Installation\n\n```shell\nnpm install --save redux-resx\n```\n\n## Usage\n\n### Resource Definition\n\nA resource is a grouping of redux reducers, actions and selectors for your api endpoint. You define a unique name for it and the url. You can also add your own reducer to augment the state at the \"mountpoint\" on the state store.\n\n```javascript\n// somewhere like src/resources/user.js\nimport createResource from 'redux-resx';\n\nexport default createResource({\n  // Required:\n  name: '@resx/USER', // Unique namespace for actions and reducer\n  url: '/users',\n\n  // Optional (defaults shown)\n  // This function should return the root object of where you mount your state\n  baseSelector: s =\u003e s.resources,\n  // Use this to add extra reducers which receive the state after the built-in reducer\n  // has done it's thing - this can perhaps be used in conjunction with custom middleware\n  // It only receives resource actions, not every action\n  reducer: (state, _action) =\u003e state,\n});\n\n\n// src/resources/index.js\nexport default as user from './user';\n```\n\n### Reducer\n\n```javascript\nimport { combineReducers } from 'redux';\n\nimport * as resources from '../resources';\nimport { reducer as resourceReducer } from 'redux-resx';\n\nexport default combineReducers({\n  resources: combineReducers(resourceReducer(resources)),\n});\n```\n\nLets break this down a bit:\n\n```javascript\nexport default combineReducers({\n  // 'resources' can be anywhere, you just need to specify a base selector that selects it in\n  // create resource\n  resources: combineReducers(\n    // resourceReducer is really just transforms the object to something that combineReducers can use\n    // Give it { users: [result of createResource] } and it will return { users: reducerFn } - simple\n    resourceReducer(resources)\n  ),\n});\n\n\n// Another way you could do this\n\nimport userResource from '../resources/users';\n...\nresources: combineReducers({\n  myUser: userResource.reducer,\n  //etc\n})\n```\n\n### Component\n\n*Please see the NB comments*\n\n```javascript\nimport React, { PropTypes } from 'react';\nimport { connect } from 'react-redux';\n\nimport { user as userResx } from '../resources';\n\n// NB: New in 1.0.0+\n// *************************************************************************\n// You need to provide a namespace for your 'instance' (any string) that you want to use.\n// This is so you can call a resource in multiple components without interferance.\nconst myUserResx = userResx.create('@HOME');\n// If you omit the namespace, a default one will be used (essentially the same behaviour prior to 1.0.0)\n// const myUserResx = userResx.create();\n// Using the default method, returns a singleton instance for reuse\n// const myUserResx = userResx.default();\n\nconst Home = React.createClass({\n//....\n\n  componentWillMount() {\n    const { getUser, findUsers, resetUsers } = this.props;\n    // XXX: Optional, you'll get old results before new ones are loaded if you don't do this.\n    // New in 1.0.0: If your resource is only used in this component and you destroy on unmount,\n    // you definitely/obviously won't need to use reset.\n    resetUsers();\n    findUsers({ status: 'active' }); // params of request\n    getUser(123).then(...); // id=123 NB: only if middleware returns a promise\n  },\n\n  // NB: New in 1.0.0 - will remove the namespaced data entirely\n  componentWillUnmount() {\n    this.props.destroyResx();\n  }\n\n  render() {\n    const { users, user } = this.props;\n\n    return (\n      \u003cdiv\u003e\n        {users ? JSON.stringify(users) : null}\n        {user ? JSON.stringify(user) : null}\n      \u003c/div\u003e\n    );\n  },\n});\n\nfunction mapStateToProps(state) {\n  // Select the resource state\n  const {\n    hasLoaded, // true when find has been loaded before\n    isBusy, // true when any of the following are true\n    isFinding,\n    isGetting,\n    isCreating,\n    isUpdating,\n    isPatching,\n    isRemoving,\n\n    // Result for find - always an array (initial value: [])\n    items,\n\n    // Last result for create, get, update, patch, remove\n    entity, // (initial value: undefined)\n  } = userResx.selector(state);\n\n  return {\n    users: items,\n    user: entity,\n    isBusy,\n  };\n}\n\nconst { find: findUsers, get: getUser, reset: resetUsers, destroy: destroyResx } = myUserResx.actions;\n\nexport default connect(mapStateToProps, {\n  findUsers,\n  getUser,\n  resetUsers,\n  destroyResx,\n})(Home);\n```\n\n## Selector\n\nEach `resx` has a selector function which can be used to select the resource from the state store.\n\nA `resx` has the following structure:\n\n```javascript\n// Initial structure of resx\n{\n  hasLoaded: false, // Has the resource loaded before (has find returned a result and items populated)\n  isBusy: false, // true if any operation is running on this resx, otherwise false\n  isFinding: false, // true if find call is busy, otherwise false\n  isGetting: false, // true if get call is busy, otherwise false\n  isCreating: false, // true if create call is busy, otherwise false\n  isUpdating: false, // true if update call is busy, otherwise false\n  isPatching: false, // true if patch call is busy, otherwise false\n  isRemoving: false, // true if remove call is busy, otherwise false\n  items: [], // The result of a find call\n  entity: undefined, // The result of the last get, create, patch, update and remove call\n  lastError: undefined, // The result of the call if it was an error\n}\n```\n\n## Middlewares\n\nThe middleware's job is to \"handle\" the actions coming in from resource action creators. This\nis where the side-effects are. A middleware is included which calls endpoints like\nyou would expect, but you can implement your own or use e.g. sagas.\n\n### Builtin middleware\n\nAdd middleware to store in the normal way\n\n```javascript\n// NB: Only bundled if you are using it\nimport middleware from 'redux-resx/middleware';\nimport fetch from 'isomorphic-fetch';\n//... other imports\n\nconst resxMiddleware = middleware({\n  baseUrl: '/api',\n  provider: fetch, // could write adapter to convert fetch params to e.g. request/jquery\n});\n\nexport default function createApplicationStore() {\n  return createStore(\n    reducers,\n    compose(applyMiddleware(resxMiddleware))\n  );\n}\n```\n\n### Other middleware\n\n- [redux-resx-feathers-middleware](https://github.com/fixate/redux-resx-feathers-middleware) - uses `feathers-client` to make requests\n- redux-resx-saga - sagas to handle resource actions (TODO)\n\n## TODO\n\n* Example\n\n## Future Ideas\n\n* Middleware (separate package) that implements a decoupled cache using state\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Fredux-resx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixate%2Fredux-resx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixate%2Fredux-resx/lists"}