bun-query-builder 0.2.16 → 0.2.17

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.
@@ -13,6 +13,11 @@ export declare function generateModelSource(table: string, columns: Introspected
13
13
  export declare function introspectDatabase(opts?: { tables?: string[] }): Promise<IntrospectedModel[]>;
14
14
  /** Map a raw SQL column type back to a normalized model column type. */
15
15
  export declare function sqlTypeToNormalized(rawType: string, dialect: SupportedDialect, ctx?: { enumValues?: string[] }): NormalizedColumnType;
16
+ /**
17
+ * Normalize a MySQL information_schema column without discarding physical
18
+ * details carried only by COLUMN_TYPE (for example TINYINT(1) and VARCHAR(n)).
19
+ */
20
+ export declare function mysqlColumnType(dataType: unknown, columnType: unknown, enumValues?: string[]): NormalizedColumnType;
16
21
  /**
17
22
  * The plan type for one Postgres column, given what the catalogue knows.
18
23
  *
package/dist/bin/cli.js CHANGED
@@ -17764,6 +17764,9 @@ function sqlTypeToNormalized(rawType, dialect, ctx) {
17764
17764
  return "enum";
17765
17765
  return "string";
17766
17766
  }
17767
+ function mysqlColumnType(dataType, columnType, enumValues) {
17768
+ return sqlTypeToNormalized(String(columnType || dataType || ""), "mysql", { enumValues });
17769
+ }
17767
17770
  function asAction(raw2) {
17768
17771
  const v = String(raw2 ?? "").toLowerCase().trim();
17769
17772
  if (v === "cascade" || v === "restrict" || v === "set null")
@@ -17959,7 +17962,7 @@ async function buildMysqlTable(qb, table) {
17959
17962
  const hasDefault = rawDefault != null;
17960
17963
  return {
17961
17964
  name,
17962
- type: sqlTypeToNormalized(String(r.data_type ?? r.DATA_TYPE ?? columnType), "mysql", { enumValues }),
17965
+ type: mysqlColumnType(r.data_type ?? r.DATA_TYPE, columnType, enumValues),
17963
17966
  isPrimaryKey,
17964
17967
  isUnique: uniqueColumns.has(name),
17965
17968
  isNullable: isPrimaryKey ? false : String(r.is_nullable ?? r.IS_NULLABLE).toUpperCase() === "YES",
@@ -31562,7 +31565,7 @@ function getPrefix() {
31562
31565
  }
31563
31566
  var prefix = getPrefix();
31564
31567
  // package.json
31565
- var version2 = "0.2.16";
31568
+ var version2 = "0.2.17";
31566
31569
 
31567
31570
  // bin/cli.ts
31568
31571
  init_actions();
package/dist/src/index.js CHANGED
@@ -17763,6 +17763,9 @@ function sqlTypeToNormalized(rawType, dialect, ctx) {
17763
17763
  return "enum";
17764
17764
  return "string";
17765
17765
  }
17766
+ function mysqlColumnType(dataType, columnType, enumValues) {
17767
+ return sqlTypeToNormalized(String(columnType || dataType || ""), "mysql", { enumValues });
17768
+ }
17766
17769
  function asAction(raw2) {
17767
17770
  const v = String(raw2 ?? "").toLowerCase().trim();
17768
17771
  if (v === "cascade" || v === "restrict" || v === "set null")
@@ -17958,7 +17961,7 @@ async function buildMysqlTable(qb, table) {
17958
17961
  const hasDefault = rawDefault != null;
17959
17962
  return {
17960
17963
  name,
17961
- type: sqlTypeToNormalized(String(r.data_type ?? r.DATA_TYPE ?? columnType), "mysql", { enumValues }),
17964
+ type: mysqlColumnType(r.data_type ?? r.DATA_TYPE, columnType, enumValues),
17962
17965
  isPrimaryKey,
17963
17966
  isUnique: uniqueColumns.has(name),
17964
17967
  isNullable: isPrimaryKey ? false : String(r.is_nullable ?? r.IS_NULLABLE).toUpperCase() === "YES",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.2.16",
4
+ "version": "0.2.17",
5
5
  "description": "A simple yet performant query builder for TypeScript. Built with Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",