@parseapi/sdk 1.4.0 → 1.6.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 CHANGED
@@ -17,7 +17,7 @@ Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEA
17
17
 
18
18
  ## API versions
19
19
 
20
- Version 1.4.0 explicitly selects the API contract supported by this SDK. It sends `Parse-Version: 2.0.0` on every lookup so responses match the API contract supported by the package. Your key and the team's saved default stay the same.
20
+ Version 1.6.0 explicitly selects the API contract supported by this SDK. It sends `Parse-Version: 2.0.0` on every lookup so responses match the API contract supported by the package. Your key and the team's saved default stay the same.
21
21
 
22
22
  Upgrade the dependency in staging, review the [release notes](https://parseapi.com/docs/releases), and test the application before deploying the same code and dependency version to production. Commit your dependency lockfile so the tested package travels with your deployment. Future major SDK upgrades can select a newer API contract.
23
23
 
@@ -132,6 +132,8 @@ await parse.date.today();
132
132
  await parse.holiday('US', { year: 2026 });
133
133
  await parse.holiday.date('US', '2026-12-25');
134
134
  await parse.elevation(35.2271, -80.8431);
135
+ await parse.elevation.points([[35.2271, -80.8431], [40.7128, -74.006]]);
136
+ await parse.elevation.path([[35.2271, -80.8431], [35.5951, -82.5515]], 100);
135
137
  await parse.point(36.0726, -79.792);
136
138
  await parse.weather(40.7128, -74.006);
137
139
  await parse.domain('example.com');
@@ -156,9 +158,59 @@ Responses are typed, plain JSON data. `country.states('US')` requests the states
156
158
 
157
159
  DNS uses pooled requests on every plan. Omit `type` to check A, AAAA, CNAME, MX, NS, TXT, SOA, CAA, SRV and PTR. Records contain `name`, `type`, `ttl` in seconds and a DNS presentation `value`. TXT values retain quoting and chunk boundaries. A selected question can include its CNAME chain. Empty records mean no records. Lookup failures remain errors.
158
160
 
161
+ ## Elevation
162
+
163
+ `elevation(lat, lon)` returns one sample with meters, feet and grid resolution in meters. `elevation.points(...)` accepts up to 512 `[lat, lon]` pairs, a `lat,lon|lat,lon` string, or `enc:` followed by a Google encoded polyline. Its `points` array preserves input order and duplicate coordinates. Unknown samples stay null, and negative elevations and known zero values are preserved. Each list uses one pooled request. The SDK automatically uses JSON POST for long URLs and numeric coordinates that JavaScript expresses in exponent notation.
164
+
165
+ `elevation.path(path, samples)` accepts the same input formats with 2-512 path vertices and a required integer sample count from 2 to 512. Its `points` array includes both endpoints, with samples spaced uniformly by cumulative great-circle distance along the path. Each segment follows the shortest arc. A segment with antipodal endpoints is rejected because it does not define a unique arc. Path sampling uses one pooled request and automatically selects JSON POST for a long URL.
166
+
159
167
  ## Time
160
168
 
161
- `time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
169
+ `time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to` or `targets`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
170
+
171
+ For an offsetless `at` with `to` or `targets`, choose how to handle a clock change with `disambiguation`. It applies to named-zone and coordinate Time calls.
172
+
173
+ | Value | Repeated time | Skipped time |
174
+ | --- | --- | --- |
175
+ | `compatible` (default) | Earlier occurrence | Shift forward by the clock change |
176
+ | `earlier` | Earlier occurrence | Shift backward by the clock change |
177
+ | `later` | Later occurrence | Shift forward by the clock change |
178
+ | `reject` | `400 ambiguous_time` | `400 nonexistent_time` |
179
+
180
+ An explicit UTC offset selects an instant directly. For example, `2026-11-01T01:30:00-04:00` and `2026-11-01T01:30:00-05:00` identify the two New York occurrences. A valid `disambiguation` value has no effect on explicit instants, current-time requests or lookups without `to` or `targets`. For user-entered appointment times, start with `reject`. Handle `ambiguous_time` or `nonexistent_time` by collecting an explicit offset or an earlier/later choice from the user. Other malformed input still uses `invalid_request`.
181
+
182
+ ```ts
183
+ const result = await parse.time('America/New_York', {
184
+ at: '2026-11-01T01:30:00', to: 'UTC', disambiguation: 'later',
185
+ });
186
+ console.log(result.to?.at); // 2026-11-01T06:30:00+00:00
187
+ ```
188
+
189
+ Canonical Time `deep` includes the pinned rule edition in `deep.timezone_database_version` and source-wall resolution in `deep.resolution`. Resolution records `kind` (`unique`, `overlap` or `gap`), the selected policy, signed `adjustment_seconds`, and chronological alternatives with exact `at`, Unix seconds and UTC offset. Unique times have an empty alternatives list. Explicit instants, current time and lookups without conversion have null resolution. Destination detail stays compact.
190
+
191
+ Search serving IANA IDs by city or region, or omit the query to list all (Go and Rust use an empty string). Discovery returns `timezone_database_version` and sorted `timezones`. No search matches returns `timezones: []`.
192
+
193
+ Pass `targets` to convert one instant to 1-10 zones in a single pooled request. The native list preserves order and duplicates. Use `targets` instead of `to`. The response adds `targets`, with optional detail inside each target. Unknown source coordinates return `targets: null`. An unknown destination rejects the whole request with `not_found`. Omission keeps the original response shape.
194
+
195
+ ```ts
196
+ const zones = await parse.time.zones('New York');
197
+ const result = await parse.time('UTC', {
198
+ at: '2026-09-24T12:00:00Z', targets: ['America/New_York', 'Asia/Tokyo'],
199
+ });
200
+ console.log(zones.timezones, result.targets);
201
+ ```
202
+
203
+ ### Location inputs and timezone filters
204
+
205
+ `parse.time(undefined, { iata: 'JFK', deep: true })` and `parse.time.zones(undefined, { country: 'US', dst: false, observes_dst: true, details: true })`.
206
+
207
+ Choose one explicit location input: IP, exact city name or stable city ID, country, IATA airport, ICAO airport, port UN/LOCODE, or address. Country and state can narrow a city or address. State requires country. Address lookup requires US country context and a strict address-point match. Port lookup covers the reviewed port subset, not every assigned UN/LOCODE. IP lookup always uses the supplied IP.
208
+
209
+ Location calls add `location` with `status`, `candidates`, `truncated`, `source` and the typed input. Check `status` before using the clock: ambiguous or missing locations retain null time fields. Candidate coordinates and IDs can also be null. A country with multiple timezones does not silently choose one. Named-zone and coordinate calls retain their existing signatures.
210
+
211
+ Timezone discovery accepts country, IANA area, exact signed offset, abbreviation, DST-at-instant and observes-DST-during-year filters. `at` selects the common instant, `sort` selects timezone or offset order, and `details` adds `zones` rows plus the evaluation `at`. The default `timezones` list stays compact. False DST filters are sent explicitly. An abbreviation returns candidate zones rather than choosing one. Observes-DST uses the UTC calendar year containing `at`.
212
+
213
+ Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offset_seconds` and `season`. Seasonal adjustments can be negative. `season` describes the current DST-flag interval, or the next within 400 days, with actual before/after transition facts and signed `change_seconds`. Unknown boundaries remain null. These fields are optional and nullable, and destination deep stays compact.
162
214
 
163
215
  ## Measurements
164
216
 
package/dist/index.cjs CHANGED
@@ -24,7 +24,7 @@ __export(index_exports, {
24
24
  parseAPI: () => parseAPI
25
25
  });
26
26
  module.exports = __toCommonJS(index_exports);
27
- var VERSION = "1.4.0";
27
+ var VERSION = "1.6.0";
28
28
  var API_VERSION = "2.0.0";
29
29
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
30
30
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -183,6 +183,15 @@ function parseAPI(apiKey, options = {}) {
183
183
  }
184
184
  const enc = encodeURIComponent;
185
185
  const deepQuery = (opts) => opts?.deep ? { deep: true } : {};
186
+ function elevationSamples(selector, coordinates, opts, samples) {
187
+ const value = typeof coordinates === "string" ? coordinates : coordinates.map(([lat, lon]) => `${lat},${lon}`).join("|");
188
+ const numericJson = typeof coordinates !== "string" && coordinates.some((point) => point.some((value2) => /e/i.test(String(value2))));
189
+ const sampling = samples === void 0 ? {} : { samples };
190
+ const query = { [selector]: value, ...sampling };
191
+ const url = new URL(baseUrl + "/elevation");
192
+ for (const [name, value2] of Object.entries(query)) url.searchParams.set(name, String(value2));
193
+ return !numericJson && url.href.length <= 8e3 ? request("/elevation", query, void 0, opts) : request("/elevation", void 0, void 0, opts, { [selector]: coordinates, ...sampling });
194
+ }
186
195
  return {
187
196
  /** Estimate task access, capacity and additional charges. Requires a secret key. Reserves no units or money and does not enforce the supplied budget. */
188
197
  preflight: (task, opts) => request("/preflight", void 0, void 0, opts, task),
@@ -324,11 +333,13 @@ function parseAPI(apiKey, options = {}) {
324
333
  ),
325
334
  language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
326
335
  name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
327
- /** Current local time, UTC by default. With to, offsetless at is source wall time. */
336
+ /** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
328
337
  time: Object.assign(
329
- (timezone, opts) => request(timezone === void 0 ? "/time" : `/time/${enc(timezone)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
338
+ (timezone, opts) => request(timePath(timezone), { ...timeSource(timezone, opts), at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts),
330
339
  {
331
- at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts)
340
+ /** Search serving timezone IDs. Omit query to list all. */
341
+ zones: (query, opts) => request("/time/zones", { q: query, country: opts?.country, area: opts?.area, offset: opts?.offset, abbreviation: opts?.abbreviation, dst: opts?.dst === void 0 ? void 0 : String(opts.dst), observes_dst: opts?.observes_dst === void 0 ? void 0 : String(opts.observes_dst), at: opts?.at, details: opts?.details, sort: opts?.sort }, void 0, opts),
342
+ at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts)
332
343
  }
333
344
  ),
334
345
  timezone: Object.assign(
@@ -349,7 +360,15 @@ function parseAPI(apiKey, options = {}) {
349
360
  date: (country, date, opts) => request(`/holiday/${enc(country)}/${enc(date)}`, void 0, void 0, opts)
350
361
  }
351
362
  ),
352
- elevation: (lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
363
+ elevation: Object.assign(
364
+ (lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
365
+ {
366
+ /** Sample up to 512 coordinates in order. Accepts lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
367
+ points: (points, opts) => elevationSamples("points", points, opts),
368
+ /** Sample a path at 2-512 evenly spaced great-circle distances, including both endpoints. Accepts 2-512 vertices as lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
369
+ path: (path, samples, opts) => elevationSamples("path", path, opts, samples)
370
+ }
371
+ ),
353
372
  /** Resolve the country, state, district and timezone at coordinates. Deep adds terrain and compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is null when none is within 200 km. */
354
373
  point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }, void 0, opts),
355
374
  /** Get current conditions in metric and imperial units. Paid deep adds specialist current measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-DD) in deep.history alongside current conditions. Date alone does not request history. */
@@ -362,6 +381,24 @@ function parseAPI(apiKey, options = {}) {
362
381
  )
363
382
  };
364
383
  }
384
+ function timeSource(timezone, options = {}) {
385
+ const values = { ip: options.ip, city: options.city, country: options.country, state: options.state, iata: options.iata, icao: options.icao, unlocode: options.unlocode, address: options.address };
386
+ const primary = [options.ip, options.city, options.iata, options.icao, options.unlocode, options.address].filter((value) => value !== void 0);
387
+ const present = Object.values(values).some((value) => value !== void 0);
388
+ if (Object.values(values).some((value) => value !== void 0 && (typeof value !== "string" || !value.trim())) || timezone !== void 0 && present || primary.length > 1 || options.country !== void 0 && primary.length > 0 && options.city === void 0 && options.address === void 0 || options.state !== void 0 && (options.city === void 0 && options.address === void 0 || options.country === void 0) || options.address !== void 0 && options.country === void 0) throw new TypeError("Pass one Time source, using country only with city or address and state only with city or address and country.");
389
+ return values;
390
+ }
391
+ function timePath(timezone) {
392
+ if (timezone !== void 0 && ["zones", "help"].includes(timezone.trim().toLowerCase())) throw new TypeError("Time source must be an IANA timezone ID. Use timezone discovery to list IDs.");
393
+ return timezone === void 0 ? "/time" : `/time/${encodeURIComponent(timezone)}`;
394
+ }
395
+ function timeTargets(targets, to) {
396
+ if (targets === void 0) return void 0;
397
+ if (to !== void 0 || !Array.isArray(targets) || targets.length < 1 || targets.length > 10 || Array.from(targets).some((zone) => typeof zone !== "string" || !zone.trim() || zone.includes(","))) {
398
+ throw new TypeError("Time targets requires 1 to 10 timezone IDs and cannot be combined with to.");
399
+ }
400
+ return targets.join(",");
401
+ }
365
402
  // Annotate the CommonJS export names for ESM import in node:
366
403
  0 && (module.exports = {
367
404
  ParseAPIError,
package/dist/index.d.cts CHANGED
@@ -695,8 +695,47 @@ interface Timezone {
695
695
  to?: TimezoneConversionTarget | null;
696
696
  deep?: Deep<TimezoneDeep>;
697
697
  }
698
- /** Current time and timezone facts. Null clock fields mean the coordinates did not resolve. */
698
+ /** Current time and timezone facts. Unresolved or ambiguous sources keep clock fields null. */
699
699
  interface Time extends Timezone {
700
+ /** Present only for explicit location selectors. Ambiguous or missing results retain null clock fields. */
701
+ location?: TimeLocation;
702
+ /** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
703
+ targets?: TimezoneConversionTarget[] | null;
704
+ }
705
+ /** Serving timezone identifiers and their pinned rule edition. */
706
+ interface TimeZones {
707
+ timezone_database_version: string;
708
+ timezones: string[];
709
+ /** Present with details=true. The one instant used for all rows. */
710
+ at?: string;
711
+ zones?: TimeZoneEntry[];
712
+ }
713
+ interface TimeZoneEntry {
714
+ timezone: string;
715
+ countries: string[];
716
+ area: string | null;
717
+ abbreviation: string;
718
+ offset: string;
719
+ offset_seconds: number;
720
+ dst: boolean;
721
+ observes_dst: boolean;
722
+ }
723
+ interface TimeTransitionState {
724
+ at?: string | null;
725
+ offset?: string | null;
726
+ offset_seconds?: number | null;
727
+ abbreviation?: string | null;
728
+ dst?: boolean | null;
729
+ }
730
+ interface TimeTransition {
731
+ at?: string | null;
732
+ before?: TimeTransitionState | null;
733
+ after?: TimeTransitionState | null;
734
+ change_seconds?: number | null;
735
+ }
736
+ interface TimeSeason {
737
+ start?: TimeTransition | null;
738
+ end?: TimeTransition | null;
700
739
  }
701
740
  /** The other side of a timezone conversion. `at` is the converted wall time. */
702
741
  interface TimezoneConversionTarget {
@@ -749,6 +788,10 @@ interface Elevation {
749
788
  elevation_ft: number | null;
750
789
  resolution: number | null;
751
790
  }
791
+ interface ElevationLocations {
792
+ /** Ordered samples. Point lists preserve supplied coordinates. Paths include both endpoints with even spacing along the path. Unknown elevations stay null. */
793
+ points: Elevation[];
794
+ }
752
795
  interface PointDeep {
753
796
  city: PointCity | null;
754
797
  elevation: number | null;
@@ -1204,7 +1247,31 @@ interface NameDeep {
1204
1247
  /** Name initials using CLDR formatting rules. */
1205
1248
  initials?: string | null;
1206
1249
  }
1250
+ /** How an offsetless source wall time selected an instant. */
1251
+ interface TimeResolution {
1252
+ kind?: string | null;
1253
+ policy?: string | null;
1254
+ /** Signed wall-clock adjustment. Zero for unique and overlapping times. */
1255
+ adjustment_seconds?: number | null;
1256
+ /** Chronological alternatives. Empty means the wall time is unique. */
1257
+ alternatives?: TimeResolutionAlternative[] | null;
1258
+ }
1259
+ interface TimeResolutionAlternative {
1260
+ at?: string | null;
1261
+ unix?: number | null;
1262
+ offset?: string | null;
1263
+ }
1207
1264
  interface TimezoneDeep {
1265
+ /** Rule-defined standard offset. Seasonal changes may be negative. */
1266
+ standard_offset?: string | null;
1267
+ standard_offset_seconds?: number | null;
1268
+ dst_offset_seconds?: number | null;
1269
+ /** Current DST-flag interval, or the next within 400 days. */
1270
+ season?: TimeSeason | null;
1271
+ /** Pinned rules used by canonical Time. */
1272
+ timezone_database_version?: string | null;
1273
+ /** Null when no offsetless conversion was resolved. */
1274
+ resolution?: TimeResolution | null;
1208
1275
  name: string | null;
1209
1276
  /** Whole minutes, truncated toward zero for historical second offsets. */
1210
1277
  offset_minutes: number | null;
@@ -1288,6 +1355,26 @@ interface PropertyTax {
1288
1355
  /** Reporting period, YYYY-YYYY. Monetary amounts use the final year of this period. */
1289
1356
  period: string;
1290
1357
  }
1358
+ interface TimeLocationInput {
1359
+ type: string;
1360
+ value: string;
1361
+ }
1362
+ interface TimeLocationCandidate {
1363
+ id: string | null;
1364
+ name: string | null;
1365
+ country: string | null;
1366
+ state: string | null;
1367
+ timezone: string | null;
1368
+ latitude: number | null;
1369
+ longitude: number | null;
1370
+ }
1371
+ interface TimeLocation {
1372
+ input: TimeLocationInput;
1373
+ status: string;
1374
+ candidates: TimeLocationCandidate[];
1375
+ truncated: boolean;
1376
+ source: string;
1377
+ }
1291
1378
 
1292
1379
  /** A proposed task contains operation counts, never lookup inputs. */
1293
1380
  interface PreflightOperation {
@@ -1564,14 +1651,50 @@ type NameOptions = {
1564
1651
  /** CLDR name-formatting locale, such as en or ja. Defaults to en. */
1565
1652
  name_locale?: string;
1566
1653
  } & DeepOption & RequestOptions;
1654
+ /** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
1567
1655
  type TimeOptions = LanguageOption & {
1656
+ ip?: string;
1657
+ city?: string;
1658
+ country?: string;
1659
+ state?: string;
1660
+ iata?: string;
1661
+ icao?: string;
1662
+ unlocode?: string;
1663
+ address?: string;
1664
+ /** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
1568
1665
  at?: string;
1666
+ /** Destination IANA timezone. The target has the same unix instant. */
1569
1667
  to?: string;
1668
+ /** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
1669
+ targets?: readonly string[];
1670
+ /** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
1671
+ disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
1570
1672
  } & DeepOption & RequestOptions;
1673
+ /** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
1571
1674
  type TimeAtOptions = LanguageOption & {
1675
+ /** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
1572
1676
  at?: string;
1677
+ /** Destination IANA timezone. The target has the same unix instant. */
1573
1678
  to?: string;
1679
+ /** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
1680
+ targets?: readonly string[];
1681
+ /** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
1682
+ disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
1574
1683
  } & DeepOption & RequestOptions;
1684
+ /** Filter supported identifiers at one instant. Abbreviations return candidates, never an inferred zone. */
1685
+ type TimeZonesOptions = {
1686
+ country?: string;
1687
+ area?: string;
1688
+ /** Exact signed UTC offset, such as +05:45 or +00:09:21. */
1689
+ offset?: string;
1690
+ abbreviation?: string;
1691
+ dst?: boolean;
1692
+ /** Whether a DST-flagged state occurs in the UTC calendar year containing at. */
1693
+ observes_dst?: boolean;
1694
+ at?: string;
1695
+ details?: boolean;
1696
+ sort?: 'timezone' | 'offset';
1697
+ } & RequestOptions;
1575
1698
  type TimezoneOptions = LanguageOption & {
1576
1699
  at?: string;
1577
1700
  to?: string;
@@ -1692,8 +1815,10 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1692
1815
  };
1693
1816
  language: (code: string, opts?: LanguageOptions) => Promise<Language>;
1694
1817
  name: (name: string, opts?: NameOptions) => Promise<Name>;
1695
- /** Current local time, UTC by default. With to, offsetless at is source wall time. */
1818
+ /** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
1696
1819
  time: ((timezone?: string, opts?: TimeOptions) => Promise<Time>) & {
1820
+ /** Search serving timezone IDs. Omit query to list all. */
1821
+ zones: (query?: string, opts?: TimeZonesOptions) => Promise<TimeZones>;
1697
1822
  at: (lat: number, lon: number, opts?: TimeAtOptions) => Promise<Time>;
1698
1823
  };
1699
1824
  timezone: ((id: string, opts?: TimezoneOptions) => Promise<Timezone>) & {
@@ -1705,7 +1830,12 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1705
1830
  holiday: ((country: string, opts?: HolidayOptions) => Promise<HolidayYear>) & {
1706
1831
  date: (country: string, date: string, opts?: HolidayDateOptions) => Promise<HolidayDate>;
1707
1832
  };
1708
- elevation: (lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>;
1833
+ elevation: ((lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>) & {
1834
+ /** Sample up to 512 coordinates in order. Accepts lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
1835
+ points: (points: Array<[number, number]> | string, opts?: ElevationOptions) => Promise<ElevationLocations>;
1836
+ /** Sample a path at 2-512 evenly spaced great-circle distances, including both endpoints. Accepts 2-512 vertices as lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
1837
+ path: (path: Array<[number, number]> | string, samples: number, opts?: ElevationOptions) => Promise<ElevationLocations>;
1838
+ };
1709
1839
  /** Resolve the country, state, district and timezone at coordinates. Deep adds terrain and compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is null when none is within 200 km. */
1710
1840
  point: (lat: number, lon: number, opts?: PointOptions) => Promise<Point>;
1711
1841
  /** Get current conditions in metric and imperial units. Paid deep adds specialist current measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-DD) in deep.history alongside current conditions. Date alone does not request history. */
@@ -1716,4 +1846,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1716
1846
  };
1717
1847
  type ParseAPIClient = ReturnType<typeof parseAPI>;
1718
1848
 
1719
- export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, 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 CompanyCountry, type CompanyDeep, type CompanyOptions, 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 ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, 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 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 TimeOptions, 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 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 };
1849
+ export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, 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 CompanyCountry, type CompanyDeep, type CompanyOptions, 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 EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, 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 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 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
@@ -695,8 +695,47 @@ interface Timezone {
695
695
  to?: TimezoneConversionTarget | null;
696
696
  deep?: Deep<TimezoneDeep>;
697
697
  }
698
- /** Current time and timezone facts. Null clock fields mean the coordinates did not resolve. */
698
+ /** Current time and timezone facts. Unresolved or ambiguous sources keep clock fields null. */
699
699
  interface Time extends Timezone {
700
+ /** Present only for explicit location selectors. Ambiguous or missing results retain null clock fields. */
701
+ location?: TimeLocation;
702
+ /** With targets only. Order and duplicates are preserved. Null means the source timezone is unresolved. */
703
+ targets?: TimezoneConversionTarget[] | null;
704
+ }
705
+ /** Serving timezone identifiers and their pinned rule edition. */
706
+ interface TimeZones {
707
+ timezone_database_version: string;
708
+ timezones: string[];
709
+ /** Present with details=true. The one instant used for all rows. */
710
+ at?: string;
711
+ zones?: TimeZoneEntry[];
712
+ }
713
+ interface TimeZoneEntry {
714
+ timezone: string;
715
+ countries: string[];
716
+ area: string | null;
717
+ abbreviation: string;
718
+ offset: string;
719
+ offset_seconds: number;
720
+ dst: boolean;
721
+ observes_dst: boolean;
722
+ }
723
+ interface TimeTransitionState {
724
+ at?: string | null;
725
+ offset?: string | null;
726
+ offset_seconds?: number | null;
727
+ abbreviation?: string | null;
728
+ dst?: boolean | null;
729
+ }
730
+ interface TimeTransition {
731
+ at?: string | null;
732
+ before?: TimeTransitionState | null;
733
+ after?: TimeTransitionState | null;
734
+ change_seconds?: number | null;
735
+ }
736
+ interface TimeSeason {
737
+ start?: TimeTransition | null;
738
+ end?: TimeTransition | null;
700
739
  }
701
740
  /** The other side of a timezone conversion. `at` is the converted wall time. */
702
741
  interface TimezoneConversionTarget {
@@ -749,6 +788,10 @@ interface Elevation {
749
788
  elevation_ft: number | null;
750
789
  resolution: number | null;
751
790
  }
791
+ interface ElevationLocations {
792
+ /** Ordered samples. Point lists preserve supplied coordinates. Paths include both endpoints with even spacing along the path. Unknown elevations stay null. */
793
+ points: Elevation[];
794
+ }
752
795
  interface PointDeep {
753
796
  city: PointCity | null;
754
797
  elevation: number | null;
@@ -1204,7 +1247,31 @@ interface NameDeep {
1204
1247
  /** Name initials using CLDR formatting rules. */
1205
1248
  initials?: string | null;
1206
1249
  }
1250
+ /** How an offsetless source wall time selected an instant. */
1251
+ interface TimeResolution {
1252
+ kind?: string | null;
1253
+ policy?: string | null;
1254
+ /** Signed wall-clock adjustment. Zero for unique and overlapping times. */
1255
+ adjustment_seconds?: number | null;
1256
+ /** Chronological alternatives. Empty means the wall time is unique. */
1257
+ alternatives?: TimeResolutionAlternative[] | null;
1258
+ }
1259
+ interface TimeResolutionAlternative {
1260
+ at?: string | null;
1261
+ unix?: number | null;
1262
+ offset?: string | null;
1263
+ }
1207
1264
  interface TimezoneDeep {
1265
+ /** Rule-defined standard offset. Seasonal changes may be negative. */
1266
+ standard_offset?: string | null;
1267
+ standard_offset_seconds?: number | null;
1268
+ dst_offset_seconds?: number | null;
1269
+ /** Current DST-flag interval, or the next within 400 days. */
1270
+ season?: TimeSeason | null;
1271
+ /** Pinned rules used by canonical Time. */
1272
+ timezone_database_version?: string | null;
1273
+ /** Null when no offsetless conversion was resolved. */
1274
+ resolution?: TimeResolution | null;
1208
1275
  name: string | null;
1209
1276
  /** Whole minutes, truncated toward zero for historical second offsets. */
1210
1277
  offset_minutes: number | null;
@@ -1288,6 +1355,26 @@ interface PropertyTax {
1288
1355
  /** Reporting period, YYYY-YYYY. Monetary amounts use the final year of this period. */
1289
1356
  period: string;
1290
1357
  }
1358
+ interface TimeLocationInput {
1359
+ type: string;
1360
+ value: string;
1361
+ }
1362
+ interface TimeLocationCandidate {
1363
+ id: string | null;
1364
+ name: string | null;
1365
+ country: string | null;
1366
+ state: string | null;
1367
+ timezone: string | null;
1368
+ latitude: number | null;
1369
+ longitude: number | null;
1370
+ }
1371
+ interface TimeLocation {
1372
+ input: TimeLocationInput;
1373
+ status: string;
1374
+ candidates: TimeLocationCandidate[];
1375
+ truncated: boolean;
1376
+ source: string;
1377
+ }
1291
1378
 
1292
1379
  /** A proposed task contains operation counts, never lookup inputs. */
1293
1380
  interface PreflightOperation {
@@ -1564,14 +1651,50 @@ type NameOptions = {
1564
1651
  /** CLDR name-formatting locale, such as en or ja. Defaults to en. */
1565
1652
  name_locale?: string;
1566
1653
  } & DeepOption & RequestOptions;
1654
+ /** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
1567
1655
  type TimeOptions = LanguageOption & {
1656
+ ip?: string;
1657
+ city?: string;
1658
+ country?: string;
1659
+ state?: string;
1660
+ iata?: string;
1661
+ icao?: string;
1662
+ unlocode?: string;
1663
+ address?: string;
1664
+ /** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
1568
1665
  at?: string;
1666
+ /** Destination IANA timezone. The target has the same unix instant. */
1569
1667
  to?: string;
1668
+ /** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
1669
+ targets?: readonly string[];
1670
+ /** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
1671
+ disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
1570
1672
  } & DeepOption & RequestOptions;
1673
+ /** Local time or same-instant conversion. Optional reference detail is pooled on every plan. */
1571
1674
  type TimeAtOptions = LanguageOption & {
1675
+ /** ISO timestamp. With to or targets, an offsetless value is source wall time. Otherwise it is UTC. */
1572
1676
  at?: string;
1677
+ /** Destination IANA timezone. The target has the same unix instant. */
1573
1678
  to?: string;
1679
+ /** One to ten destination IDs, preserving order and duplicates. Use instead of to. */
1680
+ targets?: readonly string[];
1681
+ /** Offsetless conversion clock changes: compatible (default), earlier, later, or reject. Explicit offsets select the instant directly. */
1682
+ disambiguation?: 'compatible' | 'earlier' | 'later' | 'reject';
1574
1683
  } & DeepOption & RequestOptions;
1684
+ /** Filter supported identifiers at one instant. Abbreviations return candidates, never an inferred zone. */
1685
+ type TimeZonesOptions = {
1686
+ country?: string;
1687
+ area?: string;
1688
+ /** Exact signed UTC offset, such as +05:45 or +00:09:21. */
1689
+ offset?: string;
1690
+ abbreviation?: string;
1691
+ dst?: boolean;
1692
+ /** Whether a DST-flagged state occurs in the UTC calendar year containing at. */
1693
+ observes_dst?: boolean;
1694
+ at?: string;
1695
+ details?: boolean;
1696
+ sort?: 'timezone' | 'offset';
1697
+ } & RequestOptions;
1575
1698
  type TimezoneOptions = LanguageOption & {
1576
1699
  at?: string;
1577
1700
  to?: string;
@@ -1692,8 +1815,10 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1692
1815
  };
1693
1816
  language: (code: string, opts?: LanguageOptions) => Promise<Language>;
1694
1817
  name: (name: string, opts?: NameOptions) => Promise<Name>;
1695
- /** Current local time, UTC by default. With to, offsetless at is source wall time. */
1818
+ /** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
1696
1819
  time: ((timezone?: string, opts?: TimeOptions) => Promise<Time>) & {
1820
+ /** Search serving timezone IDs. Omit query to list all. */
1821
+ zones: (query?: string, opts?: TimeZonesOptions) => Promise<TimeZones>;
1697
1822
  at: (lat: number, lon: number, opts?: TimeAtOptions) => Promise<Time>;
1698
1823
  };
1699
1824
  timezone: ((id: string, opts?: TimezoneOptions) => Promise<Timezone>) & {
@@ -1705,7 +1830,12 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1705
1830
  holiday: ((country: string, opts?: HolidayOptions) => Promise<HolidayYear>) & {
1706
1831
  date: (country: string, date: string, opts?: HolidayDateOptions) => Promise<HolidayDate>;
1707
1832
  };
1708
- elevation: (lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>;
1833
+ elevation: ((lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>) & {
1834
+ /** Sample up to 512 coordinates in order. Accepts lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
1835
+ points: (points: Array<[number, number]> | string, opts?: ElevationOptions) => Promise<ElevationLocations>;
1836
+ /** Sample a path at 2-512 evenly spaced great-circle distances, including both endpoints. Accepts 2-512 vertices as lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
1837
+ path: (path: Array<[number, number]> | string, samples: number, opts?: ElevationOptions) => Promise<ElevationLocations>;
1838
+ };
1709
1839
  /** Resolve the country, state, district and timezone at coordinates. Deep adds terrain and compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is null when none is within 200 km. */
1710
1840
  point: (lat: number, lon: number, opts?: PointOptions) => Promise<Point>;
1711
1841
  /** Get current conditions in metric and imperial units. Paid deep adds specialist current measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-DD) in deep.history alongside current conditions. Date alone does not request history. */
@@ -1716,4 +1846,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
1716
1846
  };
1717
1847
  type ParseAPIClient = ReturnType<typeof parseAPI>;
1718
1848
 
1719
- export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, 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 CompanyCountry, type CompanyDeep, type CompanyOptions, 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 ElevationOptions, type Email, type EmailDeep, type EmailOptions, type Emoji, type EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, 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 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 TimeOptions, 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 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 };
1849
+ export { type Address, type AddressOptions, type AddressSearch, type AddressSearchOptions, type AddressSuggestion, type Asn, type AsnOptions, type Bin, type BinOptions, type Bloc, type BlocCountries, type BlocCountriesOptions, type BlocCountryItem, type BlocOptions, type Caller, type CallerOptions, 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 CompanyCountry, type CompanyDeep, type CompanyOptions, 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 EmojiDeep, type EmojiOptions, type EmojiSearch, type EmojiSearchOptions, type EmojiSkin, type Hlr, type HlrDeep, type HlrOptions, type Holiday, type HolidayDate, type HolidayDateOptions, type HolidayOptions, type HolidayYear, type Iban, type IbanDeep, type IbanOptions, 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 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 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
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var VERSION = "1.4.0";
2
+ var VERSION = "1.6.0";
3
3
  var API_VERSION = "2.0.0";
4
4
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
5
5
  var DEFAULT_TIMEOUT_MS = 1e4;
@@ -158,6 +158,15 @@ function parseAPI(apiKey, options = {}) {
158
158
  }
159
159
  const enc = encodeURIComponent;
160
160
  const deepQuery = (opts) => opts?.deep ? { deep: true } : {};
161
+ function elevationSamples(selector, coordinates, opts, samples) {
162
+ const value = typeof coordinates === "string" ? coordinates : coordinates.map(([lat, lon]) => `${lat},${lon}`).join("|");
163
+ const numericJson = typeof coordinates !== "string" && coordinates.some((point) => point.some((value2) => /e/i.test(String(value2))));
164
+ const sampling = samples === void 0 ? {} : { samples };
165
+ const query = { [selector]: value, ...sampling };
166
+ const url = new URL(baseUrl + "/elevation");
167
+ for (const [name, value2] of Object.entries(query)) url.searchParams.set(name, String(value2));
168
+ return !numericJson && url.href.length <= 8e3 ? request("/elevation", query, void 0, opts) : request("/elevation", void 0, void 0, opts, { [selector]: coordinates, ...sampling });
169
+ }
161
170
  return {
162
171
  /** Estimate task access, capacity and additional charges. Requires a secret key. Reserves no units or money and does not enforce the supplied budget. */
163
172
  preflight: (task, opts) => request("/preflight", void 0, void 0, opts, task),
@@ -299,11 +308,13 @@ function parseAPI(apiKey, options = {}) {
299
308
  ),
300
309
  language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
301
310
  name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
302
- /** Current local time, UTC by default. With to, offsetless at is source wall time. */
311
+ /** Current local time, UTC by default. With to or targets, offsetless at is source wall time. */
303
312
  time: Object.assign(
304
- (timezone, opts) => request(timezone === void 0 ? "/time" : `/time/${enc(timezone)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
313
+ (timezone, opts) => request(timePath(timezone), { ...timeSource(timezone, opts), at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts),
305
314
  {
306
- at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts)
315
+ /** Search serving timezone IDs. Omit query to list all. */
316
+ zones: (query, opts) => request("/time/zones", { q: query, country: opts?.country, area: opts?.area, offset: opts?.offset, abbreviation: opts?.abbreviation, dst: opts?.dst === void 0 ? void 0 : String(opts.dst), observes_dst: opts?.observes_dst === void 0 ? void 0 : String(opts.observes_dst), at: opts?.at, details: opts?.details, sort: opts?.sort }, void 0, opts),
317
+ at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, targets: timeTargets(opts?.targets, opts?.to), disambiguation: opts?.disambiguation, ...deepQuery(opts) }, void 0, opts)
307
318
  }
308
319
  ),
309
320
  timezone: Object.assign(
@@ -324,7 +335,15 @@ function parseAPI(apiKey, options = {}) {
324
335
  date: (country, date, opts) => request(`/holiday/${enc(country)}/${enc(date)}`, void 0, void 0, opts)
325
336
  }
326
337
  ),
327
- elevation: (lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
338
+ elevation: Object.assign(
339
+ (lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
340
+ {
341
+ /** Sample up to 512 coordinates in order. Accepts lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
342
+ points: (points, opts) => elevationSamples("points", points, opts),
343
+ /** Sample a path at 2-512 evenly spaced great-circle distances, including both endpoints. Accepts 2-512 vertices as lat/lon tuples, a pipe list, or an enc: Google polyline. Long URLs use JSON POST automatically. */
344
+ path: (path, samples, opts) => elevationSamples("path", path, opts, samples)
345
+ }
346
+ ),
328
347
  /** Resolve the country, state, district and timezone at coordinates. Deep adds terrain and compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is null when none is within 200 km. */
329
348
  point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }, void 0, opts),
330
349
  /** Get current conditions in metric and imperial units. Paid deep adds specialist current measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-DD) in deep.history alongside current conditions. Date alone does not request history. */
@@ -337,6 +356,24 @@ function parseAPI(apiKey, options = {}) {
337
356
  )
338
357
  };
339
358
  }
359
+ function timeSource(timezone, options = {}) {
360
+ const values = { ip: options.ip, city: options.city, country: options.country, state: options.state, iata: options.iata, icao: options.icao, unlocode: options.unlocode, address: options.address };
361
+ const primary = [options.ip, options.city, options.iata, options.icao, options.unlocode, options.address].filter((value) => value !== void 0);
362
+ const present = Object.values(values).some((value) => value !== void 0);
363
+ if (Object.values(values).some((value) => value !== void 0 && (typeof value !== "string" || !value.trim())) || timezone !== void 0 && present || primary.length > 1 || options.country !== void 0 && primary.length > 0 && options.city === void 0 && options.address === void 0 || options.state !== void 0 && (options.city === void 0 && options.address === void 0 || options.country === void 0) || options.address !== void 0 && options.country === void 0) throw new TypeError("Pass one Time source, using country only with city or address and state only with city or address and country.");
364
+ return values;
365
+ }
366
+ function timePath(timezone) {
367
+ if (timezone !== void 0 && ["zones", "help"].includes(timezone.trim().toLowerCase())) throw new TypeError("Time source must be an IANA timezone ID. Use timezone discovery to list IDs.");
368
+ return timezone === void 0 ? "/time" : `/time/${encodeURIComponent(timezone)}`;
369
+ }
370
+ function timeTargets(targets, to) {
371
+ if (targets === void 0) return void 0;
372
+ if (to !== void 0 || !Array.isArray(targets) || targets.length < 1 || targets.length > 10 || Array.from(targets).some((zone) => typeof zone !== "string" || !zone.trim() || zone.includes(","))) {
373
+ throw new TypeError("Time targets requires 1 to 10 timezone IDs and cannot be combined with to.");
374
+ }
375
+ return targets.join(",");
376
+ }
340
377
  export {
341
378
  ParseAPIError,
342
379
  parseAPI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parseapi/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Official ParseAPI client for Node and TypeScript. One key, minimal JSON, fast.",
5
5
  "keywords": [
6
6
  "parseapi",