@parseapi/sdk 0.1.2 → 0.1.3

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
@@ -23,7 +23,13 @@ One method per endpoint, named after the route.
23
23
  await parse.ip('8.8.8.8');
24
24
  await parse.ip.self();
25
25
  await parse.email('hello@gmail.com');
26
+ await parse.vat('DE136695976');
27
+ await parse.iban('DE89370400440532013000');
26
28
  await parse.phone('+14155552671');
29
+ await parse.carrier('+14155552671');
30
+ await parse.caller('+14155552671');
31
+ await parse.hlr('+14155552671');
32
+ await parse.postal('SW1A 1AA');
27
33
  await parse.postal('28202', { country: 'US' });
28
34
  await parse.postal.nearby('28202', { country: 'US', radius: 40 });
29
35
  await parse.postal.distance('28202', '10001', { country: 'US' });
@@ -31,11 +37,14 @@ await parse.city('charlotte', { country: 'US' });
31
37
  await parse.city.id('city_mb8mbqrkz8zb');
32
38
  await parse.city.search('char', { country: 'US', limit: 10 });
33
39
  await parse.city.nearest(35.2271, -80.8431);
40
+ await parse.city.nearby('denver', { radius: 8, unit: 'mi' });
34
41
  await parse.country('US');
35
42
  await parse.country.states('US');
43
+ await parse.state('colorado');
36
44
  await parse.state('NC', { country: 'US' });
37
45
  await parse.state.districts('NC', { country: 'US' });
38
46
  await parse.district('37081');
47
+ await parse.district('guilford county');
39
48
  await parse.continent('NA');
40
49
  await parse.continent.countries('NA');
41
50
  await parse.currency('USD');
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.2";
27
+ var VERSION = "0.1.3";
28
28
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
29
29
  var DEFAULT_TIMEOUT_MS = 1e4;
30
30
  var DEFAULT_RETRIES = 2;
@@ -126,8 +126,10 @@ function parseAPI(apiKey, options = {}) {
126
126
  at: opts?.at
127
127
  });
128
128
  }
129
+ const idOpts = lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts : void 0;
129
130
  return request(`/timezone/${enc(idOrLat)}`, {
130
- at: lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts.at : void 0
131
+ at: idOpts?.at,
132
+ to: idOpts?.to
131
133
  });
132
134
  }
133
135
  return {
@@ -143,6 +145,12 @@ function parseAPI(apiKey, options = {}) {
143
145
  countries: (code) => request(`/continent/${enc(code)}/countries`)
144
146
  }
145
147
  ),
148
+ bloc: Object.assign(
149
+ (code) => request(`/bloc/${enc(code)}`),
150
+ {
151
+ countries: (code) => request(`/bloc/${enc(code)}/countries`)
152
+ }
153
+ ),
146
154
  country: Object.assign(
147
155
  (code) => request(`/country/${enc(code)}`),
148
156
  {
@@ -150,45 +158,70 @@ function parseAPI(apiKey, options = {}) {
150
158
  }
151
159
  ),
152
160
  state: Object.assign(
153
- (code, opts) => request(`/state/${enc(code)}`, { country: opts.country }),
161
+ (code, opts) => request(`/state/${enc(code)}`, { country: opts?.country }),
154
162
  {
155
- districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts.country })
163
+ districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts?.country })
156
164
  }
157
165
  ),
158
- district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country }),
166
+ district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state }),
159
167
  city: Object.assign(
160
168
  (name, opts) => request(`/city/${enc(name)}`, { country: opts?.country, state: opts?.state }),
161
169
  {
162
170
  id: (id) => request(`/city/id/${enc(id)}`),
163
171
  search: (q, opts) => request("/city", { q, country: opts?.country, state: opts?.state, limit: opts?.limit }),
164
- nearest: (lat, lon) => request("/city", { lat, lon })
172
+ nearest: (lat, lon) => request("/city", { lat, lon }),
173
+ nearby: (name, opts) => request(`/city/${enc(name)}/nearby`, {
174
+ radius: opts?.radius,
175
+ unit: opts?.unit,
176
+ country: opts?.country,
177
+ state: opts?.state,
178
+ limit: opts?.limit
179
+ })
165
180
  }
166
181
  ),
167
182
  postal: Object.assign(
168
- (code, opts) => request(`/postal/${enc(code)}`, { country: opts.country }),
183
+ (code, opts) => request(`/postal/${enc(code)}`, { country: opts?.country }),
169
184
  {
170
185
  nearby: (code, opts) => request(`/postal/${enc(code)}/nearby`, {
171
- country: opts.country,
172
- radius: opts.radius,
173
- unit: opts.unit
186
+ country: opts?.country,
187
+ radius: opts?.radius,
188
+ unit: opts?.unit
174
189
  }),
175
- distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts.country })
190
+ distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts?.country })
176
191
  }
177
192
  ),
178
193
  email: (email, opts) => request(`/email/${enc(email)}`, deepQuery(opts)),
194
+ vat: (number, opts) => request(`/vat/${enc(number)}`, {
195
+ country: opts?.country,
196
+ from: opts?.from,
197
+ ...deepQuery(opts)
198
+ }),
199
+ iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country }),
179
200
  phone: (number, opts) => request(`/phone/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }),
201
+ carrier: (number, opts) => request(`/carrier/${enc(number)}`, { country: opts?.country }),
202
+ caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }),
203
+ hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country }),
180
204
  domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts)),
181
205
  mx: (domain) => request(`/mx/${enc(domain)}`),
182
206
  useragent: (ua, opts) => request("/useragent", deepQuery(opts), { "User-Agent": ua }),
183
207
  currency: Object.assign(
184
208
  (code) => request(`/currency/${enc(code)}`),
185
209
  {
186
- rate: (base, quote) => request(`/currency/${enc(base)}/${enc(quote)}`)
210
+ rate: (base, quote, opts) => request(`/currency/${enc(base)}/${enc(quote)}`, {
211
+ date: opts?.date,
212
+ amount: opts?.amount
213
+ })
187
214
  }
188
215
  ),
189
216
  language: (code) => request(`/language/${enc(code)}`),
190
217
  name: (name) => request(`/name/${enc(name)}`),
191
218
  timezone,
219
+ date: Object.assign(
220
+ (date, opts) => request(`/date/${enc(date)}`, { format: opts?.format, to: opts?.to }),
221
+ {
222
+ today: (opts) => request("/date", { to: opts?.to })
223
+ }
224
+ ),
192
225
  holiday: Object.assign(
193
226
  (country, opts) => request(`/holiday/${enc(country)}`, { year: opts?.year }),
194
227
  {
@@ -197,7 +230,7 @@ function parseAPI(apiKey, options = {}) {
197
230
  ),
198
231
  elevation: (lat, lon) => request("/elevation", { lat, lon }),
199
232
  point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }),
200
- weather: (lat, lon, opts) => request("/weather", { lat, lon, ...deepQuery(opts) }),
233
+ weather: (lat, lon, opts) => request("/weather", { lat, lon, date: opts?.date, ...deepQuery(opts) }),
201
234
  emoji: Object.assign(
202
235
  (emoji) => request(`/emoji/${enc(emoji)}`),
203
236
  {
package/dist/index.d.cts CHANGED
@@ -46,6 +46,22 @@ interface ContinentCountries {
46
46
  continent: string;
47
47
  countries: ContinentCountryItem[];
48
48
  }
49
+ interface Bloc {
50
+ bloc: string;
51
+ name: string;
52
+ /** Current member count. An entity fact, not a list-length field. */
53
+ members: number;
54
+ }
55
+ interface BlocCountryItem {
56
+ country: string;
57
+ name: string;
58
+ emoji?: string | null;
59
+ calling_code?: string | null;
60
+ }
61
+ interface BlocCountries {
62
+ bloc: string;
63
+ countries: BlocCountryItem[];
64
+ }
49
65
  interface Country {
50
66
  country: string;
51
67
  iso3: string;
@@ -70,6 +86,8 @@ interface Country {
70
86
  emoji: string | null;
71
87
  languages: string[];
72
88
  borders: string[];
89
+ /** Bloc memberships (EU, SCHENGEN, NATO, ...). Empty when none. */
90
+ blocs: string[];
73
91
  }
74
92
  interface CountryStateItem {
75
93
  state: string;
@@ -92,6 +110,13 @@ interface State {
92
110
  population: number | null;
93
111
  area: number | null;
94
112
  timezone: string | null;
113
+ timezones: string[];
114
+ iso_3166_2: string | null;
115
+ fips: string | null;
116
+ capital: string | null;
117
+ area_codes: string[];
118
+ tax: string | null;
119
+ tax_rate: number | null;
95
120
  }
96
121
  interface StateDistrictItem {
97
122
  district: string;
@@ -118,16 +143,28 @@ interface District {
118
143
  population: number | null;
119
144
  land_area: number | null;
120
145
  water_area: number | null;
146
+ seat: string | null;
147
+ timezone: string | null;
148
+ timezones: string[];
121
149
  }
122
150
  interface City {
123
151
  name: string;
124
152
  local_name: string | null;
153
+ type: string | null;
154
+ capital: 'country' | 'state' | null;
125
155
  state: string | null;
126
156
  state_name: string | null;
157
+ district: string | null;
158
+ district_name: string | null;
127
159
  country: string;
160
+ country_name: string | null;
128
161
  latitude: number | null;
129
162
  longitude: number | null;
163
+ elevation: number | null;
164
+ elevation_ft: number | null;
130
165
  population: number | null;
166
+ land_area: number | null;
167
+ water_area: number | null;
131
168
  timezone: string | null;
132
169
  /** Minted parse id (`city_` + 12 chars). Stable pin via `/city/id/{id}`. */
133
170
  id: string;
@@ -143,6 +180,14 @@ interface CitySearch {
143
180
  state?: string;
144
181
  cities: City[];
145
182
  }
183
+ interface CityNearby {
184
+ city: string;
185
+ state: string | null;
186
+ country: string;
187
+ radius: number;
188
+ unit: string;
189
+ nearby: CityNearest[];
190
+ }
146
191
  interface Postal {
147
192
  postal: string;
148
193
  city: string | null;
@@ -154,11 +199,14 @@ interface Postal {
154
199
  state_name: string | null;
155
200
  state_name_local: string | null;
156
201
  country: string;
202
+ country_name: string | null;
157
203
  latitude: number | null;
158
204
  longitude: number | null;
159
205
  elevation: number | null;
160
206
  elevation_ft: number | null;
161
207
  population: number | null;
208
+ land_area: number | null;
209
+ water_area: number | null;
162
210
  timezone: string | null;
163
211
  currency: string | null;
164
212
  neighbors: string[];
@@ -203,22 +251,94 @@ interface Email {
203
251
  disposable: boolean;
204
252
  deep?: Deep<EmailDeep>;
205
253
  }
206
- interface PhoneDeep {
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;
254
+ interface VatAddress {
255
+ street: string | null;
211
256
  city: string | null;
212
- state: string | null;
213
- state_name: string | null;
257
+ postal: string | null;
258
+ country: string | null;
259
+ }
260
+ interface VatDeep {
261
+ registered: boolean | null;
262
+ name: string | null;
263
+ address: VatAddress | null;
264
+ consultation: string | null;
265
+ consulted: string | null;
266
+ }
267
+ interface Vat {
268
+ vat: string | null;
269
+ valid: boolean;
270
+ country: string | null;
271
+ from?: string;
272
+ deep?: Deep<VatDeep>;
273
+ }
274
+ interface Iban {
275
+ iban: string | null;
276
+ valid: boolean;
277
+ country: string | null;
278
+ /** Print form in groups of four, for display. Null when invalid. */
279
+ formatted: string | null;
280
+ /** Two check digits as a string, keeping a leading zero. */
281
+ checksum: string | null;
282
+ /** Bank identifier parsed from the number, not a name. */
283
+ bank: string | null;
284
+ /** Branch identifier when that country has one. */
285
+ branch: string | null;
286
+ account: string | null;
214
287
  }
215
288
  interface Phone {
289
+ phone: string | null;
290
+ valid: boolean;
291
+ /** What the numbering plan can see. Never voip (that is the carrier field's word). Present when valid. */
292
+ type?: 'mobile' | 'landline' | 'toll_free' | 'unknown';
293
+ /** NPA-derived state code (US/CA). Present when valid. */
294
+ state?: string | null;
295
+ state_name?: string | null;
296
+ country: string | null;
297
+ national?: string | null;
298
+ international?: string | null;
299
+ /** Always empty. The metered proves are their own endpoints: carrier, caller, hlr. */
300
+ deep?: Record<string, never>;
301
+ }
302
+ interface Carrier {
303
+ phone: string | null;
304
+ valid: boolean;
305
+ country: string | null;
306
+ /** The network's word, including voip. Present when valid. */
307
+ type?: 'mobile' | 'landline' | 'voip' | 'toll_free' | 'unknown';
308
+ /** Current carrier display name. Null when the probe had no answer. */
309
+ carrier?: string | null;
310
+ /** Carrier is a known burner number app. Null when carrier is unknown. */
311
+ burner?: boolean | null;
312
+ /** Issuing rate-center city. */
313
+ city?: string | null;
314
+ state?: string | null;
315
+ state_name?: string | null;
316
+ }
317
+ interface Caller {
318
+ phone: string | null;
319
+ valid: boolean;
320
+ country: string | null;
321
+ /** CNAM record verbatim (all-caps telco artifact). Null when no record or outside NANP. Present when valid. */
322
+ caller?: string | null;
323
+ }
324
+ interface Hlr {
216
325
  phone: string | null;
217
326
  valid: boolean;
218
327
  country: string | null;
219
- national: string | null;
220
- international: string | null;
221
- deep?: Deep<PhoneDeep>;
328
+ /** Assigned to a subscriber. Present when valid. */
329
+ live?: boolean | null;
330
+ /** Handset reachable right now. Null means unconfirmed, never no. */
331
+ connected?: boolean | null;
332
+ /** The six network extras fill on live HLR dips only. Null elsewhere (NANP, failover). */
333
+ roaming?: boolean | null;
334
+ roaming_network?: string | null;
335
+ /** ISO2, uppercase. */
336
+ roaming_country?: string | null;
337
+ /** Current serving network name. */
338
+ network?: string | null;
339
+ original_network?: string | null;
340
+ mcc?: string | null;
341
+ mnc?: string | null;
222
342
  }
223
343
  interface MxRecord {
224
344
  priority: number;
@@ -332,6 +452,10 @@ interface CurrencyRate {
332
452
  quote: string;
333
453
  rate: number;
334
454
  date: string;
455
+ /** With amount= only: echo of the amount asked. */
456
+ amount?: number;
457
+ /** With amount= only: amount times rate, rounded to the quote currency minor-unit digits. */
458
+ converted?: number;
335
459
  source?: string;
336
460
  }
337
461
  interface TimezoneNextDst {
@@ -350,6 +474,49 @@ interface Timezone {
350
474
  offset_minutes: number | null;
351
475
  dst: boolean | null;
352
476
  next_dst: TimezoneNextDst | null;
477
+ /** With to= only: the resolved wall time in the from zone, ISO with its UTC offset. */
478
+ at?: string;
479
+ /** With to= only: the other zone at the same instant. to.at is the converted time. */
480
+ to?: TimezoneConversionTarget;
481
+ }
482
+ /** The other side of a timezone conversion. `at` is the converted wall time. */
483
+ interface TimezoneConversionTarget {
484
+ timezone: string;
485
+ name: string | null;
486
+ abbreviation: string | null;
487
+ offset: string;
488
+ offset_minutes: number;
489
+ dst: boolean;
490
+ at: string;
491
+ }
492
+ /**
493
+ * Calendar facts for one date. Junk or ambiguous input returns valid: false,
494
+ * never an error. `to` and `days` appear only when a to= date was passed.
495
+ */
496
+ interface DateInfo {
497
+ date: string;
498
+ valid: boolean;
499
+ year: number | null;
500
+ month: number | null;
501
+ month_name: string | null;
502
+ day: number | null;
503
+ /** ISO weekday, Monday 1 to Sunday 7. */
504
+ weekday: number | null;
505
+ weekday_name: string | null;
506
+ /** ISO 8601 week number. */
507
+ week: number | null;
508
+ /** The year that ISO week belongs to. Differs from year around January 1. */
509
+ week_year: number | null;
510
+ day_of_year: number | null;
511
+ quarter: number | null;
512
+ leap: boolean | null;
513
+ days_in_month: number | null;
514
+ /** Unix time at midnight UTC of that date, seconds. */
515
+ unix: number | null;
516
+ /** With to= only: the other date, normalized ISO. */
517
+ to?: string;
518
+ /** With to= only: signed days to the other date. Future positive. */
519
+ days?: number | null;
353
520
  }
354
521
  interface Holiday {
355
522
  date: string;
@@ -418,13 +585,79 @@ interface WeatherAlert {
418
585
  onset: string | null;
419
586
  expires: string | null;
420
587
  }
421
- interface WeatherDeep {
422
- forecast: WeatherForecastPeriod[];
423
- alerts: WeatherAlert[];
588
+ interface WeatherHour {
589
+ at: string | null;
590
+ daytime: boolean | null;
591
+ temperature: number | null;
592
+ temperature_f: number | null;
593
+ feels_like: number | null;
594
+ feels_like_f: number | null;
595
+ humidity: number | null;
596
+ precipitation_chance: number | null;
597
+ wind_speed: number | null;
598
+ wind_speed_mph: number | null;
599
+ wind_gust: number | null;
600
+ wind_gust_mph: number | null;
601
+ wind_direction: number | null;
602
+ condition: string | null;
603
+ condition_name: string | null;
604
+ condition_emoji: string | null;
424
605
  }
425
- interface Weather {
426
- latitude: number;
427
- longitude: number;
606
+ interface WeatherMinute {
607
+ at: string;
608
+ precipitation: number | null;
609
+ precipitation_in: number | null;
610
+ type: string | null;
611
+ }
612
+ interface WeatherDay {
613
+ date: string;
614
+ high: number | null;
615
+ high_f: number | null;
616
+ low: number | null;
617
+ low_f: number | null;
618
+ precipitation_chance: number | null;
619
+ condition: string | null;
620
+ condition_name: string | null;
621
+ condition_emoji: string | null;
622
+ sunrise: string | null;
623
+ sunset: string | null;
624
+ moon_phase: string | null;
625
+ moon_phase_name: string | null;
626
+ moon_phase_emoji: string | null;
627
+ }
628
+ interface WeatherAir {
629
+ aqi: number | null;
630
+ aqi_name: string | null;
631
+ pm2_5: number | null;
632
+ pm10: number | null;
633
+ }
634
+ interface WeatherHistory {
635
+ date: string;
636
+ high: number | null;
637
+ high_f: number | null;
638
+ low: number | null;
639
+ low_f: number | null;
640
+ precipitation: number | null;
641
+ precipitation_in: number | null;
642
+ wind_max: number | null;
643
+ wind_max_mph: number | null;
644
+ sunrise: string | null;
645
+ sunset: string | null;
646
+ moon_phase: string | null;
647
+ moon_phase_name: string | null;
648
+ moon_phase_emoji: string | null;
649
+ }
650
+ interface WeatherDeep {
651
+ forecast: WeatherForecastPeriod[] | null;
652
+ alerts: WeatherAlert[] | null;
653
+ minutes: WeatherMinute[] | null;
654
+ hours: WeatherHour[] | null;
655
+ days: WeatherDay[] | null;
656
+ air: WeatherAir | null;
657
+ /** Only present when the call carried ?date=. */
658
+ history?: WeatherHistory | null;
659
+ }
660
+ interface WeatherCurrent {
428
661
  temperature: number | null;
429
662
  temperature_f: number | null;
430
663
  feels_like: number | null;
@@ -445,12 +678,23 @@ interface Weather {
445
678
  condition_name: string | null;
446
679
  condition_emoji: string | null;
447
680
  observed_at: string | null;
448
- station: string;
449
- station_name: string | null;
450
- station_distance: number;
451
- station_distance_mi: number;
452
- source: string;
453
- source_name: string | null;
681
+ }
682
+ interface WeatherStation {
683
+ id: string;
684
+ name: string | null;
685
+ distance: number | null;
686
+ distance_mi: number | null;
687
+ }
688
+ interface WeatherSource {
689
+ id: string;
690
+ name: string | null;
691
+ }
692
+ interface Weather {
693
+ latitude: number;
694
+ longitude: number;
695
+ current: WeatherCurrent;
696
+ station: WeatherStation | null;
697
+ source: WeatherSource;
454
698
  deep?: Deep<WeatherDeep>;
455
699
  }
456
700
  interface EmojiSkin {
@@ -509,18 +753,22 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
509
753
  continent: ((code: string) => Promise<Continent>) & {
510
754
  countries: (code: string) => Promise<ContinentCountries>;
511
755
  };
756
+ bloc: ((code: string) => Promise<Bloc>) & {
757
+ countries: (code: string) => Promise<BlocCountries>;
758
+ };
512
759
  country: ((code: string) => Promise<Country>) & {
513
760
  states: (code: string) => Promise<CountryStates>;
514
761
  };
515
- state: ((code: string, opts: {
516
- country: string;
762
+ state: ((code: string, opts?: {
763
+ country?: string;
517
764
  }) => Promise<State>) & {
518
- districts: (code: string, opts: {
519
- country: string;
765
+ districts: (code: string, opts?: {
766
+ country?: string;
520
767
  }) => Promise<StateDistricts>;
521
768
  };
522
769
  district: (code: string, opts?: {
523
770
  country?: string;
771
+ state?: string;
524
772
  }) => Promise<District>;
525
773
  city: ((name: string, opts?: {
526
774
  country?: string;
@@ -533,39 +781,74 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
533
781
  limit?: number;
534
782
  }) => Promise<CitySearch>;
535
783
  nearest: (lat: number, lon: number) => Promise<CityNearest>;
784
+ nearby: (name: string, opts?: {
785
+ radius?: number;
786
+ unit?: "km" | "mi";
787
+ country?: string;
788
+ state?: string;
789
+ limit?: number;
790
+ }) => Promise<CityNearby>;
536
791
  };
537
- postal: ((code: string, opts: {
538
- country: string;
792
+ postal: ((code: string, opts?: {
793
+ country?: string;
539
794
  }) => Promise<Postal>) & {
540
- nearby: (code: string, opts: {
541
- country: string;
795
+ nearby: (code: string, opts?: {
796
+ country?: string;
542
797
  radius?: number;
543
798
  unit?: "km" | "mi";
544
799
  }) => Promise<PostalNearby>;
545
- distance: (from: string, to: string, opts: {
546
- country: string;
800
+ distance: (from: string, to: string, opts?: {
801
+ country?: string;
547
802
  }) => Promise<PostalDistance>;
548
803
  };
549
804
  email: (email: string, opts?: DeepOption) => Promise<Email>;
805
+ vat: (number: string, opts?: {
806
+ country?: string;
807
+ from?: string;
808
+ } & DeepOption) => Promise<Vat>;
809
+ iban: (iban: string, opts?: {
810
+ country?: string;
811
+ }) => Promise<Iban>;
550
812
  phone: (number: string, opts?: {
551
813
  country?: string;
552
814
  } & DeepOption) => Promise<Phone>;
815
+ carrier: (number: string, opts?: {
816
+ country?: string;
817
+ }) => Promise<Carrier>;
818
+ caller: (number: string, opts?: {
819
+ country?: string;
820
+ }) => Promise<Caller>;
821
+ hlr: (number: string, opts?: {
822
+ country?: string;
823
+ }) => Promise<Hlr>;
553
824
  domain: (domain: string, opts?: DeepOption) => Promise<Domain>;
554
825
  mx: (domain: string) => Promise<Mx>;
555
826
  useragent: (ua: string, opts?: DeepOption) => Promise<Useragent>;
556
827
  currency: ((code: string) => Promise<Currency>) & {
557
- rate: (base: string, quote: string) => Promise<CurrencyRate>;
828
+ rate: (base: string, quote: string, opts?: {
829
+ date?: string;
830
+ amount?: number;
831
+ }) => Promise<CurrencyRate>;
558
832
  };
559
833
  language: (code: string) => Promise<Language>;
560
834
  name: (name: string) => Promise<Name>;
561
835
  timezone: {
562
836
  (id: string, opts?: {
563
837
  at?: string;
838
+ to?: string;
564
839
  }): Promise<Timezone>;
565
840
  (lat: number, lon: number, opts?: {
566
841
  at?: string;
567
842
  }): Promise<Timezone>;
568
843
  };
844
+ date: ((date: string, opts?: {
845
+ format?: "mdy" | "dmy";
846
+ to?: string;
847
+ }) => Promise<DateInfo>) & {
848
+ today: (opts?: {
849
+ to?: string;
850
+ }) => Promise<DateInfo>;
851
+ };
569
852
  holiday: ((country: string, opts?: {
570
853
  year?: number;
571
854
  }) => Promise<HolidayYear>) & {
@@ -573,7 +856,9 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
573
856
  };
574
857
  elevation: (lat: number, lon: number) => Promise<Elevation>;
575
858
  point: (lat: number, lon: number, opts?: DeepOption) => Promise<Point>;
576
- weather: (lat: number, lon: number, opts?: DeepOption) => Promise<Weather>;
859
+ weather: (lat: number, lon: number, opts?: DeepOption & {
860
+ date?: string;
861
+ }) => Promise<Weather>;
577
862
  emoji: ((emoji: string) => Promise<Emoji>) & {
578
863
  search: (q: string, opts?: {
579
864
  limit?: number;
@@ -582,4 +867,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
582
867
  };
583
868
  type ParseAPIClient = ReturnType<typeof parseAPI>;
584
869
 
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 };
870
+ export { type Bloc, type BlocCountries, type BlocCountryItem, type Caller, type Carrier, type City, type CityNearby, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type DateInfo, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Hlr, type Holiday, type HolidayDate, type HolidayYear, type Iban, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type Name, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneConversionTarget, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherSource, type WeatherStation, parseAPI };
package/dist/index.d.ts CHANGED
@@ -46,6 +46,22 @@ interface ContinentCountries {
46
46
  continent: string;
47
47
  countries: ContinentCountryItem[];
48
48
  }
49
+ interface Bloc {
50
+ bloc: string;
51
+ name: string;
52
+ /** Current member count. An entity fact, not a list-length field. */
53
+ members: number;
54
+ }
55
+ interface BlocCountryItem {
56
+ country: string;
57
+ name: string;
58
+ emoji?: string | null;
59
+ calling_code?: string | null;
60
+ }
61
+ interface BlocCountries {
62
+ bloc: string;
63
+ countries: BlocCountryItem[];
64
+ }
49
65
  interface Country {
50
66
  country: string;
51
67
  iso3: string;
@@ -70,6 +86,8 @@ interface Country {
70
86
  emoji: string | null;
71
87
  languages: string[];
72
88
  borders: string[];
89
+ /** Bloc memberships (EU, SCHENGEN, NATO, ...). Empty when none. */
90
+ blocs: string[];
73
91
  }
74
92
  interface CountryStateItem {
75
93
  state: string;
@@ -92,6 +110,13 @@ interface State {
92
110
  population: number | null;
93
111
  area: number | null;
94
112
  timezone: string | null;
113
+ timezones: string[];
114
+ iso_3166_2: string | null;
115
+ fips: string | null;
116
+ capital: string | null;
117
+ area_codes: string[];
118
+ tax: string | null;
119
+ tax_rate: number | null;
95
120
  }
96
121
  interface StateDistrictItem {
97
122
  district: string;
@@ -118,16 +143,28 @@ interface District {
118
143
  population: number | null;
119
144
  land_area: number | null;
120
145
  water_area: number | null;
146
+ seat: string | null;
147
+ timezone: string | null;
148
+ timezones: string[];
121
149
  }
122
150
  interface City {
123
151
  name: string;
124
152
  local_name: string | null;
153
+ type: string | null;
154
+ capital: 'country' | 'state' | null;
125
155
  state: string | null;
126
156
  state_name: string | null;
157
+ district: string | null;
158
+ district_name: string | null;
127
159
  country: string;
160
+ country_name: string | null;
128
161
  latitude: number | null;
129
162
  longitude: number | null;
163
+ elevation: number | null;
164
+ elevation_ft: number | null;
130
165
  population: number | null;
166
+ land_area: number | null;
167
+ water_area: number | null;
131
168
  timezone: string | null;
132
169
  /** Minted parse id (`city_` + 12 chars). Stable pin via `/city/id/{id}`. */
133
170
  id: string;
@@ -143,6 +180,14 @@ interface CitySearch {
143
180
  state?: string;
144
181
  cities: City[];
145
182
  }
183
+ interface CityNearby {
184
+ city: string;
185
+ state: string | null;
186
+ country: string;
187
+ radius: number;
188
+ unit: string;
189
+ nearby: CityNearest[];
190
+ }
146
191
  interface Postal {
147
192
  postal: string;
148
193
  city: string | null;
@@ -154,11 +199,14 @@ interface Postal {
154
199
  state_name: string | null;
155
200
  state_name_local: string | null;
156
201
  country: string;
202
+ country_name: string | null;
157
203
  latitude: number | null;
158
204
  longitude: number | null;
159
205
  elevation: number | null;
160
206
  elevation_ft: number | null;
161
207
  population: number | null;
208
+ land_area: number | null;
209
+ water_area: number | null;
162
210
  timezone: string | null;
163
211
  currency: string | null;
164
212
  neighbors: string[];
@@ -203,22 +251,94 @@ interface Email {
203
251
  disposable: boolean;
204
252
  deep?: Deep<EmailDeep>;
205
253
  }
206
- interface PhoneDeep {
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;
254
+ interface VatAddress {
255
+ street: string | null;
211
256
  city: string | null;
212
- state: string | null;
213
- state_name: string | null;
257
+ postal: string | null;
258
+ country: string | null;
259
+ }
260
+ interface VatDeep {
261
+ registered: boolean | null;
262
+ name: string | null;
263
+ address: VatAddress | null;
264
+ consultation: string | null;
265
+ consulted: string | null;
266
+ }
267
+ interface Vat {
268
+ vat: string | null;
269
+ valid: boolean;
270
+ country: string | null;
271
+ from?: string;
272
+ deep?: Deep<VatDeep>;
273
+ }
274
+ interface Iban {
275
+ iban: string | null;
276
+ valid: boolean;
277
+ country: string | null;
278
+ /** Print form in groups of four, for display. Null when invalid. */
279
+ formatted: string | null;
280
+ /** Two check digits as a string, keeping a leading zero. */
281
+ checksum: string | null;
282
+ /** Bank identifier parsed from the number, not a name. */
283
+ bank: string | null;
284
+ /** Branch identifier when that country has one. */
285
+ branch: string | null;
286
+ account: string | null;
214
287
  }
215
288
  interface Phone {
289
+ phone: string | null;
290
+ valid: boolean;
291
+ /** What the numbering plan can see. Never voip (that is the carrier field's word). Present when valid. */
292
+ type?: 'mobile' | 'landline' | 'toll_free' | 'unknown';
293
+ /** NPA-derived state code (US/CA). Present when valid. */
294
+ state?: string | null;
295
+ state_name?: string | null;
296
+ country: string | null;
297
+ national?: string | null;
298
+ international?: string | null;
299
+ /** Always empty. The metered proves are their own endpoints: carrier, caller, hlr. */
300
+ deep?: Record<string, never>;
301
+ }
302
+ interface Carrier {
303
+ phone: string | null;
304
+ valid: boolean;
305
+ country: string | null;
306
+ /** The network's word, including voip. Present when valid. */
307
+ type?: 'mobile' | 'landline' | 'voip' | 'toll_free' | 'unknown';
308
+ /** Current carrier display name. Null when the probe had no answer. */
309
+ carrier?: string | null;
310
+ /** Carrier is a known burner number app. Null when carrier is unknown. */
311
+ burner?: boolean | null;
312
+ /** Issuing rate-center city. */
313
+ city?: string | null;
314
+ state?: string | null;
315
+ state_name?: string | null;
316
+ }
317
+ interface Caller {
318
+ phone: string | null;
319
+ valid: boolean;
320
+ country: string | null;
321
+ /** CNAM record verbatim (all-caps telco artifact). Null when no record or outside NANP. Present when valid. */
322
+ caller?: string | null;
323
+ }
324
+ interface Hlr {
216
325
  phone: string | null;
217
326
  valid: boolean;
218
327
  country: string | null;
219
- national: string | null;
220
- international: string | null;
221
- deep?: Deep<PhoneDeep>;
328
+ /** Assigned to a subscriber. Present when valid. */
329
+ live?: boolean | null;
330
+ /** Handset reachable right now. Null means unconfirmed, never no. */
331
+ connected?: boolean | null;
332
+ /** The six network extras fill on live HLR dips only. Null elsewhere (NANP, failover). */
333
+ roaming?: boolean | null;
334
+ roaming_network?: string | null;
335
+ /** ISO2, uppercase. */
336
+ roaming_country?: string | null;
337
+ /** Current serving network name. */
338
+ network?: string | null;
339
+ original_network?: string | null;
340
+ mcc?: string | null;
341
+ mnc?: string | null;
222
342
  }
223
343
  interface MxRecord {
224
344
  priority: number;
@@ -332,6 +452,10 @@ interface CurrencyRate {
332
452
  quote: string;
333
453
  rate: number;
334
454
  date: string;
455
+ /** With amount= only: echo of the amount asked. */
456
+ amount?: number;
457
+ /** With amount= only: amount times rate, rounded to the quote currency minor-unit digits. */
458
+ converted?: number;
335
459
  source?: string;
336
460
  }
337
461
  interface TimezoneNextDst {
@@ -350,6 +474,49 @@ interface Timezone {
350
474
  offset_minutes: number | null;
351
475
  dst: boolean | null;
352
476
  next_dst: TimezoneNextDst | null;
477
+ /** With to= only: the resolved wall time in the from zone, ISO with its UTC offset. */
478
+ at?: string;
479
+ /** With to= only: the other zone at the same instant. to.at is the converted time. */
480
+ to?: TimezoneConversionTarget;
481
+ }
482
+ /** The other side of a timezone conversion. `at` is the converted wall time. */
483
+ interface TimezoneConversionTarget {
484
+ timezone: string;
485
+ name: string | null;
486
+ abbreviation: string | null;
487
+ offset: string;
488
+ offset_minutes: number;
489
+ dst: boolean;
490
+ at: string;
491
+ }
492
+ /**
493
+ * Calendar facts for one date. Junk or ambiguous input returns valid: false,
494
+ * never an error. `to` and `days` appear only when a to= date was passed.
495
+ */
496
+ interface DateInfo {
497
+ date: string;
498
+ valid: boolean;
499
+ year: number | null;
500
+ month: number | null;
501
+ month_name: string | null;
502
+ day: number | null;
503
+ /** ISO weekday, Monday 1 to Sunday 7. */
504
+ weekday: number | null;
505
+ weekday_name: string | null;
506
+ /** ISO 8601 week number. */
507
+ week: number | null;
508
+ /** The year that ISO week belongs to. Differs from year around January 1. */
509
+ week_year: number | null;
510
+ day_of_year: number | null;
511
+ quarter: number | null;
512
+ leap: boolean | null;
513
+ days_in_month: number | null;
514
+ /** Unix time at midnight UTC of that date, seconds. */
515
+ unix: number | null;
516
+ /** With to= only: the other date, normalized ISO. */
517
+ to?: string;
518
+ /** With to= only: signed days to the other date. Future positive. */
519
+ days?: number | null;
353
520
  }
354
521
  interface Holiday {
355
522
  date: string;
@@ -418,13 +585,79 @@ interface WeatherAlert {
418
585
  onset: string | null;
419
586
  expires: string | null;
420
587
  }
421
- interface WeatherDeep {
422
- forecast: WeatherForecastPeriod[];
423
- alerts: WeatherAlert[];
588
+ interface WeatherHour {
589
+ at: string | null;
590
+ daytime: boolean | null;
591
+ temperature: number | null;
592
+ temperature_f: number | null;
593
+ feels_like: number | null;
594
+ feels_like_f: number | null;
595
+ humidity: number | null;
596
+ precipitation_chance: number | null;
597
+ wind_speed: number | null;
598
+ wind_speed_mph: number | null;
599
+ wind_gust: number | null;
600
+ wind_gust_mph: number | null;
601
+ wind_direction: number | null;
602
+ condition: string | null;
603
+ condition_name: string | null;
604
+ condition_emoji: string | null;
424
605
  }
425
- interface Weather {
426
- latitude: number;
427
- longitude: number;
606
+ interface WeatherMinute {
607
+ at: string;
608
+ precipitation: number | null;
609
+ precipitation_in: number | null;
610
+ type: string | null;
611
+ }
612
+ interface WeatherDay {
613
+ date: string;
614
+ high: number | null;
615
+ high_f: number | null;
616
+ low: number | null;
617
+ low_f: number | null;
618
+ precipitation_chance: number | null;
619
+ condition: string | null;
620
+ condition_name: string | null;
621
+ condition_emoji: string | null;
622
+ sunrise: string | null;
623
+ sunset: string | null;
624
+ moon_phase: string | null;
625
+ moon_phase_name: string | null;
626
+ moon_phase_emoji: string | null;
627
+ }
628
+ interface WeatherAir {
629
+ aqi: number | null;
630
+ aqi_name: string | null;
631
+ pm2_5: number | null;
632
+ pm10: number | null;
633
+ }
634
+ interface WeatherHistory {
635
+ date: string;
636
+ high: number | null;
637
+ high_f: number | null;
638
+ low: number | null;
639
+ low_f: number | null;
640
+ precipitation: number | null;
641
+ precipitation_in: number | null;
642
+ wind_max: number | null;
643
+ wind_max_mph: number | null;
644
+ sunrise: string | null;
645
+ sunset: string | null;
646
+ moon_phase: string | null;
647
+ moon_phase_name: string | null;
648
+ moon_phase_emoji: string | null;
649
+ }
650
+ interface WeatherDeep {
651
+ forecast: WeatherForecastPeriod[] | null;
652
+ alerts: WeatherAlert[] | null;
653
+ minutes: WeatherMinute[] | null;
654
+ hours: WeatherHour[] | null;
655
+ days: WeatherDay[] | null;
656
+ air: WeatherAir | null;
657
+ /** Only present when the call carried ?date=. */
658
+ history?: WeatherHistory | null;
659
+ }
660
+ interface WeatherCurrent {
428
661
  temperature: number | null;
429
662
  temperature_f: number | null;
430
663
  feels_like: number | null;
@@ -445,12 +678,23 @@ interface Weather {
445
678
  condition_name: string | null;
446
679
  condition_emoji: string | null;
447
680
  observed_at: string | null;
448
- station: string;
449
- station_name: string | null;
450
- station_distance: number;
451
- station_distance_mi: number;
452
- source: string;
453
- source_name: string | null;
681
+ }
682
+ interface WeatherStation {
683
+ id: string;
684
+ name: string | null;
685
+ distance: number | null;
686
+ distance_mi: number | null;
687
+ }
688
+ interface WeatherSource {
689
+ id: string;
690
+ name: string | null;
691
+ }
692
+ interface Weather {
693
+ latitude: number;
694
+ longitude: number;
695
+ current: WeatherCurrent;
696
+ station: WeatherStation | null;
697
+ source: WeatherSource;
454
698
  deep?: Deep<WeatherDeep>;
455
699
  }
456
700
  interface EmojiSkin {
@@ -509,18 +753,22 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
509
753
  continent: ((code: string) => Promise<Continent>) & {
510
754
  countries: (code: string) => Promise<ContinentCountries>;
511
755
  };
756
+ bloc: ((code: string) => Promise<Bloc>) & {
757
+ countries: (code: string) => Promise<BlocCountries>;
758
+ };
512
759
  country: ((code: string) => Promise<Country>) & {
513
760
  states: (code: string) => Promise<CountryStates>;
514
761
  };
515
- state: ((code: string, opts: {
516
- country: string;
762
+ state: ((code: string, opts?: {
763
+ country?: string;
517
764
  }) => Promise<State>) & {
518
- districts: (code: string, opts: {
519
- country: string;
765
+ districts: (code: string, opts?: {
766
+ country?: string;
520
767
  }) => Promise<StateDistricts>;
521
768
  };
522
769
  district: (code: string, opts?: {
523
770
  country?: string;
771
+ state?: string;
524
772
  }) => Promise<District>;
525
773
  city: ((name: string, opts?: {
526
774
  country?: string;
@@ -533,39 +781,74 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
533
781
  limit?: number;
534
782
  }) => Promise<CitySearch>;
535
783
  nearest: (lat: number, lon: number) => Promise<CityNearest>;
784
+ nearby: (name: string, opts?: {
785
+ radius?: number;
786
+ unit?: "km" | "mi";
787
+ country?: string;
788
+ state?: string;
789
+ limit?: number;
790
+ }) => Promise<CityNearby>;
536
791
  };
537
- postal: ((code: string, opts: {
538
- country: string;
792
+ postal: ((code: string, opts?: {
793
+ country?: string;
539
794
  }) => Promise<Postal>) & {
540
- nearby: (code: string, opts: {
541
- country: string;
795
+ nearby: (code: string, opts?: {
796
+ country?: string;
542
797
  radius?: number;
543
798
  unit?: "km" | "mi";
544
799
  }) => Promise<PostalNearby>;
545
- distance: (from: string, to: string, opts: {
546
- country: string;
800
+ distance: (from: string, to: string, opts?: {
801
+ country?: string;
547
802
  }) => Promise<PostalDistance>;
548
803
  };
549
804
  email: (email: string, opts?: DeepOption) => Promise<Email>;
805
+ vat: (number: string, opts?: {
806
+ country?: string;
807
+ from?: string;
808
+ } & DeepOption) => Promise<Vat>;
809
+ iban: (iban: string, opts?: {
810
+ country?: string;
811
+ }) => Promise<Iban>;
550
812
  phone: (number: string, opts?: {
551
813
  country?: string;
552
814
  } & DeepOption) => Promise<Phone>;
815
+ carrier: (number: string, opts?: {
816
+ country?: string;
817
+ }) => Promise<Carrier>;
818
+ caller: (number: string, opts?: {
819
+ country?: string;
820
+ }) => Promise<Caller>;
821
+ hlr: (number: string, opts?: {
822
+ country?: string;
823
+ }) => Promise<Hlr>;
553
824
  domain: (domain: string, opts?: DeepOption) => Promise<Domain>;
554
825
  mx: (domain: string) => Promise<Mx>;
555
826
  useragent: (ua: string, opts?: DeepOption) => Promise<Useragent>;
556
827
  currency: ((code: string) => Promise<Currency>) & {
557
- rate: (base: string, quote: string) => Promise<CurrencyRate>;
828
+ rate: (base: string, quote: string, opts?: {
829
+ date?: string;
830
+ amount?: number;
831
+ }) => Promise<CurrencyRate>;
558
832
  };
559
833
  language: (code: string) => Promise<Language>;
560
834
  name: (name: string) => Promise<Name>;
561
835
  timezone: {
562
836
  (id: string, opts?: {
563
837
  at?: string;
838
+ to?: string;
564
839
  }): Promise<Timezone>;
565
840
  (lat: number, lon: number, opts?: {
566
841
  at?: string;
567
842
  }): Promise<Timezone>;
568
843
  };
844
+ date: ((date: string, opts?: {
845
+ format?: "mdy" | "dmy";
846
+ to?: string;
847
+ }) => Promise<DateInfo>) & {
848
+ today: (opts?: {
849
+ to?: string;
850
+ }) => Promise<DateInfo>;
851
+ };
569
852
  holiday: ((country: string, opts?: {
570
853
  year?: number;
571
854
  }) => Promise<HolidayYear>) & {
@@ -573,7 +856,9 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
573
856
  };
574
857
  elevation: (lat: number, lon: number) => Promise<Elevation>;
575
858
  point: (lat: number, lon: number, opts?: DeepOption) => Promise<Point>;
576
- weather: (lat: number, lon: number, opts?: DeepOption) => Promise<Weather>;
859
+ weather: (lat: number, lon: number, opts?: DeepOption & {
860
+ date?: string;
861
+ }) => Promise<Weather>;
577
862
  emoji: ((emoji: string) => Promise<Emoji>) & {
578
863
  search: (q: string, opts?: {
579
864
  limit?: number;
@@ -582,4 +867,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
582
867
  };
583
868
  type ParseAPIClient = ReturnType<typeof parseAPI>;
584
869
 
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 };
870
+ export { type Bloc, type BlocCountries, type BlocCountryItem, type Caller, type Carrier, type City, type CityNearby, type CityNearest, type CitySearch, type Continent, type ContinentCountries, type ContinentCountryItem, type Country, type CountryStateItem, type CountryStates, type Currency, type CurrencyRate, type DateInfo, type Deep, type District, type Domain, type DomainDeep, type DomainRegistration, type Elevation, type Email, type EmailDeep, type Emoji, type EmojiSearch, type EmojiSkin, type Hlr, type Holiday, type HolidayDate, type HolidayYear, type Iban, type Ip, type IpDeep, type Language, type Mx, type MxRecord, type Name, type ParseAPIClient, ParseAPIError, type ParseAPIOptions, type Phone, type Point, type PointDeep, type Postal, type PostalDistance, type PostalDistanceEnd, type PostalNearby, type PostalNearbyItem, type State, type StateDistrictItem, type StateDistricts, type Timezone, type TimezoneConversionTarget, type TimezoneNextDst, type Useragent, type UseragentBrowserBrand, type UseragentBrowserDeep, type UseragentDeep, type UseragentDeviceDeep, type UseragentEngineDeep, type UseragentOsDeep, type Vat, type VatAddress, type VatDeep, type Weather, type WeatherAir, type WeatherAlert, type WeatherCurrent, type WeatherDay, type WeatherDeep, type WeatherForecastPeriod, type WeatherHistory, type WeatherHour, type WeatherMinute, type WeatherSource, type WeatherStation, parseAPI };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var VERSION = "0.1.2";
2
+ var VERSION = "0.1.3";
3
3
  var DEFAULT_BASE_URL = "https://api.parseapi.com";
4
4
  var DEFAULT_TIMEOUT_MS = 1e4;
5
5
  var DEFAULT_RETRIES = 2;
@@ -101,8 +101,10 @@ function parseAPI(apiKey, options = {}) {
101
101
  at: opts?.at
102
102
  });
103
103
  }
104
+ const idOpts = lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts : void 0;
104
105
  return request(`/timezone/${enc(idOrLat)}`, {
105
- at: lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts.at : void 0
106
+ at: idOpts?.at,
107
+ to: idOpts?.to
106
108
  });
107
109
  }
108
110
  return {
@@ -118,6 +120,12 @@ function parseAPI(apiKey, options = {}) {
118
120
  countries: (code) => request(`/continent/${enc(code)}/countries`)
119
121
  }
120
122
  ),
123
+ bloc: Object.assign(
124
+ (code) => request(`/bloc/${enc(code)}`),
125
+ {
126
+ countries: (code) => request(`/bloc/${enc(code)}/countries`)
127
+ }
128
+ ),
121
129
  country: Object.assign(
122
130
  (code) => request(`/country/${enc(code)}`),
123
131
  {
@@ -125,45 +133,70 @@ function parseAPI(apiKey, options = {}) {
125
133
  }
126
134
  ),
127
135
  state: Object.assign(
128
- (code, opts) => request(`/state/${enc(code)}`, { country: opts.country }),
136
+ (code, opts) => request(`/state/${enc(code)}`, { country: opts?.country }),
129
137
  {
130
- districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts.country })
138
+ districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts?.country })
131
139
  }
132
140
  ),
133
- district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country }),
141
+ district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state }),
134
142
  city: Object.assign(
135
143
  (name, opts) => request(`/city/${enc(name)}`, { country: opts?.country, state: opts?.state }),
136
144
  {
137
145
  id: (id) => request(`/city/id/${enc(id)}`),
138
146
  search: (q, opts) => request("/city", { q, country: opts?.country, state: opts?.state, limit: opts?.limit }),
139
- nearest: (lat, lon) => request("/city", { lat, lon })
147
+ nearest: (lat, lon) => request("/city", { lat, lon }),
148
+ nearby: (name, opts) => request(`/city/${enc(name)}/nearby`, {
149
+ radius: opts?.radius,
150
+ unit: opts?.unit,
151
+ country: opts?.country,
152
+ state: opts?.state,
153
+ limit: opts?.limit
154
+ })
140
155
  }
141
156
  ),
142
157
  postal: Object.assign(
143
- (code, opts) => request(`/postal/${enc(code)}`, { country: opts.country }),
158
+ (code, opts) => request(`/postal/${enc(code)}`, { country: opts?.country }),
144
159
  {
145
160
  nearby: (code, opts) => request(`/postal/${enc(code)}/nearby`, {
146
- country: opts.country,
147
- radius: opts.radius,
148
- unit: opts.unit
161
+ country: opts?.country,
162
+ radius: opts?.radius,
163
+ unit: opts?.unit
149
164
  }),
150
- distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts.country })
165
+ distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts?.country })
151
166
  }
152
167
  ),
153
168
  email: (email, opts) => request(`/email/${enc(email)}`, deepQuery(opts)),
169
+ vat: (number, opts) => request(`/vat/${enc(number)}`, {
170
+ country: opts?.country,
171
+ from: opts?.from,
172
+ ...deepQuery(opts)
173
+ }),
174
+ iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country }),
154
175
  phone: (number, opts) => request(`/phone/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }),
176
+ carrier: (number, opts) => request(`/carrier/${enc(number)}`, { country: opts?.country }),
177
+ caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }),
178
+ hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country }),
155
179
  domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts)),
156
180
  mx: (domain) => request(`/mx/${enc(domain)}`),
157
181
  useragent: (ua, opts) => request("/useragent", deepQuery(opts), { "User-Agent": ua }),
158
182
  currency: Object.assign(
159
183
  (code) => request(`/currency/${enc(code)}`),
160
184
  {
161
- rate: (base, quote) => request(`/currency/${enc(base)}/${enc(quote)}`)
185
+ rate: (base, quote, opts) => request(`/currency/${enc(base)}/${enc(quote)}`, {
186
+ date: opts?.date,
187
+ amount: opts?.amount
188
+ })
162
189
  }
163
190
  ),
164
191
  language: (code) => request(`/language/${enc(code)}`),
165
192
  name: (name) => request(`/name/${enc(name)}`),
166
193
  timezone,
194
+ date: Object.assign(
195
+ (date, opts) => request(`/date/${enc(date)}`, { format: opts?.format, to: opts?.to }),
196
+ {
197
+ today: (opts) => request("/date", { to: opts?.to })
198
+ }
199
+ ),
167
200
  holiday: Object.assign(
168
201
  (country, opts) => request(`/holiday/${enc(country)}`, { year: opts?.year }),
169
202
  {
@@ -172,7 +205,7 @@ function parseAPI(apiKey, options = {}) {
172
205
  ),
173
206
  elevation: (lat, lon) => request("/elevation", { lat, lon }),
174
207
  point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }),
175
- weather: (lat, lon, opts) => request("/weather", { lat, lon, ...deepQuery(opts) }),
208
+ weather: (lat, lon, opts) => request("/weather", { lat, lon, date: opts?.date, ...deepQuery(opts) }),
176
209
  emoji: Object.assign(
177
210
  (emoji) => request(`/emoji/${enc(emoji)}`),
178
211
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parseapi/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Official parseAPI client for Node and TypeScript. One key, minimal JSON, fast.",
5
5
  "keywords": [
6
6
  "parseapi",