@parseapi/sdk 0.4.0 → 1.0.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 +24 -4
- package/dist/index.cjs +5 -3
- package/dist/index.d.cts +69 -41
- package/dist/index.d.ts +69 -41
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,11 +17,13 @@ Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEA
|
|
|
17
17
|
|
|
18
18
|
## API versions
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Version 1.0.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
|
|
|
24
|
-
|
|
24
|
+
Previously published SDKs keep their existing behavior and use the team's default. Requests without `Parse-Version` also use that default, managed in [Dashboard API version](https://parseapi.com/dashboard/versions). Keep it unchanged while older applications depend on it. Rolling back to an SDK without a version header restores the team default, so rollback only restores the old contract when that default has stayed unchanged.
|
|
25
|
+
|
|
26
|
+
The package owns its supported API version. For direct HTTP integrations, an explicit `Parse-Version` header selects a supported contract. See [API versions and migration](https://parseapi.com/docs/versioning).
|
|
25
27
|
|
|
26
28
|
## Weather from a postal code
|
|
27
29
|
|
|
@@ -43,6 +45,23 @@ Pass `country` when a postal code or national phone number needs disambiguation.
|
|
|
43
45
|
|
|
44
46
|
Results are plain data. Pass a returned code or coordinate to another operation when the task needs it. Check nullable values before composing the next call.
|
|
45
47
|
|
|
48
|
+
Name paid deep includes flat `short`, `directory`, and `initials` fields beside `gender` and `salutation`. `name_locale` selects CLDR formatting rules and defaults to `en`. It changes formatting only. Country remains gender context, and unavailable formatting is null. Older responses may omit these fields.
|
|
49
|
+
|
|
50
|
+
## Display language
|
|
51
|
+
|
|
52
|
+
This source candidate accepts an optional per-request `lang` on supported
|
|
53
|
+
operations. It requires the matching API localization release and data.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const country = await parse.country('DE', { lang: 'fr' });
|
|
57
|
+
// country: 'DE', name: 'Allemagne', name_local: 'Deutschland'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Only supported display fields change. Missing translations keep their source
|
|
61
|
+
names. IDs, native-name fields, numeric facts, Date input `format`, and Measure
|
|
62
|
+
input `locale` retain their meaning. Omitting `lang` preserves the existing
|
|
63
|
+
behavior and does not inherit a previous request's choice.
|
|
64
|
+
|
|
46
65
|
## Calls
|
|
47
66
|
|
|
48
67
|
One method per endpoint, named after the route.
|
|
@@ -87,6 +106,7 @@ await parse.currency.rate('USD', 'EUR');
|
|
|
87
106
|
await parse.language('en');
|
|
88
107
|
await parse.name('BILLY OSHALL');
|
|
89
108
|
await parse.name('Andrea', { country: 'IT', deep: true });
|
|
109
|
+
await parse.name('Robert James Smith', { deep: true, name_locale: 'en' });
|
|
90
110
|
await parse.time(); // UTC now
|
|
91
111
|
await parse.time('America/New_York');
|
|
92
112
|
await parse.time('America/New_York', { at: '2026-09-05T15:00:00', to: 'Asia/Tokyo' });
|
|
@@ -144,7 +164,7 @@ const place = await parse.postal('28202', { country: 'US', deep: true });
|
|
|
144
164
|
const propertyTax = place.deep?.property_tax;
|
|
145
165
|
```
|
|
146
166
|
|
|
147
|
-
Read `population_period` alongside `population`: a reporting year (`YYYY`) or period (`YYYY-YYYY`), null when unknown or unverifiable. Keep missing or null values unknown and preserve a known zero. These fields belong to full place profiles. State district lists include each district's population and period. Postal nearby and distance detail remains metropolitan associations only. Continent population
|
|
167
|
+
Read `population_period` alongside `population`: a reporting year (`YYYY`) or period (`YYYY-YYYY`), null when unknown or unverifiable. Keep missing or null values unknown and preserve a known zero. These fields belong to full place profiles. State district lists include each district's population and period. Postal nearby and distance detail remains metropolitan associations only. Continent population stays in core; Continent has no `population_period` field.
|
|
148
168
|
|
|
149
169
|
Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
|
|
150
170
|
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,8 @@ __export(index_exports, {
|
|
|
24
24
|
parseAPI: () => parseAPI
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var VERSION = "0.
|
|
27
|
+
var VERSION = "1.0.0";
|
|
28
|
+
var API_VERSION = "2.0.0";
|
|
28
29
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
29
30
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
30
31
|
var DEFAULT_RETRIES = 2;
|
|
@@ -114,6 +115,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
114
115
|
validateTimeout(attemptTimeout);
|
|
115
116
|
validateRetries(retries);
|
|
116
117
|
const url = new URL(baseUrl + path);
|
|
118
|
+
if (controls.lang !== void 0) url.searchParams.set("lang", controls.lang);
|
|
117
119
|
for (const [name, value] of Object.entries(query ?? {})) {
|
|
118
120
|
if (value !== void 0) url.searchParams.set(name, String(value));
|
|
119
121
|
}
|
|
@@ -129,7 +131,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
129
131
|
try {
|
|
130
132
|
res = await doFetch(url, {
|
|
131
133
|
redirect: "manual",
|
|
132
|
-
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers },
|
|
134
|
+
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers, "Parse-Version": API_VERSION },
|
|
133
135
|
signal: controller.signal
|
|
134
136
|
});
|
|
135
137
|
} catch (error) {
|
|
@@ -314,7 +316,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
314
316
|
}
|
|
315
317
|
),
|
|
316
318
|
language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
317
|
-
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
319
|
+
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
|
|
318
320
|
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
319
321
|
time: Object.assign(
|
|
320
322
|
(timezone, opts) => request(timezone === void 0 ? "/time" : `/time/${enc(timezone)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
|
package/dist/index.d.cts
CHANGED
|
@@ -250,14 +250,16 @@ interface PostalDistance {
|
|
|
250
250
|
distance_mi: number;
|
|
251
251
|
}
|
|
252
252
|
interface EmailDeep {
|
|
253
|
-
deliverable: boolean;
|
|
254
|
-
catchall: boolean;
|
|
253
|
+
deliverable: boolean | null;
|
|
254
|
+
catchall: boolean | null;
|
|
255
255
|
}
|
|
256
256
|
interface Email {
|
|
257
257
|
email: string;
|
|
258
258
|
didyoumean: string | null;
|
|
259
259
|
valid: boolean;
|
|
260
|
+
free: boolean;
|
|
260
261
|
domain: string | null;
|
|
262
|
+
domain_type: 'academic' | 'government' | 'military' | null;
|
|
261
263
|
domain_valid: boolean | null;
|
|
262
264
|
role: boolean;
|
|
263
265
|
disposable: boolean;
|
|
@@ -519,7 +521,10 @@ interface Bin {
|
|
|
519
521
|
prefix: string | null;
|
|
520
522
|
country: string | null;
|
|
521
523
|
issuer: string | null;
|
|
524
|
+
/** Network key (visa, amex) or co-branded combination. */
|
|
522
525
|
brand: string | null;
|
|
526
|
+
/** Display name for brand (American Express). */
|
|
527
|
+
brand_name: string | null;
|
|
523
528
|
type: string | null;
|
|
524
529
|
prepaid: boolean | null;
|
|
525
530
|
deep?: Record<string, never>;
|
|
@@ -988,6 +993,16 @@ interface CountryDeep {
|
|
|
988
993
|
/** Reporting year or period for population (YYYY or YYYY-YYYY). Null when unknown or unverifiable. */
|
|
989
994
|
population_period?: string | null;
|
|
990
995
|
area: number | null;
|
|
996
|
+
/** Land area in km2. */
|
|
997
|
+
land_area?: number | null;
|
|
998
|
+
/** Water area in km2. */
|
|
999
|
+
water_area?: number | null;
|
|
1000
|
+
/** Coastline length in km. Zero is a known landlocked coastline. */
|
|
1001
|
+
coastline?: number | null;
|
|
1002
|
+
/** Mean elevation in metres above sea level. */
|
|
1003
|
+
elevation?: number | null;
|
|
1004
|
+
lowest_point?: CountryElevationPoint | null;
|
|
1005
|
+
highest_point?: CountryElevationPoint | null;
|
|
991
1006
|
tld: string | null;
|
|
992
1007
|
/** Levy name, such as VAT, GST or sales tax. Null when unknown or not applicable. */
|
|
993
1008
|
tax?: string | null;
|
|
@@ -1013,6 +1028,11 @@ interface CountryDeep {
|
|
|
1013
1028
|
fifa: string | null;
|
|
1014
1029
|
plate: string | null;
|
|
1015
1030
|
}
|
|
1031
|
+
interface CountryElevationPoint {
|
|
1032
|
+
name: string | null;
|
|
1033
|
+
/** Elevation in metres above sea level. Values below sea level are negative. */
|
|
1034
|
+
elevation: number;
|
|
1035
|
+
}
|
|
1016
1036
|
interface StateDeep {
|
|
1017
1037
|
population: number | null;
|
|
1018
1038
|
/** Reporting year or period for population (YYYY or YYYY-YYYY). Null when unknown or unverifiable. */
|
|
@@ -1129,12 +1149,14 @@ interface LanguageDeep {
|
|
|
1129
1149
|
countries: string[];
|
|
1130
1150
|
}
|
|
1131
1151
|
interface NameDeep {
|
|
1132
|
-
/** Name membership is independent of gender. */
|
|
1133
|
-
known: boolean;
|
|
1134
|
-
/** Associated countries, not the person's nationality. */
|
|
1135
|
-
countries: string[];
|
|
1136
1152
|
gender: 'male' | 'female' | null;
|
|
1137
1153
|
salutation: 'Mr' | 'Ms' | null;
|
|
1154
|
+
/** Compact name using CLDR formatting rules. */
|
|
1155
|
+
short?: string | null;
|
|
1156
|
+
/** Name formatted for a directory listing. */
|
|
1157
|
+
directory?: string | null;
|
|
1158
|
+
/** Name initials using CLDR formatting rules. */
|
|
1159
|
+
initials?: string | null;
|
|
1138
1160
|
}
|
|
1139
1161
|
interface TimezoneDeep {
|
|
1140
1162
|
name: string | null;
|
|
@@ -1233,6 +1255,10 @@ declare class ParseAPIError extends Error {
|
|
|
1233
1255
|
readonly requestId: string | null;
|
|
1234
1256
|
constructor(status: number, code: string, message: string, docs: string | null, requestId: string | null);
|
|
1235
1257
|
}
|
|
1258
|
+
/** Optional output language for supported display fields. Input parsing stays unchanged. */
|
|
1259
|
+
interface LanguageOption {
|
|
1260
|
+
lang?: string;
|
|
1261
|
+
}
|
|
1236
1262
|
interface RequestOptions {
|
|
1237
1263
|
/** Cancel this call, including any retry wait. */
|
|
1238
1264
|
signal?: AbortSignal;
|
|
@@ -1252,36 +1278,36 @@ interface ParseAPIOptions {
|
|
|
1252
1278
|
fetch?: typeof fetch;
|
|
1253
1279
|
}
|
|
1254
1280
|
/** IP enrichment is included with a paid plan. `deep` does not use a separate check meter. */
|
|
1255
|
-
type IpOptions = DeepOption & RequestOptions;
|
|
1256
|
-
type IpSelfOptions = DeepOption & RequestOptions;
|
|
1257
|
-
type ContinentOptions = RequestOptions;
|
|
1258
|
-
type ContinentCountriesOptions = RequestOptions;
|
|
1281
|
+
type IpOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1282
|
+
type IpSelfOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1283
|
+
type ContinentOptions = LanguageOption & RequestOptions;
|
|
1284
|
+
type ContinentCountriesOptions = LanguageOption & RequestOptions;
|
|
1259
1285
|
type BlocOptions = RequestOptions;
|
|
1260
|
-
type BlocCountriesOptions = RequestOptions;
|
|
1261
|
-
type CountryOptions = DeepOption & RequestOptions;
|
|
1262
|
-
type CountryStatesOptions = RequestOptions;
|
|
1263
|
-
type StateOptions = {
|
|
1286
|
+
type BlocCountriesOptions = LanguageOption & RequestOptions;
|
|
1287
|
+
type CountryOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1288
|
+
type CountryStatesOptions = LanguageOption & RequestOptions;
|
|
1289
|
+
type StateOptions = LanguageOption & {
|
|
1264
1290
|
country?: string;
|
|
1265
1291
|
} & DeepOption & RequestOptions;
|
|
1266
|
-
type StateDistrictsOptions = {
|
|
1292
|
+
type StateDistrictsOptions = LanguageOption & {
|
|
1267
1293
|
country?: string;
|
|
1268
1294
|
} & DeepOption & RequestOptions;
|
|
1269
|
-
type DistrictOptions = {
|
|
1295
|
+
type DistrictOptions = LanguageOption & {
|
|
1270
1296
|
country?: string;
|
|
1271
1297
|
state?: string;
|
|
1272
1298
|
} & DeepOption & RequestOptions;
|
|
1273
|
-
type CityOptions = {
|
|
1299
|
+
type CityOptions = LanguageOption & {
|
|
1274
1300
|
country?: string;
|
|
1275
1301
|
state?: string;
|
|
1276
1302
|
} & DeepOption & RequestOptions;
|
|
1277
|
-
type CityIdOptions = DeepOption & RequestOptions;
|
|
1278
|
-
type CitySearchOptions = {
|
|
1303
|
+
type CityIdOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1304
|
+
type CitySearchOptions = LanguageOption & {
|
|
1279
1305
|
country?: string;
|
|
1280
1306
|
state?: string;
|
|
1281
1307
|
limit?: number;
|
|
1282
1308
|
} & DeepOption & RequestOptions;
|
|
1283
|
-
type CityNearestOptions = DeepOption & RequestOptions;
|
|
1284
|
-
type CityNearbyOptions = {
|
|
1309
|
+
type CityNearestOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1310
|
+
type CityNearbyOptions = LanguageOption & {
|
|
1285
1311
|
radius?: number;
|
|
1286
1312
|
unit?: 'km' | 'mi';
|
|
1287
1313
|
country?: string;
|
|
@@ -1289,15 +1315,15 @@ type CityNearbyOptions = {
|
|
|
1289
1315
|
limit?: number;
|
|
1290
1316
|
} & DeepOption & RequestOptions;
|
|
1291
1317
|
/** Pass country when known. Codes shared by multiple countries need it. */
|
|
1292
|
-
type PostalOptions = {
|
|
1318
|
+
type PostalOptions = LanguageOption & {
|
|
1293
1319
|
country?: string;
|
|
1294
1320
|
} & DeepOption & RequestOptions;
|
|
1295
|
-
type PostalNearbyOptions = {
|
|
1321
|
+
type PostalNearbyOptions = LanguageOption & {
|
|
1296
1322
|
country?: string;
|
|
1297
1323
|
radius?: number;
|
|
1298
1324
|
unit?: 'km' | 'mi';
|
|
1299
1325
|
} & DeepOption & RequestOptions;
|
|
1300
|
-
type PostalDistanceOptions = {
|
|
1326
|
+
type PostalDistanceOptions = LanguageOption & {
|
|
1301
1327
|
country?: string;
|
|
1302
1328
|
} & DeepOption & RequestOptions;
|
|
1303
1329
|
type AddressOptions = {
|
|
@@ -1316,7 +1342,7 @@ type AddressSearchOptions = {
|
|
|
1316
1342
|
/** Actual end-user IP as an optional locality hint for server-side calls. */
|
|
1317
1343
|
ip?: string;
|
|
1318
1344
|
} & RequestOptions;
|
|
1319
|
-
type CompanyOptions = {
|
|
1345
|
+
type CompanyOptions = LanguageOption & {
|
|
1320
1346
|
country?: string;
|
|
1321
1347
|
} & DeepOption & RequestOptions;
|
|
1322
1348
|
/** `deep: true` requests a metered deliverability check. No automatic retries by default. */
|
|
@@ -1329,7 +1355,7 @@ type VatOptions = {
|
|
|
1329
1355
|
type IbanOptions = {
|
|
1330
1356
|
country?: string;
|
|
1331
1357
|
} & DeepOption & RequestOptions;
|
|
1332
|
-
type NpiOptions = DeepOption & RequestOptions;
|
|
1358
|
+
type NpiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1333
1359
|
/** Country resolves national-number ambiguity. Deep adds numbering-plan geography on every plan. */
|
|
1334
1360
|
type PhoneOptions = {
|
|
1335
1361
|
country?: string;
|
|
@@ -1346,7 +1372,7 @@ type HlrOptions = {
|
|
|
1346
1372
|
country?: string;
|
|
1347
1373
|
} & DeepOption & RequestOptions;
|
|
1348
1374
|
type DomainOptions = DeepOption & RequestOptions;
|
|
1349
|
-
type AsnOptions = RequestOptions;
|
|
1375
|
+
type AsnOptions = LanguageOption & RequestOptions;
|
|
1350
1376
|
type MacOptions = RequestOptions;
|
|
1351
1377
|
/** Card-prefix reference lookup. Deep returns an empty object on every plan. */
|
|
1352
1378
|
type BinOptions = DeepOption & RequestOptions;
|
|
@@ -1356,7 +1382,7 @@ type MeasureOptions = {
|
|
|
1356
1382
|
locale?: string;
|
|
1357
1383
|
system?: 'us' | 'imperial';
|
|
1358
1384
|
} & RequestOptions;
|
|
1359
|
-
type MeasureUnitsOptions = {
|
|
1385
|
+
type MeasureUnitsOptions = LanguageOption & {
|
|
1360
1386
|
query?: string;
|
|
1361
1387
|
type?: string;
|
|
1362
1388
|
unit?: string;
|
|
@@ -1380,36 +1406,38 @@ type TariffOptions = {
|
|
|
1380
1406
|
origin?: string;
|
|
1381
1407
|
} & DeepOption & RequestOptions;
|
|
1382
1408
|
type TariffSearchOptions = RequestOptions;
|
|
1383
|
-
type CurrencyOptions = DeepOption & RequestOptions;
|
|
1409
|
+
type CurrencyOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1384
1410
|
type CurrencyRateOptions = {
|
|
1385
1411
|
date?: string;
|
|
1386
1412
|
amount?: number;
|
|
1387
1413
|
} & RequestOptions;
|
|
1388
|
-
type LanguageOptions = DeepOption & RequestOptions;
|
|
1389
|
-
/** Country
|
|
1414
|
+
type LanguageOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1415
|
+
/** Country scopes paid deep gender evidence. Name locale selects formatting rules without changing parsing. */
|
|
1390
1416
|
type NameOptions = {
|
|
1391
1417
|
country?: string;
|
|
1418
|
+
/** CLDR name-formatting locale, such as en or ja. Defaults to en. */
|
|
1419
|
+
name_locale?: string;
|
|
1392
1420
|
} & DeepOption & RequestOptions;
|
|
1393
|
-
type TimeOptions = {
|
|
1421
|
+
type TimeOptions = LanguageOption & {
|
|
1394
1422
|
at?: string;
|
|
1395
1423
|
to?: string;
|
|
1396
1424
|
} & DeepOption & RequestOptions;
|
|
1397
|
-
type TimeAtOptions = {
|
|
1425
|
+
type TimeAtOptions = LanguageOption & {
|
|
1398
1426
|
at?: string;
|
|
1399
1427
|
to?: string;
|
|
1400
1428
|
} & DeepOption & RequestOptions;
|
|
1401
|
-
type TimezoneOptions = {
|
|
1429
|
+
type TimezoneOptions = LanguageOption & {
|
|
1402
1430
|
at?: string;
|
|
1403
1431
|
to?: string;
|
|
1404
1432
|
} & DeepOption & RequestOptions;
|
|
1405
|
-
type TimezoneAtOptions = {
|
|
1433
|
+
type TimezoneAtOptions = LanguageOption & {
|
|
1406
1434
|
at?: string;
|
|
1407
1435
|
} & DeepOption & RequestOptions;
|
|
1408
|
-
type DateOptions = {
|
|
1436
|
+
type DateOptions = LanguageOption & {
|
|
1409
1437
|
format?: 'mdy' | 'dmy';
|
|
1410
1438
|
to?: string;
|
|
1411
1439
|
} & DeepOption & RequestOptions;
|
|
1412
|
-
type DateTodayOptions = {
|
|
1440
|
+
type DateTodayOptions = LanguageOption & {
|
|
1413
1441
|
to?: string;
|
|
1414
1442
|
} & DeepOption & RequestOptions;
|
|
1415
1443
|
type HolidayOptions = {
|
|
@@ -1418,14 +1446,14 @@ type HolidayOptions = {
|
|
|
1418
1446
|
type HolidayDateOptions = RequestOptions;
|
|
1419
1447
|
type ElevationOptions = RequestOptions;
|
|
1420
1448
|
/** 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. */
|
|
1421
|
-
type PointOptions = DeepOption & RequestOptions;
|
|
1449
|
+
type PointOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1422
1450
|
/** 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. */
|
|
1423
1451
|
type WeatherOptions = DeepOption & {
|
|
1424
1452
|
/** Past UTC day, YYYY-MM-DD. Requires paid deep and populates deep.history alongside current. */
|
|
1425
1453
|
date?: string;
|
|
1426
1454
|
} & RequestOptions;
|
|
1427
|
-
type EmojiOptions = DeepOption & RequestOptions;
|
|
1428
|
-
type EmojiSearchOptions = {
|
|
1455
|
+
type EmojiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1456
|
+
type EmojiSearchOptions = LanguageOption & {
|
|
1429
1457
|
limit?: number;
|
|
1430
1458
|
} & DeepOption & RequestOptions;
|
|
1431
1459
|
interface DeepOption {
|
|
@@ -1538,4 +1566,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1538
1566
|
};
|
|
1539
1567
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1540
1568
|
|
|
1541
|
-
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 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 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 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 };
|
|
1569
|
+
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 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -250,14 +250,16 @@ interface PostalDistance {
|
|
|
250
250
|
distance_mi: number;
|
|
251
251
|
}
|
|
252
252
|
interface EmailDeep {
|
|
253
|
-
deliverable: boolean;
|
|
254
|
-
catchall: boolean;
|
|
253
|
+
deliverable: boolean | null;
|
|
254
|
+
catchall: boolean | null;
|
|
255
255
|
}
|
|
256
256
|
interface Email {
|
|
257
257
|
email: string;
|
|
258
258
|
didyoumean: string | null;
|
|
259
259
|
valid: boolean;
|
|
260
|
+
free: boolean;
|
|
260
261
|
domain: string | null;
|
|
262
|
+
domain_type: 'academic' | 'government' | 'military' | null;
|
|
261
263
|
domain_valid: boolean | null;
|
|
262
264
|
role: boolean;
|
|
263
265
|
disposable: boolean;
|
|
@@ -519,7 +521,10 @@ interface Bin {
|
|
|
519
521
|
prefix: string | null;
|
|
520
522
|
country: string | null;
|
|
521
523
|
issuer: string | null;
|
|
524
|
+
/** Network key (visa, amex) or co-branded combination. */
|
|
522
525
|
brand: string | null;
|
|
526
|
+
/** Display name for brand (American Express). */
|
|
527
|
+
brand_name: string | null;
|
|
523
528
|
type: string | null;
|
|
524
529
|
prepaid: boolean | null;
|
|
525
530
|
deep?: Record<string, never>;
|
|
@@ -988,6 +993,16 @@ interface CountryDeep {
|
|
|
988
993
|
/** Reporting year or period for population (YYYY or YYYY-YYYY). Null when unknown or unverifiable. */
|
|
989
994
|
population_period?: string | null;
|
|
990
995
|
area: number | null;
|
|
996
|
+
/** Land area in km2. */
|
|
997
|
+
land_area?: number | null;
|
|
998
|
+
/** Water area in km2. */
|
|
999
|
+
water_area?: number | null;
|
|
1000
|
+
/** Coastline length in km. Zero is a known landlocked coastline. */
|
|
1001
|
+
coastline?: number | null;
|
|
1002
|
+
/** Mean elevation in metres above sea level. */
|
|
1003
|
+
elevation?: number | null;
|
|
1004
|
+
lowest_point?: CountryElevationPoint | null;
|
|
1005
|
+
highest_point?: CountryElevationPoint | null;
|
|
991
1006
|
tld: string | null;
|
|
992
1007
|
/** Levy name, such as VAT, GST or sales tax. Null when unknown or not applicable. */
|
|
993
1008
|
tax?: string | null;
|
|
@@ -1013,6 +1028,11 @@ interface CountryDeep {
|
|
|
1013
1028
|
fifa: string | null;
|
|
1014
1029
|
plate: string | null;
|
|
1015
1030
|
}
|
|
1031
|
+
interface CountryElevationPoint {
|
|
1032
|
+
name: string | null;
|
|
1033
|
+
/** Elevation in metres above sea level. Values below sea level are negative. */
|
|
1034
|
+
elevation: number;
|
|
1035
|
+
}
|
|
1016
1036
|
interface StateDeep {
|
|
1017
1037
|
population: number | null;
|
|
1018
1038
|
/** Reporting year or period for population (YYYY or YYYY-YYYY). Null when unknown or unverifiable. */
|
|
@@ -1129,12 +1149,14 @@ interface LanguageDeep {
|
|
|
1129
1149
|
countries: string[];
|
|
1130
1150
|
}
|
|
1131
1151
|
interface NameDeep {
|
|
1132
|
-
/** Name membership is independent of gender. */
|
|
1133
|
-
known: boolean;
|
|
1134
|
-
/** Associated countries, not the person's nationality. */
|
|
1135
|
-
countries: string[];
|
|
1136
1152
|
gender: 'male' | 'female' | null;
|
|
1137
1153
|
salutation: 'Mr' | 'Ms' | null;
|
|
1154
|
+
/** Compact name using CLDR formatting rules. */
|
|
1155
|
+
short?: string | null;
|
|
1156
|
+
/** Name formatted for a directory listing. */
|
|
1157
|
+
directory?: string | null;
|
|
1158
|
+
/** Name initials using CLDR formatting rules. */
|
|
1159
|
+
initials?: string | null;
|
|
1138
1160
|
}
|
|
1139
1161
|
interface TimezoneDeep {
|
|
1140
1162
|
name: string | null;
|
|
@@ -1233,6 +1255,10 @@ declare class ParseAPIError extends Error {
|
|
|
1233
1255
|
readonly requestId: string | null;
|
|
1234
1256
|
constructor(status: number, code: string, message: string, docs: string | null, requestId: string | null);
|
|
1235
1257
|
}
|
|
1258
|
+
/** Optional output language for supported display fields. Input parsing stays unchanged. */
|
|
1259
|
+
interface LanguageOption {
|
|
1260
|
+
lang?: string;
|
|
1261
|
+
}
|
|
1236
1262
|
interface RequestOptions {
|
|
1237
1263
|
/** Cancel this call, including any retry wait. */
|
|
1238
1264
|
signal?: AbortSignal;
|
|
@@ -1252,36 +1278,36 @@ interface ParseAPIOptions {
|
|
|
1252
1278
|
fetch?: typeof fetch;
|
|
1253
1279
|
}
|
|
1254
1280
|
/** IP enrichment is included with a paid plan. `deep` does not use a separate check meter. */
|
|
1255
|
-
type IpOptions = DeepOption & RequestOptions;
|
|
1256
|
-
type IpSelfOptions = DeepOption & RequestOptions;
|
|
1257
|
-
type ContinentOptions = RequestOptions;
|
|
1258
|
-
type ContinentCountriesOptions = RequestOptions;
|
|
1281
|
+
type IpOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1282
|
+
type IpSelfOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1283
|
+
type ContinentOptions = LanguageOption & RequestOptions;
|
|
1284
|
+
type ContinentCountriesOptions = LanguageOption & RequestOptions;
|
|
1259
1285
|
type BlocOptions = RequestOptions;
|
|
1260
|
-
type BlocCountriesOptions = RequestOptions;
|
|
1261
|
-
type CountryOptions = DeepOption & RequestOptions;
|
|
1262
|
-
type CountryStatesOptions = RequestOptions;
|
|
1263
|
-
type StateOptions = {
|
|
1286
|
+
type BlocCountriesOptions = LanguageOption & RequestOptions;
|
|
1287
|
+
type CountryOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1288
|
+
type CountryStatesOptions = LanguageOption & RequestOptions;
|
|
1289
|
+
type StateOptions = LanguageOption & {
|
|
1264
1290
|
country?: string;
|
|
1265
1291
|
} & DeepOption & RequestOptions;
|
|
1266
|
-
type StateDistrictsOptions = {
|
|
1292
|
+
type StateDistrictsOptions = LanguageOption & {
|
|
1267
1293
|
country?: string;
|
|
1268
1294
|
} & DeepOption & RequestOptions;
|
|
1269
|
-
type DistrictOptions = {
|
|
1295
|
+
type DistrictOptions = LanguageOption & {
|
|
1270
1296
|
country?: string;
|
|
1271
1297
|
state?: string;
|
|
1272
1298
|
} & DeepOption & RequestOptions;
|
|
1273
|
-
type CityOptions = {
|
|
1299
|
+
type CityOptions = LanguageOption & {
|
|
1274
1300
|
country?: string;
|
|
1275
1301
|
state?: string;
|
|
1276
1302
|
} & DeepOption & RequestOptions;
|
|
1277
|
-
type CityIdOptions = DeepOption & RequestOptions;
|
|
1278
|
-
type CitySearchOptions = {
|
|
1303
|
+
type CityIdOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1304
|
+
type CitySearchOptions = LanguageOption & {
|
|
1279
1305
|
country?: string;
|
|
1280
1306
|
state?: string;
|
|
1281
1307
|
limit?: number;
|
|
1282
1308
|
} & DeepOption & RequestOptions;
|
|
1283
|
-
type CityNearestOptions = DeepOption & RequestOptions;
|
|
1284
|
-
type CityNearbyOptions = {
|
|
1309
|
+
type CityNearestOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1310
|
+
type CityNearbyOptions = LanguageOption & {
|
|
1285
1311
|
radius?: number;
|
|
1286
1312
|
unit?: 'km' | 'mi';
|
|
1287
1313
|
country?: string;
|
|
@@ -1289,15 +1315,15 @@ type CityNearbyOptions = {
|
|
|
1289
1315
|
limit?: number;
|
|
1290
1316
|
} & DeepOption & RequestOptions;
|
|
1291
1317
|
/** Pass country when known. Codes shared by multiple countries need it. */
|
|
1292
|
-
type PostalOptions = {
|
|
1318
|
+
type PostalOptions = LanguageOption & {
|
|
1293
1319
|
country?: string;
|
|
1294
1320
|
} & DeepOption & RequestOptions;
|
|
1295
|
-
type PostalNearbyOptions = {
|
|
1321
|
+
type PostalNearbyOptions = LanguageOption & {
|
|
1296
1322
|
country?: string;
|
|
1297
1323
|
radius?: number;
|
|
1298
1324
|
unit?: 'km' | 'mi';
|
|
1299
1325
|
} & DeepOption & RequestOptions;
|
|
1300
|
-
type PostalDistanceOptions = {
|
|
1326
|
+
type PostalDistanceOptions = LanguageOption & {
|
|
1301
1327
|
country?: string;
|
|
1302
1328
|
} & DeepOption & RequestOptions;
|
|
1303
1329
|
type AddressOptions = {
|
|
@@ -1316,7 +1342,7 @@ type AddressSearchOptions = {
|
|
|
1316
1342
|
/** Actual end-user IP as an optional locality hint for server-side calls. */
|
|
1317
1343
|
ip?: string;
|
|
1318
1344
|
} & RequestOptions;
|
|
1319
|
-
type CompanyOptions = {
|
|
1345
|
+
type CompanyOptions = LanguageOption & {
|
|
1320
1346
|
country?: string;
|
|
1321
1347
|
} & DeepOption & RequestOptions;
|
|
1322
1348
|
/** `deep: true` requests a metered deliverability check. No automatic retries by default. */
|
|
@@ -1329,7 +1355,7 @@ type VatOptions = {
|
|
|
1329
1355
|
type IbanOptions = {
|
|
1330
1356
|
country?: string;
|
|
1331
1357
|
} & DeepOption & RequestOptions;
|
|
1332
|
-
type NpiOptions = DeepOption & RequestOptions;
|
|
1358
|
+
type NpiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1333
1359
|
/** Country resolves national-number ambiguity. Deep adds numbering-plan geography on every plan. */
|
|
1334
1360
|
type PhoneOptions = {
|
|
1335
1361
|
country?: string;
|
|
@@ -1346,7 +1372,7 @@ type HlrOptions = {
|
|
|
1346
1372
|
country?: string;
|
|
1347
1373
|
} & DeepOption & RequestOptions;
|
|
1348
1374
|
type DomainOptions = DeepOption & RequestOptions;
|
|
1349
|
-
type AsnOptions = RequestOptions;
|
|
1375
|
+
type AsnOptions = LanguageOption & RequestOptions;
|
|
1350
1376
|
type MacOptions = RequestOptions;
|
|
1351
1377
|
/** Card-prefix reference lookup. Deep returns an empty object on every plan. */
|
|
1352
1378
|
type BinOptions = DeepOption & RequestOptions;
|
|
@@ -1356,7 +1382,7 @@ type MeasureOptions = {
|
|
|
1356
1382
|
locale?: string;
|
|
1357
1383
|
system?: 'us' | 'imperial';
|
|
1358
1384
|
} & RequestOptions;
|
|
1359
|
-
type MeasureUnitsOptions = {
|
|
1385
|
+
type MeasureUnitsOptions = LanguageOption & {
|
|
1360
1386
|
query?: string;
|
|
1361
1387
|
type?: string;
|
|
1362
1388
|
unit?: string;
|
|
@@ -1380,36 +1406,38 @@ type TariffOptions = {
|
|
|
1380
1406
|
origin?: string;
|
|
1381
1407
|
} & DeepOption & RequestOptions;
|
|
1382
1408
|
type TariffSearchOptions = RequestOptions;
|
|
1383
|
-
type CurrencyOptions = DeepOption & RequestOptions;
|
|
1409
|
+
type CurrencyOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1384
1410
|
type CurrencyRateOptions = {
|
|
1385
1411
|
date?: string;
|
|
1386
1412
|
amount?: number;
|
|
1387
1413
|
} & RequestOptions;
|
|
1388
|
-
type LanguageOptions = DeepOption & RequestOptions;
|
|
1389
|
-
/** Country
|
|
1414
|
+
type LanguageOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1415
|
+
/** Country scopes paid deep gender evidence. Name locale selects formatting rules without changing parsing. */
|
|
1390
1416
|
type NameOptions = {
|
|
1391
1417
|
country?: string;
|
|
1418
|
+
/** CLDR name-formatting locale, such as en or ja. Defaults to en. */
|
|
1419
|
+
name_locale?: string;
|
|
1392
1420
|
} & DeepOption & RequestOptions;
|
|
1393
|
-
type TimeOptions = {
|
|
1421
|
+
type TimeOptions = LanguageOption & {
|
|
1394
1422
|
at?: string;
|
|
1395
1423
|
to?: string;
|
|
1396
1424
|
} & DeepOption & RequestOptions;
|
|
1397
|
-
type TimeAtOptions = {
|
|
1425
|
+
type TimeAtOptions = LanguageOption & {
|
|
1398
1426
|
at?: string;
|
|
1399
1427
|
to?: string;
|
|
1400
1428
|
} & DeepOption & RequestOptions;
|
|
1401
|
-
type TimezoneOptions = {
|
|
1429
|
+
type TimezoneOptions = LanguageOption & {
|
|
1402
1430
|
at?: string;
|
|
1403
1431
|
to?: string;
|
|
1404
1432
|
} & DeepOption & RequestOptions;
|
|
1405
|
-
type TimezoneAtOptions = {
|
|
1433
|
+
type TimezoneAtOptions = LanguageOption & {
|
|
1406
1434
|
at?: string;
|
|
1407
1435
|
} & DeepOption & RequestOptions;
|
|
1408
|
-
type DateOptions = {
|
|
1436
|
+
type DateOptions = LanguageOption & {
|
|
1409
1437
|
format?: 'mdy' | 'dmy';
|
|
1410
1438
|
to?: string;
|
|
1411
1439
|
} & DeepOption & RequestOptions;
|
|
1412
|
-
type DateTodayOptions = {
|
|
1440
|
+
type DateTodayOptions = LanguageOption & {
|
|
1413
1441
|
to?: string;
|
|
1414
1442
|
} & DeepOption & RequestOptions;
|
|
1415
1443
|
type HolidayOptions = {
|
|
@@ -1418,14 +1446,14 @@ type HolidayOptions = {
|
|
|
1418
1446
|
type HolidayDateOptions = RequestOptions;
|
|
1419
1447
|
type ElevationOptions = RequestOptions;
|
|
1420
1448
|
/** 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. */
|
|
1421
|
-
type PointOptions = DeepOption & RequestOptions;
|
|
1449
|
+
type PointOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1422
1450
|
/** 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. */
|
|
1423
1451
|
type WeatherOptions = DeepOption & {
|
|
1424
1452
|
/** Past UTC day, YYYY-MM-DD. Requires paid deep and populates deep.history alongside current. */
|
|
1425
1453
|
date?: string;
|
|
1426
1454
|
} & RequestOptions;
|
|
1427
|
-
type EmojiOptions = DeepOption & RequestOptions;
|
|
1428
|
-
type EmojiSearchOptions = {
|
|
1455
|
+
type EmojiOptions = LanguageOption & DeepOption & RequestOptions;
|
|
1456
|
+
type EmojiSearchOptions = LanguageOption & {
|
|
1429
1457
|
limit?: number;
|
|
1430
1458
|
} & DeepOption & RequestOptions;
|
|
1431
1459
|
interface DeepOption {
|
|
@@ -1538,4 +1566,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
|
|
|
1538
1566
|
};
|
|
1539
1567
|
type ParseAPIClient = ReturnType<typeof parseAPI>;
|
|
1540
1568
|
|
|
1541
|
-
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 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 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 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 };
|
|
1569
|
+
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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var VERSION = "0.
|
|
2
|
+
var VERSION = "1.0.0";
|
|
3
|
+
var API_VERSION = "2.0.0";
|
|
3
4
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
4
5
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
5
6
|
var DEFAULT_RETRIES = 2;
|
|
@@ -89,6 +90,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
89
90
|
validateTimeout(attemptTimeout);
|
|
90
91
|
validateRetries(retries);
|
|
91
92
|
const url = new URL(baseUrl + path);
|
|
93
|
+
if (controls.lang !== void 0) url.searchParams.set("lang", controls.lang);
|
|
92
94
|
for (const [name, value] of Object.entries(query ?? {})) {
|
|
93
95
|
if (value !== void 0) url.searchParams.set(name, String(value));
|
|
94
96
|
}
|
|
@@ -104,7 +106,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
104
106
|
try {
|
|
105
107
|
res = await doFetch(url, {
|
|
106
108
|
redirect: "manual",
|
|
107
|
-
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers },
|
|
109
|
+
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers, "Parse-Version": API_VERSION },
|
|
108
110
|
signal: controller.signal
|
|
109
111
|
});
|
|
110
112
|
} catch (error) {
|
|
@@ -289,7 +291,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
289
291
|
}
|
|
290
292
|
),
|
|
291
293
|
language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
292
|
-
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
294
|
+
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
|
|
293
295
|
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
294
296
|
time: Object.assign(
|
|
295
297
|
(timezone, opts) => request(timezone === void 0 ? "/time" : `/time/${enc(timezone)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
|