@getnexorai/sdk 0.1.4 → 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/chat.cjs CHANGED
@@ -237,10 +237,21 @@ function randomHex(bytes) {
237
237
  }
238
238
 
239
239
  // src/chat/validate.ts
240
+ 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])?)+$/;
240
241
  function isValidEmail(value) {
241
242
  const s = (value || "").trim();
242
243
  if (s.length < 6 || s.length > 254) return false;
243
- return /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s);
244
+ const at = s.lastIndexOf("@");
245
+ if (at < 1) return false;
246
+ const local = s.slice(0, at);
247
+ const domain = s.slice(at + 1);
248
+ if (local.length > 64) return false;
249
+ if (local.startsWith(".") || local.endsWith(".") || local.includes("..")) {
250
+ return false;
251
+ }
252
+ if (domain.includes("..")) return false;
253
+ if (!/\.[a-zA-Z]{2,}$/.test(domain)) return false;
254
+ return EMAIL_RE.test(s);
244
255
  }
245
256
 
246
257
  // src/chat/template.ts