@signaliz/cli 1.0.37 → 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 +19 -0
- package/dist/bin.js +36 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,6 +43,25 @@ 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
|
+
# Stream JSONL directly from another process; no temporary file is required.
|
|
59
|
+
generate-company-rows | signaliz company-signals --input - --jsonl --omit-raw
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
JSONL writes one `{ "type": "result", ... }` line per input followed by one
|
|
63
|
+
`{ "type": "summary", ... }` line. Input order and cardinality are preserved.
|
|
64
|
+
|
|
46
65
|
If a batch submission response is lost, rerun the same command with
|
|
47
66
|
`--idempotency-key <key>` to recover the original job without duplicate work.
|
|
48
67
|
|
package/dist/bin.js
CHANGED
|
@@ -31,8 +31,12 @@ 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
|
|
39
|
+
--input - Read a JSON array or JSONL batch from stdin
|
|
36
40
|
--concurrency <1-50> Simultaneous API requests for batch input (default: 10)
|
|
37
41
|
--idempotency-key <key> Reuse after an ambiguous batch submission to recover the same job
|
|
38
42
|
`;
|
|
@@ -82,24 +86,25 @@ function csvFlag(name) {
|
|
|
82
86
|
function readBatchInput() {
|
|
83
87
|
const path = flag("input");
|
|
84
88
|
if (!path) return null;
|
|
89
|
+
const source = path === "-" ? "stdin" : path;
|
|
85
90
|
let raw;
|
|
86
91
|
try {
|
|
87
|
-
raw = (0, import_node_fs.readFileSync)(path, "utf8").trim();
|
|
92
|
+
raw = (0, import_node_fs.readFileSync)(path === "-" ? 0 : path, "utf8").trim();
|
|
88
93
|
} catch (error) {
|
|
89
|
-
fail(`Unable to read --input
|
|
94
|
+
fail(`Unable to read --input ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
90
95
|
}
|
|
91
|
-
if (!raw) fail(
|
|
96
|
+
if (!raw) fail(`--input ${source} must contain at least one record`);
|
|
92
97
|
let rows;
|
|
93
98
|
try {
|
|
94
99
|
rows = raw.startsWith("[") ? JSON.parse(raw) : raw.split(/\r?\n/).filter(Boolean).map((line, index) => {
|
|
95
100
|
try {
|
|
96
101
|
return JSON.parse(line);
|
|
97
102
|
} catch {
|
|
98
|
-
fail(`Invalid JSON on line ${index + 1} of ${
|
|
103
|
+
fail(`Invalid JSON on line ${index + 1} of ${source}`);
|
|
99
104
|
}
|
|
100
105
|
});
|
|
101
106
|
} catch (error) {
|
|
102
|
-
fail(`Invalid JSON in --input
|
|
107
|
+
fail(`Invalid JSON in --input ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
103
108
|
}
|
|
104
109
|
if (!Array.isArray(rows) || rows.length === 0) fail("--input must be a non-empty JSON array or JSONL file");
|
|
105
110
|
if (rows.length > 5e3) fail(`--input supports at most 5,000 records; received ${rows.length}`);
|
|
@@ -111,10 +116,26 @@ function record(value) {
|
|
|
111
116
|
function batchOptions() {
|
|
112
117
|
return {
|
|
113
118
|
concurrency: numberFlag("concurrency"),
|
|
114
|
-
idempotencyKey: flag("idempotency-key")
|
|
119
|
+
idempotencyKey: flag("idempotency-key"),
|
|
120
|
+
compactDuplicates: !hasFlag("expand-duplicates")
|
|
115
121
|
};
|
|
116
122
|
}
|
|
117
123
|
function batchOutput(value) {
|
|
124
|
+
if (hasFlag("jsonl")) {
|
|
125
|
+
for (const result of value.results) {
|
|
126
|
+
process.stdout.write(`${stringifyMachineJson({ type: "result", ...record(result) })}
|
|
127
|
+
`);
|
|
128
|
+
}
|
|
129
|
+
process.stdout.write(`${stringifyMachineJson({
|
|
130
|
+
type: "summary",
|
|
131
|
+
total: value.total,
|
|
132
|
+
succeeded: value.succeeded,
|
|
133
|
+
failed: value.failed,
|
|
134
|
+
durationMs: value.durationMs
|
|
135
|
+
})}
|
|
136
|
+
`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
118
139
|
output(value, () => {
|
|
119
140
|
process.stdout.write(`Processed ${value.total}: ${value.succeeded} succeeded, ${value.failed} failed in ${value.durationMs}ms
|
|
120
141
|
`);
|
|
@@ -134,8 +155,8 @@ function createClient() {
|
|
|
134
155
|
});
|
|
135
156
|
}
|
|
136
157
|
function output(value, human) {
|
|
137
|
-
if (hasFlag("json")) {
|
|
138
|
-
process.stdout.write(`${
|
|
158
|
+
if (hasFlag("json") || hasFlag("jsonl")) {
|
|
159
|
+
process.stdout.write(`${stringifyMachineJson(value, hasFlag("json") ? 2 : void 0)}
|
|
139
160
|
`);
|
|
140
161
|
} else if (human) {
|
|
141
162
|
human();
|
|
@@ -144,6 +165,10 @@ function output(value, human) {
|
|
|
144
165
|
`);
|
|
145
166
|
}
|
|
146
167
|
}
|
|
168
|
+
function stringifyMachineJson(value, space) {
|
|
169
|
+
const omitRaw = hasFlag("omit-raw");
|
|
170
|
+
return JSON.stringify(value, omitRaw ? (key, item) => key === "raw" ? void 0 : item : void 0, space);
|
|
171
|
+
}
|
|
147
172
|
function fail(message) {
|
|
148
173
|
process.stderr.write(`${message}
|
|
149
174
|
`);
|
|
@@ -463,9 +488,9 @@ Run: signaliz --help`);
|
|
|
463
488
|
}
|
|
464
489
|
main().catch((error) => {
|
|
465
490
|
const message = error instanceof Error ? error.message : String(error);
|
|
466
|
-
if (hasFlag("json")) {
|
|
491
|
+
if (hasFlag("json") || hasFlag("jsonl")) {
|
|
467
492
|
const signalizError = error instanceof import_sdk.SignalizError ? error : null;
|
|
468
|
-
process.stdout.write(`${
|
|
493
|
+
process.stdout.write(`${stringifyMachineJson({
|
|
469
494
|
success: false,
|
|
470
495
|
error: "product_request_failed",
|
|
471
496
|
error_code: signalizError?.code || "CLI_ERROR",
|
|
@@ -473,7 +498,7 @@ main().catch((error) => {
|
|
|
473
498
|
retry_eligible: signalizError?.isRetryable ?? false,
|
|
474
499
|
...signalizError?.errorType ? { error_type: signalizError.errorType } : {},
|
|
475
500
|
...signalizError?.details ? { details: signalizError.details } : {}
|
|
476
|
-
},
|
|
501
|
+
}, hasFlag("json") ? 2 : void 0)}
|
|
477
502
|
`);
|
|
478
503
|
process.exitCode = 1;
|
|
479
504
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaliz/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
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.
|
|
31
|
+
"@signaliz/sdk": "^1.0.38"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"tsup": "^8.0.0",
|