Skip to content

Commit

Permalink
feat(gatsby-source-shopify): use gatsby node id to enable relationshi…
Browse files Browse the repository at this point in the history
…ps (#37775) (#37786)

* feat(gatsby-source-shopify): use gatsby node id to enable relationships

* remove console.Log

* Enable jest

* fix tests

(cherry picked from commit a2c3fa3)

Co-authored-by: Ward Peeters <ward@coding-tech.com>
  • Loading branch information
ViCo0TeCH and wardpeet committed Mar 27, 2023
1 parent b1abb5b commit 0f838b2
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,7 @@ Array [
width
}
featuredMedia {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
feedback {
details {
Expand Down Expand Up @@ -318,18 +307,7 @@ Array [
media {
edges {
node {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
}
}
Expand Down Expand Up @@ -699,18 +677,7 @@ Array [
width
}
featuredMedia {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
feedback {
details {
Expand Down Expand Up @@ -982,18 +949,7 @@ Array [
media {
edges {
node {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
}
}
Expand Down Expand Up @@ -1363,18 +1319,7 @@ Array [
width
}
featuredMedia {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
feedback {
details {
Expand Down Expand Up @@ -1646,18 +1591,7 @@ Array [
media {
edges {
node {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
}
}
Expand Down Expand Up @@ -2027,18 +1961,7 @@ Array [
width
}
featuredMedia {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
feedback {
details {
Expand Down Expand Up @@ -2310,18 +2233,7 @@ Array [
media {
edges {
node {
... on ExternalVideo {
id
}
... on MediaImage {
id
}
... on Model3d {
id
}
... on Video {
id
}
id
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,12 @@ Array [
",
"
type __PREFIX__ShopifyProduct implements Node @dontInfer {
_featuredMedia: String! # Temporary field so we don't break existing users
createdAt: Date! @dateformat
description: String!
descriptionHtml: String!
featuredImage: __PREFIX__ShopifyImage
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"featuredMedia.shopifyId\\", by: \\"shopifyId\\")
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"_featuredMedia\\", by: \\"id\\")
feedback: __PREFIX__ShopifyResourceFeedback
giftCardTemplateSuffix: String
handle: String!
Expand Down Expand Up @@ -764,6 +765,7 @@ Array [
",
"
type __PREFIX__ShopifyProductVariant implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
availableForSale: Boolean!
barcode: String
compareAtPrice: Float
Expand All @@ -780,7 +782,7 @@ Array [
position: Int!
presentmentPrices: [__PREFIX__ShopifyProductVariantPricePair!]!
price: Float!
product: __PREFIX__ShopifyProduct! @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct! @link(from: \\"_product\\", by: \\"id\\")
requiresShipping: Boolean! @deprecated(reason: \\"Use \`InventoryItem.requiresShipping\` instead.\\")
selectedOptions: [__PREFIX__ShopifySelectedOption!]!
sellingPlanGroupCount: Int!
Expand Down Expand Up @@ -925,9 +927,10 @@ Array [
}
type __PREFIX__ShopifyInventoryLevel implements Node @dontInfer {
_location: String! # Temporary field so we don't break existing users
available: Int!
id: ID!
location: __PREFIX__ShopifyLocation! @link(from: \\"location.shopifyId\\", by: \\"shopifyId\\")
location: __PREFIX__ShopifyLocation! @link(from: \\"_location\\", by: \\"id\\")
shopifyId: String!
}
Expand Down Expand Up @@ -976,8 +979,9 @@ Array [
",
"
type __PREFIX__ShopifyLineItem implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
id: ID!
product: __PREFIX__ShopifyProduct @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct @link(from: \\"_product\\", by: \\"id\\")
shopifyId: String!
}
Expand Down Expand Up @@ -1704,11 +1708,12 @@ Array [
",
"
type __PREFIX__ShopifyProduct implements Node @dontInfer {
_featuredMedia: String! # Temporary field so we don't break existing users
createdAt: Date! @dateformat
description: String!
descriptionHtml: String!
featuredImage: __PREFIX__ShopifyImage
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"featuredMedia.shopifyId\\", by: \\"shopifyId\\")
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"_featuredMedia\\", by: \\"id\\")
feedback: __PREFIX__ShopifyResourceFeedback
giftCardTemplateSuffix: String
handle: String!
Expand Down Expand Up @@ -1770,6 +1775,7 @@ Array [
",
"
type __PREFIX__ShopifyProductVariant implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
availableForSale: Boolean!
barcode: String
compareAtPrice: Float
Expand All @@ -1786,7 +1792,7 @@ Array [
position: Int!
presentmentPrices: [__PREFIX__ShopifyProductVariantPricePair!]!
price: Float!
product: __PREFIX__ShopifyProduct! @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct! @link(from: \\"_product\\", by: \\"id\\")
requiresShipping: Boolean! @deprecated(reason: \\"Use \`InventoryItem.requiresShipping\` instead.\\")
selectedOptions: [__PREFIX__ShopifySelectedOption!]!
sellingPlanGroupCount: Int!
Expand Down Expand Up @@ -2524,11 +2530,12 @@ Array [
",
"
type __PREFIX__ShopifyProduct implements Node @dontInfer {
_featuredMedia: String! # Temporary field so we don't break existing users
createdAt: Date! @dateformat
description: String!
descriptionHtml: String!
featuredImage: __PREFIX__ShopifyImage
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"featuredMedia.shopifyId\\", by: \\"shopifyId\\")
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"_featuredMedia\\", by: \\"id\\")
feedback: __PREFIX__ShopifyResourceFeedback
giftCardTemplateSuffix: String
handle: String!
Expand Down Expand Up @@ -2590,6 +2597,7 @@ Array [
",
"
type __PREFIX__ShopifyProductVariant implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
availableForSale: Boolean!
barcode: String
compareAtPrice: Float
Expand All @@ -2606,7 +2614,7 @@ Array [
position: Int!
presentmentPrices: [__PREFIX__ShopifyProductVariantPricePair!]!
price: Float!
product: __PREFIX__ShopifyProduct! @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct! @link(from: \\"_product\\", by: \\"id\\")
requiresShipping: Boolean! @deprecated(reason: \\"Use \`InventoryItem.requiresShipping\` instead.\\")
selectedOptions: [__PREFIX__ShopifySelectedOption!]!
sellingPlanGroupCount: Int!
Expand Down Expand Up @@ -2751,9 +2759,10 @@ Array [
}
type __PREFIX__ShopifyInventoryLevel implements Node @dontInfer {
_location: String! # Temporary field so we don't break existing users
available: Int!
id: ID!
location: __PREFIX__ShopifyLocation! @link(from: \\"location.shopifyId\\", by: \\"shopifyId\\")
location: __PREFIX__ShopifyLocation! @link(from: \\"_location\\", by: \\"id\\")
shopifyId: String!
}
Expand Down Expand Up @@ -2802,8 +2811,9 @@ Array [
",
"
type __PREFIX__ShopifyLineItem implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
id: ID!
product: __PREFIX__ShopifyProduct @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct @link(from: \\"_product\\", by: \\"id\\")
shopifyId: String!
}
Expand Down Expand Up @@ -3525,11 +3535,12 @@ Array [
",
"
type __PREFIX__ShopifyProduct implements Node @dontInfer {
_featuredMedia: String! # Temporary field so we don't break existing users
createdAt: Date! @dateformat
description: String!
descriptionHtml: String!
featuredImage: __PREFIX__ShopifyImage
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"featuredMedia.shopifyId\\", by: \\"shopifyId\\")
featuredMedia: __PREFIX__ShopifyMedia @link(from: \\"_featuredMedia\\", by: \\"id\\")
feedback: __PREFIX__ShopifyResourceFeedback
giftCardTemplateSuffix: String
handle: String!
Expand Down Expand Up @@ -3591,6 +3602,7 @@ Array [
",
"
type __PREFIX__ShopifyProductVariant implements Node @dontInfer {
_product: String! # Temporary field so we don't break existing users
availableForSale: Boolean!
barcode: String
compareAtPrice: Float
Expand All @@ -3607,7 +3619,7 @@ Array [
position: Int!
presentmentPrices: [__PREFIX__ShopifyProductVariantPricePair!]!
price: Float!
product: __PREFIX__ShopifyProduct! @link(from: \\"product.shopifyId\\", by: \\"shopifyId\\")
product: __PREFIX__ShopifyProduct! @link(from: \\"_product\\", by: \\"id\\")
requiresShipping: Boolean! @deprecated(reason: \\"Use \`InventoryItem.requiresShipping\` instead.\\")
selectedOptions: [__PREFIX__ShopifySelectedOption!]!
sellingPlanGroupCount: Int!
Expand Down
Loading

0 comments on commit 0f838b2

Please sign in to comment.