@cyanheads/geonames-mcp-server 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +13 -12
- package/CLAUDE.md +13 -12
- package/Dockerfile +16 -7
- package/README.md +75 -43
- package/changelog/0.1.x/0.1.2.md +26 -0
- package/changelog/0.1.x/0.1.3.md +45 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +13 -4
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +87 -38
- package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +6 -4
- package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-children.tool.js +65 -20
- package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-countries.tool.js +21 -13
- package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +3 -3
- package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-place.tool.js +18 -9
- package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +41 -4
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-reference.tool.js +22 -12
- package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +8 -0
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +93 -39
- package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +23 -1
- package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-places.tool.js +143 -25
- package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -1
- package/dist/mcp-server/tools/shared-inputs.d.ts +93 -12
- package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -1
- package/dist/mcp-server/tools/shared-inputs.js +164 -21
- package/dist/mcp-server/tools/shared-inputs.js.map +1 -1
- package/dist/services/geonames/country-codes.d.ts +32 -0
- package/dist/services/geonames/country-codes.d.ts.map +1 -0
- package/dist/services/geonames/country-codes.js +298 -0
- package/dist/services/geonames/country-codes.js.map +1 -0
- package/dist/services/geonames/geonames-service.d.ts +14 -5
- package/dist/services/geonames/geonames-service.d.ts.map +1 -1
- package/dist/services/geonames/geonames-service.js +98 -42
- package/dist/services/geonames/geonames-service.js.map +1 -1
- package/dist/services/geonames/response-parsers.d.ts +12 -4
- package/dist/services/geonames/response-parsers.d.ts.map +1 -1
- package/dist/services/geonames/response-parsers.js +122 -23
- package/dist/services/geonames/response-parsers.js.map +1 -1
- package/dist/services/geonames/types.d.ts +37 -12
- package/dist/services/geonames/types.d.ts.map +1 -1
- package/dist/services/geonames/types.js +4 -3
- package/dist/services/geonames/types.js.map +1 -1
- package/dist/utils/inline-text.d.ts +52 -12
- package/dist/utils/inline-text.d.ts.map +1 -1
- package/dist/utils/inline-text.js +129 -14
- package/dist/utils/inline-text.js.map +1 -1
- package/package.json +12 -12
- package/server.json +16 -24
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Input schemas and local list semantics shared by every GeoNames tool.
|
|
3
3
|
* Normalizations run in the schema, before validation: blanks from form clients
|
|
4
|
-
* become unset, lists accept a comma-separated string, codes are upper-cased
|
|
5
|
-
* word enums are lower-cased.
|
|
4
|
+
* become unset, lists accept a comma-separated string, codes are upper-cased (country
|
|
5
|
+
* codes mapped to alpha-2), and word enums are lower-cased. Also the checks tools run
|
|
6
|
+
* before any request: country codes GeoNames files no feature under, feature filters
|
|
7
|
+
* that intersect to nothing, and the clamp that holds a limit to the tool's cap; and, once
|
|
8
|
+
* a page is back, the notice fragment naming the territories a country filter also returned.
|
|
6
9
|
* @module mcp-server/tools/shared-inputs
|
|
7
10
|
*/
|
|
8
11
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
9
|
-
import {
|
|
12
|
+
import { alpha2For, isFiledCountryCode } from '../../services/geonames/country-codes.js';
|
|
13
|
+
import { FEATURE_CLASS_CODES, getFeatureCode, } from '../../services/geonames/feature-codes.js';
|
|
10
14
|
/** Blank when absent, null, or a whitespace-only string. */
|
|
11
15
|
export const isBlank = (value) => value === undefined || value === null || (typeof value === 'string' && value.trim() === '');
|
|
12
16
|
/**
|
|
@@ -28,7 +32,8 @@ const unsetIfBlank = (value) => {
|
|
|
28
32
|
export const blankAsUnset = (schema) => z.preprocess(unsetIfBlank, schema);
|
|
29
33
|
/**
|
|
30
34
|
* An optional list that also accepts a comma-separated string. Items are trimmed and
|
|
31
|
-
* normalized, blanks dropped, and an empty list is unset.
|
|
35
|
+
* normalized, blanks dropped, and an empty list is unset. The advertised schema is the array
|
|
36
|
+
* alone, so a description offers only the list; the joined string is tolerated.
|
|
32
37
|
*/
|
|
33
38
|
export function listInput(item, { max, normalize }) {
|
|
34
39
|
return z.preprocess((value) => {
|
|
@@ -43,12 +48,25 @@ export function listInput(item, { max, normalize }) {
|
|
|
43
48
|
return items.length === 0 ? undefined : items.slice(0, max + 1);
|
|
44
49
|
}, z.array(item).max(max).optional());
|
|
45
50
|
}
|
|
46
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Lower-cases a string before `schema` validates it, so a word enum accepts any case (`Tourism`).
|
|
53
|
+
* The advertised enum lists only the lower-case members, so the description offers only those.
|
|
54
|
+
*/
|
|
47
55
|
export const lowerCased = (schema) => z.preprocess((value) => (typeof value === 'string' ? value.toLowerCase() : value), schema);
|
|
48
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The two codes outside ISO 3166-1 alpha-2 that GeoNames' search answers as a country:
|
|
58
|
+
* `UK` (ISO's exceptionally reserved code for the United Kingdom) and `FL` (Liechtenstein's
|
|
59
|
+
* international vehicle code).
|
|
60
|
+
*/
|
|
61
|
+
const COUNTRY_ALIASES = { UK: 'GB', FL: 'LI' };
|
|
62
|
+
/**
|
|
63
|
+
* Upper-cases a country code and maps it to the alpha-2 GeoNames keys countries by: `UK`
|
|
64
|
+
* to `GB` and `FL` to `LI` (see {@link COUNTRY_ALIASES}), and an alpha-3 or three-digit
|
|
65
|
+
* numeric code to its country's alpha-2. A code no country has stays, upper-cased.
|
|
66
|
+
*/
|
|
49
67
|
export const toAlpha2 = (item) => {
|
|
50
68
|
const code = item.toUpperCase();
|
|
51
|
-
return code
|
|
69
|
+
return COUNTRY_ALIASES[code] ?? alpha2For(code) ?? code;
|
|
52
70
|
};
|
|
53
71
|
/** Optional caller GeoNames account; never logged, cached, or echoed. */
|
|
54
72
|
export const geonamesUsernameInput = blankAsUnset(z
|
|
@@ -60,10 +78,11 @@ export const USERNAME_ALIASES = { username: 'geonamesUsername' };
|
|
|
60
78
|
/**
|
|
61
79
|
* Argument names `setup()` registers with `sanitization.setSensitiveFields`, so the
|
|
62
80
|
* failed-call payload record redacts a username sent under a near-miss key. The framework
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
81
|
+
* splits a key into lower-cased words at separators, camelCase boundaries, the end of a run
|
|
82
|
+
* of capitals, and around digits, and matches every run of adjacent words, joined:
|
|
83
|
+
* `user` and `account` cover `geonames_user`, `GEONAMES_USER`, and `GeoNamesAccount`, and
|
|
84
|
+
* the run-together names cover a key written as one word, such as `geonamesuser` or
|
|
85
|
+
* `GEONAMESUSER`, which the word split leaves whole.
|
|
67
86
|
*/
|
|
68
87
|
export const USERNAME_LOG_FIELDS = [
|
|
69
88
|
'geonamesUsername',
|
|
@@ -80,6 +99,8 @@ const MAX_GEONAME_ID = 2_147_483_647;
|
|
|
80
99
|
/**
|
|
81
100
|
* Required GeoNames feature id, as a digit string of at most {@link MAX_GEONAME_ID}. A
|
|
82
101
|
* JSON integer becomes its digit string here, so an out-of-range one gets the range message.
|
|
102
|
+
* The advertised pattern admits only the digit string, so the description offers only that;
|
|
103
|
+
* the URL and integer forms are tolerated.
|
|
83
104
|
*/
|
|
84
105
|
export const geonameIdInput = z
|
|
85
106
|
.preprocess((value) => typeof value === 'string'
|
|
@@ -88,25 +109,127 @@ export const geonameIdInput = z
|
|
|
88
109
|
? String(value)
|
|
89
110
|
: value, z
|
|
90
111
|
.string()
|
|
91
|
-
.regex(/^[1-9]\d*$/, {
|
|
112
|
+
.regex(/^[1-9]\d*$/, {
|
|
113
|
+
error: 'Must be a digit string with no leading zero, such as "5809844".',
|
|
114
|
+
abort: true,
|
|
115
|
+
})
|
|
92
116
|
.refine((id) => Number(id) <= MAX_GEONAME_ID, {
|
|
93
117
|
error: `Must be at most ${MAX_GEONAME_ID}, the largest geonameId GeoNames accepts.`,
|
|
94
118
|
}))
|
|
95
|
-
.describe(`GeoNames feature id
|
|
96
|
-
/**
|
|
119
|
+
.describe(`GeoNames feature id as a digit string up to ${MAX_GEONAME_ID}, such as "5809844" (Seattle): the geonameId the other geonames tools return, sent as a string.`);
|
|
120
|
+
/**
|
|
121
|
+
* Optional country filter, up to 10 codes, each mapped to alpha-2 by {@link toAlpha2}. A
|
|
122
|
+
* well-formed code GeoNames files no feature under passes the schema for the tool to
|
|
123
|
+
* reject before any request; see {@link unknownCountryCodes}. GeoNames' `country` filter
|
|
124
|
+
* also returns the territories it files under a listed country, and the tools relay those
|
|
125
|
+
* rows as returned, so the description says so.
|
|
126
|
+
*/
|
|
97
127
|
export const countriesInput = listInput(z
|
|
98
128
|
.string()
|
|
99
|
-
.regex(/^[A-Z]{2}$/)
|
|
100
|
-
.describe('ISO 3166-1 alpha-2 country code.'), { max: 10, normalize: toAlpha2 }).describe('ISO 3166-1 alpha-2
|
|
129
|
+
.regex(/^([A-Z]{2,3}|\d{3})$/)
|
|
130
|
+
.describe('ISO 3166-1 alpha-2, alpha-3, or three-digit numeric country code.'), { max: 10, normalize: toAlpha2 }).describe('ISO 3166-1 country codes, up to 10, as a list: alpha-2 (US, GB, DE), alpha-3 (USA, GBR, DEU), or three-digit numeric (840, 826, 276), each sent to GeoNames as alpha-2. UK is accepted for GB and FL for LI. A listed country also returns the territories GeoNames files under it (GB also returns IM, JE, and GG), each result naming its own country in countryCode.');
|
|
131
|
+
/**
|
|
132
|
+
* The `countries` entries GeoNames files no feature under: after {@link toAlpha2}, each
|
|
133
|
+
* entry outside the 250 country codes and the retired `AN`, `CS`, and `YU`, whether an
|
|
134
|
+
* alpha-2 such as `EL` or an alpha-3 or numeric code the table could not map. Returns
|
|
135
|
+
* `undefined` when every entry is one of those codes.
|
|
136
|
+
*/
|
|
137
|
+
export function unknownCountryCodes(countries) {
|
|
138
|
+
const unknown = [...new Set(countries?.filter((code) => !isFiledCountryCode(code)))];
|
|
139
|
+
if (unknown.length === 0)
|
|
140
|
+
return;
|
|
141
|
+
return {
|
|
142
|
+
countries: unknown,
|
|
143
|
+
message: `No country has the ${unknown.length === 1 ? 'code' : 'codes'} ${unknown.join(', ')}. countries takes ISO 3166-1 codes: alpha-2 (US, GB, DE), alpha-3 (USA), or three-digit numeric (840).`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const LIST = new Intl.ListFormat('en', { type: 'conjunction' });
|
|
147
|
+
/**
|
|
148
|
+
* The notice fragment naming the countries on a page that `countries` (as the schema
|
|
149
|
+
* normalized it, alpha-2) does not list: the territories GeoNames' `country` filter returns
|
|
150
|
+
* under a listed country, relayed rather than dropped. Each code appears once, in page
|
|
151
|
+
* order, read from the page's own rows, so no parent-to-territory table is needed; a row
|
|
152
|
+
* with no `countryCode` is skipped. `noun` names one row of the page. Returns `undefined`
|
|
153
|
+
* without `countries` or when every code on the page is listed.
|
|
154
|
+
*/
|
|
155
|
+
export function unlistedCountriesFragment(countryCodes, countries, noun) {
|
|
156
|
+
if (countries === undefined)
|
|
157
|
+
return;
|
|
158
|
+
const unlisted = [
|
|
159
|
+
...new Set(countryCodes.filter((code) => code !== undefined && !countries.includes(code))),
|
|
160
|
+
];
|
|
161
|
+
if (unlisted.length === 0)
|
|
162
|
+
return;
|
|
163
|
+
return `This page also holds ${noun}s in ${LIST.format(unlisted)}, which countries does not list: GeoNames returns the territories it files under a listed country, and each ${noun}'s countryCode names its own country.`;
|
|
164
|
+
}
|
|
101
165
|
/** Optional feature-class filter, up to all nine classes. */
|
|
102
|
-
export const featureClassesInput = listInput(z.enum(FEATURE_CLASS_CODES).describe('One-letter GeoNames feature class.'), { max: 9, normalize: (item) => item.toUpperCase() }).describe('GeoNames feature classes: A admin divisions, H water, L areas, P populated places, R roads, S spots and buildings, T terrain, U undersea, V vegetation.
|
|
166
|
+
export const featureClassesInput = listInput(z.enum(FEATURE_CLASS_CODES).describe('One-letter GeoNames feature class.'), { max: 9, normalize: (item) => item.toUpperCase() }).describe('GeoNames feature classes: A admin divisions, H water, L areas, P populated places, R roads, S spots and buildings, T terrain, U undersea, V vegetation. With featureCodes too, the two lists intersect: list exactly the classes of those codes, or pass featureCodes alone.');
|
|
103
167
|
/** Optional feature-code filter, up to 20 codes; tools check each against the bundled table. */
|
|
104
168
|
export const featureCodesInput = listInput(z
|
|
105
169
|
.string()
|
|
106
170
|
.regex(/^[A-Z0-9]{2,5}$/)
|
|
107
|
-
.describe('GeoNames feature code without its class prefix.'), { max: 20, normalize: (item) => item.toUpperCase().replace(/^[A-Z]\./, '') }).describe(
|
|
171
|
+
.describe('GeoNames feature code without its class prefix.'), { max: 20, normalize: (item) => item.toUpperCase().replace(/^[A-Z]\./, '') }).describe("GeoNames feature codes (PPLC capital, ADM1 state, MT mountain, AIRP airport), up to 20, as a list. Each code implies its class; with featureClasses too, the two lists intersect, so featureClasses must list exactly these codes' classes. geonames_list_reference topic feature_codes lists every code.");
|
|
108
172
|
/** Optional population tier for populated places. */
|
|
109
|
-
export const citiesInput = blankAsUnset(lowerCased(z.enum(['cities1000', 'cities5000', 'cities15000']).optional())).describe("Keep only populated places with a population of at least 1,000 (cities1000), 5,000 (cities5000), or 15,000 (cities15000), plus seats of admin divisions: GeoNames' cities tiers.
|
|
173
|
+
export const citiesInput = blankAsUnset(lowerCased(z.enum(['cities1000', 'cities5000', 'cities15000']).optional())).describe("Keep only populated places (class P) with a population of at least 1,000 (cities1000), 5,000 (cities5000), or 15,000 (cities15000), plus seats of admin divisions: GeoNames' cities tiers. Beside featureClasses or featureCodes, list only class P or class-P codes such as PPLC.");
|
|
174
|
+
/** `cities` as the class restriction it is. */
|
|
175
|
+
const CITIES_RESTRICTION = 'cities (class P only)';
|
|
176
|
+
/**
|
|
177
|
+
* GeoNames applies `featureClass`, `featureCode`, and `cities` (class P only) together,
|
|
178
|
+
* so a code whose class is not listed, a listed class with no listed code, and a class or
|
|
179
|
+
* code other than P beside `cities` each match nothing. Returns those entries, or
|
|
180
|
+
* `undefined` when every entry can match. A code the bundled table lacks has no class to
|
|
181
|
+
* compare and is skipped: tools reject it first as `unknown_feature_code`.
|
|
182
|
+
*/
|
|
183
|
+
export function featureFilterMismatch({ featureClasses, featureCodes, cities, }) {
|
|
184
|
+
const classOf = new Map();
|
|
185
|
+
for (const code of featureCodes ?? []) {
|
|
186
|
+
const entry = getFeatureCode(code);
|
|
187
|
+
if (entry)
|
|
188
|
+
classOf.set(code, entry.featureClass);
|
|
189
|
+
}
|
|
190
|
+
const codeClauses = new Map();
|
|
191
|
+
for (const [code, featureClass] of classOf) {
|
|
192
|
+
const outside = [];
|
|
193
|
+
if (featureClasses !== undefined && !featureClasses.includes(featureClass)) {
|
|
194
|
+
outside.push('featureClasses');
|
|
195
|
+
}
|
|
196
|
+
if (cities !== undefined && featureClass !== 'P')
|
|
197
|
+
outside.push(CITIES_RESTRICTION);
|
|
198
|
+
if (outside.length > 0) {
|
|
199
|
+
codeClauses.set(code, `${code} is class ${featureClass}, outside ${outside.join(' and ')}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const codedClasses = new Set(classOf.values());
|
|
203
|
+
const classClauses = new Map();
|
|
204
|
+
for (const featureClass of featureClasses ?? []) {
|
|
205
|
+
const faults = [];
|
|
206
|
+
if (featureCodes !== undefined && !codedClasses.has(featureClass)) {
|
|
207
|
+
faults.push('has no code in featureCodes');
|
|
208
|
+
}
|
|
209
|
+
if (cities !== undefined && featureClass !== 'P') {
|
|
210
|
+
faults.push(`is outside ${CITIES_RESTRICTION}`);
|
|
211
|
+
}
|
|
212
|
+
if (faults.length > 0) {
|
|
213
|
+
classClauses.set(featureClass, `class ${featureClass} ${faults.join(' and ')}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (codeClauses.size === 0 && classClauses.size === 0)
|
|
217
|
+
return;
|
|
218
|
+
const applied = [];
|
|
219
|
+
if (featureClasses !== undefined)
|
|
220
|
+
applied.push('featureClasses');
|
|
221
|
+
if (featureCodes !== undefined)
|
|
222
|
+
applied.push('featureCodes');
|
|
223
|
+
if (cities !== undefined)
|
|
224
|
+
applied.push('cities');
|
|
225
|
+
const filters = LIST.format(applied);
|
|
226
|
+
const clauses = [...codeClauses.values(), ...classClauses.values()].join('; ');
|
|
227
|
+
return {
|
|
228
|
+
featureClasses: [...classClauses.keys()],
|
|
229
|
+
featureCodes: [...codeClauses.keys()],
|
|
230
|
+
message: `GeoNames applies ${filters} together, so these entries can never match: ${clauses}.`,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
110
233
|
/** Latitude in decimal degrees. */
|
|
111
234
|
export const latInput = z
|
|
112
235
|
.number()
|
|
@@ -121,8 +244,28 @@ export const lngInput = z
|
|
|
121
244
|
.describe('Longitude in decimal degrees, -180 to 180.');
|
|
122
245
|
/** Optional local name filter; see {@link nameMatcher}. */
|
|
123
246
|
export const nameContainsInput = blankAsUnset(z.string().max(100).optional()).describe('Keep only entries whose name contains every word of this text as a substring (kansas also matches Arkansas), ignoring case, accents, and punctuation.');
|
|
124
|
-
/**
|
|
125
|
-
|
|
247
|
+
/** The largest `limit` a clamped input accepts; anything above it fails validation as absurd. */
|
|
248
|
+
const LIMIT_CEILING = 1000;
|
|
249
|
+
/**
|
|
250
|
+
* A `limit` input for a tool that returns at most `cap` entries a call: 1 to 1,000, `fallback`
|
|
251
|
+
* when omitted or blank. The handler holds a value above `cap` to `cap` with {@link clampLimit}
|
|
252
|
+
* instead of rejecting a request it can answer up to the cap.
|
|
253
|
+
*/
|
|
254
|
+
export const clampedLimitInput = (cap, fallback) => blankAsUnset(z.number().int().min(1).max(LIMIT_CEILING).default(fallback)).describe(`Maximum entries to return, 1 to ${LIMIT_CEILING.toLocaleString('en-US')}. This tool returns at most ${cap} per call: a larger limit is held to ${cap}, and the notice says so when more entries remain. Default ${fallback}.`);
|
|
255
|
+
/**
|
|
256
|
+
* Holds `requested` to `cap`, before any request or slice. The tool writes `applied` as its
|
|
257
|
+
* `cap` enrichment, and puts `fragment` in its notice ahead of its continuation only on a page
|
|
258
|
+
* with entries remaining past it: a clamped call whose entries all fit says nothing of the
|
|
259
|
+
* clamp. `field` is the input's name as the fragment prints it.
|
|
260
|
+
*/
|
|
261
|
+
export function clampLimit(requested, cap, field = 'limit') {
|
|
262
|
+
return requested > cap
|
|
263
|
+
? {
|
|
264
|
+
applied: cap,
|
|
265
|
+
fragment: `${field} ${requested} was capped at ${cap}, the most this tool returns per call.`,
|
|
266
|
+
}
|
|
267
|
+
: { applied: requested };
|
|
268
|
+
}
|
|
126
269
|
/** An `offset` input: entries to skip, 0 when omitted or blank. */
|
|
127
270
|
export const offsetInput = (max) => blankAsUnset((max === undefined ? z.number().int().min(0) : z.number().int().min(0).max(max)).default(0)).describe(max === undefined
|
|
128
271
|
? 'Entries to skip before the first one returned, for paging. Default 0.'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-inputs.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/shared-inputs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shared-inputs.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/shared-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EACL,mBAAmB,EAEnB,cAAc,GACf,MAAM,sCAAsC,CAAC;AAE9C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAW,EAAE,CACjD,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,KAAc,EAAW,EAAE;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IACrF,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IACjE,CAA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AAC;IACrE,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,QAAQ,GAAG,MAAM;aACpB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;aACtC,GAAG,CAAC,iBAAiB,CAAC;aACtB,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC;AACJ,CAAC;AASD,iFAAiF;AACjF,MAAM,UAAU,QAAQ,CAAI,KAAmB,EAAE,MAAc,EAAE,KAAa;IAC5E,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ISO 3166-1 alpha-2, alpha-3, and numeric codes of the 250 GeoNames
|
|
3
|
+
* countries, bundled so the country filters can map alpha-3 and numeric codes to the
|
|
4
|
+
* alpha-2 GeoNames takes inside a synchronous schema preprocess, and refuse before any
|
|
5
|
+
* request a code GeoNames files no feature under (the 250 plus three retired codes).
|
|
6
|
+
*
|
|
7
|
+
* Source: https://secure.geonames.org/countryInfoJSON (`countryCode`, `isoAlpha3`,
|
|
8
|
+
* `isoNumeric`), fetched 2026-10-01 (250 rows). Kosovo (XK/XKX) has no ISO numeric code
|
|
9
|
+
* (GeoNames sends `0`), so its row has none. Data © GeoNames (geonames.org), CC BY 4.0.
|
|
10
|
+
* Each row below is `alpha2|alpha3|numeric`, sorted by alpha-2.
|
|
11
|
+
* @module services/geonames/country-codes
|
|
12
|
+
*/
|
|
13
|
+
/** One country's ISO 3166-1 codes. */
|
|
14
|
+
export interface CountryCodes {
|
|
15
|
+
alpha2: string;
|
|
16
|
+
alpha3: string;
|
|
17
|
+
/** Three digits, zero-padded; absent for Kosovo. */
|
|
18
|
+
numeric?: string;
|
|
19
|
+
}
|
|
20
|
+
/** All 250 countries, sorted by alpha-2. */
|
|
21
|
+
export declare const COUNTRY_CODES: readonly CountryCodes[];
|
|
22
|
+
/**
|
|
23
|
+
* The alpha-2 code for an upper-case alpha-3 or three-digit numeric code; `undefined` for
|
|
24
|
+
* any other code, an alpha-2 code included.
|
|
25
|
+
*/
|
|
26
|
+
export declare function alpha2For(code: string): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Whether GeoNames files features under the upper-case alpha-2 `code`: one of the 250
|
|
29
|
+
* countries, or a retired code in {@link RETIRED_CODES}.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isFiledCountryCode(code: string): boolean;
|
|
32
|
+
//# sourceMappingURL=country-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-codes.d.ts","sourceRoot":"","sources":["../../../src/services/geonames/country-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA+PD,4CAA4C;AAC5C,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAK7C,CAAC;AAgBL;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ISO 3166-1 alpha-2, alpha-3, and numeric codes of the 250 GeoNames
|
|
3
|
+
* countries, bundled so the country filters can map alpha-3 and numeric codes to the
|
|
4
|
+
* alpha-2 GeoNames takes inside a synchronous schema preprocess, and refuse before any
|
|
5
|
+
* request a code GeoNames files no feature under (the 250 plus three retired codes).
|
|
6
|
+
*
|
|
7
|
+
* Source: https://secure.geonames.org/countryInfoJSON (`countryCode`, `isoAlpha3`,
|
|
8
|
+
* `isoNumeric`), fetched 2026-10-01 (250 rows). Kosovo (XK/XKX) has no ISO numeric code
|
|
9
|
+
* (GeoNames sends `0`), so its row has none. Data © GeoNames (geonames.org), CC BY 4.0.
|
|
10
|
+
* Each row below is `alpha2|alpha3|numeric`, sorted by alpha-2.
|
|
11
|
+
* @module services/geonames/country-codes
|
|
12
|
+
*/
|
|
13
|
+
const ROWS = `
|
|
14
|
+
AD|AND|020
|
|
15
|
+
AE|ARE|784
|
|
16
|
+
AF|AFG|004
|
|
17
|
+
AG|ATG|028
|
|
18
|
+
AI|AIA|660
|
|
19
|
+
AL|ALB|008
|
|
20
|
+
AM|ARM|051
|
|
21
|
+
AO|AGO|024
|
|
22
|
+
AQ|ATA|010
|
|
23
|
+
AR|ARG|032
|
|
24
|
+
AS|ASM|016
|
|
25
|
+
AT|AUT|040
|
|
26
|
+
AU|AUS|036
|
|
27
|
+
AW|ABW|533
|
|
28
|
+
AX|ALA|248
|
|
29
|
+
AZ|AZE|031
|
|
30
|
+
BA|BIH|070
|
|
31
|
+
BB|BRB|052
|
|
32
|
+
BD|BGD|050
|
|
33
|
+
BE|BEL|056
|
|
34
|
+
BF|BFA|854
|
|
35
|
+
BG|BGR|100
|
|
36
|
+
BH|BHR|048
|
|
37
|
+
BI|BDI|108
|
|
38
|
+
BJ|BEN|204
|
|
39
|
+
BL|BLM|652
|
|
40
|
+
BM|BMU|060
|
|
41
|
+
BN|BRN|096
|
|
42
|
+
BO|BOL|068
|
|
43
|
+
BQ|BES|535
|
|
44
|
+
BR|BRA|076
|
|
45
|
+
BS|BHS|044
|
|
46
|
+
BT|BTN|064
|
|
47
|
+
BV|BVT|074
|
|
48
|
+
BW|BWA|072
|
|
49
|
+
BY|BLR|112
|
|
50
|
+
BZ|BLZ|084
|
|
51
|
+
CA|CAN|124
|
|
52
|
+
CC|CCK|166
|
|
53
|
+
CD|COD|180
|
|
54
|
+
CF|CAF|140
|
|
55
|
+
CG|COG|178
|
|
56
|
+
CH|CHE|756
|
|
57
|
+
CI|CIV|384
|
|
58
|
+
CK|COK|184
|
|
59
|
+
CL|CHL|152
|
|
60
|
+
CM|CMR|120
|
|
61
|
+
CN|CHN|156
|
|
62
|
+
CO|COL|170
|
|
63
|
+
CR|CRI|188
|
|
64
|
+
CU|CUB|192
|
|
65
|
+
CV|CPV|132
|
|
66
|
+
CW|CUW|531
|
|
67
|
+
CX|CXR|162
|
|
68
|
+
CY|CYP|196
|
|
69
|
+
CZ|CZE|203
|
|
70
|
+
DE|DEU|276
|
|
71
|
+
DJ|DJI|262
|
|
72
|
+
DK|DNK|208
|
|
73
|
+
DM|DMA|212
|
|
74
|
+
DO|DOM|214
|
|
75
|
+
DZ|DZA|012
|
|
76
|
+
EC|ECU|218
|
|
77
|
+
EE|EST|233
|
|
78
|
+
EG|EGY|818
|
|
79
|
+
EH|ESH|732
|
|
80
|
+
ER|ERI|232
|
|
81
|
+
ES|ESP|724
|
|
82
|
+
ET|ETH|231
|
|
83
|
+
FI|FIN|246
|
|
84
|
+
FJ|FJI|242
|
|
85
|
+
FK|FLK|238
|
|
86
|
+
FM|FSM|583
|
|
87
|
+
FO|FRO|234
|
|
88
|
+
FR|FRA|250
|
|
89
|
+
GA|GAB|266
|
|
90
|
+
GB|GBR|826
|
|
91
|
+
GD|GRD|308
|
|
92
|
+
GE|GEO|268
|
|
93
|
+
GF|GUF|254
|
|
94
|
+
GG|GGY|831
|
|
95
|
+
GH|GHA|288
|
|
96
|
+
GI|GIB|292
|
|
97
|
+
GL|GRL|304
|
|
98
|
+
GM|GMB|270
|
|
99
|
+
GN|GIN|324
|
|
100
|
+
GP|GLP|312
|
|
101
|
+
GQ|GNQ|226
|
|
102
|
+
GR|GRC|300
|
|
103
|
+
GS|SGS|239
|
|
104
|
+
GT|GTM|320
|
|
105
|
+
GU|GUM|316
|
|
106
|
+
GW|GNB|624
|
|
107
|
+
GY|GUY|328
|
|
108
|
+
HK|HKG|344
|
|
109
|
+
HM|HMD|334
|
|
110
|
+
HN|HND|340
|
|
111
|
+
HR|HRV|191
|
|
112
|
+
HT|HTI|332
|
|
113
|
+
HU|HUN|348
|
|
114
|
+
ID|IDN|360
|
|
115
|
+
IE|IRL|372
|
|
116
|
+
IL|ISR|376
|
|
117
|
+
IM|IMN|833
|
|
118
|
+
IN|IND|356
|
|
119
|
+
IO|IOT|086
|
|
120
|
+
IQ|IRQ|368
|
|
121
|
+
IR|IRN|364
|
|
122
|
+
IS|ISL|352
|
|
123
|
+
IT|ITA|380
|
|
124
|
+
JE|JEY|832
|
|
125
|
+
JM|JAM|388
|
|
126
|
+
JO|JOR|400
|
|
127
|
+
JP|JPN|392
|
|
128
|
+
KE|KEN|404
|
|
129
|
+
KG|KGZ|417
|
|
130
|
+
KH|KHM|116
|
|
131
|
+
KI|KIR|296
|
|
132
|
+
KM|COM|174
|
|
133
|
+
KN|KNA|659
|
|
134
|
+
KP|PRK|408
|
|
135
|
+
KR|KOR|410
|
|
136
|
+
KW|KWT|414
|
|
137
|
+
KY|CYM|136
|
|
138
|
+
KZ|KAZ|398
|
|
139
|
+
LA|LAO|418
|
|
140
|
+
LB|LBN|422
|
|
141
|
+
LC|LCA|662
|
|
142
|
+
LI|LIE|438
|
|
143
|
+
LK|LKA|144
|
|
144
|
+
LR|LBR|430
|
|
145
|
+
LS|LSO|426
|
|
146
|
+
LT|LTU|440
|
|
147
|
+
LU|LUX|442
|
|
148
|
+
LV|LVA|428
|
|
149
|
+
LY|LBY|434
|
|
150
|
+
MA|MAR|504
|
|
151
|
+
MC|MCO|492
|
|
152
|
+
MD|MDA|498
|
|
153
|
+
ME|MNE|499
|
|
154
|
+
MF|MAF|663
|
|
155
|
+
MG|MDG|450
|
|
156
|
+
MH|MHL|584
|
|
157
|
+
MK|MKD|807
|
|
158
|
+
ML|MLI|466
|
|
159
|
+
MM|MMR|104
|
|
160
|
+
MN|MNG|496
|
|
161
|
+
MO|MAC|446
|
|
162
|
+
MP|MNP|580
|
|
163
|
+
MQ|MTQ|474
|
|
164
|
+
MR|MRT|478
|
|
165
|
+
MS|MSR|500
|
|
166
|
+
MT|MLT|470
|
|
167
|
+
MU|MUS|480
|
|
168
|
+
MV|MDV|462
|
|
169
|
+
MW|MWI|454
|
|
170
|
+
MX|MEX|484
|
|
171
|
+
MY|MYS|458
|
|
172
|
+
MZ|MOZ|508
|
|
173
|
+
NA|NAM|516
|
|
174
|
+
NC|NCL|540
|
|
175
|
+
NE|NER|562
|
|
176
|
+
NF|NFK|574
|
|
177
|
+
NG|NGA|566
|
|
178
|
+
NI|NIC|558
|
|
179
|
+
NL|NLD|528
|
|
180
|
+
NO|NOR|578
|
|
181
|
+
NP|NPL|524
|
|
182
|
+
NR|NRU|520
|
|
183
|
+
NU|NIU|570
|
|
184
|
+
NZ|NZL|554
|
|
185
|
+
OM|OMN|512
|
|
186
|
+
PA|PAN|591
|
|
187
|
+
PE|PER|604
|
|
188
|
+
PF|PYF|258
|
|
189
|
+
PG|PNG|598
|
|
190
|
+
PH|PHL|608
|
|
191
|
+
PK|PAK|586
|
|
192
|
+
PL|POL|616
|
|
193
|
+
PM|SPM|666
|
|
194
|
+
PN|PCN|612
|
|
195
|
+
PR|PRI|630
|
|
196
|
+
PS|PSE|275
|
|
197
|
+
PT|PRT|620
|
|
198
|
+
PW|PLW|585
|
|
199
|
+
PY|PRY|600
|
|
200
|
+
QA|QAT|634
|
|
201
|
+
RE|REU|638
|
|
202
|
+
RO|ROU|642
|
|
203
|
+
RS|SRB|688
|
|
204
|
+
RU|RUS|643
|
|
205
|
+
RW|RWA|646
|
|
206
|
+
SA|SAU|682
|
|
207
|
+
SB|SLB|090
|
|
208
|
+
SC|SYC|690
|
|
209
|
+
SD|SDN|729
|
|
210
|
+
SE|SWE|752
|
|
211
|
+
SG|SGP|702
|
|
212
|
+
SH|SHN|654
|
|
213
|
+
SI|SVN|705
|
|
214
|
+
SJ|SJM|744
|
|
215
|
+
SK|SVK|703
|
|
216
|
+
SL|SLE|694
|
|
217
|
+
SM|SMR|674
|
|
218
|
+
SN|SEN|686
|
|
219
|
+
SO|SOM|706
|
|
220
|
+
SR|SUR|740
|
|
221
|
+
SS|SSD|728
|
|
222
|
+
ST|STP|678
|
|
223
|
+
SV|SLV|222
|
|
224
|
+
SX|SXM|534
|
|
225
|
+
SY|SYR|760
|
|
226
|
+
SZ|SWZ|748
|
|
227
|
+
TC|TCA|796
|
|
228
|
+
TD|TCD|148
|
|
229
|
+
TF|ATF|260
|
|
230
|
+
TG|TGO|768
|
|
231
|
+
TH|THA|764
|
|
232
|
+
TJ|TJK|762
|
|
233
|
+
TK|TKL|772
|
|
234
|
+
TL|TLS|626
|
|
235
|
+
TM|TKM|795
|
|
236
|
+
TN|TUN|788
|
|
237
|
+
TO|TON|776
|
|
238
|
+
TR|TUR|792
|
|
239
|
+
TT|TTO|780
|
|
240
|
+
TV|TUV|798
|
|
241
|
+
TW|TWN|158
|
|
242
|
+
TZ|TZA|834
|
|
243
|
+
UA|UKR|804
|
|
244
|
+
UG|UGA|800
|
|
245
|
+
UM|UMI|581
|
|
246
|
+
US|USA|840
|
|
247
|
+
UY|URY|858
|
|
248
|
+
UZ|UZB|860
|
|
249
|
+
VA|VAT|336
|
|
250
|
+
VC|VCT|670
|
|
251
|
+
VE|VEN|862
|
|
252
|
+
VG|VGB|092
|
|
253
|
+
VI|VIR|850
|
|
254
|
+
VN|VNM|704
|
|
255
|
+
VU|VUT|548
|
|
256
|
+
WF|WLF|876
|
|
257
|
+
WS|WSM|882
|
|
258
|
+
XK|XKX|
|
|
259
|
+
YE|YEM|887
|
|
260
|
+
YT|MYT|175
|
|
261
|
+
ZA|ZAF|710
|
|
262
|
+
ZM|ZMB|894
|
|
263
|
+
ZW|ZWE|716
|
|
264
|
+
`;
|
|
265
|
+
/** All 250 countries, sorted by alpha-2. */
|
|
266
|
+
export const COUNTRY_CODES = ROWS.trim()
|
|
267
|
+
.split('\n')
|
|
268
|
+
.map((row) => {
|
|
269
|
+
const [alpha2, alpha3, numeric] = row.split('|');
|
|
270
|
+
return { alpha2, alpha3, ...(numeric ? { numeric } : {}) };
|
|
271
|
+
});
|
|
272
|
+
const TO_ALPHA2 = new Map();
|
|
273
|
+
for (const { alpha2, alpha3, numeric } of COUNTRY_CODES) {
|
|
274
|
+
TO_ALPHA2.set(alpha3, alpha2);
|
|
275
|
+
if (numeric)
|
|
276
|
+
TO_ALPHA2.set(numeric, alpha2);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Retired codes GeoNames still files historical-country records under (allCountries dump
|
|
280
|
+
* of 2026-10-18: AN 2 features, CS 2, YU 1); no country row carries them.
|
|
281
|
+
*/
|
|
282
|
+
const RETIRED_CODES = new Set(['AN', 'CS', 'YU']);
|
|
283
|
+
const FILED_CODES = new Set([...COUNTRY_CODES.map(({ alpha2 }) => alpha2), ...RETIRED_CODES]);
|
|
284
|
+
/**
|
|
285
|
+
* The alpha-2 code for an upper-case alpha-3 or three-digit numeric code; `undefined` for
|
|
286
|
+
* any other code, an alpha-2 code included.
|
|
287
|
+
*/
|
|
288
|
+
export function alpha2For(code) {
|
|
289
|
+
return TO_ALPHA2.get(code);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Whether GeoNames files features under the upper-case alpha-2 `code`: one of the 250
|
|
293
|
+
* countries, or a retired code in {@link RETIRED_CODES}.
|
|
294
|
+
*/
|
|
295
|
+
export function isFiledCountryCode(code) {
|
|
296
|
+
return FILED_CODES.has(code);
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=country-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-codes.js","sourceRoot":"","sources":["../../../src/services/geonames/country-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2PZ,CAAC;AAEF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,aAAa,GAA4B,IAAI,CAAC,IAAI,EAAE;KAC9D,KAAK,CAAC,IAAI,CAAC;KACX,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;IACX,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAA6B,CAAC;IAC7E,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEL,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC5C,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,aAAa,EAAE,CAAC;IACxD,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,OAAO;QAAE,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAElD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC;AAE9F;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -63,9 +63,14 @@ export declare class GeoNamesService {
|
|
|
63
63
|
children(geonameId: string, hierarchy: ChildHierarchy, account: GeoNamesAccount, ctx: Context): Promise<ChildrenResult | undefined>;
|
|
64
64
|
/**
|
|
65
65
|
* `countrySubdivisionJSON?level=5` (1 credit, cached 24 h). `undefined` when no country
|
|
66
|
-
* contains the point (status 15) — a result, cached like any other.
|
|
66
|
+
* contains the point (status 15) — a result, cached like any other. A `bufferKm` above 0
|
|
67
|
+
* is sent as `radius`, matching the nearest country within it; at 0 no `radius` is sent,
|
|
68
|
+
* so the request and its cache key are the unbuffered ones. `maxRows` is never sent:
|
|
69
|
+
* beside `radius` it switches the response to a list of subdivisions.
|
|
67
70
|
*/
|
|
68
|
-
subdivision(lat: number, lng: number, account: GeoNamesAccount, ctx: Context
|
|
71
|
+
subdivision(lat: number, lng: number, account: GeoNamesAccount, ctx: Context, options?: {
|
|
72
|
+
bufferKm?: number;
|
|
73
|
+
}): Promise<Subdivision | undefined>;
|
|
69
74
|
/**
|
|
70
75
|
* `oceanJSON` (1 credit, cached 24 h). `undefined` when GeoNames knows no water body
|
|
71
76
|
* there either (status 15). `deadlineMs` narrows the ladder for a follow-up call.
|
|
@@ -78,11 +83,15 @@ export declare class GeoNamesService {
|
|
|
78
83
|
/** `findNearbyJSON` (4 credits, cached 24 h): nearest features of the given classes/codes. */
|
|
79
84
|
nearbyFeatures(params: NearbyFeaturesParams, account: GeoNamesAccount, ctx: Context): Promise<Toponym[]>;
|
|
80
85
|
/**
|
|
81
|
-
* `timezoneJSON` (1 credit, never cached: it carries the current local time)
|
|
82
|
-
* `
|
|
86
|
+
* `timezoneJSON` (1 credit, never cached: it carries the current local time), with the
|
|
87
|
+
* `date` whose solar day covers the point's local date when GeoNames' default one does
|
|
88
|
+
* not. `undefined` when GeoNames answers status 15.
|
|
83
89
|
*/
|
|
84
90
|
timezone(lat: number, lng: number, account: GeoNamesAccount, ctx: Context): Promise<TimezoneInfo | undefined>;
|
|
85
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* `postalCodeSearchJSON` (1 credit, cached 24 h): by postal code or by place name. GeoNames
|
|
93
|
+
* documents no `startRow` here but honors it in both lookups, up to 5000.
|
|
94
|
+
*/
|
|
86
95
|
postalSearch(params: PostalSearchParams, account: GeoNamesAccount, ctx: Context): Promise<PostalCode[]>;
|
|
87
96
|
/** `findNearbyPostalCodesJSON` (2 credits, cached 24 h), nearest first. */
|
|
88
97
|
postalNearby(params: PostalNearbyParams, account: GeoNamesAccount, ctx: Context): Promise<PostalCode[]>;
|