/** * TypeScript interfaces for @world/countries package */ /** * Timezone information for a country */ interface ITimezone { zoneName: string; gmtOffset: number; gmtOffsetName: string; abbreviation: string; tzName: string; } /** * Translations for country/state/city names */ interface ITranslations { [languageCode: string]: string; } /** * Basic country information (lightweight) * Used in countries.json for fast loading */ interface ICountry { id: number; name: string; iso2: string; iso3: string; numeric_code: string; phonecode: string; capital: string; currency: string; currency_name: string; currency_symbol: string; tld: string; native: string; population: number | null; gdp: number | null; region: string; region_id: number | null; subregion: string; subregion_id: number | null; nationality: string; latitude: string; longitude: string; emoji: string; emojiU: string; } /** * Full country metadata including timezones and translations * Used in {Country-CODE}/meta.json */ interface ICountryMeta extends ICountry { timezones: ITimezone[]; translations: ITranslations; } /** * State/Province information */ interface IState { id: number; name: string; country_id: number; country_code: string; fips_code: string | null; iso2: string; iso3166_2: string | null; type: string | null; latitude: string | null; longitude: string | null; native: string | null; timezone: string | null; translations: ITranslations; } /** * Region (continent) information */ interface IRegion { id: number; name: string; translations: ITranslations; wikiDataId: string | null; } /** * Subregion information */ interface ISubregion { id: number; name: string; region_id: number; translations: ITranslations; wikiDataId: string | null; } /** * City information */ interface ICity { id: number; name: string; state_id: number; state_code: string; country_id: number; country_code: string; latitude: string; longitude: string; native: string | null; timezone: string | null; translations: ITranslations; } /** * Dynamic data loaders for @world/countries * Uses dynamic import() to enable code-splitting and lazy loading * Falls back to fs.readFileSync for CommonJS environments */ /** * Get lightweight list of all countries * @returns Promise with array of countries (basic info only) * @bundle ~5KB - Loads countries.json */ declare function getCountries(): Promise; /** * Get list of all regions (continents) * @returns Promise with array of regions * @bundle ~3KB - Loads regions.json */ declare function getRegions(): Promise; /** * Get list of all subregions * @returns Promise with array of subregions * @bundle ~13KB - Loads subregions.json */ declare function getSubregions(): Promise; /** * Get full country metadata including timezones and translations * @param countryCode - ISO2 country code (e.g., 'US', 'IN') * @returns Promise with full country metadata or null if not found * @bundle ~5KB per country - Loads {Country-CODE}/meta.json */ declare function getCountryByCode(countryCode: string): Promise; /** * Get all states/provinces for a specific country * @param countryCode - ISO2 country code * @returns Promise with array of states or empty array if not found * @bundle ~10-100KB depending on country - Loads {Country-CODE}/states.json */ declare function getStatesOfCountry(countryCode: string): Promise; /** * Get specific state by code * @param countryCode - ISO2 country code * @param stateCode - State code (e.g., 'CA', 'TX') * @returns Promise with state object or null if not found * @bundle Same as getStatesOfCountry - filters in memory */ declare function getStateByCode(countryCode: string, stateCode: string): Promise; /** * Get all cities in a specific state * @param countryCode - ISO2 country code * @param stateCode - State code * @returns Promise with array of cities or empty array if not found * @bundle ~5-200KB depending on state - Loads {Country-CODE}/{State-CODE}/cities.json */ declare function getCitiesOfState(countryCode: string, stateCode: string): Promise; /** * Get ALL cities in an entire country * WARNING: Large data size - loads all state city files for the country * @param countryCode - ISO2 country code * @returns Promise with array of all cities in country * @bundle Large - loads multiple city files */ declare function getAllCitiesOfCountry(countryCode: string): Promise; /** * Get every city globally * WARNING: MASSIVE data (8MB+) - rarely needed, use sparingly * @returns Promise with array of all cities worldwide * @bundle 8MB+ - loads ALL city files */ declare function getAllCitiesInWorld(): Promise; /** * Get specific city by ID * @param countryCode - ISO2 country code * @param stateCode - State code * @param cityId - Database city ID * @returns Promise with city object or null if not found * @bundle Same as getCitiesOfState - filters in memory */ declare function getCityById(countryCode: string, stateCode: string, cityId: number): Promise; /** * Utility functions for @world/countries */ /** * Validate if a country code exists * @param countryCode - ISO2 country code * @returns Promise with boolean indicating if country exists */ declare function isValidCountryCode(countryCode: string): Promise; /** * Validate if a state code exists in a country * @param countryCode - ISO2 country code * @param stateCode - State code * @returns Promise with boolean indicating if state exists */ declare function isValidStateCode(countryCode: string, stateCode: string): Promise; /** * Search cities by name (partial match) * Note: This loads cities for the specified state only * @param countryCode - ISO2 country code * @param stateCode - State code * @param searchTerm - Search term (case-insensitive partial match) * @returns Promise with array of matching cities */ declare function searchCitiesByName(countryCode: string, stateCode: string, searchTerm: string): Promise; /** * Get country name from code * @param countryCode - ISO2 country code * @returns Promise with country name or null if not found */ declare function getCountryNameByCode(countryCode: string): Promise; /** * Get state name from code * @param countryCode - ISO2 country code * @param stateCode - State code * @returns Promise with state name or null if not found */ declare function getStateNameByCode(countryCode: string, stateCode: string): Promise; /** * Get timezone for specific city * @param countryCode - ISO2 country code * @param stateCode - State code * @param cityName - City name * @returns Promise with timezone string or null if not found */ declare function getTimezoneForCity(countryCode: string, stateCode: string, cityName: string): Promise; /** * Get all timezones for country * @param countryCode - ISO2 country code * @returns Promise with array of timezone names */ declare function getCountryTimezones(countryCode: string): Promise; /** * Get all subregions belonging to a region * @param regionId - Region ID (see getRegions()) * @returns Promise with array of subregions */ declare function getSubregionsOfRegion(regionId: number): Promise; /** * Get all countries in a region * @param region - Region name (case-insensitive, e.g. 'Europe') or region ID * @returns Promise with array of countries */ declare function getCountriesByRegion(region: string | number): Promise; /** * Get all countries in a subregion * @param subregion - Subregion name (case-insensitive, e.g. 'South America') or subregion ID * @returns Promise with array of countries */ declare function getCountriesBySubregion(subregion: string | number): Promise; export { type ICity, type ICountry, type ICountryMeta, type IRegion, type IState, type ISubregion, type ITimezone, type ITranslations, getCountries as default, getAllCitiesInWorld, getAllCitiesOfCountry, getCitiesOfState, getCityById, getCountries, getCountriesByRegion, getCountriesBySubregion, getCountryByCode, getCountryNameByCode, getCountryTimezones, getRegions, getStateByCode, getStateNameByCode, getStatesOfCountry, getSubregions, getSubregionsOfRegion, getTimezoneForCity, isValidCountryCode, isValidStateCode, searchCitiesByName };