feat(import): publish taxonomies after import#124
Open
cs-raj wants to merge 1 commit intofeat/taxonomy-publishingfrom
Open
feat(import): publish taxonomies after import#124cs-raj wants to merge 1 commit intofeat/taxonomy-publishingfrom
cs-raj wants to merge 1 commit intofeat/taxonomy-publishingfrom
Conversation
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change extends stack import so the taxonomies module not only imports taxonomy JSON via the existing
import-taxonomyflow, but also publishes taxonomies when export data includespublish_detailsand the destination stack has a usable environment UID mapping. Publishing is integrated as a nested progress step (same UX pattern as entries publish), uses Management SDKtaxonomy().publishat API version3.2, and respects branch whenbranchNameis configured.Motivation
Exports can carry taxonomy publish intent (
publish_details). Previously import recreated taxonomies/terms but did not replay publish to target environments. Aligning import with that metadata reduces manual republishing after migration.User-visible behavior
Analyze
publish_details,locale, and at least one environment UID that maps throughuid-mapping.json).Import phase
import-taxonomy.Publish phase (only if
publishJobCount > 0)When publish is skipped
publish_details/locale, or mapper empty / missing: no publish phase (or jobs filtered out); optional warn when mapper is empty so operators know to import environments first.Technical design
backupDir/mapper/environments/uid-mapping.json: source stack env UID → destination stack env UID.publish_details,locale, and for analyze count at least one mapped env; jobs collected deduped by taxonomy UID.environments: destination UIDs;locales:[String(taxonomy.locale)];items:[{ uid: taxonomy.uid }].publish-taxonomiesinmakeAPICall:(stack as any).taxonomy().publish(apiData, '3.2', publishParams)withpublishParams = { branch }whenimportConfig.branchNameis set.environments,locales, oritems(after serialization).PROCESS_NAMES.TAXONOMIES_PUBLISH+PROCESS_STATUSmessages;initializeTaxonomiesProgressregisters import + optional publish totals.Files touched (typical)
cli-plugins/packages/contentstack-import/src/import/modules/taxonomies.ts— orchestration, mapper read, job build,serializePublishTaxonomies, section comments / JSDoc cleanup.cli-plugins/packages/contentstack-import/src/import/modules/base-class.ts—ApiModuleType, guard,publish-taxonomiescase.cli-plugins/packages/contentstack-import/src/utils/constants.ts—TAXONOMIES_PUBLISH+ status strings.cli-plugins/packages/contentstack-import/test/unit/import/modules/taxonomies.test.ts— publish serialization and nested progress behavior as applicable.cli-plugins/packages/contentstack-import/test/unit/import/modules/base-class.test.ts— publish branch / version / empty payload behavior.Test plan
pnpm exec mocha … taxonomies.test.ts(or package test script)base-classunit tests forpublish-taxonomiespublish_details; confirm published state in destination environments