Skip to content

Dev#1004

Merged
umeshmore45 merged 8 commits intopre-stagefrom
dev
Mar 23, 2026
Merged

Dev#1004
umeshmore45 merged 8 commits intopre-stagefrom
dev

Conversation

@umeshmore45
Copy link
Contributor

No description provided.

shobhitupadhyayy and others added 8 commits March 16, 2026 12:43
- Added utility functions  and  to manage group field mapping based on nesting depth.
- Introduced unit tests for the new utility functions to ensure correct behavior.
- Updated  component to utilize the new utilities for improved schema processing.
- Modified  to include test configuration.
- Updated  for dependency version updates.
feat: implement group schema utilities and add unit tests
…rvices and utils

- Updated various files to use optional chaining for improved null safety, preventing potential runtime errors.
- Added new region configurations for GCP Europe and Australia in constants.
- Ensured consistent handling of optional properties in request bodies and parameters across services.
- Improved error handling in login and user services to gracefully manage undefined values.
- Added new dependencies for supertest and vitest coverage in package-lock.json.
- Adjusted coverage thresholds in vitest.config.ts for lines, branches, and statements.
- Enhanced test mocks in various service tests to include new OAuth and configuration handlers.
- Updated token payload structure in multiple tests to include 'is_sso' property for consistency.
Copy link
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

This PR introduces SSO/OAuth-based authentication support across the API and UI (including token refresh handling), adds a setup/migration script for generating app.json/OAuth configuration, and refactors ContentMapper’s group-mapping behavior with accompanying unit tests.

Changes:

  • Add SSO login flow in the UI (app-config fetch, SSO status polling) and backend endpoints/utilities to support OAuth token exchange + refresh.
  • Update multiple API services to support SSO authorization headers and retry-on-refresh behavior.
  • Refine ContentMapper group schema option logic (new utils + tests) and adjust UI test tooling (Vitest config).

Reviewed changes

Copilot reviewed 48 out of 51 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
upload-api/src/config/index.ts Minor config formatting (trailing comma).
ui/vite.config.ts Adds Vitest config block in Vite config.
ui/src/services/api/login.service.ts Adds new auth-related API calls (app-config, sso-status, logout).
ui/src/pages/Login/index.tsx Implements SSO login flow + polling and adds an SSO login button.
ui/src/pages/Login/index.scss Adds SSO button styles and new utility-like classes.
ui/src/components/ProfileHeader/index.tsx Adds backend logout call + disables repeated logout clicks.
ui/src/components/ContentMapper/index.tsx Refactors schema re-sync logic; wires in new group schema utilities.
ui/src/components/ContentMapper/groupSchema.utils.ts Adds helpers controlling group-option nesting and recursion behavior.
ui/src/components/ContentMapper/tests/groupSchema.utils.test.ts Adds unit tests for new group schema utilities.
build.sh Adds region selection + OAuth login + manifest redirect update + runs SSO migration script.
app.json Adds app config artifact containing OAuth/PKCE data (should not be committed).
api/vitest.config.ts Lowers coverage thresholds.
api/tests/unit/services/user.service.test.ts Updates expectation for missing user object behavior.
api/tests/unit/services/taxonomy.service.test.ts Updates mocks to use authentication model instead of prior auth util.
api/tests/unit/services/projects.service.test.ts Updates token payload shape; changes createProject “name required” expectation.
api/tests/unit/services/org.service.test.ts Updates token payload shape to include is_sso.
api/tests/unit/services/migration.service.test.ts Updates token payload shape to include is_sso.
api/tests/unit/services/marketplace.service.test.ts Updates mocks to use authentication model instead of prior auth util.
api/tests/unit/services/globalField.service.test.ts Updates mocks to use authentication model instead of prior auth util.
api/tests/unit/services/auth.service.test.ts Updates expected JWT payload to include is_sso.
api/tests/unit/routes/auth.routes.test.ts Adds controller mocks for new auth routes.
api/sso.utils.js Adds SSO setup migration script to create/update app manifest + write app.json.
api/src/utils/sso-request.utils.ts Adds request wrapper that refreshes SSO access tokens on auth errors.
api/src/utils/pagination.utils.ts Adds optional SSO-aware request path for pagination fetches.
api/src/utils/crypto.utils.ts Adds decryption helpers for encrypted fields in app.json.
api/src/utils/config-handler.util.ts Adds helpers to configure CLI auth for OAuth vs basic auth.
api/src/utils/auth.utils.ts Adds app.json loading/decrypting helpers + access token/org helpers.
api/src/services/user.service.ts Adds SSO branch for user profile retrieval with org validation.
api/src/services/taxonomy.service.ts Updates auth header sourcing to support OAuth access tokens.
api/src/services/runCli.service.ts Switches CLI auth setup to OAuth/basic based on stored user data.
api/src/services/projects.service.ts Adds SSO flag on project data; adds SSO-aware stack fetch w/ refresh.
api/src/services/org.service.ts Adds SSO-aware request wrapper + headers for org/stack/locales calls.
api/src/services/migration.service.ts Adds SSO-aware headers and request-with-refresh paths for stack ops.
api/src/services/marketplace.service.ts Updates token sourcing from AuthenticationModel (access_token/authtoken).
api/src/services/globalField.service.ts Updates token sourcing from AuthenticationModel (access_token/authtoken).
api/src/services/contentMapper.service.ts Adds SSO-aware headers + pagination token payload wiring.
api/src/services/auth.service.ts Adds OAuth callback/token save, refresh flow, app-config read, SSO status, logout.
api/src/routes/auth.routes.ts Adds new auth routes: save-token, app-config, sso-status, logout.
api/src/models/types.ts Adds is_sso to JWT payload type + RefreshTokenResponse type.
api/src/models/project-lowdb.ts Adds isSSO field to stored project model interface.
api/src/models/authentication.ts Extends authentication model typing (currently incomplete vs usage).
api/src/controllers/auth.controller.ts Adds controllers for new SSO/app-config/logout endpoints.
api/src/constants/index.ts Adds OAuth token hosts + regional API host mapping.
api/production.env Adds manifest encryption env vars (should not be committed).
api/package.json Removes type: module and updates deps/types.
api/package-lock.json Locks updated dependency graph.
api/manifest.json Adds encrypted OAuth manifest config.
api/encrypt-manifest.js Adds script to encrypt sensitive manifest fields.
.talismanrc Adds new ignore entries, but repeats YAML keys (likely overrides earlier config).
.gitignore Ensures app.json is ignored.
Files not reviewed (1)
  • api/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

api/package.json:26

  • "type": "module" was removed, but the API codebase contains ESM-only usage (e.g. import.meta.url in src/services/wordpress.service.ts). Without type: module, Node will treat the built .js as CommonJS and import.meta will throw at runtime. Re-add "type": "module" (or convert ESM-only files to be CJS-safe / .mts with appropriate build settings).
    "test:watch": "vitest",
    "test:coverage": "vitest run --coverage",
    "test:unit": "vitest run tests/unit",
    "test:integration": "vitest run tests/integration",
    "coverage:ui": "npx serve coverage -l 3939"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/contentstack/migration-v2.git"
  },
  "author": "Contentstack",

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

@umeshmore45 umeshmore45 merged commit 6ffd4f4 into pre-stage Mar 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants