@signaliz/sdk 1.0.58 → 1.0.60

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/README.md CHANGED
@@ -44,6 +44,10 @@ const verified = await signaliz.verifyEmail(found.email!, {
44
44
  skipCache: true,
45
45
  });
46
46
 
47
+ // Syntax failures are terminal local results, with no HTTP or provider call.
48
+ const malformed = await signaliz.verifyEmail('badformat@@gmail..com');
49
+ console.log(malformed.success, malformed.isMalformed, malformed.verificationVerdict);
50
+
47
51
  // The SDK waits for long checks by default. For an agent handoff, return early
48
52
  // and resume the exact provider run later without duplicate spend.
49
53
  const queuedVerification = await signaliz.verifyEmail('jane@example.com', {
@@ -114,10 +118,14 @@ when the REST API supplies them, including after automatic row retries are
114
118
  exhausted.
115
119
 
116
120
  Every single-result method treats an error payload as `success: false`, even if
117
- an upstream HTTP 200 omits or contradicts the success flag. Find Email also
118
- withholds any email from a contradictory error response. Verify Email, Company
119
- Signals, and Signal to Copy expose normalized `error` and `errorCode` fields;
120
- the original response remains available in `raw`.
121
+ an upstream HTTP 200 omits or contradicts the success flag. This includes
122
+ `ok: false`, non-empty error fields or error arrays, and terminal provider
123
+ statuses such as `timed_out` or `crashed`; an informational `message` alone is
124
+ not an error. Find Email withholds the email and every send-safe indicator,
125
+ Verify Email withholds deliverability and confidence, and Company Signals and
126
+ Signal to Copy withhold contradictory signals, narratives, and copy. Normalized
127
+ `error` and `errorCode` fields explain the failure while the original response
128
+ remains available in `raw` for audit.
121
129
 
122
130
  For an ambiguous single request or batch submission failure, retry with the
123
131
  same `idempotencyKey` to recover the original request, durable job, or provider
@@ -408,6 +408,29 @@ var Signaliz = class {
408
408
  );
409
409
  }
410
410
  async verifyEmail(email, options) {
411
+ const normalizedEmail = typeof email === "string" ? email.trim() : "";
412
+ if (options?.dryRun !== true && !options?.verificationRunId && normalizedEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) {
413
+ const error = `Invalid email format: "${normalizedEmail}"`;
414
+ return normalizeVerifyEmailResult(normalizedEmail, {
415
+ success: false,
416
+ email: normalizedEmail,
417
+ status: "completed",
418
+ is_valid: false,
419
+ is_deliverable: false,
420
+ email_verified: false,
421
+ verified_for_sending: false,
422
+ is_malformed: true,
423
+ verification_status: "malformed",
424
+ verification_verdict: "malformed",
425
+ verification_source: "input_validation",
426
+ provider_status: "rejected_before_provider",
427
+ error,
428
+ error_code: "INPUT_001",
429
+ retry_eligible: false,
430
+ credits_used: 0,
431
+ live_provider_called: false
432
+ });
433
+ }
411
434
  const request = compact({
412
435
  email: email || void 0,
413
436
  verification_run_id: options?.verificationRunId,
@@ -945,15 +968,15 @@ function normalizeFindEmailResult(data) {
945
968
  email,
946
969
  firstName: data.first_name,
947
970
  lastName: data.last_name,
948
- confidence: data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
949
- verificationStatus,
950
- isVerified: verified,
951
- isVerifiedForSending: !needsReverification && data.verified_for_sending === true,
971
+ confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
972
+ verificationStatus: failed ? "error" : verificationStatus,
973
+ isVerified: !failed && verified,
974
+ isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
952
975
  isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
953
976
  verificationFreshness,
954
977
  verificationAgeDays,
955
978
  verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
956
- needsReverification,
979
+ needsReverification: failed || needsReverification,
957
980
  providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
958
981
  creditsUsed: data.credits_used,
959
982
  estimatedExternalCostUsd: data.estimated_external_cost_usd,
@@ -976,6 +999,7 @@ function normalizeVerifyEmailResult(email, data) {
976
999
  const failed = coreProductResponseFailed(data);
977
1000
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
978
1001
  const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
1002
+ const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
979
1003
  return {
980
1004
  success: !failed,
981
1005
  error: failed ? coreProductErrorMessage(data) : void 0,
@@ -987,11 +1011,11 @@ function normalizeVerifyEmailResult(email, data) {
987
1011
  nextPollAfterSeconds: data.next_poll_after_seconds,
988
1012
  isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
989
1013
  isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
990
- isMalformed: data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed",
1014
+ isMalformed: malformed,
991
1015
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
992
1016
  verifiedForSending: !failed && data.verified_for_sending === true,
993
- verificationVerdict: data.verification_verdict ?? data.verification_status ?? "unknown",
994
- confidenceScore: data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
1017
+ verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
1018
+ confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
995
1019
  provider: data.provider,
996
1020
  verificationSource: data.verification_source,
997
1021
  billingReplayed: data.billing_replayed,
@@ -1064,16 +1088,16 @@ function normalizeCompanySignalResult(params, data) {
1064
1088
  classification: signal.signal_classification ?? null
1065
1089
  };
1066
1090
  }),
1067
- signalCount: data.signal_count ?? data.total_signals ?? rawSignals.length,
1068
- signalSummary: data.signal_summary ?? null,
1069
- intelligence: data.intelligence ?? null,
1070
- copyFuel: data.copy_fuel ?? null,
1071
- evidenceValidation: data.evidence_validation,
1072
- evidenceSources: data.metadata?.evidence_sources ?? data.evidence_sources,
1073
- evidenceCount: data.evidence_count,
1074
- evidenceCountTotal: data.evidence_count_total,
1075
- evidenceSourcesOmitted: data.evidence_sources_omitted,
1076
- evidenceScope: data.evidence_scope,
1091
+ signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
1092
+ signalSummary: failed ? null : data.signal_summary ?? null,
1093
+ intelligence: failed ? null : data.intelligence ?? null,
1094
+ copyFuel: failed ? null : data.copy_fuel ?? null,
1095
+ evidenceValidation: failed ? void 0 : data.evidence_validation,
1096
+ evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
1097
+ evidenceCount: failed ? 0 : data.evidence_count,
1098
+ evidenceCountTotal: failed ? 0 : data.evidence_count_total,
1099
+ evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
1100
+ evidenceScope: failed ? void 0 : data.evidence_scope,
1077
1101
  billingMetadata: data.billing_metadata,
1078
1102
  resultReturnedFrom: data.result_returned_from,
1079
1103
  cacheHit: data.cache_hit,
@@ -1435,7 +1459,7 @@ function normalizeSignalToCopyResult(data) {
1435
1459
  researchPrompt: data.research_prompt,
1436
1460
  empty: data.empty,
1437
1461
  emptyReason: data.empty_reason,
1438
- researchMetadata: data.research_metadata,
1462
+ researchMetadata: failed ? void 0 : data.research_metadata,
1439
1463
  billingMetadata: data.billing_metadata,
1440
1464
  resultReturnedFrom: data.result_returned_from,
1441
1465
  cacheHit: data.cache_hit,
@@ -1460,15 +1484,29 @@ function isPendingSignalResponse(data) {
1460
1484
  return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
1461
1485
  }
1462
1486
  function coreProductResponseFailed(data) {
1463
- if (data.success === false) return true;
1464
- if (typeof data.error_code === "string" && data.error_code.trim()) return true;
1465
- if (typeof data.error === "string" && data.error.trim()) return true;
1466
- if (data.error && typeof data.error === "object" && Object.keys(data.error).length > 0) return true;
1467
- return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
1487
+ if (data.success === false || data.ok === false) return true;
1488
+ if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
1489
+ if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
1490
+ if (Array.isArray(data.errors) && data.errors.length > 0) return true;
1491
+ return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
1492
+ }
1493
+ function hasCoreProductFailureValue(value) {
1494
+ if (typeof value === "string") return value.trim().length > 0;
1495
+ if (Array.isArray(value)) return value.length > 0;
1496
+ if (value && typeof value === "object") return Object.keys(value).length > 0;
1497
+ return value === true || typeof value === "number" && value !== 0;
1468
1498
  }
1469
1499
  function coreProductErrorMessage(data) {
1470
1500
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1471
- const candidates = [nested?.message, data.message, typeof data.error === "string" ? data.error : void 0];
1501
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1502
+ const candidates = [
1503
+ nested?.message,
1504
+ firstError?.message,
1505
+ data.error_message,
1506
+ data.errorMessage,
1507
+ data.message,
1508
+ typeof data.error === "string" ? data.error : void 0
1509
+ ];
1472
1510
  for (const candidate of candidates) {
1473
1511
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1474
1512
  }
@@ -1476,7 +1514,17 @@ function coreProductErrorMessage(data) {
1476
1514
  }
1477
1515
  function coreProductErrorCode(data) {
1478
1516
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1479
- const candidates = [data.error_code, nested?.code, data.code];
1517
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1518
+ const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
1519
+ const candidates = [
1520
+ data.error_code,
1521
+ data.errorCode,
1522
+ nested?.code,
1523
+ details?.error_code,
1524
+ details?.legacy_error_code,
1525
+ firstError?.code,
1526
+ data.code
1527
+ ];
1480
1528
  for (const candidate of candidates) {
1481
1529
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1482
1530
  }
package/dist/index.js CHANGED
@@ -435,6 +435,29 @@ var Signaliz = class {
435
435
  );
436
436
  }
437
437
  async verifyEmail(email, options) {
438
+ const normalizedEmail = typeof email === "string" ? email.trim() : "";
439
+ if (options?.dryRun !== true && !options?.verificationRunId && normalizedEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) {
440
+ const error = `Invalid email format: "${normalizedEmail}"`;
441
+ return normalizeVerifyEmailResult(normalizedEmail, {
442
+ success: false,
443
+ email: normalizedEmail,
444
+ status: "completed",
445
+ is_valid: false,
446
+ is_deliverable: false,
447
+ email_verified: false,
448
+ verified_for_sending: false,
449
+ is_malformed: true,
450
+ verification_status: "malformed",
451
+ verification_verdict: "malformed",
452
+ verification_source: "input_validation",
453
+ provider_status: "rejected_before_provider",
454
+ error,
455
+ error_code: "INPUT_001",
456
+ retry_eligible: false,
457
+ credits_used: 0,
458
+ live_provider_called: false
459
+ });
460
+ }
438
461
  const request = compact({
439
462
  email: email || void 0,
440
463
  verification_run_id: options?.verificationRunId,
@@ -972,15 +995,15 @@ function normalizeFindEmailResult(data) {
972
995
  email,
973
996
  firstName: data.first_name,
974
997
  lastName: data.last_name,
975
- confidence: data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
976
- verificationStatus,
977
- isVerified: verified,
978
- isVerifiedForSending: !needsReverification && data.verified_for_sending === true,
998
+ confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
999
+ verificationStatus: failed ? "error" : verificationStatus,
1000
+ isVerified: !failed && verified,
1001
+ isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
979
1002
  isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
980
1003
  verificationFreshness,
981
1004
  verificationAgeDays,
982
1005
  verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
983
- needsReverification,
1006
+ needsReverification: failed || needsReverification,
984
1007
  providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
985
1008
  creditsUsed: data.credits_used,
986
1009
  estimatedExternalCostUsd: data.estimated_external_cost_usd,
@@ -1003,6 +1026,7 @@ function normalizeVerifyEmailResult(email, data) {
1003
1026
  const failed = coreProductResponseFailed(data);
1004
1027
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
1005
1028
  const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
1029
+ const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
1006
1030
  return {
1007
1031
  success: !failed,
1008
1032
  error: failed ? coreProductErrorMessage(data) : void 0,
@@ -1014,11 +1038,11 @@ function normalizeVerifyEmailResult(email, data) {
1014
1038
  nextPollAfterSeconds: data.next_poll_after_seconds,
1015
1039
  isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
1016
1040
  isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
1017
- isMalformed: data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed",
1041
+ isMalformed: malformed,
1018
1042
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
1019
1043
  verifiedForSending: !failed && data.verified_for_sending === true,
1020
- verificationVerdict: data.verification_verdict ?? data.verification_status ?? "unknown",
1021
- confidenceScore: data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
1044
+ verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
1045
+ confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
1022
1046
  provider: data.provider,
1023
1047
  verificationSource: data.verification_source,
1024
1048
  billingReplayed: data.billing_replayed,
@@ -1091,16 +1115,16 @@ function normalizeCompanySignalResult(params, data) {
1091
1115
  classification: signal.signal_classification ?? null
1092
1116
  };
1093
1117
  }),
1094
- signalCount: data.signal_count ?? data.total_signals ?? rawSignals.length,
1095
- signalSummary: data.signal_summary ?? null,
1096
- intelligence: data.intelligence ?? null,
1097
- copyFuel: data.copy_fuel ?? null,
1098
- evidenceValidation: data.evidence_validation,
1099
- evidenceSources: data.metadata?.evidence_sources ?? data.evidence_sources,
1100
- evidenceCount: data.evidence_count,
1101
- evidenceCountTotal: data.evidence_count_total,
1102
- evidenceSourcesOmitted: data.evidence_sources_omitted,
1103
- evidenceScope: data.evidence_scope,
1118
+ signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
1119
+ signalSummary: failed ? null : data.signal_summary ?? null,
1120
+ intelligence: failed ? null : data.intelligence ?? null,
1121
+ copyFuel: failed ? null : data.copy_fuel ?? null,
1122
+ evidenceValidation: failed ? void 0 : data.evidence_validation,
1123
+ evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
1124
+ evidenceCount: failed ? 0 : data.evidence_count,
1125
+ evidenceCountTotal: failed ? 0 : data.evidence_count_total,
1126
+ evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
1127
+ evidenceScope: failed ? void 0 : data.evidence_scope,
1104
1128
  billingMetadata: data.billing_metadata,
1105
1129
  resultReturnedFrom: data.result_returned_from,
1106
1130
  cacheHit: data.cache_hit,
@@ -1462,7 +1486,7 @@ function normalizeSignalToCopyResult(data) {
1462
1486
  researchPrompt: data.research_prompt,
1463
1487
  empty: data.empty,
1464
1488
  emptyReason: data.empty_reason,
1465
- researchMetadata: data.research_metadata,
1489
+ researchMetadata: failed ? void 0 : data.research_metadata,
1466
1490
  billingMetadata: data.billing_metadata,
1467
1491
  resultReturnedFrom: data.result_returned_from,
1468
1492
  cacheHit: data.cache_hit,
@@ -1487,15 +1511,29 @@ function isPendingSignalResponse(data) {
1487
1511
  return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
1488
1512
  }
1489
1513
  function coreProductResponseFailed(data) {
1490
- if (data.success === false) return true;
1491
- if (typeof data.error_code === "string" && data.error_code.trim()) return true;
1492
- if (typeof data.error === "string" && data.error.trim()) return true;
1493
- if (data.error && typeof data.error === "object" && Object.keys(data.error).length > 0) return true;
1494
- return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
1514
+ if (data.success === false || data.ok === false) return true;
1515
+ if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
1516
+ if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
1517
+ if (Array.isArray(data.errors) && data.errors.length > 0) return true;
1518
+ return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
1519
+ }
1520
+ function hasCoreProductFailureValue(value) {
1521
+ if (typeof value === "string") return value.trim().length > 0;
1522
+ if (Array.isArray(value)) return value.length > 0;
1523
+ if (value && typeof value === "object") return Object.keys(value).length > 0;
1524
+ return value === true || typeof value === "number" && value !== 0;
1495
1525
  }
1496
1526
  function coreProductErrorMessage(data) {
1497
1527
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1498
- const candidates = [nested?.message, data.message, typeof data.error === "string" ? data.error : void 0];
1528
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1529
+ const candidates = [
1530
+ nested?.message,
1531
+ firstError?.message,
1532
+ data.error_message,
1533
+ data.errorMessage,
1534
+ data.message,
1535
+ typeof data.error === "string" ? data.error : void 0
1536
+ ];
1499
1537
  for (const candidate of candidates) {
1500
1538
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1501
1539
  }
@@ -1503,7 +1541,17 @@ function coreProductErrorMessage(data) {
1503
1541
  }
1504
1542
  function coreProductErrorCode(data) {
1505
1543
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1506
- const candidates = [data.error_code, nested?.code, data.code];
1544
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1545
+ const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
1546
+ const candidates = [
1547
+ data.error_code,
1548
+ data.errorCode,
1549
+ nested?.code,
1550
+ details?.error_code,
1551
+ details?.legacy_error_code,
1552
+ firstError?.code,
1553
+ data.code
1554
+ ];
1507
1555
  for (const candidate of candidates) {
1508
1556
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1509
1557
  }
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Signaliz,
3
3
  SignalizError
4
- } from "./chunk-EAKP4DSS.mjs";
4
+ } from "./chunk-MFY4KSQ6.mjs";
5
5
  export {
6
6
  Signaliz,
7
7
  SignalizError
@@ -439,6 +439,29 @@ var Signaliz = class {
439
439
  );
440
440
  }
441
441
  async verifyEmail(email, options) {
442
+ const normalizedEmail = typeof email === "string" ? email.trim() : "";
443
+ if (options?.dryRun !== true && !options?.verificationRunId && normalizedEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) {
444
+ const error = `Invalid email format: "${normalizedEmail}"`;
445
+ return normalizeVerifyEmailResult(normalizedEmail, {
446
+ success: false,
447
+ email: normalizedEmail,
448
+ status: "completed",
449
+ is_valid: false,
450
+ is_deliverable: false,
451
+ email_verified: false,
452
+ verified_for_sending: false,
453
+ is_malformed: true,
454
+ verification_status: "malformed",
455
+ verification_verdict: "malformed",
456
+ verification_source: "input_validation",
457
+ provider_status: "rejected_before_provider",
458
+ error,
459
+ error_code: "INPUT_001",
460
+ retry_eligible: false,
461
+ credits_used: 0,
462
+ live_provider_called: false
463
+ });
464
+ }
442
465
  const request = compact({
443
466
  email: email || void 0,
444
467
  verification_run_id: options?.verificationRunId,
@@ -976,15 +999,15 @@ function normalizeFindEmailResult(data) {
976
999
  email,
977
1000
  firstName: data.first_name,
978
1001
  lastName: data.last_name,
979
- confidence: data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
980
- verificationStatus,
981
- isVerified: verified,
982
- isVerifiedForSending: !needsReverification && data.verified_for_sending === true,
1002
+ confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
1003
+ verificationStatus: failed ? "error" : verificationStatus,
1004
+ isVerified: !failed && verified,
1005
+ isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
983
1006
  isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
984
1007
  verificationFreshness,
985
1008
  verificationAgeDays,
986
1009
  verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
987
- needsReverification,
1010
+ needsReverification: failed || needsReverification,
988
1011
  providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
989
1012
  creditsUsed: data.credits_used,
990
1013
  estimatedExternalCostUsd: data.estimated_external_cost_usd,
@@ -1007,6 +1030,7 @@ function normalizeVerifyEmailResult(email, data) {
1007
1030
  const failed = coreProductResponseFailed(data);
1008
1031
  const verificationStatus = String(data.verification_status ?? "").toLowerCase();
1009
1032
  const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
1033
+ const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
1010
1034
  return {
1011
1035
  success: !failed,
1012
1036
  error: failed ? coreProductErrorMessage(data) : void 0,
@@ -1018,11 +1042,11 @@ function normalizeVerifyEmailResult(email, data) {
1018
1042
  nextPollAfterSeconds: data.next_poll_after_seconds,
1019
1043
  isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
1020
1044
  isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
1021
- isMalformed: data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed",
1045
+ isMalformed: malformed,
1022
1046
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
1023
1047
  verifiedForSending: !failed && data.verified_for_sending === true,
1024
- verificationVerdict: data.verification_verdict ?? data.verification_status ?? "unknown",
1025
- confidenceScore: data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
1048
+ verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
1049
+ confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
1026
1050
  provider: data.provider,
1027
1051
  verificationSource: data.verification_source,
1028
1052
  billingReplayed: data.billing_replayed,
@@ -1095,16 +1119,16 @@ function normalizeCompanySignalResult(params, data) {
1095
1119
  classification: signal.signal_classification ?? null
1096
1120
  };
1097
1121
  }),
1098
- signalCount: data.signal_count ?? data.total_signals ?? rawSignals.length,
1099
- signalSummary: data.signal_summary ?? null,
1100
- intelligence: data.intelligence ?? null,
1101
- copyFuel: data.copy_fuel ?? null,
1102
- evidenceValidation: data.evidence_validation,
1103
- evidenceSources: data.metadata?.evidence_sources ?? data.evidence_sources,
1104
- evidenceCount: data.evidence_count,
1105
- evidenceCountTotal: data.evidence_count_total,
1106
- evidenceSourcesOmitted: data.evidence_sources_omitted,
1107
- evidenceScope: data.evidence_scope,
1122
+ signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
1123
+ signalSummary: failed ? null : data.signal_summary ?? null,
1124
+ intelligence: failed ? null : data.intelligence ?? null,
1125
+ copyFuel: failed ? null : data.copy_fuel ?? null,
1126
+ evidenceValidation: failed ? void 0 : data.evidence_validation,
1127
+ evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
1128
+ evidenceCount: failed ? 0 : data.evidence_count,
1129
+ evidenceCountTotal: failed ? 0 : data.evidence_count_total,
1130
+ evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
1131
+ evidenceScope: failed ? void 0 : data.evidence_scope,
1108
1132
  billingMetadata: data.billing_metadata,
1109
1133
  resultReturnedFrom: data.result_returned_from,
1110
1134
  cacheHit: data.cache_hit,
@@ -1466,7 +1490,7 @@ function normalizeSignalToCopyResult(data) {
1466
1490
  researchPrompt: data.research_prompt,
1467
1491
  empty: data.empty,
1468
1492
  emptyReason: data.empty_reason,
1469
- researchMetadata: data.research_metadata,
1493
+ researchMetadata: failed ? void 0 : data.research_metadata,
1470
1494
  billingMetadata: data.billing_metadata,
1471
1495
  resultReturnedFrom: data.result_returned_from,
1472
1496
  cacheHit: data.cache_hit,
@@ -1491,15 +1515,29 @@ function isPendingSignalResponse(data) {
1491
1515
  return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
1492
1516
  }
1493
1517
  function coreProductResponseFailed(data) {
1494
- if (data.success === false) return true;
1495
- if (typeof data.error_code === "string" && data.error_code.trim()) return true;
1496
- if (typeof data.error === "string" && data.error.trim()) return true;
1497
- if (data.error && typeof data.error === "object" && Object.keys(data.error).length > 0) return true;
1498
- return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
1518
+ if (data.success === false || data.ok === false) return true;
1519
+ if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
1520
+ if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
1521
+ if (Array.isArray(data.errors) && data.errors.length > 0) return true;
1522
+ return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
1523
+ }
1524
+ function hasCoreProductFailureValue(value) {
1525
+ if (typeof value === "string") return value.trim().length > 0;
1526
+ if (Array.isArray(value)) return value.length > 0;
1527
+ if (value && typeof value === "object") return Object.keys(value).length > 0;
1528
+ return value === true || typeof value === "number" && value !== 0;
1499
1529
  }
1500
1530
  function coreProductErrorMessage(data) {
1501
1531
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1502
- const candidates = [nested?.message, data.message, typeof data.error === "string" ? data.error : void 0];
1532
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1533
+ const candidates = [
1534
+ nested?.message,
1535
+ firstError?.message,
1536
+ data.error_message,
1537
+ data.errorMessage,
1538
+ data.message,
1539
+ typeof data.error === "string" ? data.error : void 0
1540
+ ];
1503
1541
  for (const candidate of candidates) {
1504
1542
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1505
1543
  }
@@ -1507,7 +1545,17 @@ function coreProductErrorMessage(data) {
1507
1545
  }
1508
1546
  function coreProductErrorCode(data) {
1509
1547
  const nested = data.error && typeof data.error === "object" ? data.error : void 0;
1510
- const candidates = [data.error_code, nested?.code, data.code];
1548
+ const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
1549
+ const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
1550
+ const candidates = [
1551
+ data.error_code,
1552
+ data.errorCode,
1553
+ nested?.code,
1554
+ details?.error_code,
1555
+ details?.legacy_error_code,
1556
+ firstError?.code,
1557
+ data.code
1558
+ ];
1511
1559
  for (const candidate of candidates) {
1512
1560
  if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
1513
1561
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-EAKP4DSS.mjs";
4
+ } from "./chunk-MFY4KSQ6.mjs";
5
5
 
6
6
  // src/mcp-config.ts
7
7
  import * as fs from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaliz/sdk",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "Signaliz SDK for Signals Everything, Find Email, Verify Email, Company Signal Enrichment, and Signal to Copy AI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",