@vaultgradient/pipequery-cli 0.13.3 → 0.14.1
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 +1 -1
- package/__tests__/event-log.test.ts +2 -3
- package/dist/index.js +13 -8
- package/package.json +6 -6
- package/src/config/defaults.ts +1 -1
- package/src/telegram/event-log.ts +10 -5
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ npm install -g @vaultgradient/pipequery-cli
|
|
|
19
19
|
Or install from source:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
git clone https://github.com/
|
|
22
|
+
git clone https://github.com/Vault-Gradient/pipequery.git
|
|
23
23
|
cd pipequery/cli
|
|
24
24
|
npm install && npm run build
|
|
25
25
|
npm link
|
|
@@ -213,8 +213,7 @@ describe('createEventLogger — JSONL file output', () => {
|
|
|
213
213
|
];
|
|
214
214
|
for (const e of events) logger.log(e);
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
await new Promise((r) => setTimeout(r, 50));
|
|
216
|
+
await logger.flush();
|
|
218
217
|
const content = await readFile(file, 'utf8');
|
|
219
218
|
const lines = content.trim().split('\n');
|
|
220
219
|
expect(lines).toHaveLength(3);
|
|
@@ -258,7 +257,7 @@ describe('createEventLogger — JSONL file output', () => {
|
|
|
258
257
|
now: () => FIXED_TS,
|
|
259
258
|
});
|
|
260
259
|
logger.log({ kind: 'command', user: { id: 1 }, cmd: '/help', outcome: 'success', latencyMs: 1 });
|
|
261
|
-
await
|
|
260
|
+
await logger.flush();
|
|
262
261
|
const obj = JSON.parse((await readFile(file, 'utf8')).trim()) as Record<string, unknown>;
|
|
263
262
|
expect(obj.rowCount).toBeUndefined();
|
|
264
263
|
expect(obj.error).toBeUndefined();
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var DEFAULT_CONFIG = {
|
|
|
31
31
|
dashboards: {}
|
|
32
32
|
};
|
|
33
33
|
var STARTER_YAML = `# PipeQuery Configuration
|
|
34
|
-
# Docs: https://github.com/
|
|
34
|
+
# Docs: https://github.com/Vault-Gradient/pipequery
|
|
35
35
|
|
|
36
36
|
server:
|
|
37
37
|
port: 3000
|
|
@@ -4577,7 +4577,7 @@ import chalk3 from "chalk";
|
|
|
4577
4577
|
// package.json
|
|
4578
4578
|
var package_default = {
|
|
4579
4579
|
name: "@andreadito/pq",
|
|
4580
|
-
version: "0.
|
|
4580
|
+
version: "0.14.1",
|
|
4581
4581
|
description: "CLI for PipeQuery \u2014 data sources, aggregations, APIs, and terminal dashboards",
|
|
4582
4582
|
type: "module",
|
|
4583
4583
|
bin: {
|
|
@@ -4611,7 +4611,7 @@ var package_default = {
|
|
|
4611
4611
|
chokidar: "^5.0.0",
|
|
4612
4612
|
commander: "^14.0.3",
|
|
4613
4613
|
"csv-parse": "^7.0.2",
|
|
4614
|
-
fastify: "^5.12.
|
|
4614
|
+
fastify: "^5.12.6",
|
|
4615
4615
|
grammy: "^1.42.0",
|
|
4616
4616
|
ink: "^7.0.1",
|
|
4617
4617
|
kafkajs: "^2.2.4",
|
|
@@ -4623,7 +4623,7 @@ var package_default = {
|
|
|
4623
4623
|
"snowflake-sdk": "^3.4.0",
|
|
4624
4624
|
ws: "^8.21.0",
|
|
4625
4625
|
yaml: "^2.8.3",
|
|
4626
|
-
zod: "^4.
|
|
4626
|
+
zod: "^4.6.7"
|
|
4627
4627
|
},
|
|
4628
4628
|
devDependencies: {
|
|
4629
4629
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -4633,20 +4633,20 @@ var package_default = {
|
|
|
4633
4633
|
"@types/ws": "^8.18.1",
|
|
4634
4634
|
tsup: "^8.5.1",
|
|
4635
4635
|
typescript: "~6.0.0",
|
|
4636
|
-
vitest: "^4.1.
|
|
4636
|
+
vitest: "^4.1.12"
|
|
4637
4637
|
},
|
|
4638
4638
|
overrides: {
|
|
4639
4639
|
"gcp-metadata": "^8.0.0",
|
|
4640
4640
|
esbuild: "^0.28.1",
|
|
4641
4641
|
axios: "^1.20.0",
|
|
4642
|
-
"fast-uri": "^3.1.
|
|
4642
|
+
"fast-uri": "^3.1.9",
|
|
4643
4643
|
"proxy-addr": "^2.0.8",
|
|
4644
4644
|
"source-map-js": "^1.2.2",
|
|
4645
4645
|
"@azure/msal-node": "^5.6.0"
|
|
4646
4646
|
},
|
|
4647
4647
|
repository: {
|
|
4648
4648
|
type: "git",
|
|
4649
|
-
url: "https://github.com/
|
|
4649
|
+
url: "https://github.com/Vault-Gradient/pipequery.git",
|
|
4650
4650
|
directory: "cli"
|
|
4651
4651
|
},
|
|
4652
4652
|
publishConfig: {
|
|
@@ -7419,13 +7419,17 @@ function createEventLogger(opts = {}) {
|
|
|
7419
7419
|
const writeStderr = opts.writeStderr ?? ((line) => process.stderr.write(line));
|
|
7420
7420
|
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
7421
7421
|
const filePath = opts.filePath;
|
|
7422
|
+
let chain = Promise.resolve();
|
|
7422
7423
|
return {
|
|
7423
7424
|
log(event) {
|
|
7424
7425
|
const ts = now();
|
|
7425
7426
|
writeStderr(formatPretty(event, ts) + "\n");
|
|
7426
7427
|
if (filePath) {
|
|
7427
7428
|
const json = JSON.stringify({ ts: ts.toISOString(), ...flattenForJson(event) });
|
|
7428
|
-
|
|
7429
|
+
chain = chain.then(
|
|
7430
|
+
() => appendFile(filePath, json + "\n"),
|
|
7431
|
+
() => appendFile(filePath, json + "\n")
|
|
7432
|
+
).catch((err) => {
|
|
7429
7433
|
writeStderr(
|
|
7430
7434
|
chalk7.hex("#ef4444")(" \u2717") + " [pipequery-telegram] log-file write failed: " + (err instanceof Error ? err.message : String(err)) + "\n"
|
|
7431
7435
|
);
|
|
@@ -7433,6 +7437,7 @@ function createEventLogger(opts = {}) {
|
|
|
7433
7437
|
}
|
|
7434
7438
|
},
|
|
7435
7439
|
async flush() {
|
|
7440
|
+
await chain;
|
|
7436
7441
|
}
|
|
7437
7442
|
};
|
|
7438
7443
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaultgradient/pipequery-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "CLI for PipeQuery — data sources, aggregations, APIs, and terminal dashboards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"chokidar": "^5.0.0",
|
|
35
35
|
"commander": "^14.0.3",
|
|
36
36
|
"csv-parse": "^7.0.2",
|
|
37
|
-
"fastify": "^5.12.
|
|
37
|
+
"fastify": "^5.12.6",
|
|
38
38
|
"grammy": "^1.42.0",
|
|
39
39
|
"ink": "^7.0.1",
|
|
40
40
|
"kafkajs": "^2.2.4",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"snowflake-sdk": "^3.4.0",
|
|
47
47
|
"ws": "^8.21.0",
|
|
48
48
|
"yaml": "^2.8.3",
|
|
49
|
-
"zod": "^4.
|
|
49
|
+
"zod": "^4.6.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/better-sqlite3": "^7.6.13",
|
|
@@ -56,20 +56,20 @@
|
|
|
56
56
|
"@types/ws": "^8.18.1",
|
|
57
57
|
"tsup": "^8.5.1",
|
|
58
58
|
"typescript": "~6.0.0",
|
|
59
|
-
"vitest": "^4.1.
|
|
59
|
+
"vitest": "^4.1.12"
|
|
60
60
|
},
|
|
61
61
|
"overrides": {
|
|
62
62
|
"gcp-metadata": "^8.0.0",
|
|
63
63
|
"esbuild": "^0.28.1",
|
|
64
64
|
"axios": "^1.20.0",
|
|
65
|
-
"fast-uri": "^3.1.
|
|
65
|
+
"fast-uri": "^3.1.9",
|
|
66
66
|
"proxy-addr": "^2.0.8",
|
|
67
67
|
"source-map-js": "^1.2.2",
|
|
68
68
|
"@azure/msal-node": "^5.6.0"
|
|
69
69
|
},
|
|
70
70
|
"repository": {
|
|
71
71
|
"type": "git",
|
|
72
|
-
"url": "https://github.com/
|
|
72
|
+
"url": "https://github.com/Vault-Gradient/pipequery.git",
|
|
73
73
|
"directory": "cli"
|
|
74
74
|
},
|
|
75
75
|
"author": "andreadito",
|
package/src/config/defaults.ts
CHANGED
|
@@ -83,6 +83,8 @@ export function createEventLogger(opts: EventLoggerOptions = {}): EventLogger {
|
|
|
83
83
|
const writeStderr = opts.writeStderr ?? ((line) => process.stderr.write(line));
|
|
84
84
|
const now = opts.now ?? (() => new Date());
|
|
85
85
|
const filePath = opts.filePath;
|
|
86
|
+
// Chain writes sequentially so they land on disk in log-order.
|
|
87
|
+
let chain: Promise<void> = Promise.resolve();
|
|
86
88
|
|
|
87
89
|
return {
|
|
88
90
|
log(event: BotEvent): void {
|
|
@@ -90,10 +92,13 @@ export function createEventLogger(opts: EventLoggerOptions = {}): EventLogger {
|
|
|
90
92
|
writeStderr(formatPretty(event, ts) + '\n');
|
|
91
93
|
if (filePath) {
|
|
92
94
|
const json = JSON.stringify({ ts: ts.toISOString(), ...flattenForJson(event) });
|
|
93
|
-
//
|
|
94
|
-
// doesn't
|
|
95
|
-
//
|
|
96
|
-
|
|
95
|
+
// Chain each append onto the previous one so ordering is preserved.
|
|
96
|
+
// The bot doesn't await the chain — a slow disk won't back-pressure
|
|
97
|
+
// incoming Telegram messages. Errors surface on stderr.
|
|
98
|
+
chain = chain.then(
|
|
99
|
+
() => appendFile(filePath, json + '\n'),
|
|
100
|
+
() => appendFile(filePath, json + '\n'),
|
|
101
|
+
).catch((err) => {
|
|
97
102
|
writeStderr(
|
|
98
103
|
chalk.hex('#ef4444')(' ✗') +
|
|
99
104
|
' [pipequery-telegram] log-file write failed: ' +
|
|
@@ -104,7 +109,7 @@ export function createEventLogger(opts: EventLoggerOptions = {}): EventLogger {
|
|
|
104
109
|
}
|
|
105
110
|
},
|
|
106
111
|
async flush(): Promise<void> {
|
|
107
|
-
|
|
112
|
+
await chain;
|
|
108
113
|
},
|
|
109
114
|
};
|
|
110
115
|
}
|