Skip to content

feat(shopiffy): add new shopiffy wrapper#601

Open
filipecabaco wants to merge 1 commit into
supabase:mainfrom
filipecabaco:main
Open

feat(shopiffy): add new shopiffy wrapper#601
filipecabaco wants to merge 1 commit into
supabase:mainfrom
filipecabaco:main

Conversation

@filipecabaco
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Add new shopiffy wrapper that uses the GraphQL API to work with Shopify API

Copilot AI review requested due to automatic review settings May 10, 2026 11:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new native shopify_fdw Foreign Data Wrapper for the wrappers Postgres extension, targeting Shopify Admin GraphQL API access (read + limited write support) and introducing a Bun-based mock server + CI workflow to run integration tests.

Changes:

  • Implement ShopifyFdw with table configs, GraphQL query building/parsing, and mutation support for a subset of resources.
  • Add pgrx integration tests that exercise IMPORT FOREIGN SCHEMA, common read flows, and basic write operations against a local mock server.
  • Add a Shopify GraphQL mock server (fixtures + Docker) and a dedicated GitHub Actions workflow to run the wrapper tests.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
wrappers/src/fdw/shopify_fdw/shopify_fdw.rs Core Shopify FDW implementation: table config, GraphQL queries, scanning, and mutations.
wrappers/src/fdw/shopify_fdw/mod.rs Shopify FDW module wiring + error type definition and Postgres error conversion.
wrappers/src/fdw/shopify_fdw/tests.rs Integration tests validating schema import, reads, nested resources, and write operations.
wrappers/src/fdw/mod.rs Registers the new shopify_fdw module behind a feature flag.
wrappers/Cargo.toml Adds shopify_fdw feature and dependencies; includes it in native_fdws.
wrappers/.ci/shopify-mock/server.ts Bun-based mock Shopify Admin GraphQL server routing requests to fixtures.
wrappers/.ci/shopify-mock/Dockerfile Container image for the mock Shopify server used in CI.
wrappers/.ci/docker-compose-native.yaml Adds the shopify mock service for native wrapper test environments.
.github/workflows/test_shopify_fdw.yml CI workflow to run formatting, clippy, and pgrx tests for shopify_fdw with the mock server.
wrappers/.ci/shopify-mock/fixtures/shop.json Fixture for shop singleton query.
wrappers/.ci/shopify-mock/fixtures/app.json Fixture for app singleton query.
wrappers/.ci/shopify-mock/fixtures/products.json Fixture for products list query.
wrappers/.ci/shopify-mock/fixtures/productVariants.json Fixture for productVariants list query.
wrappers/.ci/shopify-mock/fixtures/orders.json Fixture for orders list query.
wrappers/.ci/shopify-mock/fixtures/locations.json Fixture for locations list query.
wrappers/.ci/shopify-mock/fixtures/collections.json Fixture for collections list query.
wrappers/.ci/shopify-mock/fixtures/customers.json Fixture for customers list query.
wrappers/.ci/shopify-mock/fixtures/draftOrders.json Fixture for draftOrders list query.
wrappers/.ci/shopify-mock/fixtures/fulfillmentOrders.json Fixture for fulfillmentOrders list query.
wrappers/.ci/shopify-mock/fixtures/businessEntities.json Fixture for businessEntities list query.
wrappers/.ci/shopify-mock/fixtures/nested/order.json Fixture for nested order { fulfillments/refunds } query used by nested tables.
wrappers/.ci/shopify-mock/fixtures/singular/product.json Fixture for singular product(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/singular/customer.json Fixture for singular customer(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/singular/customerPaymentMethod.json Fixture for singular customerPaymentMethod(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/singular/storeCreditAccount.json Fixture for singular storeCreditAccount(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/singular/inventoryLevel.json Fixture for singular inventoryLevel(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/singular/return.json Fixture for singular return(id: ...) query.
wrappers/.ci/shopify-mock/fixtures/mutations/productCreate.json Fixture for productCreate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/productUpdate.json Fixture for productUpdate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/productDelete.json Fixture for productDelete mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/customerCreate.json Fixture for customerCreate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/customerUpdate.json Fixture for customerUpdate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/customerDelete.json Fixture for customerDelete mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/draftOrderCreate.json Fixture for draftOrderCreate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/draftOrderUpdate.json Fixture for draftOrderUpdate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/draftOrderDelete.json Fixture for draftOrderDelete mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/collectionCreate.json Fixture for collectionCreate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/collectionUpdate.json Fixture for collectionUpdate mutation.
wrappers/.ci/shopify-mock/fixtures/mutations/collectionDelete.json Fixture for collectionDelete mutation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +778 to +782
.pointer("/extensions/cost/throttleStatus")
.and_then(|s| s.as_str())
== Some("THROTTLED")
{
return Err(ShopifyFdwError::Throttled(String::new()));
Comment on lines +652 to +656
fn parse_timestamp_cell(s: &str) -> Option<Cell> {
DateTime::parse_from_rfc3339(s)
.ok()
.map(|dt| Cell::Timestamp(to_timestamp(dt.timestamp() as f64).to_utc()))
}
Comment on lines +810 to +813
} else if tgt_col.name == "attrs" {
let attrs = serde_json::from_str(&node.to_string())?;
row.push("attrs", Some(Cell::Json(JsonB(attrs))));
}
Comment on lines +1366 to +1368
let Cell::String(rowid_str) = rowid else {
return Ok(());
};
Comment on lines +1401 to +1403
let Cell::String(rowid_str) = rowid else {
return Ok(());
};
Comment on lines +36 to +45
run: |
for i in $(seq 1 20); do
if curl -sf http://localhost:12112/health; then
echo "Shopify mock is ready"
break
fi
echo "Waiting for Shopify mock... ($i/20)"
sleep 2
done

- main
paths:
- 'wrappers/src/fdw/shopify_fdw/**'
- 'wrappers/.ci/shopify-mock/**'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants