@signaliz/cli 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.
Files changed (3) hide show
  1. package/README.md +16 -0
  2. package/dist/bin.js +29 -6
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -43,6 +43,22 @@ signaliz company-signals --input companies.jsonl --concurrency 5 --json
43
43
  signaliz signal-to-copy --input copy-requests.jsonl --concurrency 5 --json
44
44
  ```
45
45
 
46
+ The CLI compacts exact duplicate successes by default: the first row contains
47
+ the full result and repeats contain `duplicateOf` pointing to its zero-based
48
+ input index. Use `--expand-duplicates` only when every repeated row must contain
49
+ the full payload.
50
+
51
+ For large machine-readable batches, JSONL avoids building one giant output
52
+ string and `--omit-raw` removes the duplicated provider response retained by the
53
+ SDK for diagnostics:
54
+
55
+ ```bash
56
+ signaliz company-signals --input companies.jsonl --jsonl --omit-raw
57
+ ```
58
+
59
+ JSONL writes one `{ "type": "result", ... }` line per input followed by one
60
+ `{ "type": "summary", ... }` line. Input order and cardinality are preserved.
61
+
46
62
  If a batch submission response is lost, rerun the same command with
47
63
  `--idempotency-key <key>` to recover the original job without duplicate work.
48
64
 
package/dist/bin.js CHANGED
@@ -31,6 +31,9 @@ Access and connection:
31
31
 
32
32
  Common flags:
33
33
  --json
34
+ --jsonl Emit one batch result per line plus a summary line
35
+ --omit-raw Omit duplicated provider payloads from machine output
36
+ --expand-duplicates Repeat full data for exact duplicate batch inputs
34
37
  --base-url <url>
35
38
  --input <json-or-jsonl-file> Batch up to 5,000 records with any product command
36
39
  --concurrency <1-50> Simultaneous API requests for batch input (default: 10)
@@ -111,10 +114,26 @@ function record(value) {
111
114
  function batchOptions() {
112
115
  return {
113
116
  concurrency: numberFlag("concurrency"),
114
- idempotencyKey: flag("idempotency-key")
117
+ idempotencyKey: flag("idempotency-key"),
118
+ compactDuplicates: !hasFlag("expand-duplicates")
115
119
  };
116
120
  }
117
121
  function batchOutput(value) {
122
+ if (hasFlag("jsonl")) {
123
+ for (const result of value.results) {
124
+ process.stdout.write(`${stringifyMachineJson({ type: "result", ...record(result) })}
125
+ `);
126
+ }
127
+ process.stdout.write(`${stringifyMachineJson({
128
+ type: "summary",
129
+ total: value.total,
130
+ succeeded: value.succeeded,
131
+ failed: value.failed,
132
+ durationMs: value.durationMs
133
+ })}
134
+ `);
135
+ return;
136
+ }
118
137
  output(value, () => {
119
138
  process.stdout.write(`Processed ${value.total}: ${value.succeeded} succeeded, ${value.failed} failed in ${value.durationMs}ms
120
139
  `);
@@ -134,8 +153,8 @@ function createClient() {
134
153
  });
135
154
  }
136
155
  function output(value, human) {
137
- if (hasFlag("json")) {
138
- process.stdout.write(`${JSON.stringify(value, null, 2)}
156
+ if (hasFlag("json") || hasFlag("jsonl")) {
157
+ process.stdout.write(`${stringifyMachineJson(value, hasFlag("json") ? 2 : void 0)}
139
158
  `);
140
159
  } else if (human) {
141
160
  human();
@@ -144,6 +163,10 @@ function output(value, human) {
144
163
  `);
145
164
  }
146
165
  }
166
+ function stringifyMachineJson(value, space) {
167
+ const omitRaw = hasFlag("omit-raw");
168
+ return JSON.stringify(value, omitRaw ? (key, item) => key === "raw" ? void 0 : item : void 0, space);
169
+ }
147
170
  function fail(message) {
148
171
  process.stderr.write(`${message}
149
172
  `);
@@ -463,9 +486,9 @@ Run: signaliz --help`);
463
486
  }
464
487
  main().catch((error) => {
465
488
  const message = error instanceof Error ? error.message : String(error);
466
- if (hasFlag("json")) {
489
+ if (hasFlag("json") || hasFlag("jsonl")) {
467
490
  const signalizError = error instanceof import_sdk.SignalizError ? error : null;
468
- process.stdout.write(`${JSON.stringify({
491
+ process.stdout.write(`${stringifyMachineJson({
469
492
  success: false,
470
493
  error: "product_request_failed",
471
494
  error_code: signalizError?.code || "CLI_ERROR",
@@ -473,7 +496,7 @@ main().catch((error) => {
473
496
  retry_eligible: signalizError?.isRetryable ?? false,
474
497
  ...signalizError?.errorType ? { error_type: signalizError.errorType } : {},
475
498
  ...signalizError?.details ? { details: signalizError.details } : {}
476
- }, null, 2)}
499
+ }, hasFlag("json") ? 2 : void 0)}
477
500
  `);
478
501
  process.exitCode = 1;
479
502
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaliz/cli",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "Signaliz CLI for Find Email, Verify Email, Company Signal Enrichment, and Signal to Copy AI.",
5
5
  "bin": {
6
6
  "signaliz": "dist/bin.js"
@@ -28,7 +28,7 @@
28
28
  "node": ">=18"
29
29
  },
30
30
  "dependencies": {
31
- "@signaliz/sdk": "^1.0.37"
31
+ "@signaliz/sdk": "^1.0.38"
32
32
  },
33
33
  "devDependencies": {
34
34
  "tsup": "^8.0.0",