@parseapi/sdk 1.10.5 → 1.11.0
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/README.md +36 -2
- package/dist/index.cjs +88 -11
- package/dist/index.d.cts +224 -24
- package/dist/index.d.ts +224 -24
- package/dist/index.js +88 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,7 +273,7 @@ const place = await parse.postal('28202', { country: 'US', deep: true });
|
|
|
273
273
|
const propertyTax = place.deep?.property_tax;
|
|
274
274
|
```
|
|
275
275
|
|
|
276
|
-
Read `
|
|
276
|
+
Read `population` as the source’s count for that place boundary. Keep missing or null values unknown and preserve a known zero. State district lists include each district’s population. Postal nearby and distance detail remains metropolitan associations only. Continent population stays in core.
|
|
277
277
|
|
|
278
278
|
Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
|
|
279
279
|
|
|
@@ -285,7 +285,7 @@ await parse.weather(40.7128, -74.006, { deep: true, date: '2026-08-15' });
|
|
|
285
285
|
|
|
286
286
|
Tariff starts with the general schedule line. Paid deep adds units and the special and other schedule columns. An optional origin then resolves country-specific measures. The three calls below show those successive choices. Without origin, schedule detail is still returned and origin-dependent fields are null. A null effective rate is not a zero rate.
|
|
287
287
|
|
|
288
|
-
Tariff lookup and search accept
|
|
288
|
+
Tariff lookup and search accept the `edition` ID returned by Tariff, such as `ted_3`, and an optional `date` (`YYYY-MM-DD`). The edition pins exact immutable source bytes. A date is accepted only when verified source coverage exists. An edition without a date returns undated schedule context (`date: null`). Default requests use today. Paid detail exposes an open-string `reason` when `effective_rate` is null, including `incomplete_coverage`. A null rate never means zero. Explicit selections fail with `tariff_selection_mismatch` if an older server ignores the requested scope.
|
|
289
289
|
|
|
290
290
|
Origin means where the goods originate, not where they ship from. The effective rate covers matched stored schedule measures only. It is not complete duty or landed cost.
|
|
291
291
|
|
|
@@ -485,3 +485,37 @@ A device's emoji font remains the ordinary display.
|
|
|
485
485
|
|
|
486
486
|
These additions are a local release candidate until the matching SDK and
|
|
487
487
|
backend are published. Existing lookup and search contracts are preserved.
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
## Canonical City operations
|
|
491
|
+
|
|
492
|
+
Classic lookup, search, nearest and named-nearby methods retain their default envelopes and required-field models. Browse and coordinate-nearby use canonical lists: `object`, `data` and nullable `next_cursor` (camelCase properties in Swift/Kotlin). Keep all query options unchanged when continuing a page; no client fetches pages automatically.
|
|
493
|
+
|
|
494
|
+
```js
|
|
495
|
+
const page = await parse.city.search('Viena', {
|
|
496
|
+
format: 'list', match: 'fuzzy', maxDistance: 1,
|
|
497
|
+
});
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Select `format=resource` for one City or `format=list` for a collection. Country inclusion/exclusion sets, timezone sets, inclusive population and meter-elevation bounds, stored-center `bbox` and signed multi-key sorting are available for collections. Unknown numeric facts do not match range filters.
|
|
501
|
+
|
|
502
|
+
Search defaults to prefix matching. Exact and fuzzy matching are explicit; fuzzy accepts maximum edit distance 1 or 2 and returns `match` evidence (`type`, `source`, `value`, `language`, `edit_distance`). Review a fuzzy choice before storing its ID.
|
|
503
|
+
|
|
504
|
+
Reviewed children, ancestors and siblings use canonical lists with partial relationship coverage. Empty data does not prove there are no geographic relatives. Children/siblings accept page controls; ancestors do not. Distance reports great-circle kilometers and miles between stored centers: zero is known zero, null is unknown, and it does not imply travel time or containment.
|
|
505
|
+
|
|
506
|
+
Strict `ambiguity=error` can return HTTP 409 `ambiguous_city` with up to two safe candidate identities. The existing error constructor and unrelated error metadata are preserved; candidates are retained only for that status/code and never contain Deep. GeoJSON is available through HTTP; these typed City list methods do not return GeoJSON.
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
Reviewed name forms:
|
|
511
|
+
|
|
512
|
+
```js
|
|
513
|
+
const city = await parse.city.id('city_7aj899nvwyku', { format: 'resource', romanized: true });
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
Coverage by country and available fields is described at https://parseapi.com/city#coverage.
|
|
517
|
+
|
|
518
|
+
`romanized=true` requests reviewed official name forms as `name_romanized` and `romanization_language` (camelCase in Swift/Kotlin). Current reviewed forms cover 20 Japanese whole-city aliases in ja-Latn. Missing or conflicting forms stay null; ASCII folding is not substituted for an official form.
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
Conditional `If-None-Match` reads and GeoJSON currently use HTTP directly. A matching City ETag returns 304 without a body; ordinary billing and rate limits apply. These JSON client methods do not supply conditional-cache handling.
|
package/dist/index.cjs
CHANGED
|
@@ -285,7 +285,7 @@ var EmojiCatalog = class {
|
|
|
285
285
|
};
|
|
286
286
|
|
|
287
287
|
// src/index.ts
|
|
288
|
-
var VERSION = "1.
|
|
288
|
+
var VERSION = "1.11.0";
|
|
289
289
|
var API_VERSION = "2.0.0";
|
|
290
290
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
291
291
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -313,8 +313,11 @@ var ParseAPIError = class extends Error {
|
|
|
313
313
|
this.retryAfter = retryAfter;
|
|
314
314
|
}
|
|
315
315
|
};
|
|
316
|
+
function tariffEditionId(value) {
|
|
317
|
+
return typeof value === "string" && (value.length === 64 && /^[a-f0-9]{64}$/.test(value) || /^ted_[1-9][0-9]{0,19}(?![\s\S])/.test(value) && (value.length < 24 || value.slice(4) <= "18446744073709551615"));
|
|
318
|
+
}
|
|
316
319
|
function tariffSelection(result, opts) {
|
|
317
|
-
if ((opts?.edition !== void 0 || opts?.date !== void 0) && (
|
|
320
|
+
if ((opts?.edition !== void 0 || opts?.date !== void 0) && (!tariffEditionId(result.edition) || opts.edition !== void 0 && result.edition !== opts.edition || (opts.date !== void 0 ? result.date !== opts.date : result.date != null))) {
|
|
318
321
|
throw new ParseAPIError(0, "tariff_selection_mismatch", "Tariff response did not confirm the requested edition/date. The server may not support this selection.", null, null);
|
|
319
322
|
}
|
|
320
323
|
return result;
|
|
@@ -441,7 +444,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
441
444
|
controller.signal.throwIfAborted();
|
|
442
445
|
}
|
|
443
446
|
signal?.throwIfAborted();
|
|
444
|
-
|
|
447
|
+
const error = new ParseAPIError(
|
|
445
448
|
res.status,
|
|
446
449
|
typeof body2.code === "string" ? body2.code : "unknown_error",
|
|
447
450
|
typeof body2.message === "string" ? body2.message : `Request failed with status ${res.status}`,
|
|
@@ -449,6 +452,11 @@ function parseAPI(apiKey, options = {}) {
|
|
|
449
452
|
typeof body2.request_id === "string" ? body2.request_id : null,
|
|
450
453
|
res.headers.get("Retry-After")
|
|
451
454
|
);
|
|
455
|
+
if (error.status === 409 && error.code === "ambiguous_city") {
|
|
456
|
+
const candidates = cityErrorCandidates(body2.candidates);
|
|
457
|
+
if (candidates) error.candidates = candidates;
|
|
458
|
+
}
|
|
459
|
+
throw error;
|
|
452
460
|
}
|
|
453
461
|
} finally {
|
|
454
462
|
clearTimeout(timer);
|
|
@@ -521,19 +529,52 @@ function parseAPI(apiKey, options = {}) {
|
|
|
521
529
|
),
|
|
522
530
|
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state, ...deepQuery(opts) }, void 0, opts),
|
|
523
531
|
city: Object.assign(
|
|
524
|
-
(name, opts) => request(`/city/${enc(name)}`, {
|
|
532
|
+
((name, opts) => request(`/city/${enc(name)}`, { ...cityScopeQuery(opts), ...cityResponseQuery(opts), aliases: opts?.aliases ? "true" : void 0, ambiguity: opts?.ambiguity, ...deepQuery(opts) }, void 0, opts)),
|
|
525
533
|
{
|
|
526
|
-
id: (id, opts) => request(`/city/id/${enc(id)}`, deepQuery(opts), void 0, opts),
|
|
527
|
-
search: (query, opts) =>
|
|
528
|
-
|
|
529
|
-
|
|
534
|
+
id: ((id, opts) => request(`/city/id/${enc(id)}`, { hierarchy: opts?.hierarchy ? "true" : void 0, ...cityResponseQuery(opts), ...deepQuery(opts) }, void 0, opts)),
|
|
535
|
+
search: (async (query, opts) => {
|
|
536
|
+
const spelling = opts?.match !== void 0 || opts?.maxDistance !== void 0;
|
|
537
|
+
const result = await request(spelling ? "/city/search" : "/city", { q: query, match: opts?.match, max_distance: opts?.maxDistance, ...cityScopeQuery(opts), ...cityCollectionQuery(opts), ...cityResponseQuery(opts), aliases: opts?.aliases ? "true" : void 0, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts);
|
|
538
|
+
if (spelling && opts?.format !== "list") {
|
|
539
|
+
const list = result;
|
|
540
|
+
return { q: query, ...opts?.country ? { country: opts.country } : {}, ...opts?.state ? { state: opts.state } : {}, cities: list.data, next_cursor: list.next_cursor };
|
|
541
|
+
}
|
|
542
|
+
return result;
|
|
543
|
+
}),
|
|
544
|
+
/** Canonical list resource. Reuse next_cursor with exactly the same options. */
|
|
545
|
+
list: (opts) => request("/city", { browse: "true", ...cityScopeQuery(opts), ...cityCollectionQuery(opts), ...cityResponseQuery(opts), format: "list", limit: opts?.limit, ...deepQuery(opts) }, void 0, opts),
|
|
546
|
+
nearbyCoordinates: (lat, lon, opts) => request("/city", {
|
|
547
|
+
lat,
|
|
548
|
+
lon,
|
|
549
|
+
nearby: "true",
|
|
530
550
|
radius: opts?.radius,
|
|
531
551
|
unit: opts?.unit,
|
|
532
|
-
|
|
533
|
-
|
|
552
|
+
...cityScopeQuery(opts),
|
|
553
|
+
...cityCollectionQuery(opts),
|
|
554
|
+
...cityResponseQuery(opts),
|
|
555
|
+
format: "list",
|
|
534
556
|
limit: opts?.limit,
|
|
535
557
|
...deepQuery(opts)
|
|
536
|
-
}, void 0, opts)
|
|
558
|
+
}, void 0, opts),
|
|
559
|
+
nearest: ((lat, lon, opts) => request("/city", { lat, lon, ...cityScopeQuery(opts), ...cityResponseQuery(opts), ...deepQuery(opts) }, void 0, opts)),
|
|
560
|
+
nearby: ((name, opts) => request(`/city/${enc(name)}/nearby`, {
|
|
561
|
+
radius: opts?.radius,
|
|
562
|
+
unit: opts?.unit,
|
|
563
|
+
...cityScopeQuery(opts),
|
|
564
|
+
...cityCollectionQuery(opts),
|
|
565
|
+
...cityResponseQuery(opts),
|
|
566
|
+
aliases: opts?.aliases ? "true" : void 0,
|
|
567
|
+
ambiguity: opts?.ambiguity,
|
|
568
|
+
limit: opts?.limit,
|
|
569
|
+
...deepQuery(opts)
|
|
570
|
+
}, void 0, opts)),
|
|
571
|
+
/** Reviewed immediate children; coverage is partial. */
|
|
572
|
+
children: (id, opts) => request(`/city/id/${enc(id)}/children`, { limit: opts?.limit, cursor: opts?.cursor, ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
573
|
+
/** Immediate parent first, following only reviewed parent facts. */
|
|
574
|
+
ancestors: (id, opts) => request(`/city/id/${enc(id)}/ancestors`, { ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
575
|
+
siblings: (id, opts) => request(`/city/id/${enc(id)}/siblings`, { limit: opts?.limit, cursor: opts?.cursor, ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
576
|
+
/** Great-circle distance between stored centers, not travel distance or containment. */
|
|
577
|
+
distance: (from, to, opts) => request(`/city/id/${enc(from)}/distance/${enc(to)}`, void 0, void 0, opts)
|
|
537
578
|
}
|
|
538
579
|
),
|
|
539
580
|
/** Look up a postal area. Pass country when known. Check nullable latitude/longitude before another location lookup. */
|
|
@@ -729,6 +770,42 @@ function timeTargets(targets, to) {
|
|
|
729
770
|
}
|
|
730
771
|
return targets.join(",");
|
|
731
772
|
}
|
|
773
|
+
function cityErrorCandidates(input) {
|
|
774
|
+
if (!Array.isArray(input)) return void 0;
|
|
775
|
+
const fields = ["name", "name_local", "country", "country_name", "state", "state_name", "type"];
|
|
776
|
+
return input.slice(0, 2).flatMap((row) => {
|
|
777
|
+
if (!row || typeof row !== "object" || typeof row.id !== "string" || !/^city_[23456789abcdefghjkmnpqrstuvwxyz]{12}$/.test(row.id)) return [];
|
|
778
|
+
const candidate = { id: row.id, object: "city" };
|
|
779
|
+
for (const field of fields) if (Object.hasOwn(row, field) && (row[field] === null || typeof row[field] === "string" && row[field].length <= 255)) candidate[field] = row[field];
|
|
780
|
+
return [candidate];
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
function cityCsv(value) {
|
|
784
|
+
return typeof value === "string" ? value : value?.join(",");
|
|
785
|
+
}
|
|
786
|
+
function cityResponseQuery(opts) {
|
|
787
|
+
return { format: opts?.format, romanized: opts?.romanized ? "true" : void 0 };
|
|
788
|
+
}
|
|
789
|
+
function cityScopeQuery(opts) {
|
|
790
|
+
return { country: opts?.country, state: opts?.state, type: opts?.type, grain: opts?.grain, hierarchy: opts?.hierarchy ? "true" : void 0 };
|
|
791
|
+
}
|
|
792
|
+
function cityCollectionQuery(opts) {
|
|
793
|
+
return {
|
|
794
|
+
min_population: opts?.minPopulation,
|
|
795
|
+
max_population: opts?.maxPopulation,
|
|
796
|
+
min_elevation: opts?.minElevation,
|
|
797
|
+
max_elevation: opts?.maxElevation,
|
|
798
|
+
countries: cityCsv(opts?.countries),
|
|
799
|
+
exclude_countries: cityCsv(opts?.excludeCountries),
|
|
800
|
+
timezones: cityCsv(opts?.timezones),
|
|
801
|
+
timezone: opts?.timezone,
|
|
802
|
+
bbox: opts?.bbox,
|
|
803
|
+
page: opts?.page ? "true" : void 0,
|
|
804
|
+
cursor: opts?.cursor,
|
|
805
|
+
sort: opts?.sort,
|
|
806
|
+
order: opts?.order
|
|
807
|
+
};
|
|
808
|
+
}
|
|
732
809
|
// Annotate the CommonJS export names for ESM import in node:
|
|
733
810
|
0 && (module.exports = {
|
|
734
811
|
EmojiCatalog,
|
package/dist/index.d.cts
CHANGED
|
@@ -58,7 +58,7 @@ interface Continent {
|
|
|
58
58
|
region: string;
|
|
59
59
|
subregion: string;
|
|
60
60
|
population: number | null;
|
|
61
|
-
/**
|
|
61
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
62
62
|
population_period?: string | null;
|
|
63
63
|
area: number | null;
|
|
64
64
|
emoji: string;
|
|
@@ -135,7 +135,7 @@ interface StateDistrictItem {
|
|
|
135
135
|
}
|
|
136
136
|
interface StateDistrictDeep {
|
|
137
137
|
population: number | null;
|
|
138
|
-
/**
|
|
138
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
139
139
|
population_period?: string | null;
|
|
140
140
|
}
|
|
141
141
|
interface StateDistricts {
|
|
@@ -160,8 +160,12 @@ interface District {
|
|
|
160
160
|
deep?: Deep<DistrictDeep>;
|
|
161
161
|
}
|
|
162
162
|
interface City {
|
|
163
|
+
/** Present for explicit search matching when the server returns suggestion evidence. */
|
|
164
|
+
match?: CityMatch;
|
|
163
165
|
name: string;
|
|
164
166
|
name_local: string | null;
|
|
167
|
+
name_romanized?: string | null;
|
|
168
|
+
romanization_language?: string | null;
|
|
165
169
|
type: string | null;
|
|
166
170
|
state: string | null;
|
|
167
171
|
state_name: string | null;
|
|
@@ -174,6 +178,10 @@ interface City {
|
|
|
174
178
|
timezone: string | null;
|
|
175
179
|
/** Minted parse id (`city_` + 12 chars). Stable pin via `/city/id/{id}`. */
|
|
176
180
|
id: string;
|
|
181
|
+
/** Returned with hierarchy=true. Null means the layer has not been reviewed. */
|
|
182
|
+
grain?: CityGrain | null;
|
|
183
|
+
/** Reviewed immediate parent; null when no reviewed relationship exists. */
|
|
184
|
+
parent?: CityParent | null;
|
|
177
185
|
deep?: Deep<CityDeep>;
|
|
178
186
|
}
|
|
179
187
|
/** Nearest-city lookups add the distance from the query point. */
|
|
@@ -185,7 +193,12 @@ interface CitySearch {
|
|
|
185
193
|
q: string;
|
|
186
194
|
country?: string;
|
|
187
195
|
state?: string;
|
|
196
|
+
type?: string;
|
|
197
|
+
grain?: CityGrain;
|
|
198
|
+
aliases?: boolean;
|
|
188
199
|
cities: City[];
|
|
200
|
+
/** Present with page=true or a continuation cursor; null when this is the last page. */
|
|
201
|
+
next_cursor?: string | null;
|
|
189
202
|
}
|
|
190
203
|
interface CityNearby {
|
|
191
204
|
city: string;
|
|
@@ -194,6 +207,7 @@ interface CityNearby {
|
|
|
194
207
|
radius: number;
|
|
195
208
|
unit: string;
|
|
196
209
|
nearby: CityNearest[];
|
|
210
|
+
next_cursor?: string | null;
|
|
197
211
|
}
|
|
198
212
|
/** An area's share of ZIP addresses, with category shares measured independently. */
|
|
199
213
|
interface PostalMetro {
|
|
@@ -1486,7 +1500,7 @@ interface CountryDeep {
|
|
|
1486
1500
|
region: string | null;
|
|
1487
1501
|
subregion: string | null;
|
|
1488
1502
|
population: number | null;
|
|
1489
|
-
/**
|
|
1503
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1490
1504
|
population_period?: string | null;
|
|
1491
1505
|
area: number | null;
|
|
1492
1506
|
/** Land area in km2. */
|
|
@@ -1531,7 +1545,7 @@ interface CountryElevationPoint {
|
|
|
1531
1545
|
}
|
|
1532
1546
|
interface StateDeep {
|
|
1533
1547
|
population: number | null;
|
|
1534
|
-
/**
|
|
1548
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1535
1549
|
population_period?: string | null;
|
|
1536
1550
|
/** Total area in km2. */
|
|
1537
1551
|
area: number | null;
|
|
@@ -1545,7 +1559,7 @@ interface StateDeep {
|
|
|
1545
1559
|
}
|
|
1546
1560
|
interface DistrictDeep {
|
|
1547
1561
|
population: number | null;
|
|
1548
|
-
/**
|
|
1562
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1549
1563
|
population_period?: string | null;
|
|
1550
1564
|
/** Total area in km2 (land + water, or the official total). */
|
|
1551
1565
|
area: number | null;
|
|
@@ -1563,8 +1577,12 @@ interface CityDeep {
|
|
|
1563
1577
|
elevation: number | null;
|
|
1564
1578
|
elevation_ft: number | null;
|
|
1565
1579
|
population: number | null;
|
|
1566
|
-
/**
|
|
1580
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1567
1581
|
population_period?: string | null;
|
|
1582
|
+
/** Exact observation date for a reviewed same-grain count; omitted for legacy undated counts. */
|
|
1583
|
+
population_observed_on?: string;
|
|
1584
|
+
/** Published population basis, for example registered_population. */
|
|
1585
|
+
population_basis?: string;
|
|
1568
1586
|
/** Total area in km2 (land + water, or the official total). */
|
|
1569
1587
|
area: number | null;
|
|
1570
1588
|
/** Land area in km2. Null when the source publishes total only. */
|
|
@@ -1576,7 +1594,7 @@ interface PostalDeep {
|
|
|
1576
1594
|
elevation: number | null;
|
|
1577
1595
|
elevation_ft: number | null;
|
|
1578
1596
|
population: number | null;
|
|
1579
|
-
/**
|
|
1597
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1580
1598
|
population_period?: string | null;
|
|
1581
1599
|
/** Total area in km2. Null when the source has no water split. */
|
|
1582
1600
|
area: number | null;
|
|
@@ -1886,6 +1904,79 @@ interface EmojiConversion {
|
|
|
1886
1904
|
text: string;
|
|
1887
1905
|
unresolved: EmojiUnresolved[];
|
|
1888
1906
|
}
|
|
1907
|
+
type CityGrain = 'municipality' | 'subdivision' | 'locality' | 'metropolitan_area';
|
|
1908
|
+
interface CityParent {
|
|
1909
|
+
id: string;
|
|
1910
|
+
name: string | null;
|
|
1911
|
+
name_local: string | null;
|
|
1912
|
+
country: string;
|
|
1913
|
+
state: string | null;
|
|
1914
|
+
type: string | null;
|
|
1915
|
+
grain: CityGrain | null;
|
|
1916
|
+
}
|
|
1917
|
+
interface CityMatch {
|
|
1918
|
+
type: string;
|
|
1919
|
+
source: string;
|
|
1920
|
+
value: string;
|
|
1921
|
+
language: string | null;
|
|
1922
|
+
edit_distance: number | null;
|
|
1923
|
+
}
|
|
1924
|
+
interface CityAmbiguityCandidate {
|
|
1925
|
+
id: string;
|
|
1926
|
+
object: 'city';
|
|
1927
|
+
name?: string | null;
|
|
1928
|
+
name_local?: string | null;
|
|
1929
|
+
country?: string | null;
|
|
1930
|
+
country_name?: string | null;
|
|
1931
|
+
state?: string | null;
|
|
1932
|
+
state_name?: string | null;
|
|
1933
|
+
type?: string | null;
|
|
1934
|
+
}
|
|
1935
|
+
type CityResource = City & {
|
|
1936
|
+
object: 'city';
|
|
1937
|
+
distance?: number;
|
|
1938
|
+
distance_mi?: number;
|
|
1939
|
+
};
|
|
1940
|
+
interface CityCollection {
|
|
1941
|
+
object: 'list';
|
|
1942
|
+
data: CityResource[];
|
|
1943
|
+
has_more?: boolean;
|
|
1944
|
+
url?: string;
|
|
1945
|
+
/** Opaque, query-bound continuation. Keep the same options on the next call. */
|
|
1946
|
+
next_cursor: string | null;
|
|
1947
|
+
q?: string;
|
|
1948
|
+
country?: string;
|
|
1949
|
+
state?: string | null;
|
|
1950
|
+
type?: string;
|
|
1951
|
+
grain?: CityGrain;
|
|
1952
|
+
aliases?: boolean;
|
|
1953
|
+
city?: string;
|
|
1954
|
+
radius?: number;
|
|
1955
|
+
unit?: string;
|
|
1956
|
+
}
|
|
1957
|
+
interface CityList extends CityCollection {
|
|
1958
|
+
}
|
|
1959
|
+
interface CityRelations extends CityCollection {
|
|
1960
|
+
city_id: string;
|
|
1961
|
+
relationship: 'children' | 'ancestors' | 'siblings';
|
|
1962
|
+
coverage: 'partial';
|
|
1963
|
+
parent_id?: string | null;
|
|
1964
|
+
}
|
|
1965
|
+
interface CityDistance {
|
|
1966
|
+
object: 'city_distance';
|
|
1967
|
+
from: string;
|
|
1968
|
+
to: string;
|
|
1969
|
+
/** Great-circle kilometers between stored centers; null when coordinates are unknown. */
|
|
1970
|
+
distance: number | null;
|
|
1971
|
+
distance_mi: number | null;
|
|
1972
|
+
method: 'great_circle';
|
|
1973
|
+
}
|
|
1974
|
+
interface CityNearbyCoordinates extends CityCollection {
|
|
1975
|
+
latitude: number;
|
|
1976
|
+
longitude: number;
|
|
1977
|
+
radius: number;
|
|
1978
|
+
unit: string;
|
|
1979
|
+
}
|
|
1889
1980
|
|
|
1890
1981
|
/** A proposed task contains operation counts, never lookup inputs. */
|
|
1891
1982
|
interface PreflightOperation {
|
|
@@ -2124,6 +2215,7 @@ declare class ParseAPIError extends Error {
|
|
|
2124
2215
|
readonly requestId: string | null;
|
|
2125
2216
|
/** Original Retry-After response header, when supplied. */
|
|
2126
2217
|
readonly retryAfter: string | null;
|
|
2218
|
+
candidates?: CityAmbiguityCandidate[];
|
|
2127
2219
|
constructor(status: number, code: string, message: string, docs: string | null, requestId: string | null, retryAfter?: string | null);
|
|
2128
2220
|
}
|
|
2129
2221
|
/** Optional output language for supported display fields. Input parsing stays unchanged. */
|
|
@@ -2167,23 +2259,34 @@ type DistrictOptions = LanguageOption & {
|
|
|
2167
2259
|
country?: string;
|
|
2168
2260
|
state?: string;
|
|
2169
2261
|
} & DeepOption & RequestOptions;
|
|
2170
|
-
type CityOptions = LanguageOption & {
|
|
2171
|
-
|
|
2172
|
-
|
|
2262
|
+
type CityOptions = LanguageOption & CityScopeOptions & CityResponseOptions & {
|
|
2263
|
+
format?: 'resource';
|
|
2264
|
+
aliases?: boolean;
|
|
2265
|
+
ambiguity?: 'error';
|
|
2173
2266
|
} & DeepOption & RequestOptions;
|
|
2174
|
-
type CityIdOptions = LanguageOption &
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2267
|
+
type CityIdOptions = LanguageOption & CityResponseOptions & {
|
|
2268
|
+
format?: 'resource';
|
|
2269
|
+
hierarchy?: boolean;
|
|
2270
|
+
} & DeepOption & RequestOptions;
|
|
2271
|
+
type CitySearchOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityPagingOptions & CityResponseOptions & {
|
|
2272
|
+
format?: 'list';
|
|
2273
|
+
aliases?: boolean;
|
|
2178
2274
|
limit?: number;
|
|
2275
|
+
sort?: CitySort;
|
|
2276
|
+
match?: 'exact' | 'prefix' | 'fuzzy';
|
|
2277
|
+
maxDistance?: 1 | 2;
|
|
2179
2278
|
} & DeepOption & RequestOptions;
|
|
2180
|
-
type CityNearestOptions = LanguageOption &
|
|
2181
|
-
|
|
2279
|
+
type CityNearestOptions = LanguageOption & CityScopeOptions & CityResponseOptions & {
|
|
2280
|
+
format?: 'resource';
|
|
2281
|
+
} & DeepOption & RequestOptions;
|
|
2282
|
+
type CityNearbyOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityPagingOptions & CityResponseOptions & {
|
|
2283
|
+
format?: 'list';
|
|
2284
|
+
aliases?: boolean;
|
|
2285
|
+
ambiguity?: 'error';
|
|
2182
2286
|
radius?: number;
|
|
2183
2287
|
unit?: 'km' | 'mi';
|
|
2184
|
-
country?: string;
|
|
2185
|
-
state?: string;
|
|
2186
2288
|
limit?: number;
|
|
2289
|
+
sort?: CitySort;
|
|
2187
2290
|
} & DeepOption & RequestOptions;
|
|
2188
2291
|
/** Pass country when known. Codes shared by multiple countries need it. */
|
|
2189
2292
|
type PostalOptions = LanguageOption & {
|
|
@@ -2452,11 +2555,21 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
2452
2555
|
districts: (code: string, opts?: StateDistrictsOptions) => Promise<StateDistricts>;
|
|
2453
2556
|
};
|
|
2454
2557
|
district: (code: string, opts?: DistrictOptions) => Promise<District>;
|
|
2455
|
-
city:
|
|
2456
|
-
id:
|
|
2457
|
-
search:
|
|
2458
|
-
|
|
2459
|
-
|
|
2558
|
+
city: CityLookupCall & {
|
|
2559
|
+
id: CityIdCall;
|
|
2560
|
+
search: CitySearchCall;
|
|
2561
|
+
/** Canonical list resource. Reuse next_cursor with exactly the same options. */
|
|
2562
|
+
list: (opts?: CityListOptions) => Promise<CityList>;
|
|
2563
|
+
nearbyCoordinates: (lat: number, lon: number, opts?: CityNearbyCoordinatesOptions) => Promise<CityNearbyCoordinates>;
|
|
2564
|
+
nearest: CityNearestCall;
|
|
2565
|
+
nearby: CityNearbyCall;
|
|
2566
|
+
/** Reviewed immediate children; coverage is partial. */
|
|
2567
|
+
children: (id: string, opts?: CityRelationsOptions) => Promise<CityRelations>;
|
|
2568
|
+
/** Immediate parent first, following only reviewed parent facts. */
|
|
2569
|
+
ancestors: (id: string, opts?: CityAncestorsOptions) => Promise<CityRelations>;
|
|
2570
|
+
siblings: (id: string, opts?: CityRelationsOptions) => Promise<CityRelations>;
|
|
2571
|
+
/** Great-circle distance between stored centers, not travel distance or containment. */
|
|
2572
|
+
distance: (from: string, to: string, opts?: CityDistanceOptions) => Promise<CityDistance>;
|
|
2460
2573
|
};
|
|
2461
2574
|
/** Look up a postal area. Pass country when known. Check nullable latitude/longitude before another location lookup. */
|
|
2462
2575
|
postal: ((code: string, opts?: PostalOptions) => Promise<Postal>) & {
|
|
@@ -2583,5 +2696,92 @@ type IbanOptions = {
|
|
|
2583
2696
|
} & DeepOption & RequestOptions;
|
|
2584
2697
|
type NpiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
2585
2698
|
type BinOptions = DeepOption & RequestOptions;
|
|
2699
|
+
type CityScopeOptions = {
|
|
2700
|
+
country?: string;
|
|
2701
|
+
state?: string;
|
|
2702
|
+
type?: string;
|
|
2703
|
+
grain?: CityGrain;
|
|
2704
|
+
hierarchy?: boolean;
|
|
2705
|
+
};
|
|
2706
|
+
type CityResponseOptions = {
|
|
2707
|
+
romanized?: boolean;
|
|
2708
|
+
};
|
|
2709
|
+
type CityCollectionFilters = {
|
|
2710
|
+
minPopulation?: number;
|
|
2711
|
+
maxPopulation?: number;
|
|
2712
|
+
minElevation?: number;
|
|
2713
|
+
maxElevation?: number;
|
|
2714
|
+
countries?: string | readonly string[];
|
|
2715
|
+
excludeCountries?: string | readonly string[];
|
|
2716
|
+
timezone?: string;
|
|
2717
|
+
timezones?: string | readonly string[];
|
|
2718
|
+
/** Center-coordinate box: west,south,east,north. West > east crosses the date line. */
|
|
2719
|
+
bbox?: string;
|
|
2720
|
+
};
|
|
2721
|
+
type CityPagingOptions = {
|
|
2722
|
+
page?: boolean;
|
|
2723
|
+
cursor?: string;
|
|
2724
|
+
order?: 'asc' | 'desc';
|
|
2725
|
+
};
|
|
2726
|
+
type CitySort = string;
|
|
2727
|
+
type CityListOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityResponseOptions & {
|
|
2728
|
+
limit?: number;
|
|
2729
|
+
cursor?: string;
|
|
2730
|
+
sort?: CitySort;
|
|
2731
|
+
order?: 'asc' | 'desc';
|
|
2732
|
+
} & DeepOption & RequestOptions;
|
|
2733
|
+
type CityNearbyCoordinatesOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityResponseOptions & {
|
|
2734
|
+
radius?: number;
|
|
2735
|
+
unit?: 'km' | 'mi';
|
|
2736
|
+
limit?: number;
|
|
2737
|
+
cursor?: string;
|
|
2738
|
+
sort?: CitySort;
|
|
2739
|
+
order?: 'asc' | 'desc';
|
|
2740
|
+
} & DeepOption & RequestOptions;
|
|
2741
|
+
type CityRelationsOptions = LanguageOption & CityResponseOptions & {
|
|
2742
|
+
limit?: number;
|
|
2743
|
+
cursor?: string;
|
|
2744
|
+
hierarchy?: boolean;
|
|
2745
|
+
} & DeepOption & RequestOptions;
|
|
2746
|
+
type CityAncestorsOptions = Omit<CityRelationsOptions, 'limit' | 'cursor'>;
|
|
2747
|
+
type CityDistanceOptions = RequestOptions;
|
|
2748
|
+
type ClassicCityOptions<T> = T & {
|
|
2749
|
+
format?: never;
|
|
2750
|
+
};
|
|
2751
|
+
interface CityLookupCall {
|
|
2752
|
+
(name: string, opts?: ClassicCityOptions<CityOptions>): Promise<City>;
|
|
2753
|
+
(name: string, opts: CityOptions & {
|
|
2754
|
+
format: 'resource';
|
|
2755
|
+
}): Promise<CityResource>;
|
|
2756
|
+
(name: string, opts: CityOptions): Promise<City>;
|
|
2757
|
+
}
|
|
2758
|
+
interface CityIdCall {
|
|
2759
|
+
(id: string, opts?: ClassicCityOptions<CityIdOptions>): Promise<City>;
|
|
2760
|
+
(id: string, opts: CityIdOptions & {
|
|
2761
|
+
format: 'resource';
|
|
2762
|
+
}): Promise<CityResource>;
|
|
2763
|
+
(id: string, opts: CityIdOptions): Promise<City>;
|
|
2764
|
+
}
|
|
2765
|
+
interface CityNearestCall {
|
|
2766
|
+
(lat: number, lon: number, opts?: ClassicCityOptions<CityNearestOptions>): Promise<CityNearest>;
|
|
2767
|
+
(lat: number, lon: number, opts: CityNearestOptions & {
|
|
2768
|
+
format: 'resource';
|
|
2769
|
+
}): Promise<CityResource & Pick<CityNearest, 'distance' | 'distance_mi'>>;
|
|
2770
|
+
(lat: number, lon: number, opts: CityNearestOptions): Promise<CityNearest>;
|
|
2771
|
+
}
|
|
2772
|
+
interface CitySearchCall {
|
|
2773
|
+
(query: string, opts?: ClassicCityOptions<CitySearchOptions>): Promise<CitySearch>;
|
|
2774
|
+
(query: string, opts: CitySearchOptions & {
|
|
2775
|
+
format: 'list';
|
|
2776
|
+
}): Promise<CityCollection>;
|
|
2777
|
+
(query: string, opts: CitySearchOptions): Promise<CitySearch | CityCollection>;
|
|
2778
|
+
}
|
|
2779
|
+
interface CityNearbyCall {
|
|
2780
|
+
(name: string, opts?: ClassicCityOptions<CityNearbyOptions>): Promise<CityNearby>;
|
|
2781
|
+
(name: string, opts: CityNearbyOptions & {
|
|
2782
|
+
format: 'list';
|
|
2783
|
+
}): Promise<CityCollection>;
|
|
2784
|
+
(name: string, opts: CityNearbyOptions): Promise<CityNearby | CityCollection>;
|
|
2785
|
+
}
|
|
2586
2786
|
|
|
2587
|
-
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type AgentTask, type AgentTaskInput, type AgentTaskLookupInput, type AgentTaskResult, type Asn, type AsnOptions, type Bank, type BankChecks, type BankDeep, type BankDirectory, type BankIssue, type BankOptions, type BankRequirementField, type BankRequirements, type BankRequirementsOptions, type BankUsAch, type BankUsAchChecks, type BankUsAchInput, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Card, type CardDeep, type CardOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCandidate, type CompanyCountry, type CompanyCoverage, type CompanyCoverageOptions, type CompanyDeep, type CompanyEmailAddress, type CompanyIdOptions, type CompanyMatch, type CompanyOptions, type CompanyPhoneNumber, type CompanyProfile, type CompanyProfileAddress, type CompanyProfileDeep, type CompanyProfileDomain, type CompanyProfileEmail, type CompanyProfileEmployees, type CompanyProfileFounding, type CompanyProfileIdentifier, type CompanyProfileIndustry, type CompanyProfileJurisdiction, type CompanyProfileListing, type CompanyProfilePhone, type CompanyProfileRegistration, type CompanyProfileRegistrationAddress, type CompanyProfileRegistrationLegalForm, type CompanyProfileSource, type CompanyProfileWebsite, type CompanySearch, type CompanySearchOptions, type CompanySocialProfile, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiArtwork, type EmojiArtworkSource, type EmojiBrowse, type EmojiBrowseOptions, EmojiCatalog, type EmojiCatalogConvertOptions, type EmojiCatalogData, EmojiCatalogError, type EmojiCatalogLocalization, type EmojiCatalogLookupOptions, type EmojiCatalogOptions, type EmojiCatalogParseOptions, type EmojiCatalogRegexOptions, type EmojiCatalogScope, type EmojiCatalogSearchFacts, type EmojiCatalogSearchOptions, type EmojiCategories, type EmojiCategory, type EmojiConversion, type EmojiConvertOptions, type EmojiDeep, type EmojiMetadata, type EmojiNativeSearchFacts, type EmojiNotice, type EmojiOptions, type EmojiParse, type EmojiParseOptions, type EmojiPosition, type EmojiSearch, type EmojiSearchOptions, type EmojiShortcodeSourceMetadata, type EmojiSkin, type EmojiSource, type EmojiUnresolved, type EmojiVariant, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Industry, type IndustryChild, type IndustryCorrection, type IndustryDeep, type IndustryExclusion, type IndustryMatch, type IndustryOptions, type IndustrySearch, type IndustrySearchItem, type IndustrySearchOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type Provider, type ProviderDeep, type ProviderEnrollment, type ProviderOptions, type ProviderSource, type ProviderSources, type ProviderTaxonomy, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vehicle, type VehicleDeep, type VehicleOptions, type VehicleRecall, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
|
2787
|
+
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type AgentTask, type AgentTaskInput, type AgentTaskLookupInput, type AgentTaskResult, type Asn, type AsnOptions, type Bank, type BankChecks, type BankDeep, type BankDirectory, type BankIssue, type BankOptions, type BankRequirementField, type BankRequirements, type BankRequirementsOptions, type BankUsAch, type BankUsAchChecks, type BankUsAchInput, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Card, type CardDeep, type CardOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityAmbiguityCandidate, type CityAncestorsOptions, type CityCollection, type CityCollectionFilters, type CityDeep, type CityDistance, type CityDistanceOptions, type CityGrain, type CityIdCall, type CityIdOptions, type CityList, type CityListOptions, type CityLookupCall, type CityMatch, type CityNearby, type CityNearbyCall, type CityNearbyCoordinates, type CityNearbyCoordinatesOptions, type CityNearbyOptions, type CityNearest, type CityNearestCall, type CityNearestOptions, type CityOptions, type CityPagingOptions, type CityParent, type CityRelations, type CityRelationsOptions, type CityResource, type CityResponseOptions, type CityScopeOptions, type CitySearch, type CitySearchCall, type CitySearchOptions, type CitySort, type Company, type CompanyCandidate, type CompanyCountry, type CompanyCoverage, type CompanyCoverageOptions, type CompanyDeep, type CompanyEmailAddress, type CompanyIdOptions, type CompanyMatch, type CompanyOptions, type CompanyPhoneNumber, type CompanyProfile, type CompanyProfileAddress, type CompanyProfileDeep, type CompanyProfileDomain, type CompanyProfileEmail, type CompanyProfileEmployees, type CompanyProfileFounding, type CompanyProfileIdentifier, type CompanyProfileIndustry, type CompanyProfileJurisdiction, type CompanyProfileListing, type CompanyProfilePhone, type CompanyProfileRegistration, type CompanyProfileRegistrationAddress, type CompanyProfileRegistrationLegalForm, type CompanyProfileSource, type CompanyProfileWebsite, type CompanySearch, type CompanySearchOptions, type CompanySocialProfile, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiArtwork, type EmojiArtworkSource, type EmojiBrowse, type EmojiBrowseOptions, EmojiCatalog, type EmojiCatalogConvertOptions, type EmojiCatalogData, EmojiCatalogError, type EmojiCatalogLocalization, type EmojiCatalogLookupOptions, type EmojiCatalogOptions, type EmojiCatalogParseOptions, type EmojiCatalogRegexOptions, type EmojiCatalogScope, type EmojiCatalogSearchFacts, type EmojiCatalogSearchOptions, type EmojiCategories, type EmojiCategory, type EmojiConversion, type EmojiConvertOptions, type EmojiDeep, type EmojiMetadata, type EmojiNativeSearchFacts, type EmojiNotice, type EmojiOptions, type EmojiParse, type EmojiParseOptions, type EmojiPosition, type EmojiSearch, type EmojiSearchOptions, type EmojiShortcodeSourceMetadata, type EmojiSkin, type EmojiSource, type EmojiUnresolved, type EmojiVariant, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Industry, type IndustryChild, type IndustryCorrection, type IndustryDeep, type IndustryExclusion, type IndustryMatch, type IndustryOptions, type IndustrySearch, type IndustrySearchItem, type IndustrySearchOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type Provider, type ProviderDeep, type ProviderEnrollment, type ProviderOptions, type ProviderSource, type ProviderSources, type ProviderTaxonomy, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vehicle, type VehicleDeep, type VehicleOptions, type VehicleRecall, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ interface Continent {
|
|
|
58
58
|
region: string;
|
|
59
59
|
subregion: string;
|
|
60
60
|
population: number | null;
|
|
61
|
-
/**
|
|
61
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
62
62
|
population_period?: string | null;
|
|
63
63
|
area: number | null;
|
|
64
64
|
emoji: string;
|
|
@@ -135,7 +135,7 @@ interface StateDistrictItem {
|
|
|
135
135
|
}
|
|
136
136
|
interface StateDistrictDeep {
|
|
137
137
|
population: number | null;
|
|
138
|
-
/**
|
|
138
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
139
139
|
population_period?: string | null;
|
|
140
140
|
}
|
|
141
141
|
interface StateDistricts {
|
|
@@ -160,8 +160,12 @@ interface District {
|
|
|
160
160
|
deep?: Deep<DistrictDeep>;
|
|
161
161
|
}
|
|
162
162
|
interface City {
|
|
163
|
+
/** Present for explicit search matching when the server returns suggestion evidence. */
|
|
164
|
+
match?: CityMatch;
|
|
163
165
|
name: string;
|
|
164
166
|
name_local: string | null;
|
|
167
|
+
name_romanized?: string | null;
|
|
168
|
+
romanization_language?: string | null;
|
|
165
169
|
type: string | null;
|
|
166
170
|
state: string | null;
|
|
167
171
|
state_name: string | null;
|
|
@@ -174,6 +178,10 @@ interface City {
|
|
|
174
178
|
timezone: string | null;
|
|
175
179
|
/** Minted parse id (`city_` + 12 chars). Stable pin via `/city/id/{id}`. */
|
|
176
180
|
id: string;
|
|
181
|
+
/** Returned with hierarchy=true. Null means the layer has not been reviewed. */
|
|
182
|
+
grain?: CityGrain | null;
|
|
183
|
+
/** Reviewed immediate parent; null when no reviewed relationship exists. */
|
|
184
|
+
parent?: CityParent | null;
|
|
177
185
|
deep?: Deep<CityDeep>;
|
|
178
186
|
}
|
|
179
187
|
/** Nearest-city lookups add the distance from the query point. */
|
|
@@ -185,7 +193,12 @@ interface CitySearch {
|
|
|
185
193
|
q: string;
|
|
186
194
|
country?: string;
|
|
187
195
|
state?: string;
|
|
196
|
+
type?: string;
|
|
197
|
+
grain?: CityGrain;
|
|
198
|
+
aliases?: boolean;
|
|
188
199
|
cities: City[];
|
|
200
|
+
/** Present with page=true or a continuation cursor; null when this is the last page. */
|
|
201
|
+
next_cursor?: string | null;
|
|
189
202
|
}
|
|
190
203
|
interface CityNearby {
|
|
191
204
|
city: string;
|
|
@@ -194,6 +207,7 @@ interface CityNearby {
|
|
|
194
207
|
radius: number;
|
|
195
208
|
unit: string;
|
|
196
209
|
nearby: CityNearest[];
|
|
210
|
+
next_cursor?: string | null;
|
|
197
211
|
}
|
|
198
212
|
/** An area's share of ZIP addresses, with category shares measured independently. */
|
|
199
213
|
interface PostalMetro {
|
|
@@ -1486,7 +1500,7 @@ interface CountryDeep {
|
|
|
1486
1500
|
region: string | null;
|
|
1487
1501
|
subregion: string | null;
|
|
1488
1502
|
population: number | null;
|
|
1489
|
-
/**
|
|
1503
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1490
1504
|
population_period?: string | null;
|
|
1491
1505
|
area: number | null;
|
|
1492
1506
|
/** Land area in km2. */
|
|
@@ -1531,7 +1545,7 @@ interface CountryElevationPoint {
|
|
|
1531
1545
|
}
|
|
1532
1546
|
interface StateDeep {
|
|
1533
1547
|
population: number | null;
|
|
1534
|
-
/**
|
|
1548
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1535
1549
|
population_period?: string | null;
|
|
1536
1550
|
/** Total area in km2. */
|
|
1537
1551
|
area: number | null;
|
|
@@ -1545,7 +1559,7 @@ interface StateDeep {
|
|
|
1545
1559
|
}
|
|
1546
1560
|
interface DistrictDeep {
|
|
1547
1561
|
population: number | null;
|
|
1548
|
-
/**
|
|
1562
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1549
1563
|
population_period?: string | null;
|
|
1550
1564
|
/** Total area in km2 (land + water, or the official total). */
|
|
1551
1565
|
area: number | null;
|
|
@@ -1563,8 +1577,12 @@ interface CityDeep {
|
|
|
1563
1577
|
elevation: number | null;
|
|
1564
1578
|
elevation_ft: number | null;
|
|
1565
1579
|
population: number | null;
|
|
1566
|
-
/**
|
|
1580
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1567
1581
|
population_period?: string | null;
|
|
1582
|
+
/** Exact observation date for a reviewed same-grain count; omitted for legacy undated counts. */
|
|
1583
|
+
population_observed_on?: string;
|
|
1584
|
+
/** Published population basis, for example registered_population. */
|
|
1585
|
+
population_basis?: string;
|
|
1568
1586
|
/** Total area in km2 (land + water, or the official total). */
|
|
1569
1587
|
area: number | null;
|
|
1570
1588
|
/** Land area in km2. Null when the source publishes total only. */
|
|
@@ -1576,7 +1594,7 @@ interface PostalDeep {
|
|
|
1576
1594
|
elevation: number | null;
|
|
1577
1595
|
elevation_ft: number | null;
|
|
1578
1596
|
population: number | null;
|
|
1579
|
-
/**
|
|
1597
|
+
/** @deprecated No longer returned. Retained for source compatibility. */
|
|
1580
1598
|
population_period?: string | null;
|
|
1581
1599
|
/** Total area in km2. Null when the source has no water split. */
|
|
1582
1600
|
area: number | null;
|
|
@@ -1886,6 +1904,79 @@ interface EmojiConversion {
|
|
|
1886
1904
|
text: string;
|
|
1887
1905
|
unresolved: EmojiUnresolved[];
|
|
1888
1906
|
}
|
|
1907
|
+
type CityGrain = 'municipality' | 'subdivision' | 'locality' | 'metropolitan_area';
|
|
1908
|
+
interface CityParent {
|
|
1909
|
+
id: string;
|
|
1910
|
+
name: string | null;
|
|
1911
|
+
name_local: string | null;
|
|
1912
|
+
country: string;
|
|
1913
|
+
state: string | null;
|
|
1914
|
+
type: string | null;
|
|
1915
|
+
grain: CityGrain | null;
|
|
1916
|
+
}
|
|
1917
|
+
interface CityMatch {
|
|
1918
|
+
type: string;
|
|
1919
|
+
source: string;
|
|
1920
|
+
value: string;
|
|
1921
|
+
language: string | null;
|
|
1922
|
+
edit_distance: number | null;
|
|
1923
|
+
}
|
|
1924
|
+
interface CityAmbiguityCandidate {
|
|
1925
|
+
id: string;
|
|
1926
|
+
object: 'city';
|
|
1927
|
+
name?: string | null;
|
|
1928
|
+
name_local?: string | null;
|
|
1929
|
+
country?: string | null;
|
|
1930
|
+
country_name?: string | null;
|
|
1931
|
+
state?: string | null;
|
|
1932
|
+
state_name?: string | null;
|
|
1933
|
+
type?: string | null;
|
|
1934
|
+
}
|
|
1935
|
+
type CityResource = City & {
|
|
1936
|
+
object: 'city';
|
|
1937
|
+
distance?: number;
|
|
1938
|
+
distance_mi?: number;
|
|
1939
|
+
};
|
|
1940
|
+
interface CityCollection {
|
|
1941
|
+
object: 'list';
|
|
1942
|
+
data: CityResource[];
|
|
1943
|
+
has_more?: boolean;
|
|
1944
|
+
url?: string;
|
|
1945
|
+
/** Opaque, query-bound continuation. Keep the same options on the next call. */
|
|
1946
|
+
next_cursor: string | null;
|
|
1947
|
+
q?: string;
|
|
1948
|
+
country?: string;
|
|
1949
|
+
state?: string | null;
|
|
1950
|
+
type?: string;
|
|
1951
|
+
grain?: CityGrain;
|
|
1952
|
+
aliases?: boolean;
|
|
1953
|
+
city?: string;
|
|
1954
|
+
radius?: number;
|
|
1955
|
+
unit?: string;
|
|
1956
|
+
}
|
|
1957
|
+
interface CityList extends CityCollection {
|
|
1958
|
+
}
|
|
1959
|
+
interface CityRelations extends CityCollection {
|
|
1960
|
+
city_id: string;
|
|
1961
|
+
relationship: 'children' | 'ancestors' | 'siblings';
|
|
1962
|
+
coverage: 'partial';
|
|
1963
|
+
parent_id?: string | null;
|
|
1964
|
+
}
|
|
1965
|
+
interface CityDistance {
|
|
1966
|
+
object: 'city_distance';
|
|
1967
|
+
from: string;
|
|
1968
|
+
to: string;
|
|
1969
|
+
/** Great-circle kilometers between stored centers; null when coordinates are unknown. */
|
|
1970
|
+
distance: number | null;
|
|
1971
|
+
distance_mi: number | null;
|
|
1972
|
+
method: 'great_circle';
|
|
1973
|
+
}
|
|
1974
|
+
interface CityNearbyCoordinates extends CityCollection {
|
|
1975
|
+
latitude: number;
|
|
1976
|
+
longitude: number;
|
|
1977
|
+
radius: number;
|
|
1978
|
+
unit: string;
|
|
1979
|
+
}
|
|
1889
1980
|
|
|
1890
1981
|
/** A proposed task contains operation counts, never lookup inputs. */
|
|
1891
1982
|
interface PreflightOperation {
|
|
@@ -2124,6 +2215,7 @@ declare class ParseAPIError extends Error {
|
|
|
2124
2215
|
readonly requestId: string | null;
|
|
2125
2216
|
/** Original Retry-After response header, when supplied. */
|
|
2126
2217
|
readonly retryAfter: string | null;
|
|
2218
|
+
candidates?: CityAmbiguityCandidate[];
|
|
2127
2219
|
constructor(status: number, code: string, message: string, docs: string | null, requestId: string | null, retryAfter?: string | null);
|
|
2128
2220
|
}
|
|
2129
2221
|
/** Optional output language for supported display fields. Input parsing stays unchanged. */
|
|
@@ -2167,23 +2259,34 @@ type DistrictOptions = LanguageOption & {
|
|
|
2167
2259
|
country?: string;
|
|
2168
2260
|
state?: string;
|
|
2169
2261
|
} & DeepOption & RequestOptions;
|
|
2170
|
-
type CityOptions = LanguageOption & {
|
|
2171
|
-
|
|
2172
|
-
|
|
2262
|
+
type CityOptions = LanguageOption & CityScopeOptions & CityResponseOptions & {
|
|
2263
|
+
format?: 'resource';
|
|
2264
|
+
aliases?: boolean;
|
|
2265
|
+
ambiguity?: 'error';
|
|
2173
2266
|
} & DeepOption & RequestOptions;
|
|
2174
|
-
type CityIdOptions = LanguageOption &
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2267
|
+
type CityIdOptions = LanguageOption & CityResponseOptions & {
|
|
2268
|
+
format?: 'resource';
|
|
2269
|
+
hierarchy?: boolean;
|
|
2270
|
+
} & DeepOption & RequestOptions;
|
|
2271
|
+
type CitySearchOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityPagingOptions & CityResponseOptions & {
|
|
2272
|
+
format?: 'list';
|
|
2273
|
+
aliases?: boolean;
|
|
2178
2274
|
limit?: number;
|
|
2275
|
+
sort?: CitySort;
|
|
2276
|
+
match?: 'exact' | 'prefix' | 'fuzzy';
|
|
2277
|
+
maxDistance?: 1 | 2;
|
|
2179
2278
|
} & DeepOption & RequestOptions;
|
|
2180
|
-
type CityNearestOptions = LanguageOption &
|
|
2181
|
-
|
|
2279
|
+
type CityNearestOptions = LanguageOption & CityScopeOptions & CityResponseOptions & {
|
|
2280
|
+
format?: 'resource';
|
|
2281
|
+
} & DeepOption & RequestOptions;
|
|
2282
|
+
type CityNearbyOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityPagingOptions & CityResponseOptions & {
|
|
2283
|
+
format?: 'list';
|
|
2284
|
+
aliases?: boolean;
|
|
2285
|
+
ambiguity?: 'error';
|
|
2182
2286
|
radius?: number;
|
|
2183
2287
|
unit?: 'km' | 'mi';
|
|
2184
|
-
country?: string;
|
|
2185
|
-
state?: string;
|
|
2186
2288
|
limit?: number;
|
|
2289
|
+
sort?: CitySort;
|
|
2187
2290
|
} & DeepOption & RequestOptions;
|
|
2188
2291
|
/** Pass country when known. Codes shared by multiple countries need it. */
|
|
2189
2292
|
type PostalOptions = LanguageOption & {
|
|
@@ -2452,11 +2555,21 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
2452
2555
|
districts: (code: string, opts?: StateDistrictsOptions) => Promise<StateDistricts>;
|
|
2453
2556
|
};
|
|
2454
2557
|
district: (code: string, opts?: DistrictOptions) => Promise<District>;
|
|
2455
|
-
city:
|
|
2456
|
-
id:
|
|
2457
|
-
search:
|
|
2458
|
-
|
|
2459
|
-
|
|
2558
|
+
city: CityLookupCall & {
|
|
2559
|
+
id: CityIdCall;
|
|
2560
|
+
search: CitySearchCall;
|
|
2561
|
+
/** Canonical list resource. Reuse next_cursor with exactly the same options. */
|
|
2562
|
+
list: (opts?: CityListOptions) => Promise<CityList>;
|
|
2563
|
+
nearbyCoordinates: (lat: number, lon: number, opts?: CityNearbyCoordinatesOptions) => Promise<CityNearbyCoordinates>;
|
|
2564
|
+
nearest: CityNearestCall;
|
|
2565
|
+
nearby: CityNearbyCall;
|
|
2566
|
+
/** Reviewed immediate children; coverage is partial. */
|
|
2567
|
+
children: (id: string, opts?: CityRelationsOptions) => Promise<CityRelations>;
|
|
2568
|
+
/** Immediate parent first, following only reviewed parent facts. */
|
|
2569
|
+
ancestors: (id: string, opts?: CityAncestorsOptions) => Promise<CityRelations>;
|
|
2570
|
+
siblings: (id: string, opts?: CityRelationsOptions) => Promise<CityRelations>;
|
|
2571
|
+
/** Great-circle distance between stored centers, not travel distance or containment. */
|
|
2572
|
+
distance: (from: string, to: string, opts?: CityDistanceOptions) => Promise<CityDistance>;
|
|
2460
2573
|
};
|
|
2461
2574
|
/** Look up a postal area. Pass country when known. Check nullable latitude/longitude before another location lookup. */
|
|
2462
2575
|
postal: ((code: string, opts?: PostalOptions) => Promise<Postal>) & {
|
|
@@ -2583,5 +2696,92 @@ type IbanOptions = {
|
|
|
2583
2696
|
} & DeepOption & RequestOptions;
|
|
2584
2697
|
type NpiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
2585
2698
|
type BinOptions = DeepOption & RequestOptions;
|
|
2699
|
+
type CityScopeOptions = {
|
|
2700
|
+
country?: string;
|
|
2701
|
+
state?: string;
|
|
2702
|
+
type?: string;
|
|
2703
|
+
grain?: CityGrain;
|
|
2704
|
+
hierarchy?: boolean;
|
|
2705
|
+
};
|
|
2706
|
+
type CityResponseOptions = {
|
|
2707
|
+
romanized?: boolean;
|
|
2708
|
+
};
|
|
2709
|
+
type CityCollectionFilters = {
|
|
2710
|
+
minPopulation?: number;
|
|
2711
|
+
maxPopulation?: number;
|
|
2712
|
+
minElevation?: number;
|
|
2713
|
+
maxElevation?: number;
|
|
2714
|
+
countries?: string | readonly string[];
|
|
2715
|
+
excludeCountries?: string | readonly string[];
|
|
2716
|
+
timezone?: string;
|
|
2717
|
+
timezones?: string | readonly string[];
|
|
2718
|
+
/** Center-coordinate box: west,south,east,north. West > east crosses the date line. */
|
|
2719
|
+
bbox?: string;
|
|
2720
|
+
};
|
|
2721
|
+
type CityPagingOptions = {
|
|
2722
|
+
page?: boolean;
|
|
2723
|
+
cursor?: string;
|
|
2724
|
+
order?: 'asc' | 'desc';
|
|
2725
|
+
};
|
|
2726
|
+
type CitySort = string;
|
|
2727
|
+
type CityListOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityResponseOptions & {
|
|
2728
|
+
limit?: number;
|
|
2729
|
+
cursor?: string;
|
|
2730
|
+
sort?: CitySort;
|
|
2731
|
+
order?: 'asc' | 'desc';
|
|
2732
|
+
} & DeepOption & RequestOptions;
|
|
2733
|
+
type CityNearbyCoordinatesOptions = LanguageOption & CityScopeOptions & CityCollectionFilters & CityResponseOptions & {
|
|
2734
|
+
radius?: number;
|
|
2735
|
+
unit?: 'km' | 'mi';
|
|
2736
|
+
limit?: number;
|
|
2737
|
+
cursor?: string;
|
|
2738
|
+
sort?: CitySort;
|
|
2739
|
+
order?: 'asc' | 'desc';
|
|
2740
|
+
} & DeepOption & RequestOptions;
|
|
2741
|
+
type CityRelationsOptions = LanguageOption & CityResponseOptions & {
|
|
2742
|
+
limit?: number;
|
|
2743
|
+
cursor?: string;
|
|
2744
|
+
hierarchy?: boolean;
|
|
2745
|
+
} & DeepOption & RequestOptions;
|
|
2746
|
+
type CityAncestorsOptions = Omit<CityRelationsOptions, 'limit' | 'cursor'>;
|
|
2747
|
+
type CityDistanceOptions = RequestOptions;
|
|
2748
|
+
type ClassicCityOptions<T> = T & {
|
|
2749
|
+
format?: never;
|
|
2750
|
+
};
|
|
2751
|
+
interface CityLookupCall {
|
|
2752
|
+
(name: string, opts?: ClassicCityOptions<CityOptions>): Promise<City>;
|
|
2753
|
+
(name: string, opts: CityOptions & {
|
|
2754
|
+
format: 'resource';
|
|
2755
|
+
}): Promise<CityResource>;
|
|
2756
|
+
(name: string, opts: CityOptions): Promise<City>;
|
|
2757
|
+
}
|
|
2758
|
+
interface CityIdCall {
|
|
2759
|
+
(id: string, opts?: ClassicCityOptions<CityIdOptions>): Promise<City>;
|
|
2760
|
+
(id: string, opts: CityIdOptions & {
|
|
2761
|
+
format: 'resource';
|
|
2762
|
+
}): Promise<CityResource>;
|
|
2763
|
+
(id: string, opts: CityIdOptions): Promise<City>;
|
|
2764
|
+
}
|
|
2765
|
+
interface CityNearestCall {
|
|
2766
|
+
(lat: number, lon: number, opts?: ClassicCityOptions<CityNearestOptions>): Promise<CityNearest>;
|
|
2767
|
+
(lat: number, lon: number, opts: CityNearestOptions & {
|
|
2768
|
+
format: 'resource';
|
|
2769
|
+
}): Promise<CityResource & Pick<CityNearest, 'distance' | 'distance_mi'>>;
|
|
2770
|
+
(lat: number, lon: number, opts: CityNearestOptions): Promise<CityNearest>;
|
|
2771
|
+
}
|
|
2772
|
+
interface CitySearchCall {
|
|
2773
|
+
(query: string, opts?: ClassicCityOptions<CitySearchOptions>): Promise<CitySearch>;
|
|
2774
|
+
(query: string, opts: CitySearchOptions & {
|
|
2775
|
+
format: 'list';
|
|
2776
|
+
}): Promise<CityCollection>;
|
|
2777
|
+
(query: string, opts: CitySearchOptions): Promise<CitySearch | CityCollection>;
|
|
2778
|
+
}
|
|
2779
|
+
interface CityNearbyCall {
|
|
2780
|
+
(name: string, opts?: ClassicCityOptions<CityNearbyOptions>): Promise<CityNearby>;
|
|
2781
|
+
(name: string, opts: CityNearbyOptions & {
|
|
2782
|
+
format: 'list';
|
|
2783
|
+
}): Promise<CityCollection>;
|
|
2784
|
+
(name: string, opts: CityNearbyOptions): Promise<CityNearby | CityCollection>;
|
|
2785
|
+
}
|
|
2586
2786
|
|
|
2587
|
-
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type AgentTask, type AgentTaskInput, type AgentTaskLookupInput, type AgentTaskResult, type Asn, type AsnOptions, type Bank, type BankChecks, type BankDeep, type BankDirectory, type BankIssue, type BankOptions, type BankRequirementField, type BankRequirements, type BankRequirementsOptions, type BankUsAch, type BankUsAchChecks, type BankUsAchInput, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Card, type CardDeep, type CardOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityDeep, type CityIdOptions, type CityNearby, type CityNearbyOptions, type CityNearest, type CityNearestOptions, type CityOptions, type CitySearch, type CitySearchOptions, type Company, type CompanyCandidate, type CompanyCountry, type CompanyCoverage, type CompanyCoverageOptions, type CompanyDeep, type CompanyEmailAddress, type CompanyIdOptions, type CompanyMatch, type CompanyOptions, type CompanyPhoneNumber, type CompanyProfile, type CompanyProfileAddress, type CompanyProfileDeep, type CompanyProfileDomain, type CompanyProfileEmail, type CompanyProfileEmployees, type CompanyProfileFounding, type CompanyProfileIdentifier, type CompanyProfileIndustry, type CompanyProfileJurisdiction, type CompanyProfileListing, type CompanyProfilePhone, type CompanyProfileRegistration, type CompanyProfileRegistrationAddress, type CompanyProfileRegistrationLegalForm, type CompanyProfileSource, type CompanyProfileWebsite, type CompanySearch, type CompanySearchOptions, type CompanySocialProfile, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiArtwork, type EmojiArtworkSource, type EmojiBrowse, type EmojiBrowseOptions, EmojiCatalog, type EmojiCatalogConvertOptions, type EmojiCatalogData, EmojiCatalogError, type EmojiCatalogLocalization, type EmojiCatalogLookupOptions, type EmojiCatalogOptions, type EmojiCatalogParseOptions, type EmojiCatalogRegexOptions, type EmojiCatalogScope, type EmojiCatalogSearchFacts, type EmojiCatalogSearchOptions, type EmojiCategories, type EmojiCategory, type EmojiConversion, type EmojiConvertOptions, type EmojiDeep, type EmojiMetadata, type EmojiNativeSearchFacts, type EmojiNotice, type EmojiOptions, type EmojiParse, type EmojiParseOptions, type EmojiPosition, type EmojiSearch, type EmojiSearchOptions, type EmojiShortcodeSourceMetadata, type EmojiSkin, type EmojiSource, type EmojiUnresolved, type EmojiVariant, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Industry, type IndustryChild, type IndustryCorrection, type IndustryDeep, type IndustryExclusion, type IndustryMatch, type IndustryOptions, type IndustrySearch, type IndustrySearchItem, type IndustrySearchOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type Provider, type ProviderDeep, type ProviderEnrollment, type ProviderOptions, type ProviderSource, type ProviderSources, type ProviderTaxonomy, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vehicle, type VehicleDeep, type VehicleOptions, type VehicleRecall, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
|
2787
|
+
export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type AgentTask, type AgentTaskInput, type AgentTaskLookupInput, type AgentTaskResult, type Asn, type AsnOptions, type Bank, type BankChecks, type BankDeep, type BankDirectory, type BankIssue, type BankOptions, type BankRequirementField, type BankRequirements, type BankRequirementsOptions, type BankUsAch, type BankUsAchChecks, type BankUsAchInput, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, type Card, type CardDeep, type CardOptions, type Carrier, type CarrierDeep, type CarrierOptions, type City, type CityAmbiguityCandidate, type CityAncestorsOptions, type CityCollection, type CityCollectionFilters, type CityDeep, type CityDistance, type CityDistanceOptions, type CityGrain, type CityIdCall, type CityIdOptions, type CityList, type CityListOptions, type CityLookupCall, type CityMatch, type CityNearby, type CityNearbyCall, type CityNearbyCoordinates, type CityNearbyCoordinatesOptions, type CityNearbyOptions, type CityNearest, type CityNearestCall, type CityNearestOptions, type CityOptions, type CityPagingOptions, type CityParent, type CityRelations, type CityRelationsOptions, type CityResource, type CityResponseOptions, type CityScopeOptions, type CitySearch, type CitySearchCall, type CitySearchOptions, type CitySort, type Company, type CompanyCandidate, type CompanyCountry, type CompanyCoverage, type CompanyCoverageOptions, type CompanyDeep, type CompanyEmailAddress, type CompanyIdOptions, type CompanyMatch, type CompanyOptions, type CompanyPhoneNumber, type CompanyProfile, type CompanyProfileAddress, type CompanyProfileDeep, type CompanyProfileDomain, type CompanyProfileEmail, type CompanyProfileEmployees, type CompanyProfileFounding, type CompanyProfileIdentifier, type CompanyProfileIndustry, type CompanyProfileJurisdiction, type CompanyProfileListing, type CompanyProfilePhone, type CompanyProfileRegistration, type CompanyProfileRegistrationAddress, type CompanyProfileRegistrationLegalForm, type CompanyProfileSource, type CompanyProfileWebsite, type CompanySearch, type CompanySearchOptions, type CompanySocialProfile, type Continent, type ContinentCountries, type ContinentCountriesOptions, type ContinentCountryItem, type ContinentOptions, type Country, type CountryDeep, type CountryElevationPoint, type CountryEmergency, type CountryOptions, type CountryStateItem, type CountryStates, type CountryStatesOptions, type Currency, type CurrencyDeep, type CurrencyOptions, type CurrencyRate, type CurrencyRateOptions, type DateInfo, type DateInfoDeep, type DateOptions, type DateTodayOptions, type Deep, type District, type DistrictDeep, type DistrictOptions, type Dns, type DnsOptions, type DnsRecord, type Domain, type DomainDeep, type DomainOptions, type DomainRegistration, type Elevation, type ElevationLocations, type ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiArtwork, type EmojiArtworkSource, type EmojiBrowse, type EmojiBrowseOptions, EmojiCatalog, type EmojiCatalogConvertOptions, type EmojiCatalogData, EmojiCatalogError, type EmojiCatalogLocalization, type EmojiCatalogLookupOptions, type EmojiCatalogOptions, type EmojiCatalogParseOptions, type EmojiCatalogRegexOptions, type EmojiCatalogScope, type EmojiCatalogSearchFacts, type EmojiCatalogSearchOptions, type EmojiCategories, type EmojiCategory, type EmojiConversion, type EmojiConvertOptions, type EmojiDeep, type EmojiMetadata, type EmojiNativeSearchFacts, type EmojiNotice, type EmojiOptions, type EmojiParse, type EmojiParseOptions, type EmojiPosition, type EmojiSearch, type EmojiSearchOptions, type EmojiShortcodeSourceMetadata, type EmojiSkin, type EmojiSource, type EmojiUnresolved, type EmojiVariant, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, type Industry, type IndustryChild, type IndustryCorrection, type IndustryDeep, type IndustryExclusion, type IndustryMatch, type IndustryOptions, type IndustrySearch, type IndustrySearchItem, type IndustrySearchOptions, type Ip, type IpDeep, type IpOptions, type IpSelfOptions, type Language, type LanguageDeep, type LanguageOption, type LanguageOptions, type Mac, type MacOptions, type Measure, type MeasureChoice, type MeasureOptions, type MeasureUnit, type MeasureUnits, type MeasureUnitsOptions, type Mx, type MxOptions, type MxRecord, type Naics, type NaicsChild, type NaicsCorrection, type NaicsDeep, type NaicsExclusion, type NaicsMatch, type NaicsOptions, type NaicsSearch, type NaicsSearchItem, type NaicsSearchOptions, type Name, type NameDeep, type NameOptions, type Npi, type NpiDeep, type NpiEnrollment, type NpiOptions, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type PhoneOptions, type Point, type PointCity, type PointDeep, type PointOptions, type Postal, type PostalDeep, type PostalDistance, type PostalDistanceEnd, type PostalDistanceOptions, type PostalLocality, type PostalMetro, type PostalMetrosDeep, type PostalNearby, type PostalNearbyItem, type PostalNearbyOptions, type PostalOptions, type Preflight, type PreflightCost, type PreflightEmailCapacity, type PreflightOperation, type PreflightOperationEstimate, type PreflightPooledCapacity, type PreflightSpendCapacity, type PreflightTask, type PropertyTax, type Provider, type ProviderDeep, type ProviderEnrollment, type ProviderOptions, type ProviderSource, type ProviderSources, type ProviderTaxonomy, type RequestOptions, type Stack, type StackOptions, type StackTechnology, type State, type StateDeep, type StateDistrictDeep, type StateDistrictItem, type StateDistricts, type StateDistrictsOptions, type StateOptions, type Tariff, type TariffDeep, type TariffMeasure, type TariffOptions, type TariffSearch, type TariffSearchHit, type TariffSearchOptions, type Time, type TimeAtOptions, type TimeLocation, type TimeLocationCandidate, type TimeLocationInput, type TimeOptions, type TimeResolution, type TimeResolutionAlternative, type TimeSeason, type TimeTransition, type TimeTransitionState, type TimeZoneEntry, type TimeZones, type TimeZonesOptions, type Timezone, type TimezoneAtOptions, type TimezoneConversionTarget, type TimezoneConversionTargetDeep, type TimezoneDeep, type TimezoneNextDst, type TimezoneOptions, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOptions, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type VatOptions, type Vehicle, type VehicleDeep, type VehicleOptions, type VehicleRecall, type Vin, type VinDeep, type VinOptions, type VinRecall, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherCurrentDeep, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherOptions, type WeatherStation, parseAPI };
|
package/dist/index.js
CHANGED
|
@@ -256,7 +256,7 @@ var EmojiCatalog = class {
|
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
// src/index.ts
|
|
259
|
-
var VERSION = "1.
|
|
259
|
+
var VERSION = "1.11.0";
|
|
260
260
|
var API_VERSION = "2.0.0";
|
|
261
261
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
262
262
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
@@ -284,8 +284,11 @@ var ParseAPIError = class extends Error {
|
|
|
284
284
|
this.retryAfter = retryAfter;
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
|
+
function tariffEditionId(value) {
|
|
288
|
+
return typeof value === "string" && (value.length === 64 && /^[a-f0-9]{64}$/.test(value) || /^ted_[1-9][0-9]{0,19}(?![\s\S])/.test(value) && (value.length < 24 || value.slice(4) <= "18446744073709551615"));
|
|
289
|
+
}
|
|
287
290
|
function tariffSelection(result, opts) {
|
|
288
|
-
if ((opts?.edition !== void 0 || opts?.date !== void 0) && (
|
|
291
|
+
if ((opts?.edition !== void 0 || opts?.date !== void 0) && (!tariffEditionId(result.edition) || opts.edition !== void 0 && result.edition !== opts.edition || (opts.date !== void 0 ? result.date !== opts.date : result.date != null))) {
|
|
289
292
|
throw new ParseAPIError(0, "tariff_selection_mismatch", "Tariff response did not confirm the requested edition/date. The server may not support this selection.", null, null);
|
|
290
293
|
}
|
|
291
294
|
return result;
|
|
@@ -412,7 +415,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
412
415
|
controller.signal.throwIfAborted();
|
|
413
416
|
}
|
|
414
417
|
signal?.throwIfAborted();
|
|
415
|
-
|
|
418
|
+
const error = new ParseAPIError(
|
|
416
419
|
res.status,
|
|
417
420
|
typeof body2.code === "string" ? body2.code : "unknown_error",
|
|
418
421
|
typeof body2.message === "string" ? body2.message : `Request failed with status ${res.status}`,
|
|
@@ -420,6 +423,11 @@ function parseAPI(apiKey, options = {}) {
|
|
|
420
423
|
typeof body2.request_id === "string" ? body2.request_id : null,
|
|
421
424
|
res.headers.get("Retry-After")
|
|
422
425
|
);
|
|
426
|
+
if (error.status === 409 && error.code === "ambiguous_city") {
|
|
427
|
+
const candidates = cityErrorCandidates(body2.candidates);
|
|
428
|
+
if (candidates) error.candidates = candidates;
|
|
429
|
+
}
|
|
430
|
+
throw error;
|
|
423
431
|
}
|
|
424
432
|
} finally {
|
|
425
433
|
clearTimeout(timer);
|
|
@@ -492,19 +500,52 @@ function parseAPI(apiKey, options = {}) {
|
|
|
492
500
|
),
|
|
493
501
|
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state, ...deepQuery(opts) }, void 0, opts),
|
|
494
502
|
city: Object.assign(
|
|
495
|
-
(name, opts) => request(`/city/${enc(name)}`, {
|
|
503
|
+
((name, opts) => request(`/city/${enc(name)}`, { ...cityScopeQuery(opts), ...cityResponseQuery(opts), aliases: opts?.aliases ? "true" : void 0, ambiguity: opts?.ambiguity, ...deepQuery(opts) }, void 0, opts)),
|
|
496
504
|
{
|
|
497
|
-
id: (id, opts) => request(`/city/id/${enc(id)}`, deepQuery(opts), void 0, opts),
|
|
498
|
-
search: (query, opts) =>
|
|
499
|
-
|
|
500
|
-
|
|
505
|
+
id: ((id, opts) => request(`/city/id/${enc(id)}`, { hierarchy: opts?.hierarchy ? "true" : void 0, ...cityResponseQuery(opts), ...deepQuery(opts) }, void 0, opts)),
|
|
506
|
+
search: (async (query, opts) => {
|
|
507
|
+
const spelling = opts?.match !== void 0 || opts?.maxDistance !== void 0;
|
|
508
|
+
const result = await request(spelling ? "/city/search" : "/city", { q: query, match: opts?.match, max_distance: opts?.maxDistance, ...cityScopeQuery(opts), ...cityCollectionQuery(opts), ...cityResponseQuery(opts), aliases: opts?.aliases ? "true" : void 0, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts);
|
|
509
|
+
if (spelling && opts?.format !== "list") {
|
|
510
|
+
const list = result;
|
|
511
|
+
return { q: query, ...opts?.country ? { country: opts.country } : {}, ...opts?.state ? { state: opts.state } : {}, cities: list.data, next_cursor: list.next_cursor };
|
|
512
|
+
}
|
|
513
|
+
return result;
|
|
514
|
+
}),
|
|
515
|
+
/** Canonical list resource. Reuse next_cursor with exactly the same options. */
|
|
516
|
+
list: (opts) => request("/city", { browse: "true", ...cityScopeQuery(opts), ...cityCollectionQuery(opts), ...cityResponseQuery(opts), format: "list", limit: opts?.limit, ...deepQuery(opts) }, void 0, opts),
|
|
517
|
+
nearbyCoordinates: (lat, lon, opts) => request("/city", {
|
|
518
|
+
lat,
|
|
519
|
+
lon,
|
|
520
|
+
nearby: "true",
|
|
501
521
|
radius: opts?.radius,
|
|
502
522
|
unit: opts?.unit,
|
|
503
|
-
|
|
504
|
-
|
|
523
|
+
...cityScopeQuery(opts),
|
|
524
|
+
...cityCollectionQuery(opts),
|
|
525
|
+
...cityResponseQuery(opts),
|
|
526
|
+
format: "list",
|
|
505
527
|
limit: opts?.limit,
|
|
506
528
|
...deepQuery(opts)
|
|
507
|
-
}, void 0, opts)
|
|
529
|
+
}, void 0, opts),
|
|
530
|
+
nearest: ((lat, lon, opts) => request("/city", { lat, lon, ...cityScopeQuery(opts), ...cityResponseQuery(opts), ...deepQuery(opts) }, void 0, opts)),
|
|
531
|
+
nearby: ((name, opts) => request(`/city/${enc(name)}/nearby`, {
|
|
532
|
+
radius: opts?.radius,
|
|
533
|
+
unit: opts?.unit,
|
|
534
|
+
...cityScopeQuery(opts),
|
|
535
|
+
...cityCollectionQuery(opts),
|
|
536
|
+
...cityResponseQuery(opts),
|
|
537
|
+
aliases: opts?.aliases ? "true" : void 0,
|
|
538
|
+
ambiguity: opts?.ambiguity,
|
|
539
|
+
limit: opts?.limit,
|
|
540
|
+
...deepQuery(opts)
|
|
541
|
+
}, void 0, opts)),
|
|
542
|
+
/** Reviewed immediate children; coverage is partial. */
|
|
543
|
+
children: (id, opts) => request(`/city/id/${enc(id)}/children`, { limit: opts?.limit, cursor: opts?.cursor, ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
544
|
+
/** Immediate parent first, following only reviewed parent facts. */
|
|
545
|
+
ancestors: (id, opts) => request(`/city/id/${enc(id)}/ancestors`, { ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
546
|
+
siblings: (id, opts) => request(`/city/id/${enc(id)}/siblings`, { limit: opts?.limit, cursor: opts?.cursor, ...cityResponseQuery(opts), hierarchy: opts?.hierarchy ? "true" : void 0, ...deepQuery(opts) }, void 0, opts),
|
|
547
|
+
/** Great-circle distance between stored centers, not travel distance or containment. */
|
|
548
|
+
distance: (from, to, opts) => request(`/city/id/${enc(from)}/distance/${enc(to)}`, void 0, void 0, opts)
|
|
508
549
|
}
|
|
509
550
|
),
|
|
510
551
|
/** Look up a postal area. Pass country when known. Check nullable latitude/longitude before another location lookup. */
|
|
@@ -700,6 +741,42 @@ function timeTargets(targets, to) {
|
|
|
700
741
|
}
|
|
701
742
|
return targets.join(",");
|
|
702
743
|
}
|
|
744
|
+
function cityErrorCandidates(input) {
|
|
745
|
+
if (!Array.isArray(input)) return void 0;
|
|
746
|
+
const fields = ["name", "name_local", "country", "country_name", "state", "state_name", "type"];
|
|
747
|
+
return input.slice(0, 2).flatMap((row) => {
|
|
748
|
+
if (!row || typeof row !== "object" || typeof row.id !== "string" || !/^city_[23456789abcdefghjkmnpqrstuvwxyz]{12}$/.test(row.id)) return [];
|
|
749
|
+
const candidate = { id: row.id, object: "city" };
|
|
750
|
+
for (const field of fields) if (Object.hasOwn(row, field) && (row[field] === null || typeof row[field] === "string" && row[field].length <= 255)) candidate[field] = row[field];
|
|
751
|
+
return [candidate];
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
function cityCsv(value) {
|
|
755
|
+
return typeof value === "string" ? value : value?.join(",");
|
|
756
|
+
}
|
|
757
|
+
function cityResponseQuery(opts) {
|
|
758
|
+
return { format: opts?.format, romanized: opts?.romanized ? "true" : void 0 };
|
|
759
|
+
}
|
|
760
|
+
function cityScopeQuery(opts) {
|
|
761
|
+
return { country: opts?.country, state: opts?.state, type: opts?.type, grain: opts?.grain, hierarchy: opts?.hierarchy ? "true" : void 0 };
|
|
762
|
+
}
|
|
763
|
+
function cityCollectionQuery(opts) {
|
|
764
|
+
return {
|
|
765
|
+
min_population: opts?.minPopulation,
|
|
766
|
+
max_population: opts?.maxPopulation,
|
|
767
|
+
min_elevation: opts?.minElevation,
|
|
768
|
+
max_elevation: opts?.maxElevation,
|
|
769
|
+
countries: cityCsv(opts?.countries),
|
|
770
|
+
exclude_countries: cityCsv(opts?.excludeCountries),
|
|
771
|
+
timezones: cityCsv(opts?.timezones),
|
|
772
|
+
timezone: opts?.timezone,
|
|
773
|
+
bbox: opts?.bbox,
|
|
774
|
+
page: opts?.page ? "true" : void 0,
|
|
775
|
+
cursor: opts?.cursor,
|
|
776
|
+
sort: opts?.sort,
|
|
777
|
+
order: opts?.order
|
|
778
|
+
};
|
|
779
|
+
}
|
|
703
780
|
export {
|
|
704
781
|
EmojiCatalog,
|
|
705
782
|
EmojiCatalogError,
|