{"id":15022398,"url":"https://github.com/contentful/contentful-resolve-response","last_synced_at":"2025-05-16T06:04:15.838Z","repository":{"id":17728854,"uuid":"20561211","full_name":"contentful/contentful-resolve-response","owner":"contentful","description":"Resolve items \u0026 includes of a Contentful API response into a proper object graph","archived":false,"fork":false,"pushed_at":"2025-05-09T00:34:05.000Z","size":2343,"stargazers_count":55,"open_issues_count":5,"forks_count":15,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-05-09T01:29:29.391Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/contentful.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-06-06T11:19:47.000Z","updated_at":"2025-05-09T00:34:08.000Z","dependencies_parsed_at":"2024-02-19T01:47:47.660Z","dependency_job_id":"0f8dcf18-5ce2-4585-aebc-2f9e56c1fb20","html_url":"https://github.com/contentful/contentful-resolve-response","commit_stats":{"total_commits":337,"total_committers":23,"mean_commits":"14.652173913043478","dds":0.3768545994065282,"last_synced_commit":"1922bf62aa78e4e7bdcac2e1607c8f8dc5c8b2a5"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-resolve-response","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-resolve-response/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-resolve-response/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-resolve-response/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentful","download_url":"https://codeload.github.com/contentful/contentful-resolve-response/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478186,"owners_count":22077675,"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-09-24T19:57:53.856Z","updated_at":"2025-05-16T06:04:15.739Z","avatar_url":"https://github.com/contentful.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contentful-resolve-response\n\n[![npm](https://img.shields.io/npm/v/contentful-resolve-response.svg)](https://www.npmjs.com/package/contentful-resolve-response)\n\nSuppose you have a Contentful query's response JSON. The links are\nnice, but what we really usually need is the response with a resolved\nobject graph.\n\n`contentful-resolve-response` does just that:\n\n``` js\nvar resolveResponse = require('contentful-resolve-response');\n\nvar response = {\n  items: [\n    {\n      someValue: 'wow',\n      someLink: { sys: { type: 'Link', linkType: 'Entry', id: 'suchId' } }\n    }\n  ],\n  includes: {\n    Entry: [\n      { sys: { type: 'Entry', id: 'suchId' }, very: 'doge' }\n    ]\n  }\n};\n\nvar items = resolveResponse(response)\n// Responds with the resolved array of items.\n\nconsole.log(items);\n\n// produces:\n// re`solved` object [Array] of items.\n  [\n    {\n      // Value stays the same\n      someValue: 'wow',\n\n      // Link gets replaced by the actual object from `includes.Entry`\n      someLink: {sys: {type: 'Entry', id: 'suchId'}, very: 'doge'}\n    }\n  ]\n```\n\nNote that:\n\n- Multiple links to the same resource will point to the same object\n- Circular references are possible, still!!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful-resolve-response","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentful%2Fcontentful-resolve-response","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful-resolve-response/lists"}