Member Junction
    Preparing search index...

    Class BaseGeocodingProviderAbstract

    Abstract base class for geocoding providers. Holds shared HTTP and config-lookup helpers so concrete providers only implement the API-specific request/response mapping.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    AllowsPersistentStorage: boolean

    True if the provider's free tier / ToS permits indefinite persistent storage of geocoding results. Used to gate use for RecordGeoCode persistence.

    Name: string

    Stable identifier used in config and the GeocodingSource enum (e.g. 'google', 'geocodio', 'here').

    SupportedCountries: "global" | readonly string[]

    'global' if the provider supports all countries, otherwise an array of ISO 3166-1 alpha-2 codes. Used for routing decisions when a country is known up-front.

    Methods

    • Fetch JSON from a provider API with consistent error logging. Returns null on non-2xx responses (so callers treat HTTP errors as "no result" rather than throwing); throws on network/parse errors so the scheduled job can mark the row as 'failed' and retry later.

      Type Parameters

      • T

      Parameters

      • url: string
      • Optionalinit: RequestInit

      Returns Promise<T>

    • Resolve a credential from env vars first, then mj.config.cjs. Mirrors the existing GeoCodeSyncService.getGoogleApiKey() pattern but generalized so each provider can declare its own env/config keys.

      Parameters

      • envKeys: string[]

        Ordered list of env var names to try (e.g. ['GEOCODIO_API_KEY']).

      • configPath: string

        Dotted path within __mj_config_apiIntegrations (e.g. 'geocodio.apiKey' or 'google.geocoding.apiKey').

      Returns string