@cyanheads/geonames-mcp-server 0.0.0-stage → 0.1.2

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.
Files changed (91) hide show
  1. package/AGENTS.md +439 -0
  2. package/CLAUDE.md +439 -0
  3. package/Dockerfile +177 -0
  4. package/LICENSE +201 -0
  5. package/README.md +344 -2
  6. package/changelog/0.1.x/0.1.0.md +9 -0
  7. package/changelog/0.1.x/0.1.1.md +22 -0
  8. package/changelog/0.1.x/0.1.2.md +26 -0
  9. package/changelog/template.md +151 -0
  10. package/dist/config/server-config.d.ts +13 -0
  11. package/dist/config/server-config.d.ts.map +1 -0
  12. package/dist/config/server-config.js +21 -0
  13. package/dist/config/server-config.js.map +1 -0
  14. package/dist/index.d.ts +8 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +30 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts +96 -0
  19. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.d.ts.map +1 -0
  20. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js +274 -0
  21. package/dist/mcp-server/tools/definitions/find-postal-codes.tool.js.map +1 -0
  22. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts +90 -0
  23. package/dist/mcp-server/tools/definitions/get-children.tool.d.ts.map +1 -0
  24. package/dist/mcp-server/tools/definitions/get-children.tool.js +287 -0
  25. package/dist/mcp-server/tools/definitions/get-children.tool.js.map +1 -0
  26. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts +90 -0
  27. package/dist/mcp-server/tools/definitions/get-countries.tool.d.ts.map +1 -0
  28. package/dist/mcp-server/tools/definitions/get-countries.tool.js +217 -0
  29. package/dist/mcp-server/tools/definitions/get-countries.tool.js.map +1 -0
  30. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts +64 -0
  31. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.d.ts.map +1 -0
  32. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js +168 -0
  33. package/dist/mcp-server/tools/definitions/get-hierarchy.tool.js.map +1 -0
  34. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts +108 -0
  35. package/dist/mcp-server/tools/definitions/get-place.tool.d.ts.map +1 -0
  36. package/dist/mcp-server/tools/definitions/get-place.tool.js +300 -0
  37. package/dist/mcp-server/tools/definitions/get-place.tool.js.map +1 -0
  38. package/dist/mcp-server/tools/definitions/index.d.ts +760 -0
  39. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  40. package/dist/mcp-server/tools/definitions/index.js +23 -0
  41. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  42. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts +103 -0
  43. package/dist/mcp-server/tools/definitions/list-reference.tool.d.ts.map +1 -0
  44. package/dist/mcp-server/tools/definitions/list-reference.tool.js +233 -0
  45. package/dist/mcp-server/tools/definitions/list-reference.tool.js.map +1 -0
  46. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts +142 -0
  47. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.d.ts.map +1 -0
  48. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js +421 -0
  49. package/dist/mcp-server/tools/definitions/reverse-geocode.tool.js.map +1 -0
  50. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts +145 -0
  51. package/dist/mcp-server/tools/definitions/search-places.tool.d.ts.map +1 -0
  52. package/dist/mcp-server/tools/definitions/search-places.tool.js +385 -0
  53. package/dist/mcp-server/tools/definitions/search-places.tool.js.map +1 -0
  54. package/dist/mcp-server/tools/shared-inputs.d.ts +140 -0
  55. package/dist/mcp-server/tools/shared-inputs.d.ts.map +1 -0
  56. package/dist/mcp-server/tools/shared-inputs.js +240 -0
  57. package/dist/mcp-server/tools/shared-inputs.js.map +1 -0
  58. package/dist/services/geonames/country-codes.d.ts +26 -0
  59. package/dist/services/geonames/country-codes.d.ts.map +1 -0
  60. package/dist/services/geonames/country-codes.js +284 -0
  61. package/dist/services/geonames/country-codes.js.map +1 -0
  62. package/dist/services/geonames/feature-codes.d.ts +27 -0
  63. package/dist/services/geonames/feature-codes.d.ts.map +1 -0
  64. package/dist/services/geonames/feature-codes.js +723 -0
  65. package/dist/services/geonames/feature-codes.js.map +1 -0
  66. package/dist/services/geonames/geonames-service.d.ts +103 -0
  67. package/dist/services/geonames/geonames-service.d.ts.map +1 -0
  68. package/dist/services/geonames/geonames-service.js +561 -0
  69. package/dist/services/geonames/geonames-service.js.map +1 -0
  70. package/dist/services/geonames/response-cache.d.ts +24 -0
  71. package/dist/services/geonames/response-cache.d.ts.map +1 -0
  72. package/dist/services/geonames/response-cache.js +44 -0
  73. package/dist/services/geonames/response-cache.js.map +1 -0
  74. package/dist/services/geonames/response-parsers.d.ts +38 -0
  75. package/dist/services/geonames/response-parsers.d.ts.map +1 -0
  76. package/dist/services/geonames/response-parsers.js +369 -0
  77. package/dist/services/geonames/response-parsers.js.map +1 -0
  78. package/dist/services/geonames/types.d.ts +226 -0
  79. package/dist/services/geonames/types.d.ts.map +1 -0
  80. package/dist/services/geonames/types.js +10 -0
  81. package/dist/services/geonames/types.js.map +1 -0
  82. package/dist/services/geonames/upstream-errors.d.ts +54 -0
  83. package/dist/services/geonames/upstream-errors.d.ts.map +1 -0
  84. package/dist/services/geonames/upstream-errors.js +187 -0
  85. package/dist/services/geonames/upstream-errors.js.map +1 -0
  86. package/dist/utils/inline-text.d.ts +25 -0
  87. package/dist/utils/inline-text.d.ts.map +1 -0
  88. package/dist/utils/inline-text.js +60 -0
  89. package/dist/utils/inline-text.js.map +1 -0
  90. package/package.json +108 -4
  91. package/server.json +120 -0
@@ -0,0 +1,240 @@
1
+ /**
2
+ * @fileoverview Input schemas and local list semantics shared by every GeoNames tool.
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 (country
5
+ * codes mapped to alpha-2), and word enums are lower-cased. Also the checks tools run
6
+ * before any request: country codes no country has, and feature filters that intersect
7
+ * to nothing.
8
+ * @module mcp-server/tools/shared-inputs
9
+ */
10
+ import { z } from '@cyanheads/mcp-ts-core';
11
+ import { alpha2For } from '../../services/geonames/country-codes.js';
12
+ import { FEATURE_CLASS_CODES, getFeatureCode, } from '../../services/geonames/feature-codes.js';
13
+ /** Blank when absent, null, or a whitespace-only string. */
14
+ export const isBlank = (value) => value === undefined || value === null || (typeof value === 'string' && value.trim() === '');
15
+ /**
16
+ * Maps a form client's blank to "unset" and trims strings. An object whose fields
17
+ * are all blank is unset too.
18
+ */
19
+ const unsetIfBlank = (value) => {
20
+ if (typeof value === 'string')
21
+ return value.trim() === '' ? undefined : value.trim();
22
+ if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
23
+ return Object.values(value).every(isBlank) ? undefined : value;
24
+ }
25
+ return value;
26
+ };
27
+ /**
28
+ * Wraps an optional or defaulted schema so `''`, whitespace, and all-blank objects
29
+ * parse as unset (taking the default when there is one). Sits outside `.default()`.
30
+ */
31
+ export const blankAsUnset = (schema) => z.preprocess(unsetIfBlank, schema);
32
+ /**
33
+ * An optional list that also accepts a comma-separated string. Items are trimmed and
34
+ * normalized, blanks dropped, and an empty list is unset.
35
+ */
36
+ export function listInput(item, { max, normalize }) {
37
+ return z.preprocess((value) => {
38
+ if (isBlank(value))
39
+ return;
40
+ const raw = typeof value === 'string' ? value.split(',') : value;
41
+ if (!Array.isArray(raw))
42
+ return raw;
43
+ const items = raw
44
+ .map((entry) => (typeof entry === 'string' ? normalize(entry.trim()) : entry))
45
+ .filter((entry) => entry !== '');
46
+ return items.length === 0 ? undefined : items.slice(0, max + 1);
47
+ }, z.array(item).max(max).optional());
48
+ }
49
+ /** Lower-cases a string before `schema` validates it, so a word enum accepts any case (`Tourism`). */
50
+ export const lowerCased = (schema) => z.preprocess((value) => (typeof value === 'string' ? value.toLowerCase() : value), schema);
51
+ /**
52
+ * Upper-cases a country code and maps it to the alpha-2 GeoNames keys countries by: `UK`
53
+ * (ISO's exceptionally reserved code for the United Kingdom) to `GB`, and an alpha-3 or
54
+ * three-digit numeric code to its country's alpha-2. A code no country has stays, upper-cased.
55
+ */
56
+ export const toAlpha2 = (item) => {
57
+ const code = item.toUpperCase();
58
+ return code === 'UK' ? 'GB' : (alpha2For(code) ?? code);
59
+ };
60
+ /** Optional caller GeoNames account; never logged, cached, or echoed. */
61
+ export const geonamesUsernameInput = blankAsUnset(z
62
+ .string()
63
+ .regex(/^\S{1,64}$/)
64
+ .optional()).describe("Your own GeoNames username, so the call spends that account's free credits instead of the server's. Omit it to use the server's account. The account needs free web services enabled on its geonames.org account page.");
65
+ /** Spread into a tool's `inputAliases`. */
66
+ export const USERNAME_ALIASES = { username: 'geonamesUsername' };
67
+ /**
68
+ * Argument names `setup()` registers with `sanitization.setSensitiveFields`, so the
69
+ * failed-call payload record redacts a username sent under a near-miss key. The framework
70
+ * matches a key by its lower-cased alphanumerics and by its camelCase, snake_case, or
71
+ * kebab-case words: `user` and `account` cover `geonames_user` and `GeoNamesAccount`, and
72
+ * the run-together names cover all-caps keys such as `GEONAMES_USER`, which split into
73
+ * single letters.
74
+ */
75
+ export const USERNAME_LOG_FIELDS = [
76
+ 'geonamesUsername',
77
+ 'username',
78
+ 'geonamesUser',
79
+ 'geonamesAccount',
80
+ 'user',
81
+ 'account',
82
+ ];
83
+ /** A geonames.org page or Linked Data URL; capture group 1 is the id. */
84
+ const GEONAMES_URL = /^(?:https?:\/\/)?(?:www\.|sws\.)?geonames\.org\/(\d+)(?:[/?#].*)?$/i;
85
+ /** GeoNames parses an id as a 32-bit integer and rejects anything larger (status 14). */
86
+ const MAX_GEONAME_ID = 2_147_483_647;
87
+ /**
88
+ * Required GeoNames feature id, as a digit string of at most {@link MAX_GEONAME_ID}. A
89
+ * JSON integer becomes its digit string here, so an out-of-range one gets the range message.
90
+ */
91
+ export const geonameIdInput = z
92
+ .preprocess((value) => typeof value === 'string'
93
+ ? (GEONAMES_URL.exec(value.trim())?.[1] ?? value.trim())
94
+ : Number.isSafeInteger(value)
95
+ ? String(value)
96
+ : value, z
97
+ .string()
98
+ .regex(/^[1-9]\d*$/, { error: 'Must be a positive integer such as 5809844.', abort: true })
99
+ .refine((id) => Number(id) <= MAX_GEONAME_ID, {
100
+ error: `Must be at most ${MAX_GEONAME_ID}, the largest geonameId GeoNames accepts.`,
101
+ }))
102
+ .describe(`GeoNames feature id, a positive integer up to ${MAX_GEONAME_ID} such as 5809844 (Seattle), as returned in geonameId by the other geonames tools. A geonames.org/<id> URL is reduced to its id.`);
103
+ /**
104
+ * Optional country filter, up to 10 codes, each mapped to alpha-2 by {@link toAlpha2}. A
105
+ * well-formed alpha-3 or numeric code no country has passes the schema for the tool to
106
+ * reject; see {@link unknownCountryCodes}.
107
+ */
108
+ export const countriesInput = listInput(z
109
+ .string()
110
+ .regex(/^([A-Z]{2,3}|\d{3})$/)
111
+ .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 or a comma-separated string: alpha-2 (US, GB, DE), alpha-3 (USA, GBR, DEU), or three-digit numeric (840, 826, 276), each sent to GeoNames as alpha-2. Case-insensitive; UK is accepted for GB.');
112
+ /**
113
+ * The `countries` entries {@link toAlpha2} could not map: well-formed alpha-3 or numeric
114
+ * codes no country has. Returns `undefined` when every entry is alpha-2; an alpha-2 code
115
+ * GeoNames does not know still goes upstream and matches nothing.
116
+ */
117
+ export function unknownCountryCodes(countries) {
118
+ const unknown = [...new Set(countries?.filter((code) => code.length !== 2))];
119
+ if (unknown.length === 0)
120
+ return;
121
+ return {
122
+ countries: unknown,
123
+ 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).`,
124
+ };
125
+ }
126
+ /** Optional feature-class filter, up to all nine classes. */
127
+ 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. A list or a comma-separated string; case-insensitive. With featureCodes too, the two lists intersect: list exactly the classes of those codes, or pass featureCodes alone.');
128
+ /** Optional feature-code filter, up to 20 codes; tools check each against the bundled table. */
129
+ export const featureCodesInput = listInput(z
130
+ .string()
131
+ .regex(/^[A-Z0-9]{2,5}$/)
132
+ .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 or a comma-separated string. Case-insensitive; a class prefix (P.PPLC) is dropped. 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.");
133
+ /** Optional population tier for populated places. */
134
+ 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. Case-insensitive.");
135
+ /** `cities` as the class restriction it is. */
136
+ const CITIES_RESTRICTION = 'cities (class P only)';
137
+ /**
138
+ * GeoNames applies `featureClass`, `featureCode`, and `cities` (class P only) together,
139
+ * so a code whose class is not listed, a listed class with no listed code, and a class or
140
+ * code other than P beside `cities` each match nothing. Returns those entries, or
141
+ * `undefined` when every entry can match. A code the bundled table lacks has no class to
142
+ * compare and is skipped: tools reject it first as `unknown_feature_code`.
143
+ */
144
+ export function featureFilterMismatch({ featureClasses, featureCodes, cities, }) {
145
+ const classOf = new Map();
146
+ for (const code of featureCodes ?? []) {
147
+ const entry = getFeatureCode(code);
148
+ if (entry)
149
+ classOf.set(code, entry.featureClass);
150
+ }
151
+ const codeClauses = new Map();
152
+ for (const [code, featureClass] of classOf) {
153
+ const outside = [];
154
+ if (featureClasses !== undefined && !featureClasses.includes(featureClass)) {
155
+ outside.push('featureClasses');
156
+ }
157
+ if (cities !== undefined && featureClass !== 'P')
158
+ outside.push(CITIES_RESTRICTION);
159
+ if (outside.length > 0) {
160
+ codeClauses.set(code, `${code} is class ${featureClass}, outside ${outside.join(' and ')}`);
161
+ }
162
+ }
163
+ const codedClasses = new Set(classOf.values());
164
+ const classClauses = new Map();
165
+ for (const featureClass of featureClasses ?? []) {
166
+ const faults = [];
167
+ if (featureCodes !== undefined && !codedClasses.has(featureClass)) {
168
+ faults.push('has no code in featureCodes');
169
+ }
170
+ if (cities !== undefined && featureClass !== 'P') {
171
+ faults.push(`is outside ${CITIES_RESTRICTION}`);
172
+ }
173
+ if (faults.length > 0) {
174
+ classClauses.set(featureClass, `class ${featureClass} ${faults.join(' and ')}`);
175
+ }
176
+ }
177
+ if (codeClauses.size === 0 && classClauses.size === 0)
178
+ return;
179
+ const applied = [];
180
+ if (featureClasses !== undefined)
181
+ applied.push('featureClasses');
182
+ if (featureCodes !== undefined)
183
+ applied.push('featureCodes');
184
+ if (cities !== undefined)
185
+ applied.push('cities');
186
+ const filters = new Intl.ListFormat('en', { type: 'conjunction' }).format(applied);
187
+ const clauses = [...codeClauses.values(), ...classClauses.values()].join('; ');
188
+ return {
189
+ featureClasses: [...classClauses.keys()],
190
+ featureCodes: [...codeClauses.keys()],
191
+ message: `GeoNames applies ${filters} together, so these entries can never match: ${clauses}.`,
192
+ };
193
+ }
194
+ /** Latitude in decimal degrees. */
195
+ export const latInput = z
196
+ .number()
197
+ .min(-90)
198
+ .max(90)
199
+ .describe('Latitude in decimal degrees, -90 to 90.');
200
+ /** Longitude in decimal degrees. */
201
+ export const lngInput = z
202
+ .number()
203
+ .min(-180)
204
+ .max(180)
205
+ .describe('Longitude in decimal degrees, -180 to 180.');
206
+ /** Optional local name filter; see {@link nameMatcher}. */
207
+ 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.');
208
+ /** A `limit` input: 1–`max`, `fallback` when omitted or blank. */
209
+ export const limitInput = (max, fallback) => blankAsUnset(z.number().int().min(1).max(max).default(fallback)).describe(`Maximum entries to return, 1 to ${max}. Default ${fallback}.`);
210
+ /** An `offset` input: entries to skip, 0 when omitted or blank. */
211
+ export const offsetInput = (max) => blankAsUnset((max === undefined ? z.number().int().min(0) : z.number().int().min(0).max(max)).default(0)).describe(max === undefined
212
+ ? 'Entries to skip before the first one returned, for paging. Default 0.'
213
+ : `Entries to skip before the first one returned, for paging, 0 to ${max}. Default 0.`);
214
+ /** Lower-cases, decomposes, and strips accents and punctuation for token matching. */
215
+ const normalizeForMatch = (value) => value
216
+ .toLowerCase()
217
+ .normalize('NFKD')
218
+ .replace(/\p{M}/gu, '')
219
+ .replace(/[^\p{L}\p{N}\s]/gu, ' ');
220
+ /**
221
+ * Builds the strict token matcher behind `nameContains`: every word of `query` must
222
+ * appear somewhere in the given fields.
223
+ */
224
+ export function nameMatcher(query) {
225
+ const tokens = normalizeForMatch(query).split(/\s+/).filter(Boolean);
226
+ return (fields) => {
227
+ const haystack = fields
228
+ .filter((field) => field !== undefined)
229
+ .map(normalizeForMatch)
230
+ .join(' ');
231
+ return tokens.every((token) => haystack.includes(token));
232
+ };
233
+ }
234
+ /** Slices `items` at `offset`/`limit` and reports where the next page starts. */
235
+ export function paginate(items, offset, limit) {
236
+ const page = items.slice(offset, offset + limit);
237
+ const next = offset + page.length;
238
+ return { page, ...(page.length > 0 && next < items.length ? { nextOffset: next } : {}) };
239
+ }
240
+ //# sourceMappingURL=shared-inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-inputs.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/shared-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OA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G,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,26 @@
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.
5
+ *
6
+ * Source: https://secure.geonames.org/countryInfoJSON (`countryCode`, `isoAlpha3`,
7
+ * `isoNumeric`), fetched 2026-10-01 (250 rows). Kosovo (XK/XKX) has no ISO numeric code
8
+ * (GeoNames sends `0`), so its row has none. Data © GeoNames (geonames.org), CC BY 4.0.
9
+ * Each row below is `alpha2|alpha3|numeric`, sorted by alpha-2.
10
+ * @module services/geonames/country-codes
11
+ */
12
+ /** One country's ISO 3166-1 codes. */
13
+ export interface CountryCodes {
14
+ alpha2: string;
15
+ alpha3: string;
16
+ /** Three digits, zero-padded; absent for Kosovo. */
17
+ numeric?: string;
18
+ }
19
+ /** All 250 countries, sorted by alpha-2. */
20
+ export declare const COUNTRY_CODES: readonly CountryCodes[];
21
+ /**
22
+ * The alpha-2 code for an upper-case alpha-3 or three-digit numeric code; `undefined` for
23
+ * any other code, an alpha-2 code included.
24
+ */
25
+ export declare function alpha2For(code: string): string | undefined;
26
+ //# 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;;;;;;;;;;GAUG;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;AAQL;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE1D"}
@@ -0,0 +1,284 @@
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.
5
+ *
6
+ * Source: https://secure.geonames.org/countryInfoJSON (`countryCode`, `isoAlpha3`,
7
+ * `isoNumeric`), fetched 2026-10-01 (250 rows). Kosovo (XK/XKX) has no ISO numeric code
8
+ * (GeoNames sends `0`), so its row has none. Data © GeoNames (geonames.org), CC BY 4.0.
9
+ * Each row below is `alpha2|alpha3|numeric`, sorted by alpha-2.
10
+ * @module services/geonames/country-codes
11
+ */
12
+ const ROWS = `
13
+ AD|AND|020
14
+ AE|ARE|784
15
+ AF|AFG|004
16
+ AG|ATG|028
17
+ AI|AIA|660
18
+ AL|ALB|008
19
+ AM|ARM|051
20
+ AO|AGO|024
21
+ AQ|ATA|010
22
+ AR|ARG|032
23
+ AS|ASM|016
24
+ AT|AUT|040
25
+ AU|AUS|036
26
+ AW|ABW|533
27
+ AX|ALA|248
28
+ AZ|AZE|031
29
+ BA|BIH|070
30
+ BB|BRB|052
31
+ BD|BGD|050
32
+ BE|BEL|056
33
+ BF|BFA|854
34
+ BG|BGR|100
35
+ BH|BHR|048
36
+ BI|BDI|108
37
+ BJ|BEN|204
38
+ BL|BLM|652
39
+ BM|BMU|060
40
+ BN|BRN|096
41
+ BO|BOL|068
42
+ BQ|BES|535
43
+ BR|BRA|076
44
+ BS|BHS|044
45
+ BT|BTN|064
46
+ BV|BVT|074
47
+ BW|BWA|072
48
+ BY|BLR|112
49
+ BZ|BLZ|084
50
+ CA|CAN|124
51
+ CC|CCK|166
52
+ CD|COD|180
53
+ CF|CAF|140
54
+ CG|COG|178
55
+ CH|CHE|756
56
+ CI|CIV|384
57
+ CK|COK|184
58
+ CL|CHL|152
59
+ CM|CMR|120
60
+ CN|CHN|156
61
+ CO|COL|170
62
+ CR|CRI|188
63
+ CU|CUB|192
64
+ CV|CPV|132
65
+ CW|CUW|531
66
+ CX|CXR|162
67
+ CY|CYP|196
68
+ CZ|CZE|203
69
+ DE|DEU|276
70
+ DJ|DJI|262
71
+ DK|DNK|208
72
+ DM|DMA|212
73
+ DO|DOM|214
74
+ DZ|DZA|012
75
+ EC|ECU|218
76
+ EE|EST|233
77
+ EG|EGY|818
78
+ EH|ESH|732
79
+ ER|ERI|232
80
+ ES|ESP|724
81
+ ET|ETH|231
82
+ FI|FIN|246
83
+ FJ|FJI|242
84
+ FK|FLK|238
85
+ FM|FSM|583
86
+ FO|FRO|234
87
+ FR|FRA|250
88
+ GA|GAB|266
89
+ GB|GBR|826
90
+ GD|GRD|308
91
+ GE|GEO|268
92
+ GF|GUF|254
93
+ GG|GGY|831
94
+ GH|GHA|288
95
+ GI|GIB|292
96
+ GL|GRL|304
97
+ GM|GMB|270
98
+ GN|GIN|324
99
+ GP|GLP|312
100
+ GQ|GNQ|226
101
+ GR|GRC|300
102
+ GS|SGS|239
103
+ GT|GTM|320
104
+ GU|GUM|316
105
+ GW|GNB|624
106
+ GY|GUY|328
107
+ HK|HKG|344
108
+ HM|HMD|334
109
+ HN|HND|340
110
+ HR|HRV|191
111
+ HT|HTI|332
112
+ HU|HUN|348
113
+ ID|IDN|360
114
+ IE|IRL|372
115
+ IL|ISR|376
116
+ IM|IMN|833
117
+ IN|IND|356
118
+ IO|IOT|086
119
+ IQ|IRQ|368
120
+ IR|IRN|364
121
+ IS|ISL|352
122
+ IT|ITA|380
123
+ JE|JEY|832
124
+ JM|JAM|388
125
+ JO|JOR|400
126
+ JP|JPN|392
127
+ KE|KEN|404
128
+ KG|KGZ|417
129
+ KH|KHM|116
130
+ KI|KIR|296
131
+ KM|COM|174
132
+ KN|KNA|659
133
+ KP|PRK|408
134
+ KR|KOR|410
135
+ KW|KWT|414
136
+ KY|CYM|136
137
+ KZ|KAZ|398
138
+ LA|LAO|418
139
+ LB|LBN|422
140
+ LC|LCA|662
141
+ LI|LIE|438
142
+ LK|LKA|144
143
+ LR|LBR|430
144
+ LS|LSO|426
145
+ LT|LTU|440
146
+ LU|LUX|442
147
+ LV|LVA|428
148
+ LY|LBY|434
149
+ MA|MAR|504
150
+ MC|MCO|492
151
+ MD|MDA|498
152
+ ME|MNE|499
153
+ MF|MAF|663
154
+ MG|MDG|450
155
+ MH|MHL|584
156
+ MK|MKD|807
157
+ ML|MLI|466
158
+ MM|MMR|104
159
+ MN|MNG|496
160
+ MO|MAC|446
161
+ MP|MNP|580
162
+ MQ|MTQ|474
163
+ MR|MRT|478
164
+ MS|MSR|500
165
+ MT|MLT|470
166
+ MU|MUS|480
167
+ MV|MDV|462
168
+ MW|MWI|454
169
+ MX|MEX|484
170
+ MY|MYS|458
171
+ MZ|MOZ|508
172
+ NA|NAM|516
173
+ NC|NCL|540
174
+ NE|NER|562
175
+ NF|NFK|574
176
+ NG|NGA|566
177
+ NI|NIC|558
178
+ NL|NLD|528
179
+ NO|NOR|578
180
+ NP|NPL|524
181
+ NR|NRU|520
182
+ NU|NIU|570
183
+ NZ|NZL|554
184
+ OM|OMN|512
185
+ PA|PAN|591
186
+ PE|PER|604
187
+ PF|PYF|258
188
+ PG|PNG|598
189
+ PH|PHL|608
190
+ PK|PAK|586
191
+ PL|POL|616
192
+ PM|SPM|666
193
+ PN|PCN|612
194
+ PR|PRI|630
195
+ PS|PSE|275
196
+ PT|PRT|620
197
+ PW|PLW|585
198
+ PY|PRY|600
199
+ QA|QAT|634
200
+ RE|REU|638
201
+ RO|ROU|642
202
+ RS|SRB|688
203
+ RU|RUS|643
204
+ RW|RWA|646
205
+ SA|SAU|682
206
+ SB|SLB|090
207
+ SC|SYC|690
208
+ SD|SDN|729
209
+ SE|SWE|752
210
+ SG|SGP|702
211
+ SH|SHN|654
212
+ SI|SVN|705
213
+ SJ|SJM|744
214
+ SK|SVK|703
215
+ SL|SLE|694
216
+ SM|SMR|674
217
+ SN|SEN|686
218
+ SO|SOM|706
219
+ SR|SUR|740
220
+ SS|SSD|728
221
+ ST|STP|678
222
+ SV|SLV|222
223
+ SX|SXM|534
224
+ SY|SYR|760
225
+ SZ|SWZ|748
226
+ TC|TCA|796
227
+ TD|TCD|148
228
+ TF|ATF|260
229
+ TG|TGO|768
230
+ TH|THA|764
231
+ TJ|TJK|762
232
+ TK|TKL|772
233
+ TL|TLS|626
234
+ TM|TKM|795
235
+ TN|TUN|788
236
+ TO|TON|776
237
+ TR|TUR|792
238
+ TT|TTO|780
239
+ TV|TUV|798
240
+ TW|TWN|158
241
+ TZ|TZA|834
242
+ UA|UKR|804
243
+ UG|UGA|800
244
+ UM|UMI|581
245
+ US|USA|840
246
+ UY|URY|858
247
+ UZ|UZB|860
248
+ VA|VAT|336
249
+ VC|VCT|670
250
+ VE|VEN|862
251
+ VG|VGB|092
252
+ VI|VIR|850
253
+ VN|VNM|704
254
+ VU|VUT|548
255
+ WF|WLF|876
256
+ WS|WSM|882
257
+ XK|XKX|
258
+ YE|YEM|887
259
+ YT|MYT|175
260
+ ZA|ZAF|710
261
+ ZM|ZMB|894
262
+ ZW|ZWE|716
263
+ `;
264
+ /** All 250 countries, sorted by alpha-2. */
265
+ export const COUNTRY_CODES = ROWS.trim()
266
+ .split('\n')
267
+ .map((row) => {
268
+ const [alpha2, alpha3, numeric] = row.split('|');
269
+ return { alpha2, alpha3, ...(numeric ? { numeric } : {}) };
270
+ });
271
+ const TO_ALPHA2 = new Map();
272
+ for (const { alpha2, alpha3, numeric } of COUNTRY_CODES) {
273
+ TO_ALPHA2.set(alpha3, alpha2);
274
+ if (numeric)
275
+ TO_ALPHA2.set(numeric, alpha2);
276
+ }
277
+ /**
278
+ * The alpha-2 code for an upper-case alpha-3 or three-digit numeric code; `undefined` for
279
+ * any other code, an alpha-2 code included.
280
+ */
281
+ export function alpha2For(code) {
282
+ return TO_ALPHA2.get(code);
283
+ }
284
+ //# 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;;;;;;;;;;GAUG;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,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @fileoverview GeoNames feature classes and the 684 feature codes, bundled.
3
+ *
4
+ * Source: https://download.geonames.org/export/dump/featureCodes_en.txt, fetched
5
+ * 2026-10-01 (685 lines: 684 codes plus a `null` placeholder row, dropped here).
6
+ * Class labels: https://download.geonames.org/export/dump/readme.txt, same date.
7
+ * Data © GeoNames (geonames.org), CC BY 4.0. Each row below is
8
+ * `class|code|name|description`; an empty description is GeoNames' own.
9
+ * @module services/geonames/feature-codes
10
+ */
11
+ /** The nine one-letter GeoNames feature classes. */
12
+ export declare const FEATURE_CLASS_CODES: readonly ['A', 'H', 'L', 'P', 'R', 'S', 'T', 'U', 'V'];
13
+ export type FeatureClass = (typeof FEATURE_CLASS_CODES)[number];
14
+ /** One GeoNames feature code, keyed without its class prefix (`PPLC`, not `P.PPLC`). */
15
+ export interface FeatureCode {
16
+ code: string;
17
+ description?: string;
18
+ featureClass: FeatureClass;
19
+ name: string;
20
+ }
21
+ /** GeoNames' own label for each feature class, from the dump readme. */
22
+ export declare const FEATURE_CLASS_LABELS: Readonly<Record<FeatureClass, string>>;
23
+ /** All 684 feature codes, in GeoNames' file order (by class, then code). */
24
+ export declare const FEATURE_CODES: readonly FeatureCode[];
25
+ /** Looks up a bare feature code (`PPLC`); `undefined` when GeoNames defines no such code. */
26
+ export declare function getFeatureCode(code: string): FeatureCode | undefined;
27
+ //# sourceMappingURL=feature-codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-codes.d.ts","sourceRoot":"","sources":["../../../src/services/geonames/feature-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,YAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAE1F,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,wFAAwF;AACxF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAUvE,CAAC;AAirBF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAU5C,CAAC;AAIL,6FAA6F;AAC7F,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEpE"}