Skip to content

CL-5874 Support EU endpoints configuration across SDK - #381

Draft
petrsloup wants to merge 2 commits into
mainfrom
claude/maptiler-api-endpoint-option-bv1brw
Draft

CL-5874 Support EU endpoints configuration across SDK#381
petrsloup wants to merge 2 commits into
mainfrom
claude/maptiler-api-endpoint-option-bv1brw

Conversation

@petrsloup

Copy link
Copy Markdown
Member

Objective

Enable the SDK to dynamically switch between MapTiler's default .com and EU-based .eu API endpoints throughout all components that make API requests.

Description

This change introduces comprehensive support for EU endpoint configuration by:

  1. Extended config API (src/config.ts):

    • Added useEuEndpoints(value?: boolean) method to switch between api.maptiler.com and api.maptiler.eu
    • Added isUsingEuEndpoints getter to check current endpoint status
    • Added apiHost getter to retrieve the current host
    • Added apiURL getter to retrieve the current base URL
  2. Replaced hardcoded URLs with dynamic config references:

    • src/Map.ts: Updated terrain source URL and host checks to use config.apiURL and config.apiHost
    • src/helpers/vectorlayerhelpers.ts: Updated dataset feature URLs in polyline, polygon, point, and heatmap functions
    • src/Telemetry.ts: Updated telemetry endpoint to use config.apiURL
    • src/caching.ts: Updated host check to use config.apiHost
    • src/controls/MaptilerLogoControl.ts: Updated logo URL to use config.apiURL
    • src/ImageViewer/ImageViewer.ts: Updated image API base path to use config.apiURL
    • src/custom-layers/CubemapLayer/CubemapLayer.ts: Introduced getSpaceImagesBaseUrl() function to dynamically construct space image URLs
    • src/tools.ts: Updated host check to use config.apiHost
  3. Cleaned up defaults (src/constants/defaults.ts):

    • Removed hardcoded API URLs and host that are now dynamically determined by config
  4. Added comprehensive tests (test/config.test.ts):

    • Tests for default .com endpoint behavior
    • Tests for switching to/from .eu endpoints
    • Tests verifying that endpoint changes are honored by request transformation

Acceptance

  • Added unit tests covering endpoint switching and integration with request transformation
  • All hardcoded API references have been replaced with dynamic config-based URLs
  • Existing functionality is preserved while enabling EU endpoint support

Checklist

  • I have added relevant info to the CHANGELOG.md

https://claude.ai/code/session_01HF5td6ttnvHZWWFeG9L3Yy

Delegates to the corresponding option in @maptiler/client so the
API host is configured in one place. Removes the SDK's own frozen
api.maptiler.com constants and routes the remaining host-dependent
URLs (caching, tools, Map terrain source, telemetry, logo control,
vector layer helpers, image viewer, cubemap layer) through it.
@github-actions

Copy link
Copy Markdown

Some E2E Tests Failed: Please check the attached artifacts here

@petrsloup petrsloup changed the title Support EU endpoints configuration across SDK CL-5874 Support EU endpoints configuration across SDK Jul 17, 2026
Mirrors the same change in @maptiler/client (PR #116) so both
packages stay consistent: apiKey and fetch are already get/set
pairs on SdkConfig, so a callable method here was inconsistent.
@github-actions

Copy link
Copy Markdown

Some E2E Tests Failed: Please check the attached artifacts here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants