@parseapi/sdk 1.2.0 → 1.3.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 +15 -1
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +35 -2
- package/dist/index.d.ts +35 -2
- package/dist/index.js +6 -3
- 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.3.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
|
|
|
@@ -287,3 +287,17 @@ const basic = await parse.time('America/New_York');
|
|
|
287
287
|
const detail = await parse.time('America/New_York', { deep: true });
|
|
288
288
|
console.log(basic.at, detail.deep?.next_dst);
|
|
289
289
|
```
|
|
290
|
+
|
|
291
|
+
## Stack API
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
const result = await parse.stack("example.com");
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Pass a public hostname without a scheme, path, port or IP address. Stack returns the checked URL and `checked_at` time, followed by `scope`, `pages` and `partial`. `scope` is `homepage` or `site`; `pages` counts successfully checked HTML pages. `partial` is true for homepage-only or incomplete bounded site checks. False means the known in-scope candidates were completed, not that every page on a website was visited. A homepage result has `scope: "homepage"`, `pages: 1` and `partial: true`.
|
|
298
|
+
|
|
299
|
+
`cms`, `servers`, `frameworks`, `ecommerce`, `analytics`, `chat`, `payments` and `hosting` are arrays because a site can use several technologies in each category. Each entry contains `technology`, `name` and nullable `version`. Technology codes are open strings. A successful check uses empty arrays for categories with no matches. When no HTML page could be checked, `checked_at` and all categories are null, `pages` is 0 and `partial` is null. Unknown or conflicting versions are null. Missing detections do not prove absence.
|
|
300
|
+
|
|
301
|
+
Successful checks may be reused for up to 24 hours. `pretty` optionally formats the wire JSON. Stack uses your plan's request allowance and API version 2.0.0 selected by this client.
|
|
302
|
+
|
|
303
|
+
Stack defaults to 35 seconds per attempt so a first scan has time to finish. Other lookups retain their 10-second default. An explicit client timeout applies to every operation; JavaScript also supports a per-call `timeoutMs` override.
|
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.3.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;
|
|
@@ -102,7 +102,8 @@ function parseAPI(apiKey, options = {}) {
|
|
|
102
102
|
throw new Error("parseAPI: missing API key. Pass one or set PARSEAPI_KEY.");
|
|
103
103
|
}
|
|
104
104
|
const baseUrl = (options.baseUrl ?? env("PARSEAPI_BASE_URL") ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
105
|
-
const
|
|
105
|
+
const configuredTimeoutMs = options.timeoutMs;
|
|
106
|
+
const timeoutMs = configuredTimeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
106
107
|
const configuredRetries = options.retries;
|
|
107
108
|
validateTimeout(timeoutMs);
|
|
108
109
|
validateRetries(configuredRetries);
|
|
@@ -110,7 +111,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
110
111
|
async function request(path, query, headers, controls = {}, json) {
|
|
111
112
|
const signal = controls.signal;
|
|
112
113
|
signal?.throwIfAborted();
|
|
113
|
-
const attemptTimeout = controls.timeoutMs ?? timeoutMs;
|
|
114
|
+
const attemptTimeout = controls.timeoutMs ?? configuredTimeoutMs ?? (path.startsWith("/stack/") ? 35e3 : timeoutMs);
|
|
114
115
|
const retries = controls.retries ?? configuredRetries ?? (metered(path, query) ? 0 : DEFAULT_RETRIES);
|
|
115
116
|
validateTimeout(attemptTimeout);
|
|
116
117
|
validateRetries(retries);
|
|
@@ -277,6 +278,8 @@ function parseAPI(apiKey, options = {}) {
|
|
|
277
278
|
caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }, void 0, opts),
|
|
278
279
|
/** Look up phone status at the last check. Live means assigned and connected means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep adds network diagnostics within the same metered lookup. No automatic retries by default. */
|
|
279
280
|
hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
281
|
+
/** Identify website technologies by category, with homepage or bounded site coverage metadata. */
|
|
282
|
+
stack: (domain, opts) => request(`/stack/${enc(domain)}`, { ...deepQuery(opts), pretty: opts?.pretty }, void 0, opts),
|
|
280
283
|
/** Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans. */
|
|
281
284
|
domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts), void 0, opts),
|
|
282
285
|
asn: (asn, opts) => request(`/asn/${enc(asn)}`, void 0, void 0, opts),
|
package/dist/index.d.cts
CHANGED
|
@@ -493,6 +493,33 @@ interface MxRecord {
|
|
|
493
493
|
priority: number;
|
|
494
494
|
host: string;
|
|
495
495
|
}
|
|
496
|
+
interface StackTechnology {
|
|
497
|
+
technology: string;
|
|
498
|
+
name: string;
|
|
499
|
+
version: string | null;
|
|
500
|
+
}
|
|
501
|
+
interface Stack {
|
|
502
|
+
domain: string;
|
|
503
|
+
url: string;
|
|
504
|
+
/** Time of the check, or null when no HTML page could be checked. */
|
|
505
|
+
checked_at: string | null;
|
|
506
|
+
scope: 'homepage' | 'site';
|
|
507
|
+
/** Number of successfully checked HTML pages. */
|
|
508
|
+
pages: number;
|
|
509
|
+
/** True for homepage-only or incomplete bounded checks; null when no HTML page could be checked. False never guarantees every page was visited. */
|
|
510
|
+
partial: boolean | null;
|
|
511
|
+
/** Collections are null when no HTML page could be checked and empty when no matches were found. */
|
|
512
|
+
cms: StackTechnology[] | null;
|
|
513
|
+
servers: StackTechnology[] | null;
|
|
514
|
+
frameworks: StackTechnology[] | null;
|
|
515
|
+
ecommerce: StackTechnology[] | null;
|
|
516
|
+
analytics: StackTechnology[] | null;
|
|
517
|
+
chat: StackTechnology[] | null;
|
|
518
|
+
payments: StackTechnology[] | null;
|
|
519
|
+
hosting: StackTechnology[] | null;
|
|
520
|
+
/** Empty only when the generic deep compatibility flag was requested. */
|
|
521
|
+
deep?: Record<string, never>;
|
|
522
|
+
}
|
|
496
523
|
interface DomainRegistration {
|
|
497
524
|
registered: boolean;
|
|
498
525
|
created: string | null;
|
|
@@ -1377,7 +1404,7 @@ interface RequestOptions {
|
|
|
1377
1404
|
interface ParseAPIOptions {
|
|
1378
1405
|
/** Override https://api.parseapi.com (tests, canaries). Also read from PARSEAPI_BASE_URL. */
|
|
1379
1406
|
baseUrl?: string;
|
|
1380
|
-
/** Per-attempt timeout in milliseconds.
|
|
1407
|
+
/** Per-attempt timeout in milliseconds. Defaults to 35000 for Stack and 10000 otherwise. An explicit value applies to every operation. */
|
|
1381
1408
|
timeoutMs?: number;
|
|
1382
1409
|
/** Retries after the first attempt on network errors / 429 / 5xx. Default 2 for ordinary calls, 0 for paid checks. An explicit count overrides both. */
|
|
1383
1410
|
retries?: number;
|
|
@@ -1478,6 +1505,10 @@ type CallerOptions = {
|
|
|
1478
1505
|
type HlrOptions = {
|
|
1479
1506
|
country?: string;
|
|
1480
1507
|
} & DeepOption & RequestOptions;
|
|
1508
|
+
/** Public website hostname only. Optional formatting and request controls. */
|
|
1509
|
+
type StackOptions = {
|
|
1510
|
+
pretty?: boolean;
|
|
1511
|
+
} & DeepOption & RequestOptions;
|
|
1481
1512
|
type DomainOptions = DeepOption & RequestOptions;
|
|
1482
1513
|
type AsnOptions = LanguageOption & RequestOptions;
|
|
1483
1514
|
type MacOptions = RequestOptions;
|
|
@@ -1622,6 +1653,8 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1622
1653
|
caller: (number: string, opts?: CallerOptions) => Promise<Caller>;
|
|
1623
1654
|
/** Look up phone status at the last check. Live means assigned and connected means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep adds network diagnostics within the same metered lookup. No automatic retries by default. */
|
|
1624
1655
|
hlr: (number: string, opts?: HlrOptions) => Promise<Hlr>;
|
|
1656
|
+
/** Identify website technologies by category, with homepage or bounded site coverage metadata. */
|
|
1657
|
+
stack: (domain: string, opts?: StackOptions) => Promise<Stack>;
|
|
1625
1658
|
/** Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans. */
|
|
1626
1659
|
domain: (domain: string, opts?: DomainOptions) => Promise<Domain>;
|
|
1627
1660
|
asn: (asn: string, opts?: AsnOptions) => Promise<Asn>;
|
|
@@ -1675,4 +1708,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1675
1708
|
};
|
|
1676
1709
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1677
1710
|
|
|
1678
|
-
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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -493,6 +493,33 @@ interface MxRecord {
|
|
|
493
493
|
priority: number;
|
|
494
494
|
host: string;
|
|
495
495
|
}
|
|
496
|
+
interface StackTechnology {
|
|
497
|
+
technology: string;
|
|
498
|
+
name: string;
|
|
499
|
+
version: string | null;
|
|
500
|
+
}
|
|
501
|
+
interface Stack {
|
|
502
|
+
domain: string;
|
|
503
|
+
url: string;
|
|
504
|
+
/** Time of the check, or null when no HTML page could be checked. */
|
|
505
|
+
checked_at: string | null;
|
|
506
|
+
scope: 'homepage' | 'site';
|
|
507
|
+
/** Number of successfully checked HTML pages. */
|
|
508
|
+
pages: number;
|
|
509
|
+
/** True for homepage-only or incomplete bounded checks; null when no HTML page could be checked. False never guarantees every page was visited. */
|
|
510
|
+
partial: boolean | null;
|
|
511
|
+
/** Collections are null when no HTML page could be checked and empty when no matches were found. */
|
|
512
|
+
cms: StackTechnology[] | null;
|
|
513
|
+
servers: StackTechnology[] | null;
|
|
514
|
+
frameworks: StackTechnology[] | null;
|
|
515
|
+
ecommerce: StackTechnology[] | null;
|
|
516
|
+
analytics: StackTechnology[] | null;
|
|
517
|
+
chat: StackTechnology[] | null;
|
|
518
|
+
payments: StackTechnology[] | null;
|
|
519
|
+
hosting: StackTechnology[] | null;
|
|
520
|
+
/** Empty only when the generic deep compatibility flag was requested. */
|
|
521
|
+
deep?: Record<string, never>;
|
|
522
|
+
}
|
|
496
523
|
interface DomainRegistration {
|
|
497
524
|
registered: boolean;
|
|
498
525
|
created: string | null;
|
|
@@ -1377,7 +1404,7 @@ interface RequestOptions {
|
|
|
1377
1404
|
interface ParseAPIOptions {
|
|
1378
1405
|
/** Override https://api.parseapi.com (tests, canaries). Also read from PARSEAPI_BASE_URL. */
|
|
1379
1406
|
baseUrl?: string;
|
|
1380
|
-
/** Per-attempt timeout in milliseconds.
|
|
1407
|
+
/** Per-attempt timeout in milliseconds. Defaults to 35000 for Stack and 10000 otherwise. An explicit value applies to every operation. */
|
|
1381
1408
|
timeoutMs?: number;
|
|
1382
1409
|
/** Retries after the first attempt on network errors / 429 / 5xx. Default 2 for ordinary calls, 0 for paid checks. An explicit count overrides both. */
|
|
1383
1410
|
retries?: number;
|
|
@@ -1478,6 +1505,10 @@ type CallerOptions = {
|
|
|
1478
1505
|
type HlrOptions = {
|
|
1479
1506
|
country?: string;
|
|
1480
1507
|
} & DeepOption & RequestOptions;
|
|
1508
|
+
/** Public website hostname only. Optional formatting and request controls. */
|
|
1509
|
+
type StackOptions = {
|
|
1510
|
+
pretty?: boolean;
|
|
1511
|
+
} & DeepOption & RequestOptions;
|
|
1481
1512
|
type DomainOptions = DeepOption & RequestOptions;
|
|
1482
1513
|
type AsnOptions = LanguageOption & RequestOptions;
|
|
1483
1514
|
type MacOptions = RequestOptions;
|
|
@@ -1622,6 +1653,8 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1622
1653
|
caller: (number: string, opts?: CallerOptions) => Promise<Caller>;
|
|
1623
1654
|
/** Look up phone status at the last check. Live means assigned and connected means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep adds network diagnostics within the same metered lookup. No automatic retries by default. */
|
|
1624
1655
|
hlr: (number: string, opts?: HlrOptions) => Promise<Hlr>;
|
|
1656
|
+
/** Identify website technologies by category, with homepage or bounded site coverage metadata. */
|
|
1657
|
+
stack: (domain: string, opts?: StackOptions) => Promise<Stack>;
|
|
1625
1658
|
/** Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans. */
|
|
1626
1659
|
domain: (domain: string, opts?: DomainOptions) => Promise<Domain>;
|
|
1627
1660
|
asn: (asn: string, opts?: AsnOptions) => Promise<Asn>;
|
|
@@ -1675,4 +1708,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1675
1708
|
};
|
|
1676
1709
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1677
1710
|
|
|
1678
|
-
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 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var VERSION = "1.
|
|
2
|
+
var VERSION = "1.3.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;
|
|
@@ -77,7 +77,8 @@ function parseAPI(apiKey, options = {}) {
|
|
|
77
77
|
throw new Error("parseAPI: missing API key. Pass one or set PARSEAPI_KEY.");
|
|
78
78
|
}
|
|
79
79
|
const baseUrl = (options.baseUrl ?? env("PARSEAPI_BASE_URL") ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
80
|
-
const
|
|
80
|
+
const configuredTimeoutMs = options.timeoutMs;
|
|
81
|
+
const timeoutMs = configuredTimeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
81
82
|
const configuredRetries = options.retries;
|
|
82
83
|
validateTimeout(timeoutMs);
|
|
83
84
|
validateRetries(configuredRetries);
|
|
@@ -85,7 +86,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
85
86
|
async function request(path, query, headers, controls = {}, json) {
|
|
86
87
|
const signal = controls.signal;
|
|
87
88
|
signal?.throwIfAborted();
|
|
88
|
-
const attemptTimeout = controls.timeoutMs ?? timeoutMs;
|
|
89
|
+
const attemptTimeout = controls.timeoutMs ?? configuredTimeoutMs ?? (path.startsWith("/stack/") ? 35e3 : timeoutMs);
|
|
89
90
|
const retries = controls.retries ?? configuredRetries ?? (metered(path, query) ? 0 : DEFAULT_RETRIES);
|
|
90
91
|
validateTimeout(attemptTimeout);
|
|
91
92
|
validateRetries(retries);
|
|
@@ -252,6 +253,8 @@ function parseAPI(apiKey, options = {}) {
|
|
|
252
253
|
caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }, void 0, opts),
|
|
253
254
|
/** Look up phone status at the last check. Live means assigned and connected means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep adds network diagnostics within the same metered lookup. No automatic retries by default. */
|
|
254
255
|
hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
256
|
+
/** Identify website technologies by category, with homepage or bounded site coverage metadata. */
|
|
257
|
+
stack: (domain, opts) => request(`/stack/${enc(domain)}`, { ...deepQuery(opts), pretty: opts?.pretty }, void 0, opts),
|
|
255
258
|
/** Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans. */
|
|
256
259
|
domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts), void 0, opts),
|
|
257
260
|
asn: (asn, opts) => request(`/asn/${enc(asn)}`, void 0, void 0, opts),
|