{"id":21189212,"url":"https://github.com/uptick/redux-jam","last_synced_at":"2025-03-14T20:42:20.973Z","repository":{"id":57350899,"uuid":"76770451","full_name":"uptick/redux-jam","owner":"uptick","description":"A Redux JSON API model layer.","archived":false,"fork":false,"pushed_at":"2018-04-23T04:07:36.000Z","size":734,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-02-25T21:38:14.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uptick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-18T08:02:21.000Z","updated_at":"2018-04-04T03:55:34.000Z","dependencies_parsed_at":"2022-09-16T21:12:32.466Z","dependency_job_id":null,"html_url":"https://github.com/uptick/redux-jam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uptick%2Fredux-jam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uptick%2Fredux-jam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uptick%2Fredux-jam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uptick%2Fredux-jam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uptick","download_url":"https://codeload.github.com/uptick/redux-jam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243646524,"owners_count":20324582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-20T18:50:36.804Z","updated_at":"2025-03-14T20:42:20.953Z","avatar_url":"https://github.com/uptick.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-jam\n\n[![npm version](https://badge.fury.io/js/redux-jam.svg)](http://badge.fury.io/js/redux-jam)\n![Downloads](http://img.shields.io/npm/dm/redux-jam.svg?style=flat)\n\n`redux-jam` aims to make interacting with relational database based APIs\neasier and more powerful.\n\n## Installation\n\n```bash\nnpm install redux-jam\n```\n\nor\n\n```bash\nyarn add redux-jam\n```\n\nAdd the JAM model reducer to your root reducer:\n\n```js\nimport {reducer as model} from 'redux-jam'\n\nconst rootReducer = combineReducers({\n  model,\n  ...\n})\n\nexport default rootReducer\n```\n\n\n## Defining a Schema\n\nBefore data can be manipulated a schema describing the structure of the data\nmust be defined. There are a number of ways to do it, the two most common are\nto define the data manually, or import it automatically using an external\npackage.\n\n### Manual Definition\n\nSchemas are built using the `Schema` class:\n\n```js\nimport {Schema} from 'redux-jam'\n\nlet schema = new Schema()\n```\n\nTo define models in a schema, use the `merge` method, which accepts an object\nargument describing a part of a schema:\n\n```python\nschema.merge({})\n```\n\n`merge` may be called any number of times. Each subsequent call will overwrite\nany overlapping models.\n\nThe structure of the schema object is similar in some ways to the structure of\na JSON-API object. Take for example the following definition of a movie:\n\n```js\n{\n  movie: {\n    attributes: {\n      name: {\n        required: true        \n      },\n      duration: {}\n    },\n    relationships: {\n      actors: {\n        type: \"person\",\n        many: true,\n        relatedName: \"acted_in\"\n      }\n    }\n    api: {\n      list: () =\u003e {},\n      detail: () =\u003e {},\n      create: () =\u003e {},\n      update: () =\u003e {},\n      delete: () =\u003e {}\n    }\n  },\n  person: {\n    attributes: {\n      name: {\n        required: true\n      }\n    },\n    api: {\n      list: () =\u003e {},\n      detail: () =\u003e {},\n      create: () =\u003e {},\n      update: () =\u003e {},\n      delete: () =\u003e {}\n    }\n  }\n}\n```\n\nThis defines two models: `movie` and `person`. The `api` sections of each\nmodel are placeholders for calls to API endpoints. They should return promises,\nwhich in turn return JSON-API structured data.\n\nOptions for attributes are currently limited to `required`.\n\nOptions for relationships:\n\n * type\n\n * required\n\n * many\n\n * relatedName\n\n### Django + DRF\n\nIf you're using Django and DRF, your schema can be loaded into JAM\nautomatically, which is particularly convenient.\n\nRefer to [Django-JAM](https://github.com/uptick/django-jam)\n\n## Loading Data\n\n\n## Transactions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuptick%2Fredux-jam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuptick%2Fredux-jam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuptick%2Fredux-jam/lists"}