@signaliz/sdk 1.0.30 → 1.0.31

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
@@ -78,8 +78,9 @@ callers never need an internal Trigger.dev status URL. The SDK follows the
78
78
  server's adaptive polling hints by default and still honors `pollIntervalMs`
79
79
  when a caller explicitly overrides the cadence.
80
80
  All four products are transported in 25-row REST chunks. Exact duplicate tasks
81
- are single-flighted without changing input order or result cardinality, and
82
- Signal to Copy also shares company research across copy recipients.
81
+ are single-flighted across the full batch before chunking, without changing
82
+ input order or result cardinality. Signal to Copy also shares company research
83
+ across copy recipients.
83
84
 
84
85
  Company Signal Enrichment defaults `online` and `enableDeepSearch` to `true`
85
86
  unless the caller explicitly disables them. Signal to Copy AI returns three
@@ -511,9 +511,16 @@ var Signaliz = class {
511
511
  async createSignalCopyBatch(requests, options) {
512
512
  validateBatchSize(requests);
513
513
  const startedAt = Date.now();
514
+ const deduplicated = dedupeExactBatchItems(requests, (params) => JSON.stringify({
515
+ request: signalToCopyRequestBody(params),
516
+ wait_for_result: params.waitForResult,
517
+ max_wait_ms: params.maxWaitMs,
518
+ poll_interval_ms: params.pollIntervalMs
519
+ }));
520
+ const uniqueRequests = deduplicated.uniqueItems;
514
521
  const chunks = [];
515
- for (let offset = 0; offset < requests.length; offset += 25) {
516
- chunks.push({ offset, requests: requests.slice(offset, offset + 25) });
522
+ for (let offset = 0; offset < uniqueRequests.length; offset += 25) {
523
+ chunks.push({ offset, requests: uniqueRequests.slice(offset, offset + 25) });
517
524
  }
518
525
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
519
526
  const chunkBatch = await runBatch(
@@ -521,12 +528,12 @@ var Signaliz = class {
521
528
  (chunk) => this.runSignalCopyBatchChunk(chunk.requests, serverConcurrency),
522
529
  { concurrency: chunkConcurrency }
523
530
  );
524
- const results = new Array(requests.length);
531
+ const uniqueResults = new Array(uniqueRequests.length);
525
532
  for (const chunkResult of chunkBatch.results) {
526
533
  const chunk = chunks[chunkResult.index];
527
534
  if (!chunkResult.success || !chunkResult.data) {
528
535
  for (let index = 0; index < chunk.requests.length; index += 1) {
529
- results[chunk.offset + index] = {
536
+ uniqueResults[chunk.offset + index] = {
530
537
  index: chunk.offset + index,
531
538
  success: false,
532
539
  error: chunkResult.error || "Signal to Copy batch request failed"
@@ -535,9 +542,13 @@ var Signaliz = class {
535
542
  continue;
536
543
  }
537
544
  for (const item of chunkResult.data) {
538
- results[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
545
+ uniqueResults[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
539
546
  }
540
547
  }
548
+ const results = requests.map((_, index) => ({
549
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
550
+ index
551
+ }));
541
552
  const succeeded = results.filter((item) => item.success).length;
542
553
  return {
543
554
  total: requests.length,
@@ -611,9 +622,11 @@ var Signaliz = class {
611
622
  }
612
623
  async runCoreBatchRound(path, tasks, options) {
613
624
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
625
+ const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
626
+ const uniqueTasks = deduplicated.uniqueItems;
614
627
  const chunks = [];
615
- for (let offset = 0; offset < tasks.length; offset += 25) {
616
- chunks.push({ offset, tasks: tasks.slice(offset, offset + 25) });
628
+ for (let offset = 0; offset < uniqueTasks.length; offset += 25) {
629
+ chunks.push({ offset, tasks: uniqueTasks.slice(offset, offset + 25) });
617
630
  }
618
631
  const chunkBatch = await runBatch(chunks, async (chunk) => {
619
632
  const data = await this.client.post(path, {
@@ -628,12 +641,12 @@ var Signaliz = class {
628
641
  }
629
642
  return data.results;
630
643
  }, { concurrency: chunkConcurrency });
631
- const results = new Array(tasks.length);
644
+ const uniqueResults = new Array(uniqueTasks.length);
632
645
  for (const chunkResult of chunkBatch.results) {
633
646
  const chunk = chunks[chunkResult.index];
634
647
  if (!chunkResult.success || !chunkResult.data) {
635
648
  for (let index = 0; index < chunk.tasks.length; index += 1) {
636
- results[chunk.offset + index] = {
649
+ uniqueResults[chunk.offset + index] = {
637
650
  index: chunk.tasks[index].index,
638
651
  success: false,
639
652
  error: chunkResult.error || `${path} batch request failed`
@@ -643,7 +656,7 @@ var Signaliz = class {
643
656
  }
644
657
  for (let index = 0; index < chunkResult.data.length; index += 1) {
645
658
  const raw = chunkResult.data[index];
646
- results[chunk.offset + index] = {
659
+ uniqueResults[chunk.offset + index] = {
647
660
  index: chunk.tasks[index].index,
648
661
  success: raw.success !== false,
649
662
  raw,
@@ -651,7 +664,10 @@ var Signaliz = class {
651
664
  };
652
665
  }
653
666
  }
654
- return results;
667
+ return tasks.map((task, index) => ({
668
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
669
+ index: task.index
670
+ }));
655
671
  }
656
672
  async listTools() {
657
673
  const result = await this.client.mcp("tools/list");
@@ -808,6 +824,22 @@ function batchConcurrencyPlan(options) {
808
824
  chunkConcurrency: Math.max(1, Math.floor(concurrency / serverConcurrency))
809
825
  };
810
826
  }
827
+ function dedupeExactBatchItems(items, keyForItem) {
828
+ const uniqueItems = [];
829
+ const sourceIndexByInput = [];
830
+ const uniqueIndexByKey = /* @__PURE__ */ new Map();
831
+ for (const item of items) {
832
+ const key = keyForItem(item);
833
+ let uniqueIndex = uniqueIndexByKey.get(key);
834
+ if (uniqueIndex === void 0) {
835
+ uniqueIndex = uniqueItems.length;
836
+ uniqueIndexByKey.set(key, uniqueIndex);
837
+ uniqueItems.push(item);
838
+ }
839
+ sourceIndexByInput.push(uniqueIndex);
840
+ }
841
+ return { uniqueItems, sourceIndexByInput };
842
+ }
811
843
  function finalizeCoreBatch(total, startedAt, round, normalize) {
812
844
  const results = new Array(total);
813
845
  for (const item of round) {
package/dist/index.js CHANGED
@@ -538,9 +538,16 @@ var Signaliz = class {
538
538
  async createSignalCopyBatch(requests, options) {
539
539
  validateBatchSize(requests);
540
540
  const startedAt = Date.now();
541
+ const deduplicated = dedupeExactBatchItems(requests, (params) => JSON.stringify({
542
+ request: signalToCopyRequestBody(params),
543
+ wait_for_result: params.waitForResult,
544
+ max_wait_ms: params.maxWaitMs,
545
+ poll_interval_ms: params.pollIntervalMs
546
+ }));
547
+ const uniqueRequests = deduplicated.uniqueItems;
541
548
  const chunks = [];
542
- for (let offset = 0; offset < requests.length; offset += 25) {
543
- chunks.push({ offset, requests: requests.slice(offset, offset + 25) });
549
+ for (let offset = 0; offset < uniqueRequests.length; offset += 25) {
550
+ chunks.push({ offset, requests: uniqueRequests.slice(offset, offset + 25) });
544
551
  }
545
552
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
546
553
  const chunkBatch = await runBatch(
@@ -548,12 +555,12 @@ var Signaliz = class {
548
555
  (chunk) => this.runSignalCopyBatchChunk(chunk.requests, serverConcurrency),
549
556
  { concurrency: chunkConcurrency }
550
557
  );
551
- const results = new Array(requests.length);
558
+ const uniqueResults = new Array(uniqueRequests.length);
552
559
  for (const chunkResult of chunkBatch.results) {
553
560
  const chunk = chunks[chunkResult.index];
554
561
  if (!chunkResult.success || !chunkResult.data) {
555
562
  for (let index = 0; index < chunk.requests.length; index += 1) {
556
- results[chunk.offset + index] = {
563
+ uniqueResults[chunk.offset + index] = {
557
564
  index: chunk.offset + index,
558
565
  success: false,
559
566
  error: chunkResult.error || "Signal to Copy batch request failed"
@@ -562,9 +569,13 @@ var Signaliz = class {
562
569
  continue;
563
570
  }
564
571
  for (const item of chunkResult.data) {
565
- results[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
572
+ uniqueResults[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
566
573
  }
567
574
  }
575
+ const results = requests.map((_, index) => ({
576
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
577
+ index
578
+ }));
568
579
  const succeeded = results.filter((item) => item.success).length;
569
580
  return {
570
581
  total: requests.length,
@@ -638,9 +649,11 @@ var Signaliz = class {
638
649
  }
639
650
  async runCoreBatchRound(path, tasks, options) {
640
651
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
652
+ const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
653
+ const uniqueTasks = deduplicated.uniqueItems;
641
654
  const chunks = [];
642
- for (let offset = 0; offset < tasks.length; offset += 25) {
643
- chunks.push({ offset, tasks: tasks.slice(offset, offset + 25) });
655
+ for (let offset = 0; offset < uniqueTasks.length; offset += 25) {
656
+ chunks.push({ offset, tasks: uniqueTasks.slice(offset, offset + 25) });
644
657
  }
645
658
  const chunkBatch = await runBatch(chunks, async (chunk) => {
646
659
  const data = await this.client.post(path, {
@@ -655,12 +668,12 @@ var Signaliz = class {
655
668
  }
656
669
  return data.results;
657
670
  }, { concurrency: chunkConcurrency });
658
- const results = new Array(tasks.length);
671
+ const uniqueResults = new Array(uniqueTasks.length);
659
672
  for (const chunkResult of chunkBatch.results) {
660
673
  const chunk = chunks[chunkResult.index];
661
674
  if (!chunkResult.success || !chunkResult.data) {
662
675
  for (let index = 0; index < chunk.tasks.length; index += 1) {
663
- results[chunk.offset + index] = {
676
+ uniqueResults[chunk.offset + index] = {
664
677
  index: chunk.tasks[index].index,
665
678
  success: false,
666
679
  error: chunkResult.error || `${path} batch request failed`
@@ -670,7 +683,7 @@ var Signaliz = class {
670
683
  }
671
684
  for (let index = 0; index < chunkResult.data.length; index += 1) {
672
685
  const raw = chunkResult.data[index];
673
- results[chunk.offset + index] = {
686
+ uniqueResults[chunk.offset + index] = {
674
687
  index: chunk.tasks[index].index,
675
688
  success: raw.success !== false,
676
689
  raw,
@@ -678,7 +691,10 @@ var Signaliz = class {
678
691
  };
679
692
  }
680
693
  }
681
- return results;
694
+ return tasks.map((task, index) => ({
695
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
696
+ index: task.index
697
+ }));
682
698
  }
683
699
  async listTools() {
684
700
  const result = await this.client.mcp("tools/list");
@@ -835,6 +851,22 @@ function batchConcurrencyPlan(options) {
835
851
  chunkConcurrency: Math.max(1, Math.floor(concurrency / serverConcurrency))
836
852
  };
837
853
  }
854
+ function dedupeExactBatchItems(items, keyForItem) {
855
+ const uniqueItems = [];
856
+ const sourceIndexByInput = [];
857
+ const uniqueIndexByKey = /* @__PURE__ */ new Map();
858
+ for (const item of items) {
859
+ const key = keyForItem(item);
860
+ let uniqueIndex = uniqueIndexByKey.get(key);
861
+ if (uniqueIndex === void 0) {
862
+ uniqueIndex = uniqueItems.length;
863
+ uniqueIndexByKey.set(key, uniqueIndex);
864
+ uniqueItems.push(item);
865
+ }
866
+ sourceIndexByInput.push(uniqueIndex);
867
+ }
868
+ return { uniqueItems, sourceIndexByInput };
869
+ }
838
870
  function finalizeCoreBatch(total, startedAt, round, normalize) {
839
871
  const results = new Array(total);
840
872
  for (const item of round) {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Signaliz,
3
3
  SignalizError
4
- } from "./chunk-INM326KO.mjs";
4
+ } from "./chunk-P3ICLKAE.mjs";
5
5
  export {
6
6
  Signaliz,
7
7
  SignalizError
@@ -542,9 +542,16 @@ var Signaliz = class {
542
542
  async createSignalCopyBatch(requests, options) {
543
543
  validateBatchSize(requests);
544
544
  const startedAt = Date.now();
545
+ const deduplicated = dedupeExactBatchItems(requests, (params) => JSON.stringify({
546
+ request: signalToCopyRequestBody(params),
547
+ wait_for_result: params.waitForResult,
548
+ max_wait_ms: params.maxWaitMs,
549
+ poll_interval_ms: params.pollIntervalMs
550
+ }));
551
+ const uniqueRequests = deduplicated.uniqueItems;
545
552
  const chunks = [];
546
- for (let offset = 0; offset < requests.length; offset += 25) {
547
- chunks.push({ offset, requests: requests.slice(offset, offset + 25) });
553
+ for (let offset = 0; offset < uniqueRequests.length; offset += 25) {
554
+ chunks.push({ offset, requests: uniqueRequests.slice(offset, offset + 25) });
548
555
  }
549
556
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
550
557
  const chunkBatch = await runBatch(
@@ -552,12 +559,12 @@ var Signaliz = class {
552
559
  (chunk) => this.runSignalCopyBatchChunk(chunk.requests, serverConcurrency),
553
560
  { concurrency: chunkConcurrency }
554
561
  );
555
- const results = new Array(requests.length);
562
+ const uniqueResults = new Array(uniqueRequests.length);
556
563
  for (const chunkResult of chunkBatch.results) {
557
564
  const chunk = chunks[chunkResult.index];
558
565
  if (!chunkResult.success || !chunkResult.data) {
559
566
  for (let index = 0; index < chunk.requests.length; index += 1) {
560
- results[chunk.offset + index] = {
567
+ uniqueResults[chunk.offset + index] = {
561
568
  index: chunk.offset + index,
562
569
  success: false,
563
570
  error: chunkResult.error || "Signal to Copy batch request failed"
@@ -566,9 +573,13 @@ var Signaliz = class {
566
573
  continue;
567
574
  }
568
575
  for (const item of chunkResult.data) {
569
- results[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
576
+ uniqueResults[chunk.offset + item.index] = { ...item, index: chunk.offset + item.index };
570
577
  }
571
578
  }
579
+ const results = requests.map((_, index) => ({
580
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
581
+ index
582
+ }));
572
583
  const succeeded = results.filter((item) => item.success).length;
573
584
  return {
574
585
  total: requests.length,
@@ -642,9 +653,11 @@ var Signaliz = class {
642
653
  }
643
654
  async runCoreBatchRound(path2, tasks, options) {
644
655
  const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
656
+ const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
657
+ const uniqueTasks = deduplicated.uniqueItems;
645
658
  const chunks = [];
646
- for (let offset = 0; offset < tasks.length; offset += 25) {
647
- chunks.push({ offset, tasks: tasks.slice(offset, offset + 25) });
659
+ for (let offset = 0; offset < uniqueTasks.length; offset += 25) {
660
+ chunks.push({ offset, tasks: uniqueTasks.slice(offset, offset + 25) });
648
661
  }
649
662
  const chunkBatch = await runBatch(chunks, async (chunk) => {
650
663
  const data = await this.client.post(path2, {
@@ -659,12 +672,12 @@ var Signaliz = class {
659
672
  }
660
673
  return data.results;
661
674
  }, { concurrency: chunkConcurrency });
662
- const results = new Array(tasks.length);
675
+ const uniqueResults = new Array(uniqueTasks.length);
663
676
  for (const chunkResult of chunkBatch.results) {
664
677
  const chunk = chunks[chunkResult.index];
665
678
  if (!chunkResult.success || !chunkResult.data) {
666
679
  for (let index = 0; index < chunk.tasks.length; index += 1) {
667
- results[chunk.offset + index] = {
680
+ uniqueResults[chunk.offset + index] = {
668
681
  index: chunk.tasks[index].index,
669
682
  success: false,
670
683
  error: chunkResult.error || `${path2} batch request failed`
@@ -674,7 +687,7 @@ var Signaliz = class {
674
687
  }
675
688
  for (let index = 0; index < chunkResult.data.length; index += 1) {
676
689
  const raw = chunkResult.data[index];
677
- results[chunk.offset + index] = {
690
+ uniqueResults[chunk.offset + index] = {
678
691
  index: chunk.tasks[index].index,
679
692
  success: raw.success !== false,
680
693
  raw,
@@ -682,7 +695,10 @@ var Signaliz = class {
682
695
  };
683
696
  }
684
697
  }
685
- return results;
698
+ return tasks.map((task, index) => ({
699
+ ...uniqueResults[deduplicated.sourceIndexByInput[index]],
700
+ index: task.index
701
+ }));
686
702
  }
687
703
  async listTools() {
688
704
  const result = await this.client.mcp("tools/list");
@@ -839,6 +855,22 @@ function batchConcurrencyPlan(options) {
839
855
  chunkConcurrency: Math.max(1, Math.floor(concurrency / serverConcurrency))
840
856
  };
841
857
  }
858
+ function dedupeExactBatchItems(items, keyForItem) {
859
+ const uniqueItems = [];
860
+ const sourceIndexByInput = [];
861
+ const uniqueIndexByKey = /* @__PURE__ */ new Map();
862
+ for (const item of items) {
863
+ const key = keyForItem(item);
864
+ let uniqueIndex = uniqueIndexByKey.get(key);
865
+ if (uniqueIndex === void 0) {
866
+ uniqueIndex = uniqueItems.length;
867
+ uniqueIndexByKey.set(key, uniqueIndex);
868
+ uniqueItems.push(item);
869
+ }
870
+ sourceIndexByInput.push(uniqueIndex);
871
+ }
872
+ return { uniqueItems, sourceIndexByInput };
873
+ }
842
874
  function finalizeCoreBatch(total, startedAt, round, normalize) {
843
875
  const results = new Array(total);
844
876
  for (const item of round) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  Signaliz
4
- } from "./chunk-INM326KO.mjs";
4
+ } from "./chunk-P3ICLKAE.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.30",
3
+ "version": "1.0.31",
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",