@isvalid-dev/sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -205,10 +205,32 @@ type MacResponse = {
205
205
  isLocal: boolean;
206
206
  isBroadcast: boolean;
207
207
  };
208
+ type NetPortResponse = {
209
+ valid: false;
210
+ } | {
211
+ valid: true;
212
+ port: number;
213
+ range: string;
214
+ wellKnown: boolean;
215
+ serviceName: string | null;
216
+ protocol: string | null;
217
+ description: string | null;
218
+ };
219
+ type NetPortListItem = {
220
+ port: number;
221
+ serviceName: string;
222
+ protocol: string;
223
+ description: string;
224
+ };
208
225
 
226
+ interface NetPortNamespace {
227
+ (value: string): Promise<NetPortResponse>;
228
+ list(): Promise<NetPortListItem[]>;
229
+ }
209
230
  interface NetNamespace {
210
231
  ip(value: string): Promise<IpResponse>;
211
232
  mac(value: string): Promise<MacResponse>;
233
+ port: NetPortNamespace;
212
234
  }
213
235
 
214
236
  type PeselResponse = {
@@ -368,6 +390,245 @@ interface GbNamespace {
368
390
  sortCode(value: string): Promise<SortCodeResponse>;
369
391
  }
370
392
 
393
+ type HsCodeResponse = {
394
+ valid: false;
395
+ code?: string;
396
+ level?: string;
397
+ error?: string;
398
+ } | {
399
+ valid: true;
400
+ code: string;
401
+ level: string;
402
+ description: string;
403
+ formatted: string;
404
+ chapter?: {
405
+ code: string;
406
+ description: string;
407
+ } | null;
408
+ heading?: {
409
+ code: string;
410
+ description: string;
411
+ } | null;
412
+ };
413
+ interface HsCodeListItem {
414
+ code: string;
415
+ level: string;
416
+ description: string;
417
+ }
418
+ type HsCodeListResponse = HsCodeListItem[];
419
+
420
+ interface HsCodeNamespace {
421
+ (value: string): Promise<HsCodeResponse>;
422
+ list(opts?: {
423
+ chapter?: string;
424
+ level?: string;
425
+ }): Promise<HsCodeListResponse>;
426
+ }
427
+
428
+ type Gs1PrefixResponse = {
429
+ valid: false;
430
+ prefix?: string;
431
+ error?: string;
432
+ } | {
433
+ valid: true;
434
+ prefix: string;
435
+ country: string;
436
+ inputType?: string;
437
+ };
438
+ interface Gs1PrefixListItem {
439
+ rangeStart: string;
440
+ rangeEnd: string;
441
+ country: string;
442
+ }
443
+ type Gs1PrefixListResponse = Gs1PrefixListItem[];
444
+
445
+ interface Gs1PrefixNamespace {
446
+ (value: string): Promise<Gs1PrefixResponse>;
447
+ list(): Promise<Gs1PrefixListResponse>;
448
+ }
449
+
450
+ type IndustryResponse = {
451
+ valid: false;
452
+ error?: string;
453
+ suggestedSystem?: string;
454
+ } | {
455
+ valid: true;
456
+ system: string;
457
+ edition: string;
458
+ code: string;
459
+ description: string;
460
+ level: string;
461
+ parent: string | null;
462
+ hierarchy: Array<{
463
+ code: string;
464
+ description: string;
465
+ }>;
466
+ };
467
+ interface IndustryListItem {
468
+ code: string;
469
+ level: string;
470
+ parent: string | null;
471
+ description: string;
472
+ }
473
+ type IndustryListResponse = IndustryListItem[];
474
+
475
+ interface IndustryNamespace {
476
+ (value: string, opts?: {
477
+ system?: string;
478
+ }): Promise<IndustryResponse>;
479
+ list(opts: {
480
+ system: string;
481
+ level?: string;
482
+ parent?: string;
483
+ }): Promise<IndustryListResponse>;
484
+ }
485
+
486
+ type TimezoneResponse = {
487
+ valid: false;
488
+ } | {
489
+ valid: true;
490
+ timezone: string;
491
+ region: string | null;
492
+ utcOffset: string;
493
+ abbreviation: string | null;
494
+ isDST: boolean;
495
+ };
496
+ type TimezoneListItem = {
497
+ timezone: string;
498
+ region: string | null;
499
+ utcOffset: string;
500
+ abbreviation: string | null;
501
+ isDST: boolean;
502
+ };
503
+
504
+ interface TimezoneNamespace {
505
+ (value: string): Promise<TimezoneResponse>;
506
+ list(opts?: {
507
+ region?: string;
508
+ }): Promise<TimezoneListItem[]>;
509
+ }
510
+
511
+ type MimeTypeResponse = {
512
+ valid: false;
513
+ type?: string;
514
+ subtype?: string;
515
+ } | {
516
+ valid: true;
517
+ mime: string;
518
+ type: string;
519
+ subtype: string;
520
+ extensions: string[];
521
+ compressible: boolean | null;
522
+ charset: string | null;
523
+ source: string | null;
524
+ };
525
+ type MimeTypeExtResponse = {
526
+ valid: false;
527
+ extension?: string;
528
+ } | {
529
+ valid: true;
530
+ extension: string;
531
+ mimeTypes: Array<{
532
+ mime: string;
533
+ type: string;
534
+ subtype: string;
535
+ extensions: string[];
536
+ compressible: boolean | null;
537
+ charset: string | null;
538
+ source: string | null;
539
+ }>;
540
+ };
541
+ type MimeTypeListItem = {
542
+ mime: string;
543
+ type: string;
544
+ subtype: string;
545
+ extensions: string[];
546
+ };
547
+
548
+ interface MimeTypeNamespace {
549
+ (value: string): Promise<MimeTypeResponse>;
550
+ ext(value: string): Promise<MimeTypeExtResponse>;
551
+ list(opts?: {
552
+ type?: string;
553
+ }): Promise<MimeTypeListItem[]>;
554
+ }
555
+
556
+ type HttpStatusResponse = {
557
+ valid: false;
558
+ } | {
559
+ valid: true;
560
+ code: number;
561
+ reasonPhrase: string;
562
+ category: string;
563
+ };
564
+ type HttpStatusListItem = {
565
+ code: number;
566
+ reasonPhrase: string;
567
+ category: string;
568
+ };
569
+
570
+ interface HttpStatusNamespace {
571
+ (value: string): Promise<HttpStatusResponse>;
572
+ list(): Promise<HttpStatusListItem[]>;
573
+ }
574
+
575
+ type SwiftMtResponse = {
576
+ valid: false;
577
+ } | {
578
+ valid: true;
579
+ type: string;
580
+ category: number;
581
+ group: string;
582
+ description: string;
583
+ };
584
+ type SwiftMtListItem = {
585
+ type: string;
586
+ category: number;
587
+ group: string;
588
+ description: string;
589
+ };
590
+
591
+ interface SwiftMtNamespace {
592
+ (value: string): Promise<SwiftMtResponse>;
593
+ list(opts?: {
594
+ category?: number;
595
+ }): Promise<SwiftMtListItem[]>;
596
+ }
597
+
598
+ type LocodeResponse = {
599
+ valid: false;
600
+ } | {
601
+ valid: true;
602
+ locode: string;
603
+ country: string;
604
+ location: string;
605
+ name: string | null;
606
+ nameAscii: string | null;
607
+ subdivision: string | null;
608
+ functions: string[];
609
+ iata: string | null;
610
+ coordinates: string | null;
611
+ found: boolean;
612
+ };
613
+ type LocodeListItem = {
614
+ locode: string;
615
+ country: string;
616
+ location: string;
617
+ name: string;
618
+ nameAscii: string;
619
+ subdivision: string | null;
620
+ functions: string[];
621
+ iata: string | null;
622
+ coordinates: string | null;
623
+ };
624
+
625
+ interface LocodeNamespace {
626
+ (value: string): Promise<LocodeResponse>;
627
+ list(opts: {
628
+ country: string;
629
+ }): Promise<LocodeListItem[]>;
630
+ }
631
+
371
632
  type EmailResponse = {
372
633
  valid: false;
373
634
  } | {
@@ -713,6 +974,132 @@ type CreditCardResponse = {
713
974
  valid: true;
714
975
  type: string;
715
976
  };
977
+ type CasResponse = {
978
+ valid: false;
979
+ error?: string;
980
+ } | {
981
+ valid: true;
982
+ formatted: string;
983
+ };
984
+ type EoriResponse = {
985
+ valid: false;
986
+ countryCode?: string;
987
+ country?: string;
988
+ error?: string;
989
+ } | {
990
+ valid: true;
991
+ countryCode: string;
992
+ country: string;
993
+ identifier: string;
994
+ formatted: string;
995
+ ec?: {
996
+ checked: boolean;
997
+ valid?: boolean;
998
+ statusDescr?: string | null;
999
+ name?: string | null;
1000
+ street?: string | null;
1001
+ postalCode?: string | null;
1002
+ city?: string | null;
1003
+ reason?: string;
1004
+ };
1005
+ };
1006
+ type OrcidResponse = {
1007
+ valid: false;
1008
+ error?: string;
1009
+ } | {
1010
+ valid: true;
1011
+ formatted: string;
1012
+ uri: string;
1013
+ profile?: {
1014
+ found: boolean;
1015
+ givenNames?: string | null;
1016
+ familyName?: string | null;
1017
+ organization?: string | null;
1018
+ reason?: string;
1019
+ };
1020
+ };
1021
+ type DoiResponse = {
1022
+ valid: false;
1023
+ error?: string;
1024
+ } | {
1025
+ valid: true;
1026
+ doi: string;
1027
+ prefix: string;
1028
+ suffix: string;
1029
+ registrantCode: string;
1030
+ registrant?: string;
1031
+ url: string;
1032
+ metadata?: {
1033
+ found: boolean;
1034
+ title?: string | null;
1035
+ authors?: string[] | null;
1036
+ publisher?: string | null;
1037
+ type?: string | null;
1038
+ issued?: unknown;
1039
+ reason?: string;
1040
+ };
1041
+ };
1042
+ type BarcodeResponse = {
1043
+ valid: false;
1044
+ error?: string;
1045
+ } | {
1046
+ valid: true;
1047
+ type: string;
1048
+ data: string;
1049
+ hasCheckDigit?: boolean;
1050
+ checkDigitValid?: boolean | null;
1051
+ encoding?: string;
1052
+ indicator?: string;
1053
+ length?: number;
1054
+ };
1055
+ type Base64Response = {
1056
+ valid: false;
1057
+ error?: string;
1058
+ } | {
1059
+ valid: true;
1060
+ variant: 'standard' | 'url-safe' | 'ambiguous';
1061
+ isPadded: boolean;
1062
+ decodedLength: number;
1063
+ };
1064
+ type EthAddressResponse = {
1065
+ valid: false;
1066
+ } | {
1067
+ valid: true;
1068
+ address: string;
1069
+ isChecksumValid: boolean;
1070
+ };
1071
+ type CronResponse = {
1072
+ valid: false;
1073
+ } | {
1074
+ valid: true;
1075
+ expression: string;
1076
+ fields: number;
1077
+ hasSeconds: boolean;
1078
+ humanReadable: string | null;
1079
+ nextRun: string;
1080
+ nextRuns: string[];
1081
+ };
1082
+ type DomainResponse = {
1083
+ valid: false;
1084
+ } | {
1085
+ valid: true;
1086
+ domain: string;
1087
+ tld: string;
1088
+ sld: string | null;
1089
+ isIDN: boolean;
1090
+ dnsValid: boolean;
1091
+ hasA: boolean;
1092
+ hasAAAA: boolean;
1093
+ };
1094
+ type RegexResponse = {
1095
+ valid: false;
1096
+ error?: string;
1097
+ } | {
1098
+ valid: true;
1099
+ pattern: string;
1100
+ flags: string | null;
1101
+ namedGroups: string[];
1102
+ };
716
1103
 
717
1104
  declare class IsValidError extends Error {
718
1105
  readonly status: number;
@@ -754,6 +1141,14 @@ declare class IsValid {
754
1141
  readonly in: InNamespace;
755
1142
  readonly us: UsNamespace;
756
1143
  readonly gb: GbNamespace;
1144
+ readonly hsCode: HsCodeNamespace;
1145
+ readonly gs1Prefix: Gs1PrefixNamespace;
1146
+ readonly industry: IndustryNamespace;
1147
+ readonly timezone: TimezoneNamespace;
1148
+ readonly mimeType: MimeTypeNamespace;
1149
+ readonly httpStatus: HttpStatusNamespace;
1150
+ readonly swiftMt: SwiftMtNamespace;
1151
+ readonly locode: LocodeNamespace;
757
1152
  constructor(config: IsValidConfig);
758
1153
  email(value: string, opts?: {
759
1154
  checkMx?: boolean;
@@ -802,7 +1197,27 @@ declare class IsValid {
802
1197
  gln(value: string): Promise<GlnResponse>;
803
1198
  qr(value: string): Promise<QrResponse>;
804
1199
  creditCard(number: string): Promise<CreditCardResponse>;
1200
+ cas(value: string): Promise<CasResponse>;
1201
+ eori(value: string, opts?: {
1202
+ check?: boolean;
1203
+ }): Promise<EoriResponse>;
1204
+ orcid(value: string, opts?: {
1205
+ lookup?: boolean;
1206
+ }): Promise<OrcidResponse>;
1207
+ doi(value: string, opts?: {
1208
+ lookup?: boolean;
1209
+ }): Promise<DoiResponse>;
1210
+ barcode(value: string, opts?: {
1211
+ type?: string;
1212
+ }): Promise<BarcodeResponse>;
1213
+ base64(value: string): Promise<Base64Response>;
1214
+ ethAddress(value: string): Promise<EthAddressResponse>;
1215
+ cron(value: string): Promise<CronResponse>;
1216
+ domain(value: string): Promise<DomainResponse>;
1217
+ regex(pattern: string, opts?: {
1218
+ flags?: string;
1219
+ }): Promise<RegexResponse>;
805
1220
  }
806
1221
  declare function createClient(config: IsValidConfig): IsValid;
807
1222
 
808
- export { type AbaResponse, type AbnResponse, type AuNamespace, type BicResponse, type BooleanResponse, type BrNamespace, type BtcAddressResponse, type CfiResponse, type CnpjResponse, type ColorResponse, type ContainerCodeResponse, type CountryListItem, type CountryNamespace, type CountryResponse, type CpfResponse, type CreditCardResponse, type CurrencyListItem, type CurrencyNamespace, type CurrencyResponse, type CusipResponse, type DateResponse, type DtiResponse, type EanResponse, type EmailResponse, type EsNamespace, type GbNamespace, type GlnResponse, type GpsResponse, type GstinResponse, type IataAirlineListItem, type IataAirlineNamespace, type IataAirlineResponse, type IataAirportResponse, type IataFlightResponse, type IataNamespace, type IbanResponse, type ImeiResponse, type InNamespace, type InvalidResponse, type IpResponse, IsValid, IsValidAuthError, type IsValidConfig, IsValidError, IsValidRateLimitError, type IsbnResponse, type IsinResponse, type IssnResponse, type JwtResponse, type KrsAddress, type KrsLookup, type KrsResponse, type LanguageListItem, type LanguageNamespace, type LanguageResponse, type LeiEntity, type LeiLou, type LeiLouItem, type LeiLousResponse, type LeiNamespace, type LeiResponse, type LeiSearchOptions, type LeiSearchResponse, type LeiSearchResult, type MacResponse, type MicResponse, type NetNamespace, type NifResponse, type NpiResponse, type NutsResponse, type PeselResponse, type PhoneResponse, type PlNamespace, type PostalCodeResponse, type QrResponse, type RegonLookup, type RegonResponse, type RetryConfig, type SemverResponse, type SortCodeResponse, type SsccResponse, type UrlResponse, type UsNamespace, type UuidResponse, type VatResponse, type VinResponse, createClient };
1223
+ export { type AbaResponse, type AbnResponse, type AuNamespace, type BarcodeResponse, type Base64Response, type BicResponse, type BooleanResponse, type BrNamespace, type BtcAddressResponse, type CasResponse, type CfiResponse, type CnpjResponse, type ColorResponse, type ContainerCodeResponse, type CountryListItem, type CountryNamespace, type CountryResponse, type CpfResponse, type CreditCardResponse, type CronResponse, type CurrencyListItem, type CurrencyNamespace, type CurrencyResponse, type CusipResponse, type DateResponse, type DoiResponse, type DomainResponse, type DtiResponse, type EanResponse, type EmailResponse, type EoriResponse, type EsNamespace, type EthAddressResponse, type GbNamespace, type GlnResponse, type GpsResponse, type Gs1PrefixListItem, type Gs1PrefixListResponse, type Gs1PrefixNamespace, type Gs1PrefixResponse, type GstinResponse, type HsCodeListItem, type HsCodeListResponse, type HsCodeNamespace, type HsCodeResponse, type HttpStatusListItem, type HttpStatusNamespace, type HttpStatusResponse, type IataAirlineListItem, type IataAirlineNamespace, type IataAirlineResponse, type IataAirportResponse, type IataFlightResponse, type IataNamespace, type IbanResponse, type ImeiResponse, type InNamespace, type IndustryListItem, type IndustryListResponse, type IndustryNamespace, type IndustryResponse, type InvalidResponse, type IpResponse, IsValid, IsValidAuthError, type IsValidConfig, IsValidError, IsValidRateLimitError, type IsbnResponse, type IsinResponse, type IssnResponse, type JwtResponse, type KrsAddress, type KrsLookup, type KrsResponse, type LanguageListItem, type LanguageNamespace, type LanguageResponse, type LeiEntity, type LeiLou, type LeiLouItem, type LeiLousResponse, type LeiNamespace, type LeiResponse, type LeiSearchOptions, type LeiSearchResponse, type LeiSearchResult, type LocodeListItem, type LocodeNamespace, type LocodeResponse, type MacResponse, type MicResponse, type MimeTypeExtResponse, type MimeTypeListItem, type MimeTypeNamespace, type MimeTypeResponse, type NetNamespace, type NetPortListItem, type NetPortNamespace, type NetPortResponse, type NifResponse, type NpiResponse, type NutsResponse, type OrcidResponse, type PeselResponse, type PhoneResponse, type PlNamespace, type PostalCodeResponse, type QrResponse, type RegexResponse, type RegonLookup, type RegonResponse, type RetryConfig, type SemverResponse, type SortCodeResponse, type SsccResponse, type SwiftMtListItem, type SwiftMtNamespace, type SwiftMtResponse, type TimezoneListItem, type TimezoneNamespace, type TimezoneResponse, type UrlResponse, type UsNamespace, type UuidResponse, type VatResponse, type VinResponse, createClient };