@signaliz/sdk 1.0.37 → 1.0.38

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
@@ -70,6 +70,13 @@ const verifiedBatch = await signaliz.verifyEmails(emails, { concurrency: 20 });
70
70
  const foundBatch = await signaliz.findEmails(contacts, { concurrency: 20 });
71
71
  const signalBatch = await signaliz.enrichCompanies(companies, { concurrency: 5 });
72
72
  const copyBatch = await signaliz.createSignalCopyBatch(copyRequests, { concurrency: 5 });
73
+
74
+ // Keep one full result for exact repeats and return duplicateOf references for
75
+ // the rest. This is lossless and avoids multiplying evidence-rich payloads.
76
+ const compactSignals = await signaliz.enrichCompanies(companies, {
77
+ concurrency: 5,
78
+ compactDuplicates: true,
79
+ });
73
80
  ```
74
81
 
75
82
  For an ambiguous submission failure, retry with the same
@@ -81,7 +88,10 @@ callers never need an internal Trigger.dev status URL. The SDK follows the
81
88
  server's adaptive polling hints by default and still honors `pollIntervalMs`
82
89
  when a caller explicitly overrides the cadence.
83
90
  Exact duplicate tasks are single-flighted across each full batch without
84
- changing input order or result cardinality. Find Email and Verify Email batches
91
+ changing input order or result cardinality. Set `compactDuplicates: true` to
92
+ return repeated successful rows as `duplicateOf` references to the zero-based
93
+ canonical input index; the default remains expanded for compatibility. Find Email and Verify Email
94
+ batches
85
95
  larger than 25 use one cache-aware recoverable REST job with 500-row result
86
96
  pages. Uniform Company Signal Enrichment batches larger than 25 use one
87
97
  cache-aware recoverable REST job with 25-row result pages; heterogeneous,
@@ -371,7 +371,8 @@ var Signaliz = class {
371
371
  params.length,
372
372
  startedAt,
373
373
  round,
374
- (item) => normalizeFindEmailResult(item.raw)
374
+ (item) => normalizeFindEmailResult(item.raw),
375
+ options
375
376
  );
376
377
  }
377
378
  async verifyEmail(email, options) {
@@ -396,7 +397,8 @@ var Signaliz = class {
396
397
  emails.length,
397
398
  startedAt,
398
399
  round,
399
- (item) => normalizeVerifyEmailResult(emails[item.index], item.raw)
400
+ (item) => normalizeVerifyEmailResult(emails[item.index], item.raw),
401
+ options
400
402
  );
401
403
  }
402
404
  async enrichCompanySignals(params) {
@@ -491,13 +493,14 @@ var Signaliz = class {
491
493
  await sleep2(Math.max(1, nextDelayMs));
492
494
  pending = nextPending;
493
495
  }
494
- const succeeded = results.filter((item) => item.success).length;
496
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
497
+ const succeeded = compactedResults.filter((item) => item.success).length;
495
498
  return {
496
499
  total: companies.length,
497
500
  succeeded,
498
501
  failed: companies.length - succeeded,
499
502
  durationMs: Date.now() - startedAt,
500
- results
503
+ results: compactedResults
501
504
  };
502
505
  }
503
506
  async signalToCopy(params) {
@@ -538,13 +541,14 @@ var Signaliz = class {
538
541
  ...uniqueResults[deduplicated.sourceIndexByInput[index]],
539
542
  index
540
543
  }));
541
- const succeeded = results.filter((item) => item.success).length;
544
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
545
+ const succeeded = compactedResults.filter((item) => item.success).length;
542
546
  return {
543
547
  total: requests.length,
544
548
  succeeded,
545
549
  failed: requests.length - succeeded,
546
550
  durationMs: Date.now() - startedAt,
547
- results
551
+ results: compactedResults
548
552
  };
549
553
  }
550
554
  async runSignalCopyBatchChunks(uniqueRequests, options) {
@@ -997,7 +1001,7 @@ function dedupeExactBatchItems(items, keyForItem) {
997
1001
  }
998
1002
  return { uniqueItems, sourceIndexByInput };
999
1003
  }
1000
- function finalizeCoreBatch(total, startedAt, round, normalize) {
1004
+ function finalizeCoreBatch(total, startedAt, round, normalize, options) {
1001
1005
  const results = new Array(total);
1002
1006
  for (const item of round) {
1003
1007
  if (!item.success || !item.raw) {
@@ -1014,15 +1018,31 @@ function finalizeCoreBatch(total, startedAt, round, normalize) {
1014
1018
  };
1015
1019
  }
1016
1020
  }
1017
- const succeeded = results.filter((item) => item.success).length;
1021
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
1022
+ const succeeded = compactedResults.filter((item) => item.success).length;
1018
1023
  return {
1019
1024
  total,
1020
1025
  succeeded,
1021
1026
  failed: total - succeeded,
1022
1027
  durationMs: Date.now() - startedAt,
1023
- results
1028
+ results: compactedResults
1024
1029
  };
1025
1030
  }
1031
+ function compactExactDuplicateResults(results, enabled) {
1032
+ if (!enabled) return results;
1033
+ const sourceIndexByRaw = /* @__PURE__ */ new WeakMap();
1034
+ return results.map((item) => {
1035
+ if (!item.success || !item.data || typeof item.data !== "object") return item;
1036
+ const raw = item.data.raw;
1037
+ if (!raw || typeof raw !== "object") return item;
1038
+ const duplicateOf = sourceIndexByRaw.get(raw);
1039
+ if (duplicateOf !== void 0) {
1040
+ return { index: item.index, success: true, duplicateOf };
1041
+ }
1042
+ sourceIndexByRaw.set(raw, item.index);
1043
+ return item;
1044
+ });
1045
+ }
1026
1046
  function signalToCopyRequestBody(params) {
1027
1047
  return compact({
1028
1048
  company_domain: params.companyDomain,
package/dist/index.d.mts CHANGED
@@ -11,12 +11,16 @@ interface BatchOptions {
11
11
  concurrency?: number;
12
12
  /** Stable key for safely retrying an ambiguous recoverable batch submission. */
13
13
  idempotencyKey?: string;
14
+ /** Return exact repeated successes as duplicateOf references. Defaults to false. */
15
+ compactDuplicates?: boolean;
14
16
  }
15
17
  interface BatchItemResult<T> {
16
18
  index: number;
17
19
  success: boolean;
18
20
  data?: T;
19
21
  error?: string;
22
+ /** Zero-based input index containing the full result for this exact duplicate. */
23
+ duplicateOf?: number;
20
24
  }
21
25
  interface BatchResult<T> {
22
26
  total: number;
package/dist/index.d.ts CHANGED
@@ -11,12 +11,16 @@ interface BatchOptions {
11
11
  concurrency?: number;
12
12
  /** Stable key for safely retrying an ambiguous recoverable batch submission. */
13
13
  idempotencyKey?: string;
14
+ /** Return exact repeated successes as duplicateOf references. Defaults to false. */
15
+ compactDuplicates?: boolean;
14
16
  }
15
17
  interface BatchItemResult<T> {
16
18
  index: number;
17
19
  success: boolean;
18
20
  data?: T;
19
21
  error?: string;
22
+ /** Zero-based input index containing the full result for this exact duplicate. */
23
+ duplicateOf?: number;
20
24
  }
21
25
  interface BatchResult<T> {
22
26
  total: number;
package/dist/index.js CHANGED
@@ -398,7 +398,8 @@ var Signaliz = class {
398
398
  params.length,
399
399
  startedAt,
400
400
  round,
401
- (item) => normalizeFindEmailResult(item.raw)
401
+ (item) => normalizeFindEmailResult(item.raw),
402
+ options
402
403
  );
403
404
  }
404
405
  async verifyEmail(email, options) {
@@ -423,7 +424,8 @@ var Signaliz = class {
423
424
  emails.length,
424
425
  startedAt,
425
426
  round,
426
- (item) => normalizeVerifyEmailResult(emails[item.index], item.raw)
427
+ (item) => normalizeVerifyEmailResult(emails[item.index], item.raw),
428
+ options
427
429
  );
428
430
  }
429
431
  async enrichCompanySignals(params) {
@@ -518,13 +520,14 @@ var Signaliz = class {
518
520
  await sleep2(Math.max(1, nextDelayMs));
519
521
  pending = nextPending;
520
522
  }
521
- const succeeded = results.filter((item) => item.success).length;
523
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
524
+ const succeeded = compactedResults.filter((item) => item.success).length;
522
525
  return {
523
526
  total: companies.length,
524
527
  succeeded,
525
528
  failed: companies.length - succeeded,
526
529
  durationMs: Date.now() - startedAt,
527
- results
530
+ results: compactedResults
528
531
  };
529
532
  }
530
533
  async signalToCopy(params) {
@@ -565,13 +568,14 @@ var Signaliz = class {
565
568
  ...uniqueResults[deduplicated.sourceIndexByInput[index]],
566
569
  index
567
570
  }));
568
- const succeeded = results.filter((item) => item.success).length;
571
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
572
+ const succeeded = compactedResults.filter((item) => item.success).length;
569
573
  return {
570
574
  total: requests.length,
571
575
  succeeded,
572
576
  failed: requests.length - succeeded,
573
577
  durationMs: Date.now() - startedAt,
574
- results
578
+ results: compactedResults
575
579
  };
576
580
  }
577
581
  async runSignalCopyBatchChunks(uniqueRequests, options) {
@@ -1024,7 +1028,7 @@ function dedupeExactBatchItems(items, keyForItem) {
1024
1028
  }
1025
1029
  return { uniqueItems, sourceIndexByInput };
1026
1030
  }
1027
- function finalizeCoreBatch(total, startedAt, round, normalize) {
1031
+ function finalizeCoreBatch(total, startedAt, round, normalize, options) {
1028
1032
  const results = new Array(total);
1029
1033
  for (const item of round) {
1030
1034
  if (!item.success || !item.raw) {
@@ -1041,15 +1045,31 @@ function finalizeCoreBatch(total, startedAt, round, normalize) {
1041
1045
  };
1042
1046
  }
1043
1047
  }
1044
- const succeeded = results.filter((item) => item.success).length;
1048
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
1049
+ const succeeded = compactedResults.filter((item) => item.success).length;
1045
1050
  return {
1046
1051
  total,
1047
1052
  succeeded,
1048
1053
  failed: total - succeeded,
1049
1054
  durationMs: Date.now() - startedAt,
1050
- results
1055
+ results: compactedResults
1051
1056
  };
1052
1057
  }
1058
+ function compactExactDuplicateResults(results, enabled) {
1059
+ if (!enabled) return results;
1060
+ const sourceIndexByRaw = /* @__PURE__ */ new WeakMap();
1061
+ return results.map((item) => {
1062
+ if (!item.success || !item.data || typeof item.data !== "object") return item;
1063
+ const raw = item.data.raw;
1064
+ if (!raw || typeof raw !== "object") return item;
1065
+ const duplicateOf = sourceIndexByRaw.get(raw);
1066
+ if (duplicateOf !== void 0) {
1067
+ return { index: item.index, success: true, duplicateOf };
1068
+ }
1069
+ sourceIndexByRaw.set(raw, item.index);
1070
+ return item;
1071
+ });
1072
+ }
1053
1073
  function signalToCopyRequestBody(params) {
1054
1074
  return compact({
1055
1075
  company_domain: params.companyDomain,
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Signaliz,
3
3
  SignalizError
4
- } from "./chunk-WHD7INKU.mjs";
4
+ } from "./chunk-ZIYVY22X.mjs";
5
5
  export {
6
6
  Signaliz,
7
7
  SignalizError
@@ -402,7 +402,8 @@ var Signaliz = class {
402
402
  params.length,
403
403
  startedAt,
404
404
  round,
405
- (item) => normalizeFindEmailResult(item.raw)
405
+ (item) => normalizeFindEmailResult(item.raw),
406
+ options
406
407
  );
407
408
  }
408
409
  async verifyEmail(email, options) {
@@ -427,7 +428,8 @@ var Signaliz = class {
427
428
  emails.length,
428
429
  startedAt,
429
430
  round,
430
- (item) => normalizeVerifyEmailResult(emails[item.index], item.raw)
431
+ (item) => normalizeVerifyEmailResult(emails[item.index], item.raw),
432
+ options
431
433
  );
432
434
  }
433
435
  async enrichCompanySignals(params) {
@@ -522,13 +524,14 @@ var Signaliz = class {
522
524
  await sleep2(Math.max(1, nextDelayMs));
523
525
  pending = nextPending;
524
526
  }
525
- const succeeded = results.filter((item) => item.success).length;
527
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
528
+ const succeeded = compactedResults.filter((item) => item.success).length;
526
529
  return {
527
530
  total: companies.length,
528
531
  succeeded,
529
532
  failed: companies.length - succeeded,
530
533
  durationMs: Date.now() - startedAt,
531
- results
534
+ results: compactedResults
532
535
  };
533
536
  }
534
537
  async signalToCopy(params) {
@@ -569,13 +572,14 @@ var Signaliz = class {
569
572
  ...uniqueResults[deduplicated.sourceIndexByInput[index]],
570
573
  index
571
574
  }));
572
- const succeeded = results.filter((item) => item.success).length;
575
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
576
+ const succeeded = compactedResults.filter((item) => item.success).length;
573
577
  return {
574
578
  total: requests.length,
575
579
  succeeded,
576
580
  failed: requests.length - succeeded,
577
581
  durationMs: Date.now() - startedAt,
578
- results
582
+ results: compactedResults
579
583
  };
580
584
  }
581
585
  async runSignalCopyBatchChunks(uniqueRequests, options) {
@@ -1028,7 +1032,7 @@ function dedupeExactBatchItems(items, keyForItem) {
1028
1032
  }
1029
1033
  return { uniqueItems, sourceIndexByInput };
1030
1034
  }
1031
- function finalizeCoreBatch(total, startedAt, round, normalize) {
1035
+ function finalizeCoreBatch(total, startedAt, round, normalize, options) {
1032
1036
  const results = new Array(total);
1033
1037
  for (const item of round) {
1034
1038
  if (!item.success || !item.raw) {
@@ -1045,15 +1049,31 @@ function finalizeCoreBatch(total, startedAt, round, normalize) {
1045
1049
  };
1046
1050
  }
1047
1051
  }
1048
- const succeeded = results.filter((item) => item.success).length;
1052
+ const compactedResults = compactExactDuplicateResults(results, options?.compactDuplicates === true);
1053
+ const succeeded = compactedResults.filter((item) => item.success).length;
1049
1054
  return {
1050
1055
  total,
1051
1056
  succeeded,
1052
1057
  failed: total - succeeded,
1053
1058
  durationMs: Date.now() - startedAt,
1054
- results
1059
+ results: compactedResults
1055
1060
  };
1056
1061
  }
1062
+ function compactExactDuplicateResults(results, enabled) {
1063
+ if (!enabled) return results;
1064
+ const sourceIndexByRaw = /* @__PURE__ */ new WeakMap();
1065
+ return results.map((item) => {
1066
+ if (!item.success || !item.data || typeof item.data !== "object") return item;
1067
+ const raw = item.data.raw;
1068
+ if (!raw || typeof raw !== "object") return item;
1069
+ const duplicateOf = sourceIndexByRaw.get(raw);
1070
+ if (duplicateOf !== void 0) {
1071
+ return { index: item.index, success: true, duplicateOf };
1072
+ }
1073
+ sourceIndexByRaw.set(raw, item.index);
1074
+ return item;
1075
+ });
1076
+ }
1057
1077
  function signalToCopyRequestBody(params) {
1058
1078
  return compact({
1059
1079
  company_domain: params.companyDomain,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-WHD7INKU.mjs";
4
+ } from "./chunk-ZIYVY22X.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.37",
3
+ "version": "1.0.38",
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",