@signaliz/sdk 1.0.38 → 1.0.39

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
@@ -32,6 +32,16 @@ const verified = await signaliz.verifyEmail(found.email!, {
32
32
  skipCache: true,
33
33
  });
34
34
 
35
+ // The SDK waits for long checks by default. For an agent handoff, return early
36
+ // and resume the exact provider run later without duplicate spend.
37
+ const queuedVerification = await signaliz.verifyEmail('jane@example.com', {
38
+ skipCache: true,
39
+ waitForResult: false,
40
+ });
41
+ const resumedVerification = await signaliz.verifyEmail('jane@example.com', {
42
+ verificationRunId: queuedVerification.verificationRunId,
43
+ });
44
+
35
45
  const signals = await signaliz.enrichCompanySignals({
36
46
  companyDomain: 'example.com',
37
47
  researchPrompt: 'expansion priorities',
@@ -376,11 +376,28 @@ var Signaliz = class {
376
376
  );
377
377
  }
378
378
  async verifyEmail(email, options) {
379
- const data = await this.client.post("api/v1/verify-email", {
380
- email,
379
+ const request = compact({
380
+ email: email || void 0,
381
+ verification_run_id: options?.verificationRunId,
381
382
  skip_cache: options?.skipCache
382
383
  });
383
- return normalizeVerifyEmailResult(email, data);
384
+ let data = await this.client.post("api/v1/verify-email", request);
385
+ if (options?.waitForResult !== false && isPendingSignalResponse(data) && data.verification_run_id) {
386
+ const maxWaitMs = Math.max(1e3, options?.maxWaitMs ?? 10 * 6e4);
387
+ const startedAt = Date.now();
388
+ while (Date.now() - startedAt < maxWaitMs) {
389
+ if (!await waitForNextSignalPoll(data, options?.pollIntervalMs, startedAt, maxWaitMs)) break;
390
+ data = await this.client.post("api/v1/verify-email", compact({
391
+ email: email || void 0,
392
+ verification_run_id: data.verification_run_id
393
+ }));
394
+ if (!isPendingSignalResponse(data)) break;
395
+ }
396
+ if (isPendingSignalResponse(data)) {
397
+ throw new Error(`Email verification ${data.verification_run_id} did not complete within ${maxWaitMs}ms`);
398
+ }
399
+ }
400
+ return normalizeVerifyEmailResult(email || "", data);
384
401
  }
385
402
  async verifyEmails(emails, options) {
386
403
  validateBatchSize(emails);
@@ -868,6 +885,10 @@ function normalizeVerifyEmailResult(email, data) {
868
885
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
869
886
  return {
870
887
  email: data.email ?? email,
888
+ status: String(data.status || "").toLowerCase() === "processing" ? "processing" : "completed",
889
+ verificationRunId: data.verification_run_id ?? data.run_id,
890
+ retryAfterMs: data.retry_after_ms,
891
+ nextPollAfterSeconds: data.next_poll_after_seconds,
871
892
  isValid: data.is_valid ?? data.valid ?? verified,
872
893
  isDeliverable: data.is_deliverable ?? data.deliverable ?? verified,
873
894
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
package/dist/index.d.mts CHANGED
@@ -69,6 +69,12 @@ interface FindEmailResult {
69
69
  }
70
70
  interface VerifyEmailResult {
71
71
  email: string;
72
+ /** Execution state. Processing results are never send-safe. */
73
+ status: 'processing' | 'completed';
74
+ /** Durable Trigger run id for resuming a long verification. */
75
+ verificationRunId?: string;
76
+ retryAfterMs?: number;
77
+ nextPollAfterSeconds?: number;
72
78
  isValid: boolean;
73
79
  isDeliverable: boolean;
74
80
  isCatchAll: boolean;
@@ -80,6 +86,14 @@ interface VerifyEmailResult {
80
86
  interface VerifyEmailOptions {
81
87
  /** Bypass cached verification data for a fresh-provider quality check. */
82
88
  skipCache?: boolean;
89
+ /** Resume an existing long verification without another provider call. */
90
+ verificationRunId?: string;
91
+ /** Wait for a processing verification to finish. Defaults to true. */
92
+ waitForResult?: boolean;
93
+ /** Maximum time to wait for a processing verification. Defaults to 10 minutes. */
94
+ maxWaitMs?: number;
95
+ /** Override the server-provided polling delay. */
96
+ pollIntervalMs?: number;
83
97
  }
84
98
  interface VerifyEmailBatchOptions extends BatchOptions, VerifyEmailOptions {
85
99
  }
@@ -204,7 +218,7 @@ declare class Signaliz {
204
218
  constructor(config: SignalizConfig);
205
219
  findEmail(params: FindEmailParams): Promise<FindEmailResult>;
206
220
  findEmails(params: FindEmailParams[], options?: BatchOptions): Promise<BatchResult<FindEmailResult>>;
207
- verifyEmail(email: string, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
221
+ verifyEmail(email: string | undefined, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
208
222
  verifyEmails(emails: string[], options?: VerifyEmailBatchOptions): Promise<BatchResult<VerifyEmailResult>>;
209
223
  enrichCompanySignals(params: CompanySignalEnrichmentParams): Promise<CompanySignalEnrichmentResult>;
210
224
  enrichCompanies(companies: CompanySignalEnrichmentParams[], options?: BatchOptions): Promise<BatchResult<CompanySignalEnrichmentResult>>;
package/dist/index.d.ts CHANGED
@@ -69,6 +69,12 @@ interface FindEmailResult {
69
69
  }
70
70
  interface VerifyEmailResult {
71
71
  email: string;
72
+ /** Execution state. Processing results are never send-safe. */
73
+ status: 'processing' | 'completed';
74
+ /** Durable Trigger run id for resuming a long verification. */
75
+ verificationRunId?: string;
76
+ retryAfterMs?: number;
77
+ nextPollAfterSeconds?: number;
72
78
  isValid: boolean;
73
79
  isDeliverable: boolean;
74
80
  isCatchAll: boolean;
@@ -80,6 +86,14 @@ interface VerifyEmailResult {
80
86
  interface VerifyEmailOptions {
81
87
  /** Bypass cached verification data for a fresh-provider quality check. */
82
88
  skipCache?: boolean;
89
+ /** Resume an existing long verification without another provider call. */
90
+ verificationRunId?: string;
91
+ /** Wait for a processing verification to finish. Defaults to true. */
92
+ waitForResult?: boolean;
93
+ /** Maximum time to wait for a processing verification. Defaults to 10 minutes. */
94
+ maxWaitMs?: number;
95
+ /** Override the server-provided polling delay. */
96
+ pollIntervalMs?: number;
83
97
  }
84
98
  interface VerifyEmailBatchOptions extends BatchOptions, VerifyEmailOptions {
85
99
  }
@@ -204,7 +218,7 @@ declare class Signaliz {
204
218
  constructor(config: SignalizConfig);
205
219
  findEmail(params: FindEmailParams): Promise<FindEmailResult>;
206
220
  findEmails(params: FindEmailParams[], options?: BatchOptions): Promise<BatchResult<FindEmailResult>>;
207
- verifyEmail(email: string, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
221
+ verifyEmail(email: string | undefined, options?: VerifyEmailOptions): Promise<VerifyEmailResult>;
208
222
  verifyEmails(emails: string[], options?: VerifyEmailBatchOptions): Promise<BatchResult<VerifyEmailResult>>;
209
223
  enrichCompanySignals(params: CompanySignalEnrichmentParams): Promise<CompanySignalEnrichmentResult>;
210
224
  enrichCompanies(companies: CompanySignalEnrichmentParams[], options?: BatchOptions): Promise<BatchResult<CompanySignalEnrichmentResult>>;
package/dist/index.js CHANGED
@@ -403,11 +403,28 @@ var Signaliz = class {
403
403
  );
404
404
  }
405
405
  async verifyEmail(email, options) {
406
- const data = await this.client.post("api/v1/verify-email", {
407
- email,
406
+ const request = compact({
407
+ email: email || void 0,
408
+ verification_run_id: options?.verificationRunId,
408
409
  skip_cache: options?.skipCache
409
410
  });
410
- return normalizeVerifyEmailResult(email, data);
411
+ let data = await this.client.post("api/v1/verify-email", request);
412
+ if (options?.waitForResult !== false && isPendingSignalResponse(data) && data.verification_run_id) {
413
+ const maxWaitMs = Math.max(1e3, options?.maxWaitMs ?? 10 * 6e4);
414
+ const startedAt = Date.now();
415
+ while (Date.now() - startedAt < maxWaitMs) {
416
+ if (!await waitForNextSignalPoll(data, options?.pollIntervalMs, startedAt, maxWaitMs)) break;
417
+ data = await this.client.post("api/v1/verify-email", compact({
418
+ email: email || void 0,
419
+ verification_run_id: data.verification_run_id
420
+ }));
421
+ if (!isPendingSignalResponse(data)) break;
422
+ }
423
+ if (isPendingSignalResponse(data)) {
424
+ throw new Error(`Email verification ${data.verification_run_id} did not complete within ${maxWaitMs}ms`);
425
+ }
426
+ }
427
+ return normalizeVerifyEmailResult(email || "", data);
411
428
  }
412
429
  async verifyEmails(emails, options) {
413
430
  validateBatchSize(emails);
@@ -895,6 +912,10 @@ function normalizeVerifyEmailResult(email, data) {
895
912
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
896
913
  return {
897
914
  email: data.email ?? email,
915
+ status: String(data.status || "").toLowerCase() === "processing" ? "processing" : "completed",
916
+ verificationRunId: data.verification_run_id ?? data.run_id,
917
+ retryAfterMs: data.retry_after_ms,
918
+ nextPollAfterSeconds: data.next_poll_after_seconds,
898
919
  isValid: data.is_valid ?? data.valid ?? verified,
899
920
  isDeliverable: data.is_deliverable ?? data.deliverable ?? verified,
900
921
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Signaliz,
3
3
  SignalizError
4
- } from "./chunk-ZIYVY22X.mjs";
4
+ } from "./chunk-UVW5N4LW.mjs";
5
5
  export {
6
6
  Signaliz,
7
7
  SignalizError
@@ -407,11 +407,28 @@ var Signaliz = class {
407
407
  );
408
408
  }
409
409
  async verifyEmail(email, options) {
410
- const data = await this.client.post("api/v1/verify-email", {
411
- email,
410
+ const request = compact({
411
+ email: email || void 0,
412
+ verification_run_id: options?.verificationRunId,
412
413
  skip_cache: options?.skipCache
413
414
  });
414
- return normalizeVerifyEmailResult(email, data);
415
+ let data = await this.client.post("api/v1/verify-email", request);
416
+ if (options?.waitForResult !== false && isPendingSignalResponse(data) && data.verification_run_id) {
417
+ const maxWaitMs = Math.max(1e3, options?.maxWaitMs ?? 10 * 6e4);
418
+ const startedAt = Date.now();
419
+ while (Date.now() - startedAt < maxWaitMs) {
420
+ if (!await waitForNextSignalPoll(data, options?.pollIntervalMs, startedAt, maxWaitMs)) break;
421
+ data = await this.client.post("api/v1/verify-email", compact({
422
+ email: email || void 0,
423
+ verification_run_id: data.verification_run_id
424
+ }));
425
+ if (!isPendingSignalResponse(data)) break;
426
+ }
427
+ if (isPendingSignalResponse(data)) {
428
+ throw new Error(`Email verification ${data.verification_run_id} did not complete within ${maxWaitMs}ms`);
429
+ }
430
+ }
431
+ return normalizeVerifyEmailResult(email || "", data);
415
432
  }
416
433
  async verifyEmails(emails, options) {
417
434
  validateBatchSize(emails);
@@ -899,6 +916,10 @@ function normalizeVerifyEmailResult(email, data) {
899
916
  const verified = data.email_verified === true || ["valid", "deliverable"].includes(verificationStatus);
900
917
  return {
901
918
  email: data.email ?? email,
919
+ status: String(data.status || "").toLowerCase() === "processing" ? "processing" : "completed",
920
+ verificationRunId: data.verification_run_id ?? data.run_id,
921
+ retryAfterMs: data.retry_after_ms,
922
+ nextPollAfterSeconds: data.next_poll_after_seconds,
902
923
  isValid: data.is_valid ?? data.valid ?? verified,
903
924
  isDeliverable: data.is_deliverable ?? data.deliverable ?? verified,
904
925
  isCatchAll: data.email_is_catch_all ?? data.is_catch_all ?? data.catch_all ?? data.diagnostics?.is_catch_all ?? false,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-ZIYVY22X.mjs";
4
+ } from "./chunk-UVW5N4LW.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.38",
3
+ "version": "1.0.39",
4
4
  "description": "Signaliz SDK for Find Email, Verify Email, Company Signal Enrichment, and Signal to Copy AI.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",