Public
Edited
Sep 28, 2024
1 fork
Importers
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_.orderBy(
// BlogPosts with coverImages
_.filter(entries, ({ __typename, coverImage }) => {
return __typename === "BlogPost" && coverImage;
}),

// Sort by publication date
"publicationDate",
"desc"

// Return the URL of each BlogPost's coverImage
).map(({ coverImage }) => {
return entries[coverImage].url;
})
Insert cell
Insert cell
Insert cell
{
const blogPost = entriesByType.BlogPost[0]; // Some blog post
const person = entries[blogPost.authors[0]]; // First author of the blog post
const country = entries[person.countries[0]]; // First country of the first author

return country;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
_.mapValues(entriesByType, (entries) => {
return entries.length
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
graphql(`{ blogPosts { __typename, id, publicationDate, title, coverImage { __typename, id, url } } }`)
Insert cell
graphql(`{ countries { __typename, id, name, persons { __typename, id, fullName } } }`)
Insert cell
Insert cell
Insert cell
Insert cell
_demoResponse = graphql(`{
blogPosts (first: 4) {
__typename
id
publicationDate
title

coverImage {
__typename
id
url
}

authors {
__typename
id
fullName

countries {
__typename
id
name

persons {
__typename
id
fullName
}

}
}
}
}`)
Insert cell
Insert cell
Insert cell
_demoPost = _demoResponse.blogPosts.map((id) => {
return entries[id]
})[0]
Insert cell
Insert cell
_demoPost.authors
Insert cell
_demoAuthor = _demoPost.authors.map((id) => {
return entries[id]
})[0]
Insert cell
Insert cell
_demoCountry = _demoAuthor.countries.map((id) => {
return entries[id]
})[0]
Insert cell
Insert cell
_demoCountry.persons.map((id) => {
return entries[id]
})[0]
Insert cell
Insert cell
Insert cell
entriesByType.BlogPost
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
request(`{ brands { __typename, id, name } }`)
Insert cell
entriesByType.Brand
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// _graphqlRequest = require("https://bundle.run/graphql-request")
_graphqlRequest = import('https://cdn.skypack.dev/graphql-request@5.0.0?min')
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more