You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replaces @timbenniks/contentstack-endpoints (third-party) with getContentstackEndpoint from @contentstack/utils (official Contentstack package) for region-to-endpoint resolution
Removes @timbenniks/contentstack-endpoints as a direct dependency from package.json
Cleans up the null-guard pattern and simplifies region handling in lib/contentstack.ts
Adds comprehensive region and endpoint documentation to the README
Updates .env.example with all valid region options
What changed and why
lib/contentstack.ts
Before:
import{getContentstackEndpoints,getRegionForString}from"@timbenniks/contentstack-endpoints";constregion=getRegionForString(process.env.NEXT_PUBLIC_CONTENTSTACK_REGIONasstring);constendpoints=getContentstackEndpoints(region,true);region: region ? region : process.env.NEXT_PUBLIC_CONTENTSTACK_REGIONasany,host: process.env.NEXT_PUBLIC_CONTENTSTACK_CONTENT_DELIVERY||endpoints&&endpoints.contentDelivery,host: process.env.NEXT_PUBLIC_CONTENTSTACK_PREVIEW_HOST||endpoints&&endpoints.preview,host: process.env.NEXT_PUBLIC_CONTENTSTACK_CONTENT_APPLICATION||endpoints&&endpoints.application,
Two-step region resolution collapses into one call — getContentstackEndpoint handles all alias normalisation internally (NA, na, US, us all resolve correctly)
The && null-guard is removed — getContentstackEndpoint throws on an invalid region at startup (fail-fast) instead of silently returning undefined and causing a downstream SDK error
The region ? region : ... ternary is removed — host: in the SDK config takes precedence over region at runtime, so passing the raw env var string is equivalent
package.json
Removed @timbenniks/contentstack-endpoints as a direct dependency. @contentstack/utils was already part of the Contentstack ecosystem and is the officially supported package.
README.md
Added a Regions and endpoint configuration section covering:
Area
What's documented
Region values
Full table of all 7 supported regions with accepted values
Endpoint keys
All 9 endpoint keys with their NA values
Custom environments
Override env vars for dedicated/private cloud instances
.env.example
Updated the region line with all valid region options as an inline comment:
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
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
@timbenniks/contentstack-endpoints(third-party) withgetContentstackEndpointfrom@contentstack/utils(official Contentstack package) for region-to-endpoint resolution@timbenniks/contentstack-endpointsas a direct dependency frompackage.jsonlib/contentstack.ts.env.examplewith all valid region optionsWhat changed and why
lib/contentstack.tsBefore:
After:
Key improvements:
getContentstackEndpointhandles all alias normalisation internally (NA,na,US,usall resolve correctly)&&null-guard is removed —getContentstackEndpointthrows on an invalid region at startup (fail-fast) instead of silently returningundefinedand causing a downstream SDK errorregion ? region : ...ternary is removed —host:in the SDK config takes precedence overregionat runtime, so passing the raw env var string is equivalentpackage.jsonRemoved
@timbenniks/contentstack-endpointsas a direct dependency.@contentstack/utilswas already part of the Contentstack ecosystem and is the officially supported package.README.mdAdded a Regions and endpoint configuration section covering:
.env.exampleUpdated the region line with all valid region options as an inline comment:
Files changed
lib/contentstack.tspackage.json@timbenniks/contentstack-endpointsdirect dependencypackage-lock.jsonnpm installREADME.md.env.exampleNo breaking changes
NEXT_PUBLIC_CONTENTSTACK_REGION,NEXT_PUBLIC_CONTENTSTACK_CONTENT_DELIVERY, etc.)lib/contentstack.tsis the only logic file touched — all components and page routes are untouched