@signaliz/cli 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 +3 -0
- package/dist/bin.js +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,9 @@ SDK for diagnostics:
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
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
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
JSONL writes one `{ "type": "result", ... }` line per input followed by one
|
package/dist/bin.js
CHANGED
|
@@ -36,6 +36,7 @@ Common flags:
|
|
|
36
36
|
--expand-duplicates Repeat full data for exact duplicate batch inputs
|
|
37
37
|
--base-url <url>
|
|
38
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
|
|
39
40
|
--concurrency <1-50> Simultaneous API requests for batch input (default: 10)
|
|
40
41
|
--idempotency-key <key> Reuse after an ambiguous batch submission to recover the same job
|
|
41
42
|
`;
|
|
@@ -85,24 +86,25 @@ function csvFlag(name) {
|
|
|
85
86
|
function readBatchInput() {
|
|
86
87
|
const path = flag("input");
|
|
87
88
|
if (!path) return null;
|
|
89
|
+
const source = path === "-" ? "stdin" : path;
|
|
88
90
|
let raw;
|
|
89
91
|
try {
|
|
90
|
-
raw = (0, import_node_fs.readFileSync)(path, "utf8").trim();
|
|
92
|
+
raw = (0, import_node_fs.readFileSync)(path === "-" ? 0 : path, "utf8").trim();
|
|
91
93
|
} catch (error) {
|
|
92
|
-
fail(`Unable to read --input
|
|
94
|
+
fail(`Unable to read --input ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
95
|
}
|
|
94
|
-
if (!raw) fail(
|
|
96
|
+
if (!raw) fail(`--input ${source} must contain at least one record`);
|
|
95
97
|
let rows;
|
|
96
98
|
try {
|
|
97
99
|
rows = raw.startsWith("[") ? JSON.parse(raw) : raw.split(/\r?\n/).filter(Boolean).map((line, index) => {
|
|
98
100
|
try {
|
|
99
101
|
return JSON.parse(line);
|
|
100
102
|
} catch {
|
|
101
|
-
fail(`Invalid JSON on line ${index + 1} of ${
|
|
103
|
+
fail(`Invalid JSON on line ${index + 1} of ${source}`);
|
|
102
104
|
}
|
|
103
105
|
});
|
|
104
106
|
} catch (error) {
|
|
105
|
-
fail(`Invalid JSON in --input
|
|
107
|
+
fail(`Invalid JSON in --input ${source}: ${error instanceof Error ? error.message : String(error)}`);
|
|
106
108
|
}
|
|
107
109
|
if (!Array.isArray(rows) || rows.length === 0) fail("--input must be a non-empty JSON array or JSONL file");
|
|
108
110
|
if (rows.length > 5e3) fail(`--input supports at most 5,000 records; received ${rows.length}`);
|