Skip to content

[DX-3038], fix custom config for graphQL and updated regions #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

naman-contentstack
Copy link
Contributor

Minor version bump 3.1.0 -> 3.2.0

@naman-contentstack naman-contentstack self-assigned this Jun 5, 2025
@naman-contentstack naman-contentstack requested a review from a team as a code owner June 5, 2025 11:14
@aman19K aman19K requested a review from Copilot June 5, 2025 11:18
Copy link

@Copilot 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

Adds support for AWS-NA, AWS-EU, GCP-EU, and a CUSTOM region with optional custom host, bumps version to 3.2.0, and updates GraphQL URL resolution and error messaging.

  • Expanded region union, REGIONS, and SDK utils to include new AWS-, GCP-, and CUSTOM regions
  • Updated graphqlTS to accept a host override and enhanced its validation error
  • Adjusted tests to expect the new error message suffix

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/types/index.ts Extend region type to cover AWS-NA, AWS-EU, GCP-EU, CUSTOM
src/constants/index.ts Add new region constants for AWS-NA, AWS-EU, GCP-EU, CUSTOM
src/sdk/utils.ts Map new region constants to existing Region enum values
src/graphqlTS/index.ts Honor custom host, adjust URL build and validation error
tests/unit/graphqlTS/graphqlTS.test.ts Updated expected error message to include custom-host info
tests/integration/graphqlTS/graphqlTS.test.ts Same update in integration tests
package.json Bump version from 3.1.0 to 3.2.0
Comments suppressed due to low confidence (4)

src/types/index.ts:4

  • [nitpick] The region union mixes hyphens (e.g. "AWS-NA") and underscores (e.g. "GCP_EU"). Consider standardizing separators for consistency to avoid confusion.
region:

tests/unit/graphqlTS/graphqlTS.test.ts:140

  • There's no test covering a valid custom host scenario. Add a unit test that passes a host value and verifies the request URL uses https://<host>/stacks/<apiKey>.
"GraphQL content delivery api unavailable for 'wrong-region' region and no custom host provided"

src/constants/index.ts:14

  • Consider documenting the expected use case for the CUSTOM region constant—e.g., that a custom host must be provided when selecting CUSTOM—to guide future maintainers.
CUSTOM: "CUSTOM",

src/graphqlTS/index.ts:38

  • Ensure that GRAPHQL_REGION_URL_MAPPING is updated to include entries for the new AWS-NA, AWS-EU, and GCP-EU regions; otherwise mapping will be undefined unless a custom host is provided.
url: host

Comment on lines +91 to +95
error.response.data.errors[0].extensions.errors[0].details.forEach(
(element: { error: string }) => {
details += element.error + "\n";
}
);
Copy link
Preview

Copilot AI Jun 5, 2025

Choose a reason for hiding this comment

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

[nitpick] The manual concatenation of error details could be simplified using map() and join('\n') for clearer intent and brevity.

Suggested change
error.response.data.errors[0].extensions.errors[0].details.forEach(
(element: { error: string }) => {
details += element.error + "\n";
}
);
details = error.response.data.errors[0].extensions.errors[0].details
.map((element: { error: string }) => element.error)
.join("\n");

Copilot uses AI. Check for mistakes.

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.

1 participant