Added Branches support in entry variants#361
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
Coverage report
Test suite run success688 tests passing in 32 suites. Report generated by 🧪jest coverage report action from a0d7d72 |
…o support new changelog format
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
There was a problem hiding this comment.
Pull request overview
This PR extends the Delivery SDK’s entry variant support to optionally include a branch name, allowing variant-scoped requests to also set the branch request header (while keeping existing variants(uid|uids) behavior backward compatible).
Changes:
- Added
buildVariantRequestHeaders()utility to centrally constructx-cs-variant-uidand optionalbranchheaders. - Updated
Entry,Entries,BaseQuery, andQueryrequest flows to attach variant+branch headers when configured. - Added/expanded unit tests and introduced an API test suite covering variant+branch behavior; bumped version + changelog and updated the version-bump workflow to parse the changelog format.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils.spec.ts | Adds unit coverage for buildVariantRequestHeaders(). |
| test/unit/entry.spec.ts | Adds unit coverage for Entry.variants(variant, branch) and fetch header behavior. |
| test/unit/entries.spec.ts | Adds unit coverage for Entries.variants(..., branch) and query().find() header behavior. |
| test/unit/base-query.spec.ts | Extends BaseQuery test harness to include variants branch and validates headers. |
| test/api/entry-variants-branch.spec.ts | New API test suite for entry/entries variant+branch behavior and chaining scenarios. |
| src/query/query.ts | Extends Query to carry variants branch state and apply headers during find(). |
| src/query/base-query.ts | Applies shared variant+branch header building in BaseQuery find(). |
| src/entries/entry.ts | Adds optional branch argument to Entry.variants() and applies headers during fetch(). |
| src/entries/entries.ts | Adds optional branch argument to Entries.variants(), propagates branch into query(), and applies headers during find(). |
| src/common/utils.ts | Introduces buildVariantRequestHeaders() helper. |
| package.json | Bumps SDK version to 5.3.0. |
| package-lock.json | Updates lockfile version metadata to 5.3.0. |
| CHANGELOG.md | Adds 5.3.0 entry documenting variant+branch support. |
| .github/workflows/check-version-bump.yml | Updates changelog parsing to support the current “### Version:” format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @method variants | ||
| * @memberof Entry | ||
| * @description The variant header will be added to axios client | ||
| * @description The variant header will be added to axios client. Branch is optional. | ||
| * @param {string | string[]} variants - Variant UID or UIDs | ||
| * @param {string} [branchName] - Optional branch name sent as the `branch` header |
| * @method variants | ||
| * @memberof Entries | ||
| * @description The variant header will be added to axios client | ||
| * @description The variant header will be added to axios client. Branch is optional. | ||
| * @param {string | string[]} variants - Variant UID or UIDs | ||
| * @param {string} [branchName] - Optional branch name sent as the `branch` header |
| constructor( | ||
| client: AxiosInstance, | ||
| params: params, | ||
| queryParams: queryParams, | ||
| variants?: string, | ||
| uid?: string, | ||
| variantsBranchOrQueryObj?: string | { [key: string]: any }, | ||
| queryObj?: { [key: string]: any } | ||
| ) { |
No description provided.