Skip to content

Feature | CMG-703 | stack-to-stack migration with audit report#1078

Open
chetan-contentstack wants to merge 9 commits into
devfrom
feature/cmg-703-stack-to-stack
Open

Feature | CMG-703 | stack-to-stack migration with audit report#1078
chetan-contentstack wants to merge 9 commits into
devfrom
feature/cmg-703-stack-to-stack

Conversation

@chetan-contentstack
Copy link
Copy Markdown

@chetan-contentstack chetan-contentstack commented May 27, 2026

Summary

Implements CMG-703 — content migration from a source Contentstack stack to a destination stack across regions, organizations, or within the same org/region.

The flow: source-stack auth → CLI-driven export → export validation → audit report → destination config → content mapper → test migration → final migration.

Scope delivered

Source stack selection

  • CMS picker now includes Contentstack as a source.
  • Region → Organization → Stack → Branch pickers, populated live from the source region's API (LoadUploadFile.tsx).
  • "Export" action triggers npx @contentstack/cli cm:stacks:export via the new exportCli.service.ts; exported data lands under api/export-stack/<stackId>/.

Export validation

  • validation.service.ts resolves the new branch-nested export layout (main/, master/, …) and reports missing modules (content_types, entries, assets, global_fields, locales) with a clean message.
  • Stores resolvedRoot on the project so downstream steps use one canonical path.

Audit report (new Step 3)

  • audit.service.ts + audit-lowdb.ts generate a per-project sharded audit covering:
    • Unused assets (referred vs non-referred)
    • Content types with zero entries
    • Unpublished entries
    • Unused global fields
  • AuditReport/index.tsx lets users review and exclude items from the upcoming migration; exclusions are persisted on the project.
  • New API: GET /audit-data/:projectId.

Destination configuration

  • Region/org/stack/branch/locale pickers already existed; this PR adds cross-region login (getUserProfileWithToken) so users authenticate once per region and the resulting token is cached for reuse.
  • Org/role-shape differences between EU and NA are consolidated in contentstack-user-orgs.utils.ts.

Test & final migration

  • Both flows go through the existing runCli.servicecm:stacks:import path with two new safeguards:
  • normalize-entry-links.utils.ts rewrites legacy { url, title } link values to { href, title } (recursive through group/blocks).
  • Composable-studio import failures (MODULE_NOT_FOUND) trigger a per-module fallback so the rest of the import still succeeds.
  • Per-asset ERROR: lines from the CLI are treated as non-fatal warnings; only known fatal strings abort the run.

Acceptance criteria mapping

Criterion Status
Export stack data from source stack and branch
System audits exported data
System validates exported files before migration
Configure destination region, org, stack, branch, locale ✅ (existing + cross-region login)
Map source and destination content structures ✅ via existing mapper, fed from the new export
Run a test migration
Execute final migration
Audit data stored & retrievable via API ✅ (audit-lowdb, /audit-data/:projectId)
Auth token reusable across sessions ✅ (per-region token persistence)

Known limitations (worth follow-up tickets)

  • Single branch per run. The migration imports the configured source_branch only; stacks with multiple branches need one project per branch. UI doesn't expose multi-branch selection yet.
  • Marketplace apps: quota / OAuth-permission failures on the destination are logged but don't fail the import; the module is still marked successful.
  • Developer extensions: if the CLI export doesn't capture them, content types referencing those extensions log an "extension not found" error during update. Surface this in the UI in a follow-up.
  • resolveContentstackExportRoot is duplicated between api/ and upload-api/; consolidating requires a shared workspace package.

Adds Contentstack-to-Contentstack migration across regions/orgs:
CLI-driven source export, export-structure validation, audit report
(unused assets, unpublished entries, empty content types, unused
global fields), and import via the official CLI with link-field
normalization.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chetan-contentstack chetan-contentstack self-assigned this May 27, 2026
@chetan-contentstack chetan-contentstack requested a review from a team as a code owner May 27, 2026 08:51
@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 6 334 25 ✅ Passed
🟡 Medium Severity 8 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

Comment thread api/src/controllers/projects.controller.ts Outdated
Comment thread api/src/models/audit-lowdb.ts Outdated
Comment thread api/src/models/audit-lowdb.ts Outdated
Comment thread api/src/models/audit-lowdb.ts
Comment thread api/src/models/audit-lowdb.ts Outdated
Comment thread upload-api/src/services/contentstack/locales.ts Outdated
Comment thread upload-api/src/services/contentstack/locales.ts Outdated
import AuthenticationModel from '../models/authentication.js';
import { setBasicAuthConfig } from '../utils/config-handler.util.js';

const runCommand = (command: string, args: string[] = []): Promise<void> =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No timeout or kill mechanism on long-running child process.
api/src/services/exportCli.service.ts, lines 8–19
spawn() runs npx @contentstack/cli cm:stacks:export with no timeout. For large stacks this could hang indefinitely, blocking the event loop response and holding a server resource with no recovery path.
Suggestion: Add a configurable timeout (e.g., AbortController with AbortSignal) or a setTimeout that calls cmd.kill() and rejects the promise with a clear timeout error.

Comment thread api/src/services/exportCli.service.ts Outdated
const entryFiles = await collectEntryFiles(entriesDir);
const entryAudit: any[] = [];
const contentTypeEntryCount: Record<string, number> = {};
const globalFieldUsage = new Set<string>();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

audit.service.ts — Asset reference detection via payload.includes(asset.uid) is substring-only

File: api/src/services/audit.service.ts, approximately lines 100–108
Detecting asset references via JSON.stringify(entryData) + payload.includes(asset.uid) can produce false positives if an asset UID appears as a substring within another UID or string value. For example, if asset_123 is a substring of entry_uid_asset_1234, it would be marked as "referred."
Suggestion: Use a more precise regex search: new RegExp("${asset.uid}") or check for a boundary like word characters.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 1, 2026

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 18 334 25 ✅ Passed
🟡 Medium Severity 20 3 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ 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:

  • Critical without fixes: 0
  • High without fixes: 334
  • Medium without fixes: 3
  • Low without fixes: 0

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

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

Implements Contentstack stack-to-stack migration support end-to-end (export → validate → audit → map → test → final), adding new backend services/routes, upload-api validators/mappers, and UI flow updates (including cross-region source login/session handling and improved long-running migration UX).

Changes:

  • Adds Contentstack export validation + locale extraction + upload-api validator/mapper support.
  • Adds API support for source export/validation/audit (with sharded lowdb audit storage) and CLI import safeguards (link normalization + per-module fallback).
  • Updates UI migration flow (audit step, long timeouts, better log parsing, and regional source-login token caching).

Reviewed changes

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

Show a summary per file
File Description
upload-api/tests/unit/validators/contentstack.validator.test.ts Unit tests for Contentstack zip/json validator.
upload-api/tests/unit/services/contentstack.service.test.ts Unit tests for Contentstack mapper service POSTing locales.
upload-api/tests/unit/services/contentstack.locales.test.ts Unit tests for resolving export root + extracting locales.
upload-api/tests/unit/config/index.config.test.ts Updates config env var precedence + mysql default tests.
upload-api/src/validators/index.ts Registers Contentstack validator for zip/json formats.
upload-api/src/validators/contentstack.ts Adds Contentstack zip/json validation logic.
upload-api/src/services/createMapper.ts Adds Contentstack mapper selection.
upload-api/src/services/contentstack/locales.ts Implements export-root resolution + locale extraction for upload-api.
upload-api/src/services/contentstack/index.ts Creates Contentstack mapper (posts extracted locales).
upload-api/src/routes/index.ts Tightens file path handling + response typing; fixes comment typo.
upload-api/src/config/index.ts Aligns local path env precedence + formatting.
upload-api/migration-aem/package-lock.json Removes @types/uuid entry from lockfile.
ui/src/utilities/migrationSourceSession.ts Session storage helpers for source-region token caching.
ui/src/utilities/functions.ts Ensures failure notifications always have non-empty text.
ui/src/utilities/constants.ts Adds constant for popup postMessage source.
ui/src/services/api/user.service.ts Adds profile fetch for an override token (regional login).
ui/src/services/api/upload.service.ts Hardens getCall error fallback when err.response is missing.
ui/src/services/api/stacks.service.ts Adds optional source_region + app token override when listing stacks.
ui/src/services/api/migration.service.ts Adds source-config update, audit/export endpoints, and long timeouts.
ui/src/pages/Migration/index.tsx Adds audit step + source_details persistence + multiple step flow changes.
ui/src/pages/Login/index.tsx Adds popup regional login flow + return-to handling + safer errors.
ui/src/context/app/app.interface.ts Extends migration state shape with source_details + audit + stepValue.
ui/src/components/TestMigration/index.tsx Improves disable logic + state persistence + completion handling.
ui/src/components/TestMigration/index.scss Tweaks layout spacing for test migration UI.
ui/src/components/MigrationFlowHeader/index.tsx Makes CTA label dependent on step/CMS; fixes step gating logic.
ui/src/components/LogScreen/MigrationLogViewer.tsx Buffers socket log chunks + improves parsing + completion handling.
ui/src/components/LogScreen/index.tsx Same log chunk buffering + parsing improvements for test migration logs.
ui/src/components/LegacyCms/legacyCms.scss Styles new Contentstack source panel UI.
ui/src/components/LegacyCms/Actions/LoadSelectCms.tsx Initializes source_details and sets source_mode for Contentstack.
ui/src/components/DestinationStack/Actions/LoadLanguageMapper.tsx Supports locale arrays as strings or objects (Contentstack format).
ui/src/components/Common/DeleteProjectModal/index.tsx Fixes React prop casing: tabIndex.
ui/src/components/AuditReport/index.tsx Adds UI for running/reviewing audit and persisting exclusions/summary.
ui/src/components/AuditReport/index.scss Styling for audit report UI/table.
ui/src/cmsData/migrationSteps.json Adds Audit step and renumbers steps to 6-step flow.
api/tests/unit/utils/normalize-entry-links.utils.test.ts Tests link normalization across schema shapes (group/blocks/multiple).
api/tests/unit/utils/contentstack-user-orgs.utils.test.ts Tests org mapping across region-specific role payload shapes.
api/tests/unit/services/validation.service.test.ts Tests export root resolution + structure validation.
api/tests/unit/services/user.service.test.ts Ensures profile response includes region and mapped orgs.
api/tests/unit/services/projects.service.test.ts Updates step-progression tests + adds source/audit update tests.
api/tests/unit/services/migration.service.test.ts Adds tests for export/validate/audit endpoints and step/status updates.
api/tests/unit/services/exportCli.service.test.ts Tests CLI export execution + region handling + error cases.
api/tests/unit/services/contentMapper.service.test.ts Updates expected step gating for mapper operations.
api/tests/unit/services/auth.service.test.ts Updates org membership requirements + aligns error message constant.
api/tests/unit/services/audit.service.test.ts Tests audit generation paths and edge cases.
api/tests/unit/routes/projects.routes.test.ts Adds route wiring tests for new project endpoints.
api/tests/unit/routes/migration.routes.test.ts Adds route wiring tests for new migration endpoints.
api/tests/unit/models/audit-lowdb.test.ts Tests sharded audit persistence + retrieval behavior.
api/tests/unit/controllers/migration.controller.test.ts Updates controller behavior to await long-running service calls.
api/src/utils/sanitize-path.utils.ts Adds allowlisted export-root path assertion helper.
api/src/utils/normalize-entry-links.utils.ts Adds export-wide legacy link normalization utility.
api/src/utils/contentstack-user-orgs.utils.ts Adds robust org mapping util across role shapes/regions.
api/src/services/validation.service.ts Adds Contentstack export structure validation + root resolution.
api/src/services/user.service.ts Uses org mapping util + includes region in profile payload.
api/src/services/runCli.service.ts Adds link normalization + module fallback + export-root resolution.
api/src/services/projects.service.ts Adds source config + audit selection updates; adds audit step gating.
api/src/services/exportCli.service.ts Implements Contentstack stack export via CLI with structured logging.
api/src/services/auth.service.ts Uses org mapping util for admin/owner/member determination.
api/src/services/audit.service.ts Implements audit generation + persistence to sharded lowdb store.
api/src/server.ts Fixes log tailing to avoid awaitWriteFinish delays; adds offset reset.
api/src/routes/projects.routes.ts Adds project routes for source-config and audit-selections.
api/src/routes/migration.routes.ts Adds migration routes for export/validate/audit.
api/src/models/project-lowdb.ts Extends project schema to store source_details/audit/validation/source_locales.
api/src/models/audit-lowdb.ts Adds sharded audit storage model.
api/src/controllers/projects.controller.ts Adds controllers for source-config + audit-selections.
api/src/controllers/migration.controller.ts Adds controllers for export/validate/audit; awaits long operations.
api/src/constants/index.ts Adds CMS.CONTENTSTACK, audit DB config, and renumbers step constants.
.gitignore Ignores export-stack/ output directory.
Files not reviewed (1)
  • upload-api/migration-aem/package-lock.json: Language not supported

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

Comment on lines +904 to 909
const url = `/projects/${projectId}/migration/steps/5`;
navigate(url, { replace: true });

await updateCurrentStepData(selectedOrganisation.value, projectId);
handleStepChange(3);
handleStepChange(4);
}}
Comment on lines +923 to +925
handleStepChange(4);
const url = `/projects/${projectId}/migration/steps/5`;
navigate(url, { replace: true });
Comment on lines +939 to 942
handleStepChange(5);
const url = `/projects/${projectId}/migration/steps/6`;
navigate(url, { replace: true });
//}
Comment on lines +1131 to +1146
if (
!project?.legacy_cms?.audit?.summary ||
project.status === NEW_PROJECT_STATUS[0] ||
!isStepCompleted ||
!project?.destination_stack_id
) {
const reason = !project?.legacy_cms?.audit?.summary
? 'Audit summary is missing on the project (generate the audit on this step so it can be saved).'
: project.status === NEW_PROJECT_STATUS[0]
? 'Project is still in draft status.'
: !isStepCompleted
? 'Legacy CMS or file format is incomplete.'
: 'Destination stack is not set.';
throw new BadRequestError(
`You cannot proceed from the audit step. ${reason}`
);
Comment on lines +411 to +417
if (projectIndex > -1 && !isTest) {
ProjectModelLowdb.data.projects[projectIndex].isMigrationCompleted =
true;
ProjectModelLowdb.data.projects[projectIndex].isMigrationStarted =
false;
ProjectModelLowdb.data.projects[projectIndex].current_step = 6;
ProjectModelLowdb.data.projects[projectIndex].status = 5;
}
}

const assetUidSet = new Set(assets.map((a) => a.uid).filter(Boolean));
Comment on lines +218 to 246
{
"flow_id": "auditReport",
"_metadata": { "uid": "csauditstep0001" },
"name": 3,
"title": "Audit Report",
"description": "Review source stack audit before mapping and migration",
"group_name": "Audit"
},
{
"flow_id": "contentMapping",
"_metadata": { "uid": "cs82c582021cc46a87" },
"name": 3,
"name": 4,
"title": "Content Mapping",
"description": "Review of content mapping on the target stack",
"group_name": "Layout"
},
{
"flow_id": "testMigration",
"name": 4,
"name": 5,
"title": "Test Migration",
"description": "Preview the migration process",
"group_name": "Layout"
},
{
"flow_id": "migrationExecution",
"_metadata": { "uid": "csb100b7a598d9c333" },
"name": 5,
"name": 6,
"title": "Migration Execution",
"description": "Wait for the execution for migration complete.",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants