taessina / gatsby-source-firestore Goto Github PK
View Code? Open in Web Editor NEWGatsby source plugin for building websites using the Firestore as a data source.
Gatsby source plugin for building websites using the Firestore as a data source.
I try to use your demo on my firestore DB but I did not understand the mapping
My firestore base:
collections | document |
books > > author: 'fred'
title: 'my book'
My mapping file
types: [
{
type: 'Book',
collection: 'books',
map: doc => ({
title: doc.title,
author: doc.author
}),
},
],
graphQl browser returns
{
allBook {
edges {
node {
id
}
}
}
}
graphQL does not return title and author
If Firebase auth fails, the plugin should handle this in order to not break the gatsby build.
This is desired when working on a gatsby project and having no data source at hand.
Would the firebase.json (containing adminSDK) not get pushed into build and therefore publicly accessible in my front end?
I thought if it got imported it goes into the end result. Also, are there any working examples of this? Not just snippets without context.
The Error
Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "3hWjFg8z7faY" doesnt.
GraphQL does not like nodes that start with numbers. The library you based this off of has a way of doing it but could you just prepend a string "id" when you create the nodes.
here is how the other library attacks it
// This allows you to map your data to data that GraphQL likes:
// 1. Turn your lists into actual arrays
// 2. Fix keys that GraphQL hates. It doesn't allow number keys
// like "0", you'll get this error pretty often:
// Error: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "0" does not
// 3. Remove stuff you don't need.
//
// Feel free to mutate, we sent you a copy anyway.
map: node => {
// fix keys graphql hates
node.nineteenEightyFive = node['1985']
delete node['1985']
// convert a child list to an array:
return node.sessions = Object.keys(node.sessions).map(key => {
return { _key: key, session: node.sessions[key] }
})
// finally, return the node
return node
},
},
Can somebody change plugin version so we can install it with latest changes, please ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.