Add regional endpoint selection with GatewayArea support#1
Closed
fern-support wants to merge 6 commits into
Closed
Add regional endpoint selection with GatewayArea support#1fern-support wants to merge 6 commits into
fern-support wants to merge 6 commits into
Conversation
- Add area.ts with GatewayArea type (US, EU, APAC, CN) and RegionalEndpointPool class - Add RegionalClient.ts with RegionalAgoraClient wrapper client - Update index.ts to export wrapper client as AgoraClient - Export GatewayArea and RegionalEndpointPool for advanced usage - Support region cycling for failover scenarios - Update .fernignore to protect manually added files Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
This reverts commit 4a973c0.
Collaborator
|
@fern-support is this still needed? |
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.
Add regional endpoint selection with GatewayArea support
Summary
Adds area-based URL selection to the TypeScript SDK, mirroring the pattern implemented in the Go SDK. Users can now specify a
gatewayArea(US, EU, APAC, CN) when creating a client to automatically connect to the optimal regional endpoint.Key changes:
src/area.ts: DefinesGatewayAreatype andRegionalEndpointPoolclass with region cycling supportsrc/RegionalClient.ts: Wrapper client that addsgatewayAreaandendpointPooloptionssrc/index.ts: Exports the wrapper asAgoraClient(backwards compatible) plus newGatewayAreaandRegionalEndpointPoolexports.fernignore: Protects manually added files from Fern regenerationUsage:
Note: Unlike the Go SDK, DNS-based domain selection is intentionally omitted for browser compatibility. The TS SDK uses a fixed priority order instead.
Updates since last revision
/api/conversational-ai-agentsuffix togetCurrentUrl()to match the default environment URL structureRegionalClient.tsconstructor to captureendpointPoolin a narrowedconst poolvariable, ensuring the baseUrl supplier returnsstringinstead ofstring | undefinedCannot find namespace 'undefined'build errorsagents.test.tsto use a non-empty cursor value for pagination test (empty cursor""correctly returnshasNextPage() = false, matching the telephony test pattern)Review & Testing Checklist for Human
REGION_DOMAIN_CONFIGinarea.tsagainst the Go SDK'sRegionDomainmap to ensure prefixes and suffixes are identicalAgoraClientwithoutgatewayAreashould continue to work unchangedgatewayArea: GatewayArea.USand verify requests go tohttps://api-us-west-1.agora.io/api/conversational-ai-agentRegionalClient.ts, confirm theconst pool = endpointPoolnarrowing correctly captures the pool before creating the supplier functionRecommended test plan:
gatewayArea- verify it uses the default environmentGatewayAreavalue and log/inspect the base URL being usednextRegion()cycling behavior on the endpoint poolNotes
Link to Devin run: https://app.devin.ai/sessions/3f033f4523f94c2384477ddfc79d00a8
Requested by: blank@buildwithfern.com (@fern-support)