Socket
Book a DemoInstallSign in
Socket

contentful-resolve-response

Package Overview
Dependencies
Maintainers
2
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contentful-resolve-response

[![npm](https://img.shields.io/npm/v/contentful-resolve-response.svg)](https://www.npmjs.com/package/contentful-resolve-response) [![CI](https://github.com/contentful/contentful-resolve-response/actions/workflows/main.yaml/badge.svg)](https://github.com/c

latest
Source
npmnpm
Version
1.9.5
Version published
Weekly downloads
596K
99.19%
Maintainers
2
Weekly downloads
 
Created
Source

contentful-resolve-response

npm CI

Suppose you have a Contentful query's response JSON. The links are nice, but what we really usually need is the response with a resolved object graph.

contentful-resolve-response does just that:

var resolveResponse = require('contentful-resolve-response');

var response = {
  items: [
    {
      someValue: 'wow',
      someLink: { sys: { type: 'Link', linkType: 'Entry', id: 'suchId' } }
    }
  ],
  includes: {
    Entry: [
      { sys: { type: 'Entry', id: 'suchId' }, very: 'doge' }
    ]
  }
};

var items = resolveResponse(response)
// Responds with the resolved array of items.

console.log(items);

// produces:
// re`solved` object [Array] of items.
  [
    {
      // Value stays the same
      someValue: 'wow',

      // Link gets replaced by the actual object from `includes.Entry`
      someLink: {sys: {type: 'Entry', id: 'suchId'}, very: 'doge'}
    }
  ]

Note that:

  • Multiple links to the same resource will point to the same object
  • Circular references are possible, still!!

FAQs

Package last updated on 09 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts