@housekit/kit 0.1.31 → 0.1.33
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/dist/index.js +54 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8448,7 +8448,22 @@ function resolveDatabase(config, name) {
|
|
|
8448
8448
|
const selected = pickDatabase(config, name);
|
|
8449
8449
|
let url = selected.db.url;
|
|
8450
8450
|
if (!url && selected.db.host) {
|
|
8451
|
-
|
|
8451
|
+
let host = selected.db.host;
|
|
8452
|
+
if (!host.startsWith("http://") && !host.startsWith("https://")) {
|
|
8453
|
+
host = `http://${host}`;
|
|
8454
|
+
}
|
|
8455
|
+
if (selected.db.port) {
|
|
8456
|
+
try {
|
|
8457
|
+
const parsed = new URL(host);
|
|
8458
|
+
if (!parsed.port) {
|
|
8459
|
+
parsed.port = String(selected.db.port);
|
|
8460
|
+
host = parsed.toString().replace(/\/$/, "");
|
|
8461
|
+
}
|
|
8462
|
+
} catch {
|
|
8463
|
+
host = `${host}:${selected.db.port}`;
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8466
|
+
url = host;
|
|
8452
8467
|
}
|
|
8453
8468
|
url = url || "http://localhost:8123";
|
|
8454
8469
|
const client = createClient({
|
|
@@ -9471,7 +9486,24 @@ async function pushCommand(options) {
|
|
|
9471
9486
|
} catch (e) {
|
|
9472
9487
|
error("Push failed");
|
|
9473
9488
|
error("Error during push:");
|
|
9474
|
-
|
|
9489
|
+
if (e instanceof AggregateError) {
|
|
9490
|
+
error("Multiple errors occurred:");
|
|
9491
|
+
for (const err of e.errors) {
|
|
9492
|
+
error(` • ${err instanceof Error ? err.message : String(err)}`);
|
|
9493
|
+
if (err instanceof Error && err.stack) {
|
|
9494
|
+
const stackLines = err.stack.split(`
|
|
9495
|
+
`).slice(1, 3);
|
|
9496
|
+
stackLines.forEach((line) => error(` ${line.trim()}`));
|
|
9497
|
+
}
|
|
9498
|
+
}
|
|
9499
|
+
} else if (e instanceof Error) {
|
|
9500
|
+
error(e.message);
|
|
9501
|
+
if (e.cause) {
|
|
9502
|
+
error(`Caused by: ${e.cause instanceof Error ? e.cause.message : String(e.cause)}`);
|
|
9503
|
+
}
|
|
9504
|
+
} else {
|
|
9505
|
+
error(String(e));
|
|
9506
|
+
}
|
|
9475
9507
|
} finally {
|
|
9476
9508
|
await client.close();
|
|
9477
9509
|
}
|
|
@@ -11581,13 +11613,32 @@ program.hook("preAction", (thisCommand) => {
|
|
|
11581
11613
|
const opts = thisCommand.optsWithGlobals?.() ?? thisCommand.opts();
|
|
11582
11614
|
setGlobalYesMode(Boolean(opts.yes));
|
|
11583
11615
|
});
|
|
11616
|
+
function formatError(err) {
|
|
11617
|
+
const lines = [];
|
|
11618
|
+
if (err instanceof AggregateError) {
|
|
11619
|
+
lines.push("Multiple errors occurred:");
|
|
11620
|
+
for (const e of err.errors) {
|
|
11621
|
+
lines.push(` • ${e instanceof Error ? e.message : String(e)}`);
|
|
11622
|
+
}
|
|
11623
|
+
} else if (err instanceof Error) {
|
|
11624
|
+
lines.push(err.message);
|
|
11625
|
+
if (err.cause) {
|
|
11626
|
+
lines.push(`Caused by: ${err.cause instanceof Error ? err.cause.message : String(err.cause)}`);
|
|
11627
|
+
}
|
|
11628
|
+
} else {
|
|
11629
|
+
lines.push(String(err));
|
|
11630
|
+
}
|
|
11631
|
+
return lines;
|
|
11632
|
+
}
|
|
11584
11633
|
function withErrorHandling(fn) {
|
|
11585
11634
|
return async (...args) => {
|
|
11586
11635
|
try {
|
|
11587
11636
|
await fn(...args);
|
|
11588
11637
|
} catch (error3) {
|
|
11638
|
+
const errorLines = formatError(error3);
|
|
11589
11639
|
console.error(chalk5.red(`
|
|
11590
|
-
✖ Error: ` +
|
|
11640
|
+
✖ Error: ` + errorLines[0]));
|
|
11641
|
+
errorLines.slice(1).forEach((line) => console.error(chalk5.red(line)));
|
|
11591
11642
|
if (process.env.DEBUG) {
|
|
11592
11643
|
console.error(error3);
|
|
11593
11644
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@housekit/kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.33",
|
|
4
4
|
"description": "CLI tool for HouseKit - manage ClickHouse schemas, migrations, and database operations with type-safe workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@clickhouse/client": "^1.14.0",
|
|
51
|
-
"@housekit/orm": "^0.1.
|
|
51
|
+
"@housekit/orm": "^0.1.39",
|
|
52
52
|
"boxen": "8.0.1",
|
|
53
53
|
"chalk": "^5.6.2",
|
|
54
54
|
"cli-table3": "^0.6.5",
|