njosefbeck/gatsby-source-stripe

Support Image Downloading

brxck opened this issue · 3 comments

brxck commented

It would be really great if the source plugin supported the downloading of product and sku images. This would make it possible to use things like gatsby-image with the resulting nodes.

@njosefbeck, you mentioned that a separate transformer plugin might be the way to do this, but I think it might be better to keep this within the source plugin. The transformer plugin wouldn't be able to place links to the new File nodes directly on the Stripe nodes, because they cannot be directly modified after creation. Instead links would have to be placed within fields using createNodeField.

The difference is in querying
{ stripeProduct (id: { eq: "..." }) { localImages } }
vs
{ stripeProduct (id: { eq: "..." }) { fields { localImages } } }

Browsing around, it seems that this sort of thing is usually implemented by the source plugin itself, and that transformers usually create new types of nodes from others, rather than modifying old nodes.

In any case, I'd definitely like to help get this implemented. Let me know what you think!

@brxck As it seems like you've done your research, I'm cool with incorporating this feature into the source plugin itself. I'm happy to look at any implementations you come up with for this feature. Starting with skus and products for now makes sense, and then we can expand to other object types over time.

I'm not sure if this will be an issue, but when I try to get the "File" type from Stripe, it says that it's not iterable, which doesn't really make sense to me since it seems to have the same structure as all the other "list" data for the other Stripe objects. This might not even affect your work on Products and Skus, but I just thought I'd mention it.

Let me know if there's anything I can do to help and thanks for your interest in expanding this project!

Added in ac06256 (Merge Request #9 ). This update has also been published to NPM as part of v2.1.0.

Thanks again for the hard work @brxck !

You both rock! :)