rdapper 0.10.2 → 0.10.4

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.
Files changed (2) hide show
  1. package/dist/index.js +124 -51
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -251,6 +251,7 @@ function toISO(dateLike) {
251
251
  /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})(?:Z|([+-]\d{2})(?::?(\d{2}))?)?$/,
252
252
  /^(\d{4})\/(\d{2})\/(\d{2})[ T](\d{2}):(\d{2}):(\d{2})(?:Z|([+-]\d{2})(?::?(\d{2}))?)?$/,
253
253
  /^(\d{2})-([A-Za-z]{3})-(\d{4})$/,
254
+ /^(\d{2})-(\d{2})-(\d{4})$/,
254
255
  /^([A-Za-z]{3})\s+(\d{1,2})\s+(\d{4})$/
255
256
  ]) {
256
257
  const m = raw.match(re);
@@ -298,6 +299,7 @@ function parseDateWithRegex(m, _re) {
298
299
  }
299
300
  if (m[0].includes("-")) {
300
301
  const [_$1, dd$1, monStr$1, yyyy$1] = m;
302
+ if (/^\d+$/.test(monStr$1)) return new Date(Date.UTC(Number(yyyy$1), Number(monStr$1) - 1, Number(dd$1)));
301
303
  const mon$1 = monthMap[monStr$1.toLowerCase()];
302
304
  return new Date(Date.UTC(Number(yyyy$1), mon$1, Number(dd$1)));
303
305
  }
@@ -316,10 +318,33 @@ const PRIVACY_NAME_KEYWORDS = [
316
318
  "withheld",
317
319
  "not disclosed",
318
320
  "protected",
319
- "protection"
321
+ "protection",
322
+ "privado",
323
+ "datos privados",
324
+ "data protected",
325
+ "data redacted",
326
+ "gdpr redacted",
327
+ "gdpr masked",
328
+ "non-public data",
329
+ "statutory masking",
330
+ "redacted.forprivacy",
331
+ "registration private",
332
+ "hidden upon user request",
333
+ "not available from registry"
334
+ ];
335
+ const NO_DATA_VALUES = [
336
+ "-",
337
+ ".",
338
+ "n/a",
339
+ "na",
340
+ "no data",
341
+ "not available",
342
+ "not applicable",
343
+ "none"
320
344
  ];
321
345
  function isPrivacyName(value) {
322
- const v = value.toLowerCase();
346
+ const v = value.toLowerCase().trim();
347
+ if (NO_DATA_VALUES.includes(v)) return true;
323
348
  return PRIVACY_NAME_KEYWORDS.some((k) => v.includes(k));
324
349
  }
325
350
 
@@ -845,6 +870,8 @@ const WHOIS_AVAILABLE_PATTERNS = [
845
870
  /\bdomain status[:\s]+available\b/i,
846
871
  /\bobject does not exist\b/i,
847
872
  /\bthe queried object does not exist\b/i,
873
+ /\bqueried object does not exist\b/i,
874
+ /\breturned 0 objects\b/i,
848
875
  /\bstatus:\s*free\b/i,
849
876
  /\bstatus:\s*available\b/i,
850
877
  /\bno object found\b/i,
@@ -867,52 +894,73 @@ function normalizeWhois(domain, tld, whoisText, whoisServer, includeRaw = false)
867
894
  const creationDate = anyValue(map, [
868
895
  "creation date",
869
896
  "created on",
897
+ "created",
870
898
  "registered on",
899
+ "registered",
900
+ "registration date",
871
901
  "domain registration date",
872
902
  "domain create date",
873
- "created",
874
- "registered",
875
903
  "domain name commencement date",
876
904
  "registration time",
877
905
  "domain record activated",
906
+ "domain registered",
907
+ "registered date",
878
908
  "assigned"
879
909
  ]);
880
910
  const updatedDate = anyValue(map, [
881
911
  "updated date",
912
+ "updated",
882
913
  "last updated",
914
+ "last updated on",
883
915
  "last update",
916
+ "last-update",
884
917
  "last modified",
885
918
  "modified",
919
+ "changed",
920
+ "modification date",
886
921
  "domain record last updated"
887
922
  ]);
888
923
  const expirationDate = anyValue(map, [
889
924
  "registry expiry date",
890
925
  "registry expiration date",
891
- "expiry date",
892
- "expiration date",
893
- "expire date",
894
- "expiration time",
895
926
  "registrar registration expiration date",
896
927
  "registrar registration expiry date",
897
928
  "registrar expiration date",
898
929
  "registrar expiry date",
899
- "domain expires",
900
- "paid-till",
930
+ "expiry date",
931
+ "expiration date",
932
+ "expiry",
933
+ "expire date",
934
+ "expire",
935
+ "expired",
901
936
  "expires on",
902
937
  "expires",
903
- "expire",
938
+ "expiration time",
939
+ "domain expires",
940
+ "paid-till",
904
941
  "renewal date",
905
- "validity"
942
+ "validity",
943
+ "record will expire on"
906
944
  ]);
907
945
  const registrar = (() => {
908
946
  const name = anyValue(map, [
909
947
  "registrar",
948
+ "registrar name",
949
+ "registrar organization",
950
+ "registrar organization name",
910
951
  "sponsoring registrar",
911
- "registrar name"
952
+ "organisation",
953
+ "record maintained by"
954
+ ]);
955
+ const ianaId = anyValue(map, [
956
+ "registrar iana id",
957
+ "sponsoring registrar iana id",
958
+ "iana id"
912
959
  ]);
913
- const ianaId = anyValue(map, ["registrar iana id", "iana id"]);
914
960
  const url = anyValue(map, [
915
961
  "registrar url",
962
+ "registrar website",
963
+ "registrar web",
916
964
  "url of the registrar",
917
965
  "referrer"
918
966
  ]);
@@ -927,7 +975,7 @@ function normalizeWhois(domain, tld, whoisText, whoisServer, includeRaw = false)
927
975
  phone: abusePhone || void 0
928
976
  };
929
977
  })();
930
- const statusLines = map["domain status"] || map.status || [];
978
+ const statusLines = map["domain status"] || map.status || map.flags || map.state || map["registration status"] || map.eppstatus || [];
931
979
  const statuses = statusLines.length ? statusLines.map((line) => ({
932
980
  status: line.split(/\s+/)[0],
933
981
  raw: line
@@ -936,7 +984,18 @@ function normalizeWhois(domain, tld, whoisText, whoisServer, includeRaw = false)
936
984
  ...map["name server"] || [],
937
985
  ...map.nameserver || [],
938
986
  ...map["name servers"] || [],
939
- ...map.nserver || []
987
+ ...map.nserver || [],
988
+ ...map["name server information"] || [],
989
+ ...map.dns || [],
990
+ ...map.hostname || [],
991
+ ...map["domain nameservers"] || [],
992
+ ...map["domain servers in listed order"] || [],
993
+ ...map["domain servers"] || [],
994
+ ...map["name servers dns"] || [],
995
+ ...map["ns 1"] || [],
996
+ ...map["ns 2"] || [],
997
+ ...map["ns 3"] || [],
998
+ ...map["ns 4"] || []
940
999
  ];
941
1000
  const nameservers = nsLines.length ? uniq(nsLines.map((line) => line.trim()).filter(Boolean).map((line) => {
942
1001
  const parts = line.split(/\s+/);
@@ -995,57 +1054,71 @@ function collectContacts(map) {
995
1054
  const roles = [
996
1055
  {
997
1056
  role: "registrant",
998
- prefix: "registrant"
1057
+ prefixes: [
1058
+ "registrant",
1059
+ "owner",
1060
+ "holder"
1061
+ ]
999
1062
  },
1000
1063
  {
1001
1064
  role: "admin",
1002
- prefix: "admin"
1065
+ prefixes: ["admin", "administrative"]
1003
1066
  },
1004
1067
  {
1005
1068
  role: "tech",
1006
- prefix: "tech"
1069
+ prefixes: ["tech", "technical"]
1007
1070
  },
1008
1071
  {
1009
1072
  role: "billing",
1010
- prefix: "billing"
1073
+ prefixes: ["billing"]
1011
1074
  },
1012
1075
  {
1013
1076
  role: "abuse",
1014
- prefix: "abuse"
1077
+ prefixes: ["abuse"]
1015
1078
  }
1016
1079
  ];
1017
1080
  const contacts = [];
1018
1081
  for (const r of roles) {
1019
- const name = anyValue(map, [
1020
- `${r.prefix} name`,
1021
- `${r.prefix} contact name`,
1022
- `${r.prefix}`
1023
- ]);
1024
- const org = anyValue(map, [`${r.prefix} organization`, `${r.prefix} org`]);
1025
- const email = anyValue(map, [
1026
- `${r.prefix} email`,
1027
- `${r.prefix} contact email`,
1028
- `${r.prefix} e-mail`
1029
- ]);
1030
- const phone = anyValue(map, [
1031
- `${r.prefix} phone`,
1032
- `${r.prefix} contact phone`,
1033
- `${r.prefix} telephone`
1034
- ]);
1035
- const fax = anyValue(map, [`${r.prefix} fax`, `${r.prefix} facsimile`]);
1036
- const street = multi(map, [`${r.prefix} street`, `${r.prefix} address`]);
1037
- const city = anyValue(map, [`${r.prefix} city`]);
1038
- const state = anyValue(map, [
1039
- `${r.prefix} state`,
1040
- `${r.prefix} province`,
1041
- `${r.prefix} state/province`
1042
- ]);
1043
- const postalCode = anyValue(map, [
1044
- `${r.prefix} postal code`,
1045
- `${r.prefix} postcode`,
1046
- `${r.prefix} zip`
1047
- ]);
1048
- const country = anyValue(map, [`${r.prefix} country`]);
1082
+ const nameKeys = [];
1083
+ const orgKeys = [];
1084
+ const emailKeys = [];
1085
+ const phoneKeys = [];
1086
+ const faxKeys = [];
1087
+ const streetKeys = [];
1088
+ const cityKeys = [];
1089
+ const stateKeys = [];
1090
+ const postalCodeKeys = [];
1091
+ const countryKeys = [];
1092
+ for (const prefix of r.prefixes) {
1093
+ nameKeys.push(`${prefix} name`, `${prefix} contact name`, `${prefix}`);
1094
+ if (prefix === "registrant") nameKeys.push("registrant person");
1095
+ if (prefix === "owner") nameKeys.push("owner name");
1096
+ orgKeys.push(`${prefix} organization`, `${prefix} organisation`, `${prefix} org`);
1097
+ if (prefix === "registrant") {
1098
+ orgKeys.push("trading as");
1099
+ orgKeys.push("org");
1100
+ }
1101
+ if (prefix === "owner") orgKeys.push("owner orgname");
1102
+ emailKeys.push(`${prefix} email`, `${prefix} contact email`, `${prefix} e-mail`);
1103
+ phoneKeys.push(`${prefix} phone`, `${prefix} contact phone`, `${prefix} telephone`);
1104
+ faxKeys.push(`${prefix} fax`, `${prefix} facsimile`);
1105
+ streetKeys.push(`${prefix} street`, `${prefix} address`, `${prefix}'s address`);
1106
+ if (prefix === "owner") streetKeys.push("owner addr");
1107
+ cityKeys.push(`${prefix} city`);
1108
+ stateKeys.push(`${prefix} state`, `${prefix} province`, `${prefix} state/province`);
1109
+ postalCodeKeys.push(`${prefix} postal code`, `${prefix} postcode`, `${prefix} zip`);
1110
+ countryKeys.push(`${prefix} country`);
1111
+ }
1112
+ const name = anyValue(map, nameKeys);
1113
+ const org = anyValue(map, orgKeys);
1114
+ const email = anyValue(map, emailKeys);
1115
+ const phone = anyValue(map, phoneKeys);
1116
+ const fax = anyValue(map, faxKeys);
1117
+ const street = multi(map, streetKeys);
1118
+ const city = anyValue(map, cityKeys);
1119
+ const state = anyValue(map, stateKeys);
1120
+ const postalCode = anyValue(map, postalCodeKeys);
1121
+ const country = anyValue(map, countryKeys);
1049
1122
  if (name || org || email || phone || street?.length) contacts.push({
1050
1123
  type: r.role,
1051
1124
  name: name || void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdapper",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "license": "MIT",
5
5
  "description": "🎩 RDAP/WHOIS fetcher, parser, and normalizer for Node",
6
6
  "repository": {