@parseapi/sdk 1.3.0 → 1.5.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 +11 -1
- package/dist/index.cjs +19 -2
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +19 -2
- package/package.json +1 -1
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.
|
|
20
|
+
Version 1.5.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,6 +158,12 @@ 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
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`, 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.
|
|
@@ -173,6 +181,8 @@ Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` sele
|
|
|
173
181
|
|
|
174
182
|
## Place statistics and optional detail
|
|
175
183
|
|
|
184
|
+
Australian postal lookups include core `localities` with suburb choices (`city`, `state`, `state_name`) on every plan. Null or an omitted field means unknown, while `[]` means the reviewed reference has no eligible choices. `city` stays null when the source is ambiguous, even if there is only one eligible choice. Let the user select their suburb and keep manual entry available. These are geographic choices, not mailing-address verification. [G-NAF source, adaptations and licence](https://parseapi.com/legal/attribution#postal-au).
|
|
185
|
+
|
|
176
186
|
Postal and District paid profiles include `deep.property_tax` where supported. It contains `annual_median`, `currency` and `period`: median annual property tax payable on owner-occupied homes in the statistical area. The amount is adjusted to the final year of the reporting period (`YYYY-YYYY`). This is an area statistic, not a rate or an individual property bill. Unsupported, missing and censored estimates are null.
|
|
177
187
|
|
|
178
188
|
```ts
|
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.
|
|
27
|
+
var VERSION = "1.5.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),
|
|
@@ -349,7 +358,15 @@ function parseAPI(apiKey, options = {}) {
|
|
|
349
358
|
date: (country, date, opts) => request(`/holiday/${enc(country)}/${enc(date)}`, void 0, void 0, opts)
|
|
350
359
|
}
|
|
351
360
|
),
|
|
352
|
-
elevation: (
|
|
361
|
+
elevation: Object.assign(
|
|
362
|
+
(lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
|
|
363
|
+
{
|
|
364
|
+
/** 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. */
|
|
365
|
+
points: (points, opts) => elevationSamples("points", points, opts),
|
|
366
|
+
/** 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. */
|
|
367
|
+
path: (path, samples, opts) => elevationSamples("path", path, opts, samples)
|
|
368
|
+
}
|
|
369
|
+
),
|
|
353
370
|
/** 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
371
|
point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }, void 0, opts),
|
|
355
372
|
/** 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. */
|
package/dist/index.d.cts
CHANGED
|
@@ -203,10 +203,18 @@ interface PostalMetro {
|
|
|
203
203
|
business_share: number | null;
|
|
204
204
|
other_share: number | null;
|
|
205
205
|
}
|
|
206
|
+
/** A supported Australian postcode suburb choice, independent of the scalar city. */
|
|
207
|
+
interface PostalLocality {
|
|
208
|
+
city: string;
|
|
209
|
+
state: string;
|
|
210
|
+
state_name: string;
|
|
211
|
+
}
|
|
206
212
|
interface Postal {
|
|
207
213
|
postal: string;
|
|
208
214
|
city: string | null;
|
|
209
215
|
city_local: string | null;
|
|
216
|
+
/** Null/missing is unknown. An empty list has no eligible choices. One choice does not imply city. */
|
|
217
|
+
localities?: PostalLocality[] | null;
|
|
210
218
|
district: string | null;
|
|
211
219
|
district_name: string | null;
|
|
212
220
|
district_name_local: string | null;
|
|
@@ -741,6 +749,10 @@ interface Elevation {
|
|
|
741
749
|
elevation_ft: number | null;
|
|
742
750
|
resolution: number | null;
|
|
743
751
|
}
|
|
752
|
+
interface ElevationLocations {
|
|
753
|
+
/** Ordered samples. Point lists preserve supplied coordinates. Paths include both endpoints with even spacing along the path. Unknown elevations stay null. */
|
|
754
|
+
points: Elevation[];
|
|
755
|
+
}
|
|
744
756
|
interface PointDeep {
|
|
745
757
|
city: PointCity | null;
|
|
746
758
|
elevation: number | null;
|
|
@@ -1697,7 +1709,12 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1697
1709
|
holiday: ((country: string, opts?: HolidayOptions) => Promise<HolidayYear>) & {
|
|
1698
1710
|
date: (country: string, date: string, opts?: HolidayDateOptions) => Promise<HolidayDate>;
|
|
1699
1711
|
};
|
|
1700
|
-
elevation: (lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation
|
|
1712
|
+
elevation: ((lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>) & {
|
|
1713
|
+
/** 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. */
|
|
1714
|
+
points: (points: Array<[number, number]> | string, opts?: ElevationOptions) => Promise<ElevationLocations>;
|
|
1715
|
+
/** 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. */
|
|
1716
|
+
path: (path: Array<[number, number]> | string, samples: number, opts?: ElevationOptions) => Promise<ElevationLocations>;
|
|
1717
|
+
};
|
|
1701
1718
|
/** 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. */
|
|
1702
1719
|
point: (lat: number, lon: number, opts?: PointOptions) => Promise<Point>;
|
|
1703
1720
|
/** 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. */
|
|
@@ -1708,4 +1725,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1708
1725
|
};
|
|
1709
1726
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1710
1727
|
|
|
1711
|
-
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 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 };
|
|
1728
|
+
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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -203,10 +203,18 @@ interface PostalMetro {
|
|
|
203
203
|
business_share: number | null;
|
|
204
204
|
other_share: number | null;
|
|
205
205
|
}
|
|
206
|
+
/** A supported Australian postcode suburb choice, independent of the scalar city. */
|
|
207
|
+
interface PostalLocality {
|
|
208
|
+
city: string;
|
|
209
|
+
state: string;
|
|
210
|
+
state_name: string;
|
|
211
|
+
}
|
|
206
212
|
interface Postal {
|
|
207
213
|
postal: string;
|
|
208
214
|
city: string | null;
|
|
209
215
|
city_local: string | null;
|
|
216
|
+
/** Null/missing is unknown. An empty list has no eligible choices. One choice does not imply city. */
|
|
217
|
+
localities?: PostalLocality[] | null;
|
|
210
218
|
district: string | null;
|
|
211
219
|
district_name: string | null;
|
|
212
220
|
district_name_local: string | null;
|
|
@@ -741,6 +749,10 @@ interface Elevation {
|
|
|
741
749
|
elevation_ft: number | null;
|
|
742
750
|
resolution: number | null;
|
|
743
751
|
}
|
|
752
|
+
interface ElevationLocations {
|
|
753
|
+
/** Ordered samples. Point lists preserve supplied coordinates. Paths include both endpoints with even spacing along the path. Unknown elevations stay null. */
|
|
754
|
+
points: Elevation[];
|
|
755
|
+
}
|
|
744
756
|
interface PointDeep {
|
|
745
757
|
city: PointCity | null;
|
|
746
758
|
elevation: number | null;
|
|
@@ -1697,7 +1709,12 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1697
1709
|
holiday: ((country: string, opts?: HolidayOptions) => Promise<HolidayYear>) & {
|
|
1698
1710
|
date: (country: string, date: string, opts?: HolidayDateOptions) => Promise<HolidayDate>;
|
|
1699
1711
|
};
|
|
1700
|
-
elevation: (lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation
|
|
1712
|
+
elevation: ((lat: number, lon: number, opts?: ElevationOptions) => Promise<Elevation>) & {
|
|
1713
|
+
/** 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. */
|
|
1714
|
+
points: (points: Array<[number, number]> | string, opts?: ElevationOptions) => Promise<ElevationLocations>;
|
|
1715
|
+
/** 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. */
|
|
1716
|
+
path: (path: Array<[number, number]> | string, samples: number, opts?: ElevationOptions) => Promise<ElevationLocations>;
|
|
1717
|
+
};
|
|
1701
1718
|
/** 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. */
|
|
1702
1719
|
point: (lat: number, lon: number, opts?: PointOptions) => Promise<Point>;
|
|
1703
1720
|
/** 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. */
|
|
@@ -1708,4 +1725,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1708
1725
|
};
|
|
1709
1726
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1710
1727
|
|
|
1711
|
-
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 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 };
|
|
1728
|
+
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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var VERSION = "1.
|
|
2
|
+
var VERSION = "1.5.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),
|
|
@@ -324,7 +333,15 @@ function parseAPI(apiKey, options = {}) {
|
|
|
324
333
|
date: (country, date, opts) => request(`/holiday/${enc(country)}/${enc(date)}`, void 0, void 0, opts)
|
|
325
334
|
}
|
|
326
335
|
),
|
|
327
|
-
elevation: (
|
|
336
|
+
elevation: Object.assign(
|
|
337
|
+
(lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
|
|
338
|
+
{
|
|
339
|
+
/** 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. */
|
|
340
|
+
points: (points, opts) => elevationSamples("points", points, opts),
|
|
341
|
+
/** 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. */
|
|
342
|
+
path: (path, samples, opts) => elevationSamples("path", path, opts, samples)
|
|
343
|
+
}
|
|
344
|
+
),
|
|
328
345
|
/** 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
346
|
point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }, void 0, opts),
|
|
330
347
|
/** 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. */
|