@parseapi/sdk 0.1.1 → 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/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,11 +39,29 @@ 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;
44
47
  countries: ContinentCountryItem[];
45
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
+ }
46
65
  interface Country {
47
66
  country: string;
48
67
  iso3: string;
@@ -52,6 +71,8 @@ interface Country {
52
71
  local_name: string | null;
53
72
  demonym: string | null;
54
73
  capital: string | null;
74
+ capital_lat: number | null;
75
+ capital_lon: number | null;
55
76
  continent: string;
56
77
  region: string | null;
57
78
  subregion: string | null;
@@ -61,9 +82,12 @@ interface Country {
61
82
  currency_name: string | null;
62
83
  currency_symbol: string | null;
63
84
  tld: string | null;
85
+ calling_code: string | null;
64
86
  emoji: string | null;
65
87
  languages: string[];
66
88
  borders: string[];
89
+ /** Bloc memberships (EU, SCHENGEN, NATO, ...). Empty when none. */
90
+ blocs: string[];
67
91
  }
68
92
  interface CountryStateItem {
69
93
  state: string;
@@ -86,6 +110,13 @@ interface State {
86
110
  population: number | null;
87
111
  area: number | null;
88
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;
89
120
  }
90
121
  interface StateDistrictItem {
91
122
  district: string;
@@ -112,16 +143,28 @@ interface District {
112
143
  population: number | null;
113
144
  land_area: number | null;
114
145
  water_area: number | null;
146
+ seat: string | null;
147
+ timezone: string | null;
148
+ timezones: string[];
115
149
  }
116
150
  interface City {
117
151
  name: string;
118
152
  local_name: string | null;
153
+ type: string | null;
154
+ capital: 'country' | 'state' | null;
119
155
  state: string | null;
120
156
  state_name: string | null;
157
+ district: string | null;
158
+ district_name: string | null;
121
159
  country: string;
160
+ country_name: string | null;
122
161
  latitude: number | null;
123
162
  longitude: number | null;
163
+ elevation: number | null;
164
+ elevation_ft: number | null;
124
165
  population: number | null;
166
+ land_area: number | null;
167
+ water_area: number | null;
125
168
  timezone: string | null;
126
169
  /** Minted parse id (`city_` + 12 chars). Stable pin via `/city/id/{id}`. */
127
170
  id: string;
@@ -137,6 +180,14 @@ interface CitySearch {
137
180
  state?: string;
138
181
  cities: City[];
139
182
  }
183
+ interface CityNearby {
184
+ city: string;
185
+ state: string | null;
186
+ country: string;
187
+ radius: number;
188
+ unit: string;
189
+ nearby: CityNearest[];
190
+ }
140
191
  interface Postal {
141
192
  postal: string;
142
193
  city: string | null;
@@ -148,11 +199,14 @@ interface Postal {
148
199
  state_name: string | null;
149
200
  state_name_local: string | null;
150
201
  country: string;
202
+ country_name: string | null;
151
203
  latitude: number | null;
152
204
  longitude: number | null;
153
205
  elevation: number | null;
154
206
  elevation_ft: number | null;
155
207
  population: number | null;
208
+ land_area: number | null;
209
+ water_area: number | null;
156
210
  timezone: string | null;
157
211
  currency: string | null;
158
212
  neighbors: string[];
@@ -189,6 +243,7 @@ interface EmailDeep {
189
243
  }
190
244
  interface Email {
191
245
  email: string;
246
+ didyoumean: string | null;
192
247
  valid: boolean;
193
248
  domain: string | null;
194
249
  domain_valid: boolean | null;
@@ -196,17 +251,94 @@ interface Email {
196
251
  disposable: boolean;
197
252
  deep?: Deep<EmailDeep>;
198
253
  }
199
- interface PhoneDeep {
200
- type: 'mobile' | 'landline' | 'toll_free' | 'unknown';
201
- region: string;
254
+ interface VatAddress {
255
+ street: string | null;
256
+ city: 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;
202
287
  }
203
288
  interface Phone {
289
+ phone: string | null;
204
290
  valid: boolean;
205
- e164: string | null;
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;
206
296
  country: string | null;
207
- national: string | null;
208
- international: string | null;
209
- deep?: Deep<PhoneDeep>;
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 {
325
+ phone: string | null;
326
+ valid: boolean;
327
+ country: string | null;
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;
210
342
  }
211
343
  interface MxRecord {
212
344
  priority: number;
@@ -227,7 +359,7 @@ interface DomainDeep {
227
359
  ns: string[];
228
360
  mx: MxRecord[];
229
361
  txt: string[];
230
- provider: string;
362
+ mailhost: string;
231
363
  registration: DomainRegistration;
232
364
  }
233
365
  interface Domain {
@@ -303,11 +435,27 @@ interface Language {
303
435
  direction: 'ltr' | 'rtl' | string;
304
436
  countries: string[];
305
437
  }
438
+ /** 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. */
439
+ interface Name {
440
+ name: string;
441
+ valid: boolean;
442
+ prefix: string | null;
443
+ first: string | null;
444
+ middle: string | null;
445
+ last: string | null;
446
+ suffix: string | null;
447
+ gender: 'male' | 'female' | null;
448
+ salutation: 'Mr' | 'Ms' | null;
449
+ }
306
450
  interface CurrencyRate {
307
451
  base: string;
308
452
  quote: string;
309
453
  rate: number;
310
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;
311
459
  source?: string;
312
460
  }
313
461
  interface TimezoneNextDst {
@@ -317,13 +465,58 @@ interface TimezoneNextDst {
317
465
  abbreviation: string;
318
466
  }
319
467
  interface Timezone {
468
+ latitude?: number;
469
+ longitude?: number;
470
+ timezone: string | null;
471
+ name: string | null;
472
+ abbreviation: string | null;
473
+ offset: string | null;
474
+ offset_minutes: number | null;
475
+ dst: boolean | null;
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 {
320
484
  timezone: string;
321
485
  name: string | null;
322
- abbreviation: string;
486
+ abbreviation: string | null;
323
487
  offset: string;
324
488
  offset_minutes: number;
325
489
  dst: boolean;
326
- next_dst: TimezoneNextDst | null;
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;
327
520
  }
328
521
  interface Holiday {
329
522
  date: string;
@@ -352,8 +545,8 @@ interface Elevation {
352
545
  resolution: number | null;
353
546
  }
354
547
  interface PointDeep {
355
- city: CityNearest;
356
- timezone: Timezone;
548
+ city: CityNearest | null;
549
+ timezone: Timezone | null;
357
550
  }
358
551
  interface Point {
359
552
  latitude: number;
@@ -392,13 +585,79 @@ interface WeatherAlert {
392
585
  onset: string | null;
393
586
  expires: string | null;
394
587
  }
395
- interface WeatherDeep {
396
- forecast: WeatherForecastPeriod[];
397
- 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;
398
605
  }
399
- interface Weather {
400
- latitude: number;
401
- 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 {
402
661
  temperature: number | null;
403
662
  temperature_f: number | null;
404
663
  feels_like: number | null;
@@ -419,12 +678,23 @@ interface Weather {
419
678
  condition_name: string | null;
420
679
  condition_emoji: string | null;
421
680
  observed_at: string | null;
422
- station: string;
423
- station_name: string | null;
424
- station_distance: number;
425
- station_distance_mi: number;
426
- source: string;
427
- 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;
428
698
  deep?: Deep<WeatherDeep>;
429
699
  }
430
700
  interface EmojiSkin {
@@ -483,18 +753,22 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
483
753
  continent: ((code: string) => Promise<Continent>) & {
484
754
  countries: (code: string) => Promise<ContinentCountries>;
485
755
  };
756
+ bloc: ((code: string) => Promise<Bloc>) & {
757
+ countries: (code: string) => Promise<BlocCountries>;
758
+ };
486
759
  country: ((code: string) => Promise<Country>) & {
487
760
  states: (code: string) => Promise<CountryStates>;
488
761
  };
489
- state: ((code: string, opts: {
490
- country: string;
762
+ state: ((code: string, opts?: {
763
+ country?: string;
491
764
  }) => Promise<State>) & {
492
- districts: (code: string, opts: {
493
- country: string;
765
+ districts: (code: string, opts?: {
766
+ country?: string;
494
767
  }) => Promise<StateDistricts>;
495
768
  };
496
769
  district: (code: string, opts?: {
497
770
  country?: string;
771
+ state?: string;
498
772
  }) => Promise<District>;
499
773
  city: ((name: string, opts?: {
500
774
  country?: string;
@@ -507,33 +781,74 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
507
781
  limit?: number;
508
782
  }) => Promise<CitySearch>;
509
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>;
510
791
  };
511
- postal: ((code: string, opts: {
512
- country: string;
792
+ postal: ((code: string, opts?: {
793
+ country?: string;
513
794
  }) => Promise<Postal>) & {
514
- nearby: (code: string, opts: {
515
- country: string;
795
+ nearby: (code: string, opts?: {
796
+ country?: string;
516
797
  radius?: number;
517
798
  unit?: "km" | "mi";
518
799
  }) => Promise<PostalNearby>;
519
- distance: (from: string, to: string, opts: {
520
- country: string;
800
+ distance: (from: string, to: string, opts?: {
801
+ country?: string;
521
802
  }) => Promise<PostalDistance>;
522
803
  };
523
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>;
524
812
  phone: (number: string, opts?: {
525
813
  country?: string;
526
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>;
527
824
  domain: (domain: string, opts?: DeepOption) => Promise<Domain>;
528
825
  mx: (domain: string) => Promise<Mx>;
529
826
  useragent: (ua: string, opts?: DeepOption) => Promise<Useragent>;
530
827
  currency: ((code: string) => Promise<Currency>) & {
531
- rate: (base: string, quote: string) => Promise<CurrencyRate>;
828
+ rate: (base: string, quote: string, opts?: {
829
+ date?: string;
830
+ amount?: number;
831
+ }) => Promise<CurrencyRate>;
532
832
  };
533
833
  language: (code: string) => Promise<Language>;
534
- timezone: (id: string, opts?: {
535
- at?: string;
536
- }) => Promise<Timezone>;
834
+ name: (name: string) => Promise<Name>;
835
+ timezone: {
836
+ (id: string, opts?: {
837
+ at?: string;
838
+ to?: string;
839
+ }): Promise<Timezone>;
840
+ (lat: number, lon: number, opts?: {
841
+ at?: string;
842
+ }): Promise<Timezone>;
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
+ };
537
852
  holiday: ((country: string, opts?: {
538
853
  year?: number;
539
854
  }) => Promise<HolidayYear>) & {
@@ -541,7 +856,9 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
541
856
  };
542
857
  elevation: (lat: number, lon: number) => Promise<Elevation>;
543
858
  point: (lat: number, lon: number, opts?: DeepOption) => Promise<Point>;
544
- weather: (lat: number, lon: number, opts?: DeepOption) => Promise<Weather>;
859
+ weather: (lat: number, lon: number, opts?: DeepOption & {
860
+ date?: string;
861
+ }) => Promise<Weather>;
545
862
  emoji: ((emoji: string) => Promise<Emoji>) & {
546
863
  search: (q: string, opts?: {
547
864
  limit?: number;
@@ -550,4 +867,4 @@ declare function parseAPI(apiKey?: string, options?: ParseAPIOptions): {
550
867
  };
551
868
  type ParseAPIClient = ReturnType<typeof parseAPI>;
552
869
 
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 };
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 };