feat: add search-products method#1004
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a product search functionality to the core SDK, allowing users to search for products by keywords across title, description, and tags fields. The implementation includes a new SearchMixin class, GraphQL query definitions, a command-line script for testing, and comprehensive end-to-end tests.
Changes:
- Added
searchProductsmethod to CoreSDK that searches products by keywords with automatic filtering for valid, non-voided products - Created a command-line script (
search-products) to enable searching products from the terminal - Added comprehensive e2e tests covering various search scenarios including single keyword, multiple keywords, and searches across different metadata fields
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/search-products.ts | Command-line script for searching products by keywords with environment and config options |
| packages/core-sdk/src/subgraph.ts | Auto-generated TypeScript types and SDK methods for the searchProducts GraphQL query |
| packages/core-sdk/src/search/subgraph.ts | Subgraph wrapper function that executes the search query and returns product results |
| packages/core-sdk/src/search/queries.graphql | GraphQL query and fragment definitions for searching products with various filter and pagination options |
| packages/core-sdk/src/search/mixin.ts | SearchMixin class implementing the searchProducts method with keyword filtering across title, description, and tags |
| packages/core-sdk/src/core-sdk.ts | Integration of SearchMixin into CoreSDK via mixin pattern |
| package.json | Added npm script "search-products" for running the search script |
| e2e/tests/productV1.test.ts | Comprehensive test suite with 7 test cases covering different search scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1004 +/- ##
==========================================
+ Coverage 90.93% 90.94% +0.01%
==========================================
Files 176 179 +3
Lines 7247 7281 +34
Branches 1355 1366 +11
==========================================
+ Hits 6590 6622 +32
- Misses 657 659 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tocol/core-components into search-products-feature
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Description
This PR adds a product search functionality to the core SDK, allowing users to search for products by keywords across title, description, and tags fields. The implementation includes a new SearchMixin class, GraphQL query definitions, a command-line script for testing, and comprehensive end-to-end tests.
Changes:
Added searchProducts method to CoreSDK that searches products by keywords with automatic filtering for valid, non-voided products
Created a command-line script (search-products) to enable searching products from the terminal
Added comprehensive e2e tests covering various search scenarios including single keyword, multiple keywords, and searches across different metadata fields
How to test
new e2e tests have been added