Skip to content

Commit

Permalink
🤖 Merge PR #54667 [contentful-resolve-response] update resolveRespons…
Browse files Browse the repository at this point in the history
…e params by @UrielCuriel
  • Loading branch information
UrielCuriel committed Aug 11, 2021
1 parent f7b79ae commit 32ac206
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@

import 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'}
]
}
items: [
{
someValue: 'wow',
someLink: { sys: { type: 'Link', linkType: 'Entry', id: 'suchId' } },
},
],
includes: {
Entry: [{ sys: { type: 'Entry', id: 'suchId' }, very: 'doge' }],
},
};

var items = resolveResponse(response)
var resolveResponseOptions = { removeUnresolved: true };
var items = resolveResponse(response, resolveResponseOptions);

console.log(items);
6 changes: 5 additions & 1 deletion types/contentful-resolve-response/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// Definitions by: Anton Karsten <https://github.com/antonkarsten>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

interface ResolveResponseOptions {
removeUnresolved?: boolean;
itemEntryPoints?: string[];
}

declare function resolveResponse(response: any): any;
declare function resolveResponse(response: any, options?: ResolveResponseOptions): any;
export = resolveResponse;

0 comments on commit 32ac206

Please sign in to comment.