@getnexorai/sdk 0.1.3 → 0.1.5

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.cjs CHANGED
@@ -676,10 +676,21 @@ function randomHex(bytes) {
676
676
  }
677
677
 
678
678
  // src/chat/validate.ts
679
+ var EMAIL_RE = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;
679
680
  function isValidEmail(value) {
680
681
  const s = (value || "").trim();
681
682
  if (s.length < 6 || s.length > 254) return false;
682
- return /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s);
683
+ const at = s.lastIndexOf("@");
684
+ if (at < 1) return false;
685
+ const local = s.slice(0, at);
686
+ const domain = s.slice(at + 1);
687
+ if (local.length > 64) return false;
688
+ if (local.startsWith(".") || local.endsWith(".") || local.includes("..")) {
689
+ return false;
690
+ }
691
+ if (domain.includes("..")) return false;
692
+ if (!/\.[a-zA-Z]{2,}$/.test(domain)) return false;
693
+ return EMAIL_RE.test(s);
683
694
  }
684
695
 
685
696
  // src/chat/template.ts