@signaliz/sdk 1.0.58 → 1.0.59
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 +8 -4
- package/dist/{chunk-EAKP4DSS.mjs → chunk-VKBUQTDS.mjs} +51 -26
- package/dist/index.js +51 -26
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +51 -26
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,10 +114,14 @@ when the REST API supplies them, including after automatic row retries are
|
|
|
114
114
|
exhausted.
|
|
115
115
|
|
|
116
116
|
Every single-result method treats an error payload as `success: false`, even if
|
|
117
|
-
an upstream HTTP 200 omits or contradicts the success flag.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
the
|
|
117
|
+
an upstream HTTP 200 omits or contradicts the success flag. This includes
|
|
118
|
+
`ok: false`, non-empty error fields or error arrays, and terminal provider
|
|
119
|
+
statuses such as `timed_out` or `crashed`; an informational `message` alone is
|
|
120
|
+
not an error. Find Email withholds the email and every send-safe indicator,
|
|
121
|
+
Verify Email withholds deliverability and confidence, and Company Signals and
|
|
122
|
+
Signal to Copy withhold contradictory signals, narratives, and copy. Normalized
|
|
123
|
+
`error` and `errorCode` fields explain the failure while the original response
|
|
124
|
+
remains available in `raw` for audit.
|
|
121
125
|
|
|
122
126
|
For an ambiguous single request or batch submission failure, retry with the
|
|
123
127
|
same `idempotencyKey` to recover the original request, durable job, or provider
|
|
@@ -945,15 +945,15 @@ function normalizeFindEmailResult(data) {
|
|
|
945
945
|
email,
|
|
946
946
|
firstName: data.first_name,
|
|
947
947
|
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,
|
|
948
|
+
confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
|
|
949
|
+
verificationStatus: failed ? "error" : verificationStatus,
|
|
950
|
+
isVerified: !failed && verified,
|
|
951
|
+
isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
|
|
952
952
|
isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
|
|
953
953
|
verificationFreshness,
|
|
954
954
|
verificationAgeDays,
|
|
955
955
|
verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
|
|
956
|
-
needsReverification,
|
|
956
|
+
needsReverification: failed || needsReverification,
|
|
957
957
|
providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
|
|
958
958
|
creditsUsed: data.credits_used,
|
|
959
959
|
estimatedExternalCostUsd: data.estimated_external_cost_usd,
|
|
@@ -976,6 +976,7 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
976
976
|
const failed = coreProductResponseFailed(data);
|
|
977
977
|
const verificationStatus = String(data.verification_status ?? "").toLowerCase();
|
|
978
978
|
const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
|
|
979
|
+
const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
|
|
979
980
|
return {
|
|
980
981
|
success: !failed,
|
|
981
982
|
error: failed ? coreProductErrorMessage(data) : void 0,
|
|
@@ -987,11 +988,11 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
987
988
|
nextPollAfterSeconds: data.next_poll_after_seconds,
|
|
988
989
|
isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
|
|
989
990
|
isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
|
|
990
|
-
isMalformed:
|
|
991
|
+
isMalformed: malformed,
|
|
991
992
|
isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
|
|
992
993
|
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),
|
|
994
|
+
verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
|
|
995
|
+
confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
|
|
995
996
|
provider: data.provider,
|
|
996
997
|
verificationSource: data.verification_source,
|
|
997
998
|
billingReplayed: data.billing_replayed,
|
|
@@ -1064,16 +1065,16 @@ function normalizeCompanySignalResult(params, data) {
|
|
|
1064
1065
|
classification: signal.signal_classification ?? null
|
|
1065
1066
|
};
|
|
1066
1067
|
}),
|
|
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,
|
|
1068
|
+
signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
|
|
1069
|
+
signalSummary: failed ? null : data.signal_summary ?? null,
|
|
1070
|
+
intelligence: failed ? null : data.intelligence ?? null,
|
|
1071
|
+
copyFuel: failed ? null : data.copy_fuel ?? null,
|
|
1072
|
+
evidenceValidation: failed ? void 0 : data.evidence_validation,
|
|
1073
|
+
evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
|
|
1074
|
+
evidenceCount: failed ? 0 : data.evidence_count,
|
|
1075
|
+
evidenceCountTotal: failed ? 0 : data.evidence_count_total,
|
|
1076
|
+
evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
|
|
1077
|
+
evidenceScope: failed ? void 0 : data.evidence_scope,
|
|
1077
1078
|
billingMetadata: data.billing_metadata,
|
|
1078
1079
|
resultReturnedFrom: data.result_returned_from,
|
|
1079
1080
|
cacheHit: data.cache_hit,
|
|
@@ -1435,7 +1436,7 @@ function normalizeSignalToCopyResult(data) {
|
|
|
1435
1436
|
researchPrompt: data.research_prompt,
|
|
1436
1437
|
empty: data.empty,
|
|
1437
1438
|
emptyReason: data.empty_reason,
|
|
1438
|
-
researchMetadata: data.research_metadata,
|
|
1439
|
+
researchMetadata: failed ? void 0 : data.research_metadata,
|
|
1439
1440
|
billingMetadata: data.billing_metadata,
|
|
1440
1441
|
resultReturnedFrom: data.result_returned_from,
|
|
1441
1442
|
cacheHit: data.cache_hit,
|
|
@@ -1460,15 +1461,29 @@ function isPendingSignalResponse(data) {
|
|
|
1460
1461
|
return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
|
|
1461
1462
|
}
|
|
1462
1463
|
function coreProductResponseFailed(data) {
|
|
1463
|
-
if (data.success === false) return true;
|
|
1464
|
-
if (
|
|
1465
|
-
if (
|
|
1466
|
-
if (
|
|
1467
|
-
return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
|
|
1464
|
+
if (data.success === false || data.ok === false) return true;
|
|
1465
|
+
if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
|
|
1466
|
+
if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
|
|
1467
|
+
if (Array.isArray(data.errors) && data.errors.length > 0) return true;
|
|
1468
|
+
return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
|
|
1469
|
+
}
|
|
1470
|
+
function hasCoreProductFailureValue(value) {
|
|
1471
|
+
if (typeof value === "string") return value.trim().length > 0;
|
|
1472
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
1473
|
+
if (value && typeof value === "object") return Object.keys(value).length > 0;
|
|
1474
|
+
return value === true || typeof value === "number" && value !== 0;
|
|
1468
1475
|
}
|
|
1469
1476
|
function coreProductErrorMessage(data) {
|
|
1470
1477
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1471
|
-
const
|
|
1478
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1479
|
+
const candidates = [
|
|
1480
|
+
nested?.message,
|
|
1481
|
+
firstError?.message,
|
|
1482
|
+
data.error_message,
|
|
1483
|
+
data.errorMessage,
|
|
1484
|
+
data.message,
|
|
1485
|
+
typeof data.error === "string" ? data.error : void 0
|
|
1486
|
+
];
|
|
1472
1487
|
for (const candidate of candidates) {
|
|
1473
1488
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1474
1489
|
}
|
|
@@ -1476,7 +1491,17 @@ function coreProductErrorMessage(data) {
|
|
|
1476
1491
|
}
|
|
1477
1492
|
function coreProductErrorCode(data) {
|
|
1478
1493
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1479
|
-
const
|
|
1494
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1495
|
+
const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
|
|
1496
|
+
const candidates = [
|
|
1497
|
+
data.error_code,
|
|
1498
|
+
data.errorCode,
|
|
1499
|
+
nested?.code,
|
|
1500
|
+
details?.error_code,
|
|
1501
|
+
details?.legacy_error_code,
|
|
1502
|
+
firstError?.code,
|
|
1503
|
+
data.code
|
|
1504
|
+
];
|
|
1480
1505
|
for (const candidate of candidates) {
|
|
1481
1506
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1482
1507
|
}
|
package/dist/index.js
CHANGED
|
@@ -972,15 +972,15 @@ function normalizeFindEmailResult(data) {
|
|
|
972
972
|
email,
|
|
973
973
|
firstName: data.first_name,
|
|
974
974
|
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,
|
|
975
|
+
confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
|
|
976
|
+
verificationStatus: failed ? "error" : verificationStatus,
|
|
977
|
+
isVerified: !failed && verified,
|
|
978
|
+
isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
|
|
979
979
|
isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
|
|
980
980
|
verificationFreshness,
|
|
981
981
|
verificationAgeDays,
|
|
982
982
|
verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
|
|
983
|
-
needsReverification,
|
|
983
|
+
needsReverification: failed || needsReverification,
|
|
984
984
|
providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
|
|
985
985
|
creditsUsed: data.credits_used,
|
|
986
986
|
estimatedExternalCostUsd: data.estimated_external_cost_usd,
|
|
@@ -1003,6 +1003,7 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
1003
1003
|
const failed = coreProductResponseFailed(data);
|
|
1004
1004
|
const verificationStatus = String(data.verification_status ?? "").toLowerCase();
|
|
1005
1005
|
const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
|
|
1006
|
+
const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
|
|
1006
1007
|
return {
|
|
1007
1008
|
success: !failed,
|
|
1008
1009
|
error: failed ? coreProductErrorMessage(data) : void 0,
|
|
@@ -1014,11 +1015,11 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
1014
1015
|
nextPollAfterSeconds: data.next_poll_after_seconds,
|
|
1015
1016
|
isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
|
|
1016
1017
|
isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
|
|
1017
|
-
isMalformed:
|
|
1018
|
+
isMalformed: malformed,
|
|
1018
1019
|
isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
|
|
1019
1020
|
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),
|
|
1021
|
+
verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
|
|
1022
|
+
confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
|
|
1022
1023
|
provider: data.provider,
|
|
1023
1024
|
verificationSource: data.verification_source,
|
|
1024
1025
|
billingReplayed: data.billing_replayed,
|
|
@@ -1091,16 +1092,16 @@ function normalizeCompanySignalResult(params, data) {
|
|
|
1091
1092
|
classification: signal.signal_classification ?? null
|
|
1092
1093
|
};
|
|
1093
1094
|
}),
|
|
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,
|
|
1095
|
+
signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
|
|
1096
|
+
signalSummary: failed ? null : data.signal_summary ?? null,
|
|
1097
|
+
intelligence: failed ? null : data.intelligence ?? null,
|
|
1098
|
+
copyFuel: failed ? null : data.copy_fuel ?? null,
|
|
1099
|
+
evidenceValidation: failed ? void 0 : data.evidence_validation,
|
|
1100
|
+
evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
|
|
1101
|
+
evidenceCount: failed ? 0 : data.evidence_count,
|
|
1102
|
+
evidenceCountTotal: failed ? 0 : data.evidence_count_total,
|
|
1103
|
+
evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
|
|
1104
|
+
evidenceScope: failed ? void 0 : data.evidence_scope,
|
|
1104
1105
|
billingMetadata: data.billing_metadata,
|
|
1105
1106
|
resultReturnedFrom: data.result_returned_from,
|
|
1106
1107
|
cacheHit: data.cache_hit,
|
|
@@ -1462,7 +1463,7 @@ function normalizeSignalToCopyResult(data) {
|
|
|
1462
1463
|
researchPrompt: data.research_prompt,
|
|
1463
1464
|
empty: data.empty,
|
|
1464
1465
|
emptyReason: data.empty_reason,
|
|
1465
|
-
researchMetadata: data.research_metadata,
|
|
1466
|
+
researchMetadata: failed ? void 0 : data.research_metadata,
|
|
1466
1467
|
billingMetadata: data.billing_metadata,
|
|
1467
1468
|
resultReturnedFrom: data.result_returned_from,
|
|
1468
1469
|
cacheHit: data.cache_hit,
|
|
@@ -1487,15 +1488,29 @@ function isPendingSignalResponse(data) {
|
|
|
1487
1488
|
return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
|
|
1488
1489
|
}
|
|
1489
1490
|
function coreProductResponseFailed(data) {
|
|
1490
|
-
if (data.success === false) return true;
|
|
1491
|
-
if (
|
|
1492
|
-
if (
|
|
1493
|
-
if (
|
|
1494
|
-
return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
|
|
1491
|
+
if (data.success === false || data.ok === false) return true;
|
|
1492
|
+
if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
|
|
1493
|
+
if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
|
|
1494
|
+
if (Array.isArray(data.errors) && data.errors.length > 0) return true;
|
|
1495
|
+
return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
|
|
1496
|
+
}
|
|
1497
|
+
function hasCoreProductFailureValue(value) {
|
|
1498
|
+
if (typeof value === "string") return value.trim().length > 0;
|
|
1499
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
1500
|
+
if (value && typeof value === "object") return Object.keys(value).length > 0;
|
|
1501
|
+
return value === true || typeof value === "number" && value !== 0;
|
|
1495
1502
|
}
|
|
1496
1503
|
function coreProductErrorMessage(data) {
|
|
1497
1504
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1498
|
-
const
|
|
1505
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1506
|
+
const candidates = [
|
|
1507
|
+
nested?.message,
|
|
1508
|
+
firstError?.message,
|
|
1509
|
+
data.error_message,
|
|
1510
|
+
data.errorMessage,
|
|
1511
|
+
data.message,
|
|
1512
|
+
typeof data.error === "string" ? data.error : void 0
|
|
1513
|
+
];
|
|
1499
1514
|
for (const candidate of candidates) {
|
|
1500
1515
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1501
1516
|
}
|
|
@@ -1503,7 +1518,17 @@ function coreProductErrorMessage(data) {
|
|
|
1503
1518
|
}
|
|
1504
1519
|
function coreProductErrorCode(data) {
|
|
1505
1520
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1506
|
-
const
|
|
1521
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1522
|
+
const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
|
|
1523
|
+
const candidates = [
|
|
1524
|
+
data.error_code,
|
|
1525
|
+
data.errorCode,
|
|
1526
|
+
nested?.code,
|
|
1527
|
+
details?.error_code,
|
|
1528
|
+
details?.legacy_error_code,
|
|
1529
|
+
firstError?.code,
|
|
1530
|
+
data.code
|
|
1531
|
+
];
|
|
1507
1532
|
for (const candidate of candidates) {
|
|
1508
1533
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1509
1534
|
}
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -976,15 +976,15 @@ function normalizeFindEmailResult(data) {
|
|
|
976
976
|
email,
|
|
977
977
|
firstName: data.first_name,
|
|
978
978
|
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,
|
|
979
|
+
confidence: failed ? 0 : data.confidence ?? data.confidence_score ?? (verified ? 1 : 0),
|
|
980
|
+
verificationStatus: failed ? "error" : verificationStatus,
|
|
981
|
+
isVerified: !failed && verified,
|
|
982
|
+
isVerifiedForSending: !failed && !needsReverification && data.verified_for_sending === true,
|
|
983
983
|
isCatchAll: data.email_is_catch_all === true || data.is_catch_all === true,
|
|
984
984
|
verificationFreshness,
|
|
985
985
|
verificationAgeDays,
|
|
986
986
|
verifiedAt: typeof data.verified_at === "string" ? data.verified_at : null,
|
|
987
|
-
needsReverification,
|
|
987
|
+
needsReverification: failed || needsReverification,
|
|
988
988
|
providerUsed: data.provider_used ?? data.provider ?? data.email_source ?? data.source ?? "unknown",
|
|
989
989
|
creditsUsed: data.credits_used,
|
|
990
990
|
estimatedExternalCostUsd: data.estimated_external_cost_usd,
|
|
@@ -1007,6 +1007,7 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
1007
1007
|
const failed = coreProductResponseFailed(data);
|
|
1008
1008
|
const verificationStatus = String(data.verification_status ?? "").toLowerCase();
|
|
1009
1009
|
const verified = !failed && (data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus));
|
|
1010
|
+
const malformed = data.is_malformed === true || data.verification_verdict === "malformed" || data.verification_status === "malformed" || data.deliverability_status === "malformed";
|
|
1010
1011
|
return {
|
|
1011
1012
|
success: !failed,
|
|
1012
1013
|
error: failed ? coreProductErrorMessage(data) : void 0,
|
|
@@ -1018,11 +1019,11 @@ function normalizeVerifyEmailResult(email, data) {
|
|
|
1018
1019
|
nextPollAfterSeconds: data.next_poll_after_seconds,
|
|
1019
1020
|
isValid: failed ? false : data.is_valid ?? data.valid ?? verified,
|
|
1020
1021
|
isDeliverable: failed ? false : data.is_deliverable ?? data.deliverable ?? verified,
|
|
1021
|
-
isMalformed:
|
|
1022
|
+
isMalformed: malformed,
|
|
1022
1023
|
isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
|
|
1023
1024
|
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),
|
|
1025
|
+
verificationVerdict: failed ? malformed ? "malformed" : "error" : data.verification_verdict ?? data.verification_status ?? "unknown",
|
|
1026
|
+
confidenceScore: failed ? 0 : data.confidence_score ?? data.confidence ?? data.diagnostics?.confidence_score ?? (verified ? 1 : 0),
|
|
1026
1027
|
provider: data.provider,
|
|
1027
1028
|
verificationSource: data.verification_source,
|
|
1028
1029
|
billingReplayed: data.billing_replayed,
|
|
@@ -1095,16 +1096,16 @@ function normalizeCompanySignalResult(params, data) {
|
|
|
1095
1096
|
classification: signal.signal_classification ?? null
|
|
1096
1097
|
};
|
|
1097
1098
|
}),
|
|
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,
|
|
1099
|
+
signalCount: failed ? 0 : data.signal_count ?? data.total_signals ?? rawSignals.length,
|
|
1100
|
+
signalSummary: failed ? null : data.signal_summary ?? null,
|
|
1101
|
+
intelligence: failed ? null : data.intelligence ?? null,
|
|
1102
|
+
copyFuel: failed ? null : data.copy_fuel ?? null,
|
|
1103
|
+
evidenceValidation: failed ? void 0 : data.evidence_validation,
|
|
1104
|
+
evidenceSources: failed ? [] : data.metadata?.evidence_sources ?? data.evidence_sources,
|
|
1105
|
+
evidenceCount: failed ? 0 : data.evidence_count,
|
|
1106
|
+
evidenceCountTotal: failed ? 0 : data.evidence_count_total,
|
|
1107
|
+
evidenceSourcesOmitted: failed ? 0 : data.evidence_sources_omitted,
|
|
1108
|
+
evidenceScope: failed ? void 0 : data.evidence_scope,
|
|
1108
1109
|
billingMetadata: data.billing_metadata,
|
|
1109
1110
|
resultReturnedFrom: data.result_returned_from,
|
|
1110
1111
|
cacheHit: data.cache_hit,
|
|
@@ -1466,7 +1467,7 @@ function normalizeSignalToCopyResult(data) {
|
|
|
1466
1467
|
researchPrompt: data.research_prompt,
|
|
1467
1468
|
empty: data.empty,
|
|
1468
1469
|
emptyReason: data.empty_reason,
|
|
1469
|
-
researchMetadata: data.research_metadata,
|
|
1470
|
+
researchMetadata: failed ? void 0 : data.research_metadata,
|
|
1470
1471
|
billingMetadata: data.billing_metadata,
|
|
1471
1472
|
resultReturnedFrom: data.result_returned_from,
|
|
1472
1473
|
cacheHit: data.cache_hit,
|
|
@@ -1491,15 +1492,29 @@ function isPendingSignalResponse(data) {
|
|
|
1491
1492
|
return ["triggered", "queued", "processing", "pending", "pending_version", "waiting_for_deploy"].includes(String(data.status || "").toLowerCase());
|
|
1492
1493
|
}
|
|
1493
1494
|
function coreProductResponseFailed(data) {
|
|
1494
|
-
if (data.success === false) return true;
|
|
1495
|
-
if (
|
|
1496
|
-
if (
|
|
1497
|
-
if (
|
|
1498
|
-
return ["failed", "error", "cancelled", "canceled"].includes(String(data.status || "").toLowerCase());
|
|
1495
|
+
if (data.success === false || data.ok === false) return true;
|
|
1496
|
+
if (hasCoreProductFailureValue(data.error_code) || hasCoreProductFailureValue(data.errorCode)) return true;
|
|
1497
|
+
if (hasCoreProductFailureValue(data.error) || hasCoreProductFailureValue(data.error_message) || hasCoreProductFailureValue(data.errorMessage)) return true;
|
|
1498
|
+
if (Array.isArray(data.errors) && data.errors.length > 0) return true;
|
|
1499
|
+
return ["failed", "error", "cancelled", "canceled", "crashed", "timed_out", "system_failure"].includes(String(data.status || "").toLowerCase());
|
|
1500
|
+
}
|
|
1501
|
+
function hasCoreProductFailureValue(value) {
|
|
1502
|
+
if (typeof value === "string") return value.trim().length > 0;
|
|
1503
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
1504
|
+
if (value && typeof value === "object") return Object.keys(value).length > 0;
|
|
1505
|
+
return value === true || typeof value === "number" && value !== 0;
|
|
1499
1506
|
}
|
|
1500
1507
|
function coreProductErrorMessage(data) {
|
|
1501
1508
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1502
|
-
const
|
|
1509
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1510
|
+
const candidates = [
|
|
1511
|
+
nested?.message,
|
|
1512
|
+
firstError?.message,
|
|
1513
|
+
data.error_message,
|
|
1514
|
+
data.errorMessage,
|
|
1515
|
+
data.message,
|
|
1516
|
+
typeof data.error === "string" ? data.error : void 0
|
|
1517
|
+
];
|
|
1503
1518
|
for (const candidate of candidates) {
|
|
1504
1519
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1505
1520
|
}
|
|
@@ -1507,7 +1522,17 @@ function coreProductErrorMessage(data) {
|
|
|
1507
1522
|
}
|
|
1508
1523
|
function coreProductErrorCode(data) {
|
|
1509
1524
|
const nested = data.error && typeof data.error === "object" ? data.error : void 0;
|
|
1510
|
-
const
|
|
1525
|
+
const firstError = Array.isArray(data.errors) ? data.errors[0] : void 0;
|
|
1526
|
+
const details = firstError?.details && typeof firstError.details === "object" ? firstError.details : void 0;
|
|
1527
|
+
const candidates = [
|
|
1528
|
+
data.error_code,
|
|
1529
|
+
data.errorCode,
|
|
1530
|
+
nested?.code,
|
|
1531
|
+
details?.error_code,
|
|
1532
|
+
details?.legacy_error_code,
|
|
1533
|
+
firstError?.code,
|
|
1534
|
+
data.code
|
|
1535
|
+
];
|
|
1511
1536
|
for (const candidate of candidates) {
|
|
1512
1537
|
if (typeof candidate === "string" && candidate.trim()) return candidate.trim();
|
|
1513
1538
|
}
|
package/dist/mcp-config.mjs
CHANGED
package/package.json
CHANGED