@parseapi/sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,7 +41,9 @@ await parse.continent.countries('NA');
41
41
  await parse.currency('USD');
42
42
  await parse.currency.rate('USD', 'EUR');
43
43
  await parse.language('en');
44
+ await parse.name('BILLY OSHALL');
44
45
  await parse.timezone('America/New_York');
46
+ await parse.timezone(40.7128, -74.006);
45
47
  await parse.holiday('US', { year: 2026 });
46
48
  await parse.holiday.date('US', '2026-12-25');
47
49
  await parse.elevation(35.2271, -80.8431);
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 = "0.1.1";
27
+ var VERSION = "0.1.2";
28
28
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
29
29
  var DEFAULT_TIMEOUT_MS = 1e4;
30
30
  var DEFAULT_RETRIES = 2;
@@ -118,6 +118,18 @@ function parseAPI(apiKey, options = {}) {
118
118
  }
119
119
  const enc = encodeURIComponent;
120
120
  const deepQuery = (opts) => opts?.deep ? { deep: true } : {};
121
+ function timezone(idOrLat, lonOrOpts, opts) {
122
+ if (typeof idOrLat === "number") {
123
+ return request("/timezone", {
124
+ lat: idOrLat,
125
+ lon: typeof lonOrOpts === "number" ? lonOrOpts : void 0,
126
+ at: opts?.at
127
+ });
128
+ }
129
+ return request(`/timezone/${enc(idOrLat)}`, {
130
+ at: lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts.at : void 0
131
+ });
132
+ }
121
133
  return {
122
134
  ip: Object.assign(
123
135
  (ip, opts) => request(`/ip/${enc(ip)}`, deepQuery(opts)),
@@ -175,7 +187,8 @@ function parseAPI(apiKey, options = {}) {
175
187
  }
176
188
  ),
177
189
  language: (code) => request(`/language/${enc(code)}`),
178
- timezone: (id, opts) => request(`/timezone/${enc(id)}`, { at: opts?.at }),
190
+ name: (name) => request(`/name/${enc(name)}`),
191
+ timezone,
179
192
  holiday: Object.assign(
180
193
  (country, opts) => request(`/holiday/${enc(country)}`, { year: opts?.year }),
181
194
  {
package/dist/index.d.cts CHANGED
@@ -15,6 +15,7 @@ interface IpDeep {
15
15
  datacenter: boolean;
16
16
  relay: boolean;
17
17
  tor: boolean;
18
+ vpn: boolean;
18
19
  provider: string;
19
20
  }
20
21
  interface Ip {
@@ -38,6 +39,8 @@ interface Continent {
38
39
  interface ContinentCountryItem {
39
40
  country: string;
40
41
  name: string;
42
+ emoji?: string | null;
43
+ calling_code?: string | null;
41
44
  }
42
45
  interface ContinentCountries {
43
46
  continent: string;
@@ -52,6 +55,8 @@ interface Country {
52
55
  local_name: string | null;
53
56
  demonym: string | null;
54
57
  capital: string | null;
58
+ capital_lat: number | null;
59
+ capital_lon: number | null;
55
60
  continent: string;
56
61
  region: string | null;
57
62
  subregion: string | null;
@@ -61,6 +66,7 @@ interface Country {
61
66
  currency_name: string | null;
62
67
  currency_symbol: string | null;
63
68
  tld: string | null;
69
+ calling_code: string | null;
64
70
  emoji: string | null;
65
71
  languages: string[];
66
72
  borders: string[];
@@ -189,6 +195,7 @@ interface EmailDeep {
189
195
  }
190
196
  interface Email {
191
197
  email: string;
198
+ didyoumean: string | null;
192
199
  valid: boolean;
193
200
  domain: string | null;
194
201
  domain_valid: boolean | null;
@@ -197,12 +204,17 @@ interface Email {
197
204
  deep?: Deep<EmailDeep>;
198
205
  }
199
206
  interface PhoneDeep {
200
- type: 'mobile' | 'landline' | 'toll_free' | 'unknown';
201
- region: string;
207
+ type: 'mobile' | 'landline' | 'voip' | 'toll_free' | 'unknown';
208
+ carrier: string | null;
209
+ /** Carrier is a known burner number app. Null when carrier is unknown. */
210
+ burner: boolean | null;
211
+ city: string | null;
212
+ state: string | null;
213
+ state_name: string | null;
202
214
  }
203
215
  interface Phone {
216
+ phone: string | null;
204
217
  valid: boolean;
205
- e164: string | null;
206
218
  country: string | null;
207
219
  national: string | null;
208
220
  international: string | null;
@@ -227,7 +239,7 @@ interface DomainDeep {
227
239
  ns: string[];
228
240
  mx: MxRecord[];
229
241
  txt: string[];
230
- provider: string;
242
+ mailhost: string;
231
243
  registration: DomainRegistration;
232
244
  }
233
245
  interface Domain {
@@ -303,6 +315,18 @@ interface Language {
303
315
  direction: 'ltr' | 'rtl' | string;
304
316
  countries: string[];
305
317
  }
318
+ /** A parsed person name. Junk input returns valid: false, never an error. Gender comes from dictionary data and is null when the data does not decide. */
319
+ interface Name {
320
+ name: string;
321
+ valid: boolean;
322
+ prefix: string | null;
323
+ first: string | null;
324
+ middle: string | null;
325
+ last: string | null;
326
+ suffix: string | null;
327
+ gender: 'male' | 'female' | null;
328
+ salutation: 'Mr' | 'Ms' | null;
329
+ }
306
330
  interface CurrencyRate {
307
331
  base: string;
308
332
  quote: string;
@@ -317,12 +341,14 @@ interface TimezoneNextDst {
317
341
  abbreviation: string;
318
342
  }
319
343
  interface Timezone {
320
- timezone: string;
344
+ latitude?: number;
345
+ longitude?: number;
346
+ timezone: string | null;
321
347
  name: string | null;
322
- abbreviation: string;
323
- offset: string;
324
- offset_minutes: number;
325
- dst: boolean;
348
+ abbreviation: string | null;
349
+ offset: string | null;
350
+ offset_minutes: number | null;
351
+ dst: boolean | null;
326
352
  next_dst: TimezoneNextDst | null;
327
353
  }
328
354
  interface Holiday {
@@ -352,8 +378,8 @@ interface Elevation {
352
378
  resolution: number | null;
353
379
  }
354
380
  interface PointDeep {
355
- city: CityNearest;
356
- timezone: Timezone;
381
+ city: CityNearest | null;
382
+ timezone: Timezone | null;
357
383
  }
358
384
  interface Point {
359
385
  latitude: number;
@@ -531,9 +557,15 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
531
557
  rate: (base: string, quote: string) => Promise<CurrencyRate>;
532
558
  };
533
559
  language: (code: string) => Promise<Language>;
534
- timezone: (id: string, opts?: {
535
- at?: string;
536
- }) => Promise<Timezone>;
560
+ name: (name: string) => Promise<Name>;
561
+ timezone: {
562
+ (id: string, opts?: {
563
+ at?: string;
564
+ }): Promise<Timezone>;
565
+ (lat: number, lon: number, opts?: {
566
+ at?: string;
567
+ }): Promise<Timezone>;
568
+ };
537
569
  holiday: ((country: string, opts?: {
538
570
  year?: number;
539
571
  }) => Promise<HolidayYear>) & {
@@ -550,4 +582,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
550
582
  };
551
583
  type ParseAPIClient = ReturnType<typeof parseAPI>;
552
584
 
553
- export { type City, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Holiday, type HolidayDate, type HolidayYear, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Weather, type WeatherAlert, type WeatherDeep, type WeatherForecastPeriod, parseAPI };
585
+ export { type City, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Holiday, type HolidayDate, type HolidayYear, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type Name, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Weather, type WeatherAlert, type WeatherDeep, type WeatherForecastPeriod, parseAPI };
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ interface IpDeep {
15
15
  datacenter: boolean;
16
16
  relay: boolean;
17
17
  tor: boolean;
18
+ vpn: boolean;
18
19
  provider: string;
19
20
  }
20
21
  interface Ip {
@@ -38,6 +39,8 @@ interface Continent {
38
39
  interface ContinentCountryItem {
39
40
  country: string;
40
41
  name: string;
42
+ emoji?: string | null;
43
+ calling_code?: string | null;
41
44
  }
42
45
  interface ContinentCountries {
43
46
  continent: string;
@@ -52,6 +55,8 @@ interface Country {
52
55
  local_name: string | null;
53
56
  demonym: string | null;
54
57
  capital: string | null;
58
+ capital_lat: number | null;
59
+ capital_lon: number | null;
55
60
  continent: string;
56
61
  region: string | null;
57
62
  subregion: string | null;
@@ -61,6 +66,7 @@ interface Country {
61
66
  currency_name: string | null;
62
67
  currency_symbol: string | null;
63
68
  tld: string | null;
69
+ calling_code: string | null;
64
70
  emoji: string | null;
65
71
  languages: string[];
66
72
  borders: string[];
@@ -189,6 +195,7 @@ interface EmailDeep {
189
195
  }
190
196
  interface Email {
191
197
  email: string;
198
+ didyoumean: string | null;
192
199
  valid: boolean;
193
200
  domain: string | null;
194
201
  domain_valid: boolean | null;
@@ -197,12 +204,17 @@ interface Email {
197
204
  deep?: Deep<EmailDeep>;
198
205
  }
199
206
  interface PhoneDeep {
200
- type: 'mobile' | 'landline' | 'toll_free' | 'unknown';
201
- region: string;
207
+ type: 'mobile' | 'landline' | 'voip' | 'toll_free' | 'unknown';
208
+ carrier: string | null;
209
+ /** Carrier is a known burner number app. Null when carrier is unknown. */
210
+ burner: boolean | null;
211
+ city: string | null;
212
+ state: string | null;
213
+ state_name: string | null;
202
214
  }
203
215
  interface Phone {
216
+ phone: string | null;
204
217
  valid: boolean;
205
- e164: string | null;
206
218
  country: string | null;
207
219
  national: string | null;
208
220
  international: string | null;
@@ -227,7 +239,7 @@ interface DomainDeep {
227
239
  ns: string[];
228
240
  mx: MxRecord[];
229
241
  txt: string[];
230
- provider: string;
242
+ mailhost: string;
231
243
  registration: DomainRegistration;
232
244
  }
233
245
  interface Domain {
@@ -303,6 +315,18 @@ interface Language {
303
315
  direction: 'ltr' | 'rtl' | string;
304
316
  countries: string[];
305
317
  }
318
+ /** A parsed person name. Junk input returns valid: false, never an error. Gender comes from dictionary data and is null when the data does not decide. */
319
+ interface Name {
320
+ name: string;
321
+ valid: boolean;
322
+ prefix: string | null;
323
+ first: string | null;
324
+ middle: string | null;
325
+ last: string | null;
326
+ suffix: string | null;
327
+ gender: 'male' | 'female' | null;
328
+ salutation: 'Mr' | 'Ms' | null;
329
+ }
306
330
  interface CurrencyRate {
307
331
  base: string;
308
332
  quote: string;
@@ -317,12 +341,14 @@ interface TimezoneNextDst {
317
341
  abbreviation: string;
318
342
  }
319
343
  interface Timezone {
320
- timezone: string;
344
+ latitude?: number;
345
+ longitude?: number;
346
+ timezone: string | null;
321
347
  name: string | null;
322
- abbreviation: string;
323
- offset: string;
324
- offset_minutes: number;
325
- dst: boolean;
348
+ abbreviation: string | null;
349
+ offset: string | null;
350
+ offset_minutes: number | null;
351
+ dst: boolean | null;
326
352
  next_dst: TimezoneNextDst | null;
327
353
  }
328
354
  interface Holiday {
@@ -352,8 +378,8 @@ interface Elevation {
352
378
  resolution: number | null;
353
379
  }
354
380
  interface PointDeep {
355
- city: CityNearest;
356
- timezone: Timezone;
381
+ city: CityNearest | null;
382
+ timezone: Timezone | null;
357
383
  }
358
384
  interface Point {
359
385
  latitude: number;
@@ -531,9 +557,15 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
531
557
  rate: (base: string, quote: string) => Promise<CurrencyRate>;
532
558
  };
533
559
  language: (code: string) => Promise<Language>;
534
- timezone: (id: string, opts?: {
535
- at?: string;
536
- }) => Promise<Timezone>;
560
+ name: (name: string) => Promise<Name>;
561
+ timezone: {
562
+ (id: string, opts?: {
563
+ at?: string;
564
+ }): Promise<Timezone>;
565
+ (lat: number, lon: number, opts?: {
566
+ at?: string;
567
+ }): Promise<Timezone>;
568
+ };
537
569
  holiday: ((country: string, opts?: {
538
570
  year?: number;
539
571
  }) => Promise<HolidayYear>) & {
@@ -550,4 +582,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
550
582
  };
551
583
  type ParseAPIClient = ReturnType<typeof parseAPI>;
552
584
 
553
- export { type City, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Holiday, type HolidayDate, type HolidayYear, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Weather, type WeatherAlert, type WeatherDeep, type WeatherForecastPeriod, parseAPI };
585
+ export { type City, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Holiday, type HolidayDate, type HolidayYear, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type Name, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type PhoneDeep, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Weather, type WeatherAlert, type WeatherDeep, type WeatherForecastPeriod, parseAPI };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var VERSION = "0.1.1";
2
+ var VERSION = "0.1.2";
3
3
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
4
4
  var DEFAULT_TIMEOUT_MS = 1e4;
5
5
  var DEFAULT_RETRIES = 2;
@@ -93,6 +93,18 @@ function parseAPI(apiKey, options = {}) {
93
93
  }
94
94
  const enc = encodeURIComponent;
95
95
  const deepQuery = (opts) => opts?.deep ? { deep: true } : {};
96
+ function timezone(idOrLat, lonOrOpts, opts) {
97
+ if (typeof idOrLat === "number") {
98
+ return request("/timezone", {
99
+ lat: idOrLat,
100
+ lon: typeof lonOrOpts === "number" ? lonOrOpts : void 0,
101
+ at: opts?.at
102
+ });
103
+ }
104
+ return request(`/timezone/${enc(idOrLat)}`, {
105
+ at: lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts.at : void 0
106
+ });
107
+ }
96
108
  return {
97
109
  ip: Object.assign(
98
110
  (ip, opts) => request(`/ip/${enc(ip)}`, deepQuery(opts)),
@@ -150,7 +162,8 @@ function parseAPI(apiKey, options = {}) {
150
162
  }
151
163
  ),
152
164
  language: (code) => request(`/language/${enc(code)}`),
153
- timezone: (id, opts) => request(`/timezone/${enc(id)}`, { at: opts?.at }),
165
+ name: (name) => request(`/name/${enc(name)}`),
166
+ timezone,
154
167
  holiday: Object.assign(
155
168
  (country, opts) => request(`/holiday/${enc(country)}`, { year: opts?.year }),
156
169
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parseapi/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Official parseAPI client for Node and TypeScript. One key, minimal JSON, fast.",
5
5
  "keywords": [
6
6
  "parseapi",