@sqg/sqg 0.18.0 → 0.19.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/dist/index.mjs +2631 -2598
- package/dist/sqg.mjs +40 -7
- package/dist/ui-public/assets/index-C22caD-U.js +45 -0
- package/dist/ui-public/assets/index-DQWvi9s-.css +1 -0
- package/dist/ui-public/index.html +2 -2
- package/dist/ui-server.mjs +29 -78
- package/package.json +2 -2
- package/dist/ui-public/assets/index-BIikjK2O.js +0 -45
- package/dist/ui-public/assets/index-DHD4h34g.css +0 -2
package/dist/sqg.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { exit } from "node:process";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
import consola, { LogLevels } from "consola";
|
|
5
|
-
import updateNotifier from "update-notifier";
|
|
6
5
|
import pc from "picocolors";
|
|
6
|
+
import updateNotifier from "update-notifier";
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
8
8
|
import * as clack from "@clack/prompts";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
@@ -1789,6 +1789,26 @@ var JavaTypeMapper = class JavaTypeMapper extends TypeMapper {
|
|
|
1789
1789
|
if (column.type instanceof EnumType && column.type.name) return path + pascalCase(column.type.name);
|
|
1790
1790
|
return super.getTypeName(column, path);
|
|
1791
1791
|
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Returns the primitive Java type for a column when it's non-nullable and
|
|
1794
|
+
* its mapped type has a primitive equivalent (Integer→int, Long→long, etc.).
|
|
1795
|
+
* Falls back to {@link getTypeName} otherwise. Used for appender row types
|
|
1796
|
+
* to avoid auto-boxing on hot bulk-insert paths.
|
|
1797
|
+
*/
|
|
1798
|
+
getUnboxedTypeName(column, path = "") {
|
|
1799
|
+
const typeName = this.getTypeName(column, path);
|
|
1800
|
+
if (column.nullable) return typeName;
|
|
1801
|
+
return JavaTypeMapper.boxedToPrimitive[typeName] ?? typeName;
|
|
1802
|
+
}
|
|
1803
|
+
static boxedToPrimitive = {
|
|
1804
|
+
Integer: "int",
|
|
1805
|
+
Long: "long",
|
|
1806
|
+
Short: "short",
|
|
1807
|
+
Byte: "byte",
|
|
1808
|
+
Boolean: "boolean",
|
|
1809
|
+
Double: "double",
|
|
1810
|
+
Float: "float"
|
|
1811
|
+
};
|
|
1792
1812
|
mapPrimitiveType(type, _nullable) {
|
|
1793
1813
|
const upperType = type.toString().toUpperCase();
|
|
1794
1814
|
const mappedType = this.typeMap[upperType];
|
|
@@ -2278,7 +2298,7 @@ var JavaGenerator = class extends BaseGenerator {
|
|
|
2278
2298
|
return pgBulkInsertType(column.type.toString().toUpperCase());
|
|
2279
2299
|
});
|
|
2280
2300
|
Handlebars.registerHelper("pgBulkAccessor", (column) => {
|
|
2281
|
-
return pgBulkInsertAccessor(column
|
|
2301
|
+
return pgBulkInsertAccessor(column);
|
|
2282
2302
|
});
|
|
2283
2303
|
Handlebars.registerHelper("javaVarName", (name) => {
|
|
2284
2304
|
const n = camelCase(name);
|
|
@@ -2297,7 +2317,7 @@ var JavaGenerator = class extends BaseGenerator {
|
|
|
2297
2317
|
return queryHelper.typeMapper.getDeclarations(query.allColumns);
|
|
2298
2318
|
});
|
|
2299
2319
|
Handlebars.registerHelper("appenderType", (column) => {
|
|
2300
|
-
return this.
|
|
2320
|
+
return this.typeMapper.getUnboxedTypeName(column);
|
|
2301
2321
|
});
|
|
2302
2322
|
Handlebars.registerHelper("declareEnums", (queryHelpers) => {
|
|
2303
2323
|
const enumTypes = /* @__PURE__ */ new Map();
|
|
@@ -2486,8 +2506,21 @@ function pgBulkInsertType(sqlType) {
|
|
|
2486
2506
|
if (sqlType.startsWith("_")) return `array(PgBulkInsert.PostgresTypes.${PG_BULK_TYPE_MAP[sqlType.substring(1)] || "TEXT"})`;
|
|
2487
2507
|
return PG_BULK_TYPE_MAP[sqlType] || "TEXT";
|
|
2488
2508
|
}
|
|
2489
|
-
|
|
2509
|
+
const PG_BULK_PRIMITIVE_TYPES = new Set([
|
|
2510
|
+
"INT2",
|
|
2511
|
+
"INT4",
|
|
2512
|
+
"INT8",
|
|
2513
|
+
"FLOAT4",
|
|
2514
|
+
"FLOAT8",
|
|
2515
|
+
"BOOLEAN"
|
|
2516
|
+
]);
|
|
2517
|
+
function pgBulkInsertAccessor(column) {
|
|
2518
|
+
const sqlType = column.type.toString().toUpperCase();
|
|
2490
2519
|
if (sqlType === "TIMESTAMPTZ") return "offsetDateTime";
|
|
2520
|
+
if (!column.nullable) {
|
|
2521
|
+
const pgType = PG_BULK_TYPE_MAP[sqlType];
|
|
2522
|
+
if (pgType && PG_BULK_PRIMITIVE_TYPES.has(pgType)) return "primitive";
|
|
2523
|
+
}
|
|
2491
2524
|
return "from";
|
|
2492
2525
|
}
|
|
2493
2526
|
//#endregion
|
|
@@ -3532,7 +3565,7 @@ async function processProject(projectPath, ui) {
|
|
|
3532
3565
|
//#region src/mcp-server.ts
|
|
3533
3566
|
const server = new Server({
|
|
3534
3567
|
name: "sqg-mcp",
|
|
3535
|
-
version: process.env.npm_package_version ?? "0.
|
|
3568
|
+
version: process.env.npm_package_version ?? "0.19.1"
|
|
3536
3569
|
}, { capabilities: {
|
|
3537
3570
|
tools: {},
|
|
3538
3571
|
resources: {}
|
|
@@ -3997,7 +4030,7 @@ function formatMs(ms) {
|
|
|
3997
4030
|
}
|
|
3998
4031
|
//#endregion
|
|
3999
4032
|
//#region src/sqg.ts
|
|
4000
|
-
const version = process.env.npm_package_version ?? "0.
|
|
4033
|
+
const version = process.env.npm_package_version ?? "0.19.1";
|
|
4001
4034
|
updateNotifier({ pkg: {
|
|
4002
4035
|
name: "@sqg/sqg",
|
|
4003
4036
|
version
|
|
@@ -4121,7 +4154,7 @@ program.command("ui").description("Start the SQG UI — interactive SQL developm
|
|
|
4121
4154
|
const { startUi } = await import("./start-ui-DuHxwbjr.mjs");
|
|
4122
4155
|
await startUi({
|
|
4123
4156
|
project,
|
|
4124
|
-
port: parseInt(options.port, 10)
|
|
4157
|
+
port: Number.parseInt(options.port, 10)
|
|
4125
4158
|
});
|
|
4126
4159
|
});
|
|
4127
4160
|
program.command("mcp").description("Start MCP (Model Context Protocol) server for AI assistants").action(async () => {
|