Added branch support in entry variants#556
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
✅ BUILD PASSED - All security checks passed |
|
Coverage report for commit: 32508ea Summary - Lines: 82.77% | Methods: 95.77% | Branches: 65.89%
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
🔒 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 Contentstack Management JS SDK’s Entry Variants support by allowing an optional branch to be specified for the variants scope (sent via the branch request header), and adds variant-level publish/unpublish support (plus optional request headers/params plumbing for publish/unpublish).
Changes:
- Add
entry(...).variants(variantUidOrUids, branchName?)support, including array-of-UIDs → comma-separated path handling and branch header injection for the variants scope. - Add
variants(uid).publish()/variants(uid).unpublish()(using the entry publish/unpublish endpoints with variant payloads) and allow optional{ headers, params }for publish/unpublish requests. - Add/extend unit + sanity tests and bump version to
1.31.0(plus dependency lock updates).
Reviewed changes
Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
lib/stack/contentType/entry/index.js |
Implements variants(variantUidOrUids, branchName?) and merges branch into request headers for the variants scope. |
lib/stack/contentType/entry/variants/index.js |
Supports multiple variant UIDs in the URL path and adds publish/unpublish methods for variant payloads. |
lib/entity.js |
Extends publish/unpublish helpers to merge optional headers/params into the axios request config. |
types/stack/contentType/entry.d.ts |
Updates TS typing for the new variants(...) signature (needs a fix to support null + correct return typing). |
types/stack/contentType/variants.d.ts |
Adds TS types for Variant.publish() / Variant.unpublish() options. |
types/utility/publish.d.ts |
Adds TS support for optional headers/params in publish/unpublish config. |
test/unit/variants-entry-test.js |
Adds unit coverage for variants publish/unpublish with extra headers/params and branch header behavior. |
test/sanity-check/api/entryVariants-test.js |
Adds sanity API coverage for explicit branch usage and variants(uid).publish()/unpublish(). |
CHANGELOG.md |
Adds v1.31.0 entry (needs an update to mention publish/unpublish additions). |
package.json |
Bumps package version to 1.31.0. |
package-lock.json |
Updates lockfile for the version bump and dependency resolutions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - Enh | ||
| - Entry variants: `contentType(...).entry(...).variants(variantUidOrUids, branchName?)` — optional second argument sets the CMA `branch` header for that variants scope (branch UID or alias). First argument accepts a variant UID string or an array of UIDs (comma-separated in the request path). Omitting `branchName` preserves previous behavior. | ||
| - Test | ||
| - Unit tests and sanity API tests for entry variants with an explicit branch. |
No description provided.