@bungres/kit 1.0.0 → 1.1.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../src/commands/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CAsHf"}
1
+ {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../src/commands/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAUnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CA6If"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAanD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAanD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,cAAc,EACtB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAyMf"}
@@ -1 +1 @@
1
- {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAYnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CA+Gf"}
1
+ {"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAYnD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,cAAc,EACtB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC7B,OAAO,CAAC,IAAI,CAAC,CA+Hf"}
@@ -1 +1 @@
1
- {"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/commands/studio.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AASnD,wBAAsB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4TrE"}
1
+ {"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/commands/studio.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AASnD,wBAAsB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA+UrE"}
@@ -1,2 +1,5 @@
1
- export declare const indexHtml = "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Bungres Studio</title>\n \n <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n <link href=\"https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap\" rel=\"stylesheet\">\n <link href=\"https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap\" rel=\"stylesheet\">\n\n <script src=\"https://unpkg.com/htmx.org@2.0.0\" defer></script>\n <script defer src=\"https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js\"></script>\n <script src=\"https://cdn.tailwindcss.com\"></script>\n \n <script>\n tailwind.config = {\n darkMode: \"class\",\n theme: {\n extend: {\n fontFamily: {\n sans: ['Outfit', 'sans-serif'],\n mono: ['\"Fira Code\"', 'monospace'],\n },\n colors: {\n background: 'var(--background)',\n foreground: 'var(--foreground)',\n card: 'var(--card)',\n 'card-foreground': 'var(--card-foreground)',\n popover: 'var(--popover)',\n 'popover-foreground': 'var(--popover-foreground)',\n primary: 'var(--primary)',\n 'primary-foreground': 'var(--primary-foreground)',\n secondary: 'var(--secondary)',\n 'secondary-foreground': 'var(--secondary-foreground)',\n muted: 'var(--muted)',\n 'muted-foreground': 'var(--muted-foreground)',\n accent: 'var(--accent)',\n 'accent-foreground': 'var(--accent-foreground)',\n destructive: 'var(--destructive)',\n border: 'var(--border)',\n input: 'var(--input)',\n ring: 'var(--ring)',\n sidebar: {\n DEFAULT: 'var(--sidebar)',\n foreground: 'var(--sidebar-foreground)',\n primary: 'var(--sidebar-primary)',\n 'primary-foreground': 'var(--sidebar-primary-foreground)',\n accent: 'var(--sidebar-accent)',\n 'accent-foreground': 'var(--sidebar-accent-foreground)',\n border: 'var(--sidebar-border)',\n ring: 'var(--sidebar-ring)',\n }\n }\n }\n }\n }\n </script>\n\n <style>\n :root {\n --background: oklch(1 0 0);\n --foreground: oklch(0.148 0.004 228.8);\n --card: oklch(1 0 0);\n --card-foreground: oklch(0.148 0.004 228.8);\n --popover: oklch(1 0 0);\n --popover-foreground: oklch(0.148 0.004 228.8);\n --primary: oklch(0.508 0.118 165.612);\n --primary-foreground: oklch(0.979 0.021 166.113);\n --secondary: oklch(0.967 0.001 286.375);\n --secondary-foreground: oklch(0.21 0.006 285.885);\n --muted: oklch(0.963 0.002 197.1);\n --muted-foreground: oklch(0.56 0.021 213.5);\n --accent: oklch(0.963 0.002 197.1);\n --accent-foreground: oklch(0.218 0.008 223.9);\n --destructive: oklch(0.577 0.245 27.325);\n --border: oklch(0.925 0.005 214.3);\n --input: oklch(0.925 0.005 214.3);\n --ring: oklch(0.723 0.014 214.4);\n --chart-1: oklch(0.845 0.143 164.978);\n --chart-2: oklch(0.696 0.17 162.48);\n --chart-3: oklch(0.596 0.145 163.225);\n --chart-4: oklch(0.508 0.118 165.612);\n --chart-5: oklch(0.432 0.095 166.913);\n --radius: 0.625rem;\n --sidebar: oklch(0.987 0.002 197.1);\n --sidebar-foreground: oklch(0.148 0.004 228.8);\n --sidebar-primary: oklch(0.596 0.145 163.225);\n --sidebar-primary-foreground: oklch(0.979 0.021 166.113);\n --sidebar-accent: oklch(0.963 0.002 197.1);\n --sidebar-accent-foreground: oklch(0.218 0.008 223.9);\n --sidebar-border: oklch(0.925 0.005 214.3);\n --sidebar-ring: oklch(0.723 0.014 214.4);\n }\n\n .dark {\n --background: oklch(0.148 0.004 228.8);\n --foreground: oklch(0.987 0.002 197.1);\n --card: oklch(0.218 0.008 223.9);\n --card-foreground: oklch(0.987 0.002 197.1);\n --popover: oklch(0.218 0.008 223.9);\n --popover-foreground: oklch(0.987 0.002 197.1);\n --primary: oklch(0.432 0.095 166.913);\n --primary-foreground: oklch(0.979 0.021 166.113);\n --secondary: oklch(0.274 0.006 286.033);\n --secondary-foreground: oklch(0.985 0 0);\n --muted: oklch(0.275 0.011 216.9);\n --muted-foreground: oklch(0.723 0.014 214.4);\n --accent: oklch(0.275 0.011 216.9);\n --accent-foreground: oklch(0.987 0.002 197.1);\n --destructive: oklch(0.704 0.191 22.216);\n --border: oklch(1 0 0 / 10%);\n --input: oklch(1 0 0 / 15%);\n --ring: oklch(0.56 0.021 213.5);\n --chart-1: oklch(0.845 0.143 164.978);\n --chart-2: oklch(0.696 0.17 162.48);\n --chart-3: oklch(0.596 0.145 163.225);\n --chart-4: oklch(0.508 0.118 165.612);\n --chart-5: oklch(0.432 0.095 166.913);\n --sidebar: oklch(0.218 0.008 223.9);\n --sidebar-foreground: oklch(0.987 0.002 197.1);\n --sidebar-primary: oklch(0.696 0.17 162.48);\n --sidebar-primary-foreground: oklch(0.262 0.051 172.552);\n --sidebar-accent: oklch(0.275 0.011 216.9);\n --sidebar-accent-foreground: oklch(0.987 0.002 197.1);\n --sidebar-border: oklch(1 0 0 / 10%);\n --sidebar-ring: oklch(0.56 0.021 213.5);\n }\n\n ::-webkit-scrollbar { width: 6px; height: 6px; }\n ::-webkit-scrollbar-track { background: transparent; }\n ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }\n ::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }\n ::-webkit-scrollbar-corner { background: transparent; }\n [x-cloak] { display: none !important; }\n .htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }\n .htmx-request .htmx-indicator { opacity: 1; }\n .htmx-request.htmx-indicator { opacity: 1; }\n </style>\n</head>\n<body class=\"dark bg-background text-foreground font-sans h-screen flex overflow-hidden selection:bg-primary/30\">\n <div x-data=\"{ currentTable: null, pageSize: 25 }\" class=\"flex h-screen w-full\">\n <aside class=\"w-64 bg-sidebar border-r border-sidebar-border flex flex-col z-20 shrink-0 text-sidebar-foreground\">\n <div class=\"p-4 border-b border-sidebar-border flex items-center gap-3 bg-sidebar\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"text-primary\">\n <ellipse cx=\"12\" cy=\"5\" rx=\"9\" ry=\"3\"></ellipse>\n <path d=\"M21 12c0 1.66-4 3-9 3s-9-1.34-9-3\"></path>\n <path d=\"M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5\"></path>\n </svg>\n <h1 class=\"text-sm font-semibold tracking-tight m-0\">Bungres Studio</h1>\n </div>\n <div class=\"flex-1 overflow-y-auto p-2\" hx-get=\"/htmx/sidebar\" hx-trigger=\"load\">\n <div class=\"p-4 text-xs text-muted-foreground animate-pulse text-center\">Loading schemas...</div>\n </div>\n </aside>\n <main class=\"flex-1 flex flex-col relative w-[calc(100vw-16rem)]\">\n <header class=\"h-14 px-4 border-b border-border flex items-center justify-between bg-card z-10 shrink-0 text-card-foreground\">\n <h2 class=\"text-sm font-semibold tracking-tight flex items-center gap-2\">\n <template x-if=\"currentTable\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-primary\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect>\n <line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"></line>\n <line x1=\"9\" y1=\"21\" x2=\"9\" y2=\"9\"></line>\n </svg>\n </template>\n <template x-if=\"!currentTable\">\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-muted-foreground\">\n <rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\" ry=\"2\"></rect>\n <line x1=\"3\" y1=\"9\" x2=\"21\" y2=\"9\"></line>\n <line x1=\"9\" y1=\"21\" x2=\"9\" y2=\"9\"></line>\n </svg>\n </template>\n <span x-text=\"currentTable ? currentTable : 'Select a table'\"></span>\n </h2>\n <button x-bind:disabled=\"!currentTable\" class=\"bg-card border border-border text-card-foreground px-3 py-1.5 rounded-md text-xs font-medium cursor-pointer transition-all hover:bg-accent hover:text-accent-foreground active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5 group\" x-on:click=\"$dispatch('refresh-table')\">\n <svg class=\"w-4 h-4 group-hover:rotate-180 transition-transform duration-500\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"23 4 23 10 17 10\"></polyline>\n <polyline points=\"1 20 1 14 7 14\"></polyline>\n <path d=\"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15\"></path>\n </svg>\n Refresh\n </button>\n </header>\n <div class=\"flex-1 overflow-auto relative z-[1] text-left bg-background\">\n <div id=\"data-container\" class=\"h-full w-full flex flex-col\" x-on:refresh-table.window=\"if(currentTable) htmx.ajax('GET', '/htmx/tables/' + currentTable + '?limit=' + pageSize, {target: '#data-container'})\">\n <div class=\"flex flex-col items-center justify-center h-full w-full text-muted-foreground animate-[fadeIn_0.5s_ease-out]\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"w-16 h-16 mb-4 text-muted\">\n <path d=\"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z\"></path>\n <polyline points=\"14 2 14 8 20 8\"></polyline>\n </svg>\n <h3 class=\"text-foreground m-0 mb-2 text-lg\">No Table Selected</h3>\n <p class=\"text-sm\">Choose a table from the sidebar to view its data</p>\n </div>\n </div>\n </div>\n </main>\n </div>\n <script>\n document.addEventListener('alpine:init', () => {})\n </script>\n</body>\n</html>";
1
+ export declare function renderIndexHtml(opts: {
2
+ schemas: string[];
3
+ currentSchema: string;
4
+ }): string;
2
5
  //# sourceMappingURL=template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/commands/template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,i2UA0Md,CAAC"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/commands/template.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,UA2RjF"}
package/dist/differ.d.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import type { TableConfig } from "@bungres/orm";
2
2
  /** Snapshot stored on disk after each generate */
3
- export type SchemaSnapshot = Record<string, TableConfig>;
3
+ export interface SchemaSnapshot {
4
+ tables: Record<string, TableConfig>;
5
+ enums: Record<string, {
6
+ enumName: string;
7
+ enumValues: string[];
8
+ }>;
9
+ views: Record<string, any>;
10
+ }
4
11
  export interface DiffResult {
5
12
  statements: string[];
6
13
  summary: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../src/differ.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ9D,kDAAkD;AAClD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,GACnB,UAAU,CAwIZ;AAMD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAsBpE"}
1
+ {"version":3,"file":"differ.d.ts","sourceRoot":"","sources":["../src/differ.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,cAAc,CAAC;AAQ9D,kDAAkD;AAClD,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAClE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,GACnB,UAAU,CAiNZ;AAMD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAsBpE"}
package/dist/index.js CHANGED
@@ -1702,6 +1702,37 @@ function generateDropColumn(tableName, schema, columnName) {
1702
1702
  const tbl = schema ? `"${schema}"."${tableName}"` : `"${tableName}"`;
1703
1703
  return `ALTER TABLE ${tbl} DROP COLUMN IF EXISTS "${columnName}";`;
1704
1704
  }
1705
+ function generateCreateEnum(name, values) {
1706
+ const vals = values.map((v) => `'${v.replace(/'/g, "''")}'`).join(", ");
1707
+ return `CREATE TYPE "${name}" AS ENUM (${vals});`;
1708
+ }
1709
+ function generateDropEnum(name, ifExists = true) {
1710
+ return `DROP TYPE${ifExists ? " IF EXISTS" : ""} "${name}";`;
1711
+ }
1712
+ function inlineParams(chunk) {
1713
+ let { sql: sql2, params } = chunk;
1714
+ return sql2.replace(/\$(\d+)/g, (_, n) => {
1715
+ const p = params[parseInt(n) - 1];
1716
+ if (typeof p === "string")
1717
+ return `'${p.replace(/'/g, "''")}'`;
1718
+ if (typeof p === "number")
1719
+ return String(p);
1720
+ if (typeof p === "boolean")
1721
+ return p ? "TRUE" : "FALSE";
1722
+ if (p === null)
1723
+ return "NULL";
1724
+ return `'${String(p).replace(/'/g, "''")}'`;
1725
+ });
1726
+ }
1727
+ function generateCreateView(view) {
1728
+ const kind = view.materialized ? "MATERIALIZED VIEW" : "VIEW";
1729
+ const inlineSql = inlineParams(view.query.toSQL());
1730
+ return `CREATE ${kind} "${view.name}" AS ${inlineSql};`;
1731
+ }
1732
+ function generateDropView(view, ifExists = true) {
1733
+ const kind = view.materialized ? "MATERIALIZED VIEW" : "VIEW";
1734
+ return `DROP ${kind}${ifExists ? " IF EXISTS" : ""} "${view.name}";`;
1735
+ }
1705
1736
 
1706
1737
  // src/schema-loader.ts
1707
1738
  async function loadSchemas(patterns, cwd = process.cwd()) {
@@ -1715,11 +1746,27 @@ async function loadSchemas(patterns, cwd = process.cwd()) {
1715
1746
  for (const [exportName, value] of Object.entries(mod)) {
1716
1747
  if (isTable(value)) {
1717
1748
  entries.push({
1749
+ type: "table",
1718
1750
  exportName,
1719
1751
  config: value[TableConfigSymbol],
1720
1752
  table: value,
1721
1753
  filePath: absPath
1722
1754
  });
1755
+ } else if (isEnum(value)) {
1756
+ entries.push({
1757
+ type: "enum",
1758
+ exportName,
1759
+ enumName: value.enumName,
1760
+ enumValues: value.enumValues,
1761
+ filePath: absPath
1762
+ });
1763
+ } else if (isView(value)) {
1764
+ entries.push({
1765
+ type: "view",
1766
+ exportName,
1767
+ config: value,
1768
+ filePath: absPath
1769
+ });
1723
1770
  }
1724
1771
  }
1725
1772
  }
@@ -1729,17 +1776,67 @@ async function loadSchemas(patterns, cwd = process.cwd()) {
1729
1776
  function isTable(value) {
1730
1777
  return typeof value === "object" && value !== null && TableConfigSymbol in value;
1731
1778
  }
1779
+ function isEnum(value) {
1780
+ return typeof value === "function" && "enumName" in value && "enumValues" in value && Array.isArray(value.enumValues);
1781
+ }
1782
+ function isView(value) {
1783
+ return typeof value === "object" && value !== null && "name" in value && "query" in value && typeof value.query === "object" && typeof value.query.toSQL === "function";
1784
+ }
1732
1785
  // src/differ.ts
1733
1786
  function diffSchemas(prev, next) {
1734
1787
  const statements = [];
1735
1788
  const summary = [];
1736
1789
  const warnings = [];
1737
- const prevTables = new Set(Object.keys(prev));
1738
- const nextTables = new Set(Object.keys(next));
1790
+ const prevEnums = prev.enums || {};
1791
+ const nextEnums = next.enums || {};
1792
+ const prevEnumNames = new Set(Object.keys(prevEnums));
1793
+ const nextEnumNames = new Set(Object.keys(nextEnums));
1794
+ for (const enumName of nextEnumNames) {
1795
+ if (!prevEnumNames.has(enumName)) {
1796
+ const e = nextEnums[enumName];
1797
+ statements.push(generateCreateEnum(e.enumName, e.enumValues));
1798
+ summary.push(`CREATE TYPE ${e.enumName}`);
1799
+ }
1800
+ }
1801
+ for (const enumName of prevEnumNames) {
1802
+ if (!nextEnumNames.has(enumName)) {
1803
+ const e = prevEnums[enumName];
1804
+ statements.push(generateDropEnum(e.enumName, true));
1805
+ summary.push(`DROP TYPE ${e.enumName}`);
1806
+ }
1807
+ }
1808
+ for (const enumName of nextEnumNames) {
1809
+ if (prevEnumNames.has(enumName)) {
1810
+ const p = prevEnums[enumName];
1811
+ const n = nextEnums[enumName];
1812
+ if (JSON.stringify(p.enumValues) !== JSON.stringify(n.enumValues)) {
1813
+ warnings.push(`Enum '${n.enumName}' values have changed. Bungres Kit currently requires manual migration for ALTER TYPE ... ADD VALUE.`);
1814
+ }
1815
+ }
1816
+ }
1817
+ const prevViews = prev.views || {};
1818
+ const nextViews = next.views || {};
1819
+ const prevViewNames = new Set(Object.keys(prevViews));
1820
+ const nextViewNames = new Set(Object.keys(nextViews));
1821
+ for (const viewName of prevViewNames) {
1822
+ if (!nextViewNames.has(viewName)) {
1823
+ statements.push(generateDropView(prevViews[viewName]));
1824
+ summary.push(`DROP VIEW ${viewName}`);
1825
+ } else {
1826
+ const pSql = generateCreateView(prevViews[viewName]);
1827
+ const nSql = generateCreateView(nextViews[viewName]);
1828
+ if (pSql !== nSql) {
1829
+ statements.push(generateDropView(prevViews[viewName]));
1830
+ summary.push(`DROP VIEW ${viewName} (for recreation)`);
1831
+ }
1832
+ }
1833
+ }
1834
+ const prevTables = new Set(Object.keys(prev.tables || {}));
1835
+ const nextTables = new Set(Object.keys(next.tables || {}));
1739
1836
  const newTableConfigs = [];
1740
1837
  for (const tableName of nextTables) {
1741
1838
  if (!prevTables.has(tableName)) {
1742
- newTableConfigs.push(next[tableName]);
1839
+ newTableConfigs.push(next.tables[tableName]);
1743
1840
  }
1744
1841
  }
1745
1842
  for (const config of topoSortConfigs(newTableConfigs)) {
@@ -1748,7 +1845,7 @@ function diffSchemas(prev, next) {
1748
1845
  }
1749
1846
  for (const tableName of prevTables) {
1750
1847
  if (!nextTables.has(tableName)) {
1751
- const config = prev[tableName];
1848
+ const config = prev.tables[tableName];
1752
1849
  const tbl = config.schema ? `"${config.schema}"."${tableName}"` : `"${tableName}"`;
1753
1850
  statements.push(`DROP TABLE IF EXISTS ${tbl};`);
1754
1851
  summary.push(`DROP TABLE ${tableName}`);
@@ -1758,8 +1855,8 @@ function diffSchemas(prev, next) {
1758
1855
  for (const tableName of nextTables) {
1759
1856
  if (!prevTables.has(tableName))
1760
1857
  continue;
1761
- const prevConfig = prev[tableName];
1762
- const nextConfig = next[tableName];
1858
+ const prevConfig = prev.tables[tableName];
1859
+ const nextConfig = next.tables[tableName];
1763
1860
  const prevCols = prevConfig.columns;
1764
1861
  const nextCols = nextConfig.columns;
1765
1862
  const prevColNames = new Set(Object.keys(prevCols));
@@ -1831,6 +1928,19 @@ function diffSchemas(prev, next) {
1831
1928
  }
1832
1929
  }
1833
1930
  }
1931
+ for (const viewName of nextViewNames) {
1932
+ if (!prevViewNames.has(viewName)) {
1933
+ statements.push(generateCreateView(nextViews[viewName]));
1934
+ summary.push(`CREATE VIEW ${viewName}`);
1935
+ } else {
1936
+ const pSql = generateCreateView(prevViews[viewName]);
1937
+ const nSql = generateCreateView(nextViews[viewName]);
1938
+ if (pSql !== nSql) {
1939
+ statements.push(generateCreateView(nextViews[viewName]));
1940
+ summary.push(`CREATE VIEW ${viewName} (recreated)`);
1941
+ }
1942
+ }
1943
+ }
1834
1944
  return { statements, summary, warnings };
1835
1945
  }
1836
1946
  function topoSortConfigs(tables) {
@@ -1858,7 +1968,14 @@ function topoSortConfigs(tables) {
1858
1968
  function diffColumn(prev, next) {
1859
1969
  const changes = [];
1860
1970
  const col2 = `"${next.name}"`;
1971
+ const prevDef = prev.defaultFn ?? (prev.defaultValue !== undefined ? String(prev.defaultValue) : undefined);
1972
+ const nextDef = next.defaultFn ?? (next.defaultValue !== undefined ? String(next.defaultValue) : undefined);
1973
+ let typeChanged = false;
1861
1974
  if (prev.dataType !== next.dataType) {
1975
+ typeChanged = true;
1976
+ if (prevDef !== undefined) {
1977
+ changes.push(`ALTER COLUMN ${col2} DROP DEFAULT`);
1978
+ }
1862
1979
  changes.push(`ALTER COLUMN ${col2} TYPE ${next.dataType.toUpperCase()} USING ${col2}::${next.dataType}`);
1863
1980
  } else {
1864
1981
  const prevLen = prev.length;
@@ -1875,9 +1992,12 @@ function diffColumn(prev, next) {
1875
1992
  if (prev.notNull && !next.notNull) {
1876
1993
  changes.push(`ALTER COLUMN ${col2} DROP NOT NULL`);
1877
1994
  }
1878
- const prevDef = prev.defaultFn ?? (prev.defaultValue !== undefined ? String(prev.defaultValue) : undefined);
1879
- const nextDef = next.defaultFn ?? (next.defaultValue !== undefined ? String(next.defaultValue) : undefined);
1880
- if (prevDef !== nextDef) {
1995
+ if (typeChanged) {
1996
+ if (nextDef !== undefined) {
1997
+ const val = next.defaultFn ?? formatDefault(next.defaultValue, next.dataType);
1998
+ changes.push(`ALTER COLUMN ${col2} SET DEFAULT ${val}`);
1999
+ }
2000
+ } else if (prevDef !== nextDef) {
1881
2001
  if (nextDef !== undefined) {
1882
2002
  const val = next.defaultFn ?? formatDefault(next.defaultValue, next.dataType);
1883
2003
  changes.push(`ALTER COLUMN ${col2} SET DEFAULT ${val}`);
@@ -3288,11 +3408,29 @@ async function runPush(config, opts = {}) {
3288
3408
  );
3289
3409
  `);
3290
3410
  const rows = await sql2.unsafe(`SELECT snapshot FROM ${qualifiedPush} ORDER BY id DESC LIMIT 1;`);
3291
- let prevSnapshot = {};
3411
+ let prevSnapshot = { tables: {}, enums: {}, views: {} };
3292
3412
  if (rows.length > 0) {
3293
- prevSnapshot = typeof rows[0].snapshot === "string" ? JSON.parse(rows[0].snapshot) : rows[0].snapshot;
3413
+ const parsed = typeof rows[0].snapshot === "string" ? JSON.parse(rows[0].snapshot) : rows[0].snapshot;
3414
+ if (parsed.tables || parsed.enums || parsed.views) {
3415
+ prevSnapshot = {
3416
+ tables: parsed.tables || {},
3417
+ enums: parsed.enums || {},
3418
+ views: parsed.views || {}
3419
+ };
3420
+ } else {
3421
+ prevSnapshot = { tables: parsed, enums: {}, views: {} };
3422
+ }
3423
+ }
3424
+ const currentSnapshot = { tables: {}, enums: {}, views: {} };
3425
+ for (const s2 of schemas) {
3426
+ if (s2.type === "table") {
3427
+ currentSnapshot.tables[s2.config.name] = s2.config;
3428
+ } else if (s2.type === "enum") {
3429
+ currentSnapshot.enums[s2.enumName] = { enumName: s2.enumName, enumValues: s2.enumValues };
3430
+ } else if (s2.type === "view") {
3431
+ currentSnapshot.views[s2.config.name] = s2.config;
3432
+ }
3294
3433
  }
3295
- const currentSnapshot = Object.fromEntries(schemas.map((schemaEntry) => [schemaEntry.config.name, schemaEntry.config]));
3296
3434
  const diff = diffSchemas(prevSnapshot, currentSnapshot);
3297
3435
  if (diff.statements.length === 0) {
3298
3436
  ms.stop("Up to date.");
@@ -3365,19 +3503,46 @@ async function runGenerate(config, name) {
3365
3503
  const metaDir = join3(migrationsDir, "meta");
3366
3504
  await Bun.$`mkdir -p ${migrationsDir}`.quiet();
3367
3505
  await Bun.$`mkdir -p ${metaDir}`.quiet();
3368
- const currentSnapshot = Object.fromEntries(schemas.map((s2) => [s2.config.name, s2.config]));
3369
- let prevSnapshot = {};
3506
+ const currentSnapshot = { tables: {}, enums: {}, views: {} };
3507
+ for (const s2 of schemas) {
3508
+ if (s2.type === "table") {
3509
+ currentSnapshot.tables[s2.config.name] = s2.config;
3510
+ } else if (s2.type === "enum") {
3511
+ currentSnapshot.enums[s2.enumName] = { enumName: s2.enumName, enumValues: s2.enumValues };
3512
+ } else if (s2.type === "view") {
3513
+ currentSnapshot.views[s2.config.name] = s2.config;
3514
+ }
3515
+ }
3516
+ let prevSnapshot = { tables: {}, enums: {}, views: {} };
3370
3517
  let isFirstMigration = true;
3371
3518
  try {
3372
3519
  const files = readdirSync(metaDir).filter((f2) => f2.endsWith("_snapshot.json")).sort();
3373
3520
  if (files.length > 0) {
3374
3521
  const latest = files[files.length - 1];
3375
- prevSnapshot = JSON.parse(await Bun.file(join3(metaDir, latest)).text());
3522
+ const parsed = JSON.parse(await Bun.file(join3(metaDir, latest)).text());
3523
+ if (parsed.tables || parsed.enums || parsed.views) {
3524
+ prevSnapshot = {
3525
+ tables: parsed.tables || {},
3526
+ enums: parsed.enums || {},
3527
+ views: parsed.views || {}
3528
+ };
3529
+ } else {
3530
+ prevSnapshot = { tables: parsed, enums: {}, views: {} };
3531
+ }
3376
3532
  isFirstMigration = false;
3377
3533
  } else {
3378
3534
  const legacyFile2 = Bun.file(join3(migrationsDir, ".snapshot.json"));
3379
3535
  if (await legacyFile2.exists()) {
3380
- prevSnapshot = JSON.parse(await legacyFile2.text());
3536
+ const parsed = JSON.parse(await legacyFile2.text());
3537
+ if (parsed.tables || parsed.enums || parsed.views) {
3538
+ prevSnapshot = {
3539
+ tables: parsed.tables || {},
3540
+ enums: parsed.enums || {},
3541
+ views: parsed.views || {}
3542
+ };
3543
+ } else {
3544
+ prevSnapshot = { tables: parsed, enums: {}, views: {} };
3545
+ }
3381
3546
  isFirstMigration = false;
3382
3547
  }
3383
3548
  }
@@ -3397,17 +3562,30 @@ async function runGenerate(config, name) {
3397
3562
  let summary;
3398
3563
  let warnings = [];
3399
3564
  if (isFirstMigration) {
3400
- const sorted = topoSort(schemas);
3401
- upStatements = sorted.flatMap((entry) => [
3402
- `-- ${entry.exportName}`,
3403
- generateCreateTable(entry.config, true),
3404
- ``
3405
- ]);
3406
- downStatements = [...sorted].reverse().flatMap((entry) => {
3565
+ const tableSchemas = schemas.filter((s2) => s2.type === "table");
3566
+ const enumSchemas = schemas.filter((s2) => s2.type === "enum");
3567
+ const viewSchemas = schemas.filter((s2) => s2.type === "view");
3568
+ const sorted = topoSort(tableSchemas);
3569
+ upStatements = [];
3570
+ downStatements = [];
3571
+ summary = [];
3572
+ for (const e of enumSchemas) {
3573
+ upStatements.push(`-- ${e.exportName}`, `CREATE TYPE "${e.enumName}" AS ENUM (${e.enumValues.map((v) => `'${v.replace(/'/g, "''")}'`).join(", ")});`, ``);
3574
+ downStatements.unshift(`DROP TYPE IF EXISTS "${e.enumName}";`);
3575
+ summary.push(`CREATE TYPE ${e.enumName}`);
3576
+ }
3577
+ for (const entry of sorted) {
3578
+ upStatements.push(`-- ${entry.exportName}`, generateCreateTable(entry.config, true), ``);
3407
3579
  const tbl = entry.config.schema ? `"${entry.config.schema}"."${entry.config.name}"` : `"${entry.config.name}"`;
3408
- return [`DROP TABLE IF EXISTS ${tbl};`];
3409
- });
3410
- summary = sorted.map((s2) => `CREATE TABLE ${s2.config.name}`);
3580
+ downStatements.unshift(`DROP TABLE IF EXISTS ${tbl};`);
3581
+ summary.push(`CREATE TABLE ${entry.config.name}`);
3582
+ }
3583
+ for (const v of viewSchemas) {
3584
+ upStatements.push(`-- ${v.exportName}`, generateCreateView(v.config), ``);
3585
+ const isMat = v.config.materialized ? "MATERIALIZED VIEW" : "VIEW";
3586
+ downStatements.unshift(`DROP ${isMat} IF EXISTS "${v.config.name}";`);
3587
+ summary.push(`CREATE ${isMat} ${v.config.name}`);
3588
+ }
3411
3589
  } else {
3412
3590
  const upDiff = diffSchemas(prevSnapshot, currentSnapshot);
3413
3591
  if (upDiff.statements.length === 0) {
@@ -3664,19 +3842,18 @@ function generateSchemaTS(tableMap, dbSchema) {
3664
3842
  `// Generated at: ${new Date().toISOString()}`,
3665
3843
  ``,
3666
3844
  `import {`,
3667
- ` table,`,
3845
+ ` pgTable,`,
3668
3846
  ` text, varchar, char, integer, bigint, smallint,`,
3669
3847
  ` serial, bigserial, boolean, real, doublePrecision,`,
3670
3848
  ` numeric, decimal, json, jsonb,`,
3671
3849
  ` timestamp, timestamptz, date, time, uuid,`,
3672
3850
  ` bytea, inet,`,
3673
- ` textArray, integerArray, varcharArray, uuidArray,`,
3674
3851
  `} from "@bungres/orm";`,
3675
3852
  ``
3676
3853
  ];
3677
3854
  for (const [, table2] of tableMap) {
3678
3855
  const varName = toCamelCase(table2.tableName);
3679
- lines.push(`export const ${varName} = table("${table2.tableName}", {`);
3856
+ lines.push(`export const ${varName} = pgTable("${table2.tableName}", {`);
3680
3857
  for (const col2 of table2.columns) {
3681
3858
  const colExpr = buildColumnExpression(col2);
3682
3859
  lines.push(` ${toCamelCase(col2.name)}: ${colExpr},`);
@@ -3757,11 +3934,13 @@ function buildColumnExpression(col2) {
3757
3934
  refOpts += `, onUpdate: "${updateRule}"`;
3758
3935
  opts.push(`references: { ${refOpts} }`);
3759
3936
  }
3760
- let builderName = pgTypeToBungresBuilderName(col2);
3761
- if (opts.length > 0) {
3762
- return `${builderName}({ ${opts.join(", ")} })`;
3763
- }
3764
- return `${builderName}()`;
3937
+ let builderResult = pgTypeToBungresBuilderName(col2);
3938
+ let builderName = typeof builderResult === "string" ? builderResult : builderResult.base;
3939
+ let isArray = typeof builderResult !== "string" && builderResult.isArray;
3940
+ let expr = opts.length > 0 ? `${builderName}({ ${opts.join(", ")} })` : `${builderName}()`;
3941
+ if (isArray)
3942
+ expr += `.array()`;
3943
+ return expr;
3765
3944
  }
3766
3945
  function pgTypeToBungresBuilderName(col2) {
3767
3946
  const dt = col2.dataType;
@@ -3807,14 +3986,14 @@ function pgTypeToBungresBuilderName(col2) {
3807
3986
  return "text";
3808
3987
  if (dt === "ARRAY") {
3809
3988
  if (col2.udtName === "_text")
3810
- return "textArray";
3989
+ return { base: "text", isArray: true };
3811
3990
  if (col2.udtName === "_int4" || col2.udtName === "_int8")
3812
- return "integerArray";
3991
+ return { base: "integer", isArray: true };
3813
3992
  if (col2.udtName === "_varchar")
3814
- return "varcharArray";
3993
+ return { base: "varchar", isArray: true };
3815
3994
  if (col2.udtName === "_uuid")
3816
- return "uuidArray";
3817
- return "textArray";
3995
+ return { base: "uuid", isArray: true };
3996
+ return { base: "text", isArray: true };
3818
3997
  }
3819
3998
  return "text";
3820
3999
  }
@@ -3885,9 +4064,12 @@ async function runDrop(config, opts = {}) {
3885
4064
  const s = spinner();
3886
4065
  s.start("Loading schemas...");
3887
4066
  const schemas = await loadSchemas(config.schema);
3888
- if (schemas.length === 0) {
4067
+ const tableSchemas = schemas.filter((s2) => s2.type === "table");
4068
+ const enumSchemas = schemas.filter((s2) => s2.type === "enum");
4069
+ const viewSchemas = schemas.filter((s2) => s2.type === "view");
4070
+ if (tableSchemas.length === 0 && enumSchemas.length === 0 && viewSchemas.length === 0) {
3889
4071
  s.stop("No schemas found.");
3890
- log.warn(import_picocolors5.default.yellow("No table definitions found in schema files."));
4072
+ log.warn(import_picocolors5.default.yellow("No definitions found in schema files."));
3891
4073
  outro("Failed.");
3892
4074
  return;
3893
4075
  }
@@ -3909,25 +4091,31 @@ async function runDrop(config, opts = {}) {
3909
4091
  WHERE table_schema = $1 AND table_name = $2
3910
4092
  ) AS exists`, [config.migrationsSchema, "__bungres_push"]);
3911
4093
  const pushTableExists = pushTableCheck[0]?.exists ?? false;
3912
- const tablesToDrop = schemas.filter((sch) => existingTableNames.has(sch.config.name));
3913
- if (tablesToDrop.length === 0 && !migrationTableExists && !pushTableExists) {
4094
+ const tablesToDrop = tableSchemas.filter((sch) => existingTableNames.has(sch.config.name));
4095
+ if (tablesToDrop.length === 0 && enumSchemas.length === 0 && viewSchemas.length === 0 && !migrationTableExists && !pushTableExists) {
3914
4096
  ms.stop("Nothing to do.");
3915
- log.success(import_picocolors5.default.green("No tables to drop (they either don't exist or were already dropped)."));
4097
+ log.success(import_picocolors5.default.green("No items to drop (they either don't exist or were already dropped)."));
3916
4098
  outro("Done.");
3917
4099
  return;
3918
4100
  }
3919
4101
  ms.stop("Database check complete.");
3920
- const tableNamesToPrint = tablesToDrop.map((sch) => (sch.config.schema ? sch.config.schema + "." : "") + sch.config.name);
4102
+ const namesToPrint = tablesToDrop.map((sch) => (sch.config.schema ? sch.config.schema + "." : "") + sch.config.name + " (table)");
4103
+ for (const v of viewSchemas) {
4104
+ namesToPrint.push(`${v.config.name} (view)`);
4105
+ }
4106
+ for (const e of enumSchemas) {
4107
+ namesToPrint.push(`${e.enumName} (enum)`);
4108
+ }
3921
4109
  if (migrationTableExists) {
3922
- tableNamesToPrint.push(`${config.migrationsSchema}.${config.migrationsTable}`);
4110
+ namesToPrint.push(`${config.migrationsSchema}.${config.migrationsTable} (table)`);
3923
4111
  }
3924
4112
  if (pushTableExists) {
3925
- tableNamesToPrint.push(`${config.migrationsSchema}.__bungres_push`);
4113
+ namesToPrint.push(`${config.migrationsSchema}.__bungres_push (table)`);
3926
4114
  }
3927
4115
  if (!opts.force) {
3928
4116
  log.warn(import_picocolors5.default.bgRed(import_picocolors5.default.white(" \u26A0\uFE0F WARNING ")));
3929
- log.message(import_picocolors5.default.bold(import_picocolors5.default.red("This will drop the following tables and ALL their data:")));
3930
- for (const name of tableNamesToPrint) {
4117
+ log.message(import_picocolors5.default.bold(import_picocolors5.default.red("This will drop the following items and ALL their data:")));
4118
+ for (const name of namesToPrint) {
3931
4119
  log.info(import_picocolors5.default.yellow(` - ${name}`));
3932
4120
  }
3933
4121
  const confirm2 = await confirm({
@@ -3941,11 +4129,22 @@ async function runDrop(config, opts = {}) {
3941
4129
  }
3942
4130
  const exSpinner = spinner();
3943
4131
  exSpinner.start("Dropping tables...");
4132
+ for (const entry of viewSchemas) {
4133
+ const isMat = entry.config.materialized ? "MATERIALIZED VIEW" : "VIEW";
4134
+ const ddl = `DROP ${isMat} IF EXISTS "${entry.config.name}" CASCADE;`;
4135
+ await sql2.unsafe(ddl);
4136
+ log.step(import_picocolors5.default.gray(`Dropped ${entry.config.name}`));
4137
+ }
3944
4138
  for (const entry of tablesToDrop) {
3945
4139
  const ddl = `DROP TABLE IF EXISTS "${entry.config.name}" CASCADE;`;
3946
4140
  await sql2.unsafe(ddl);
3947
4141
  log.step(import_picocolors5.default.gray(`Dropped ${entry.config.name}`));
3948
4142
  }
4143
+ for (const entry of enumSchemas) {
4144
+ const ddl = `DROP TYPE IF EXISTS "${entry.enumName}" CASCADE;`;
4145
+ await sql2.unsafe(ddl);
4146
+ log.step(import_picocolors5.default.gray(`Dropped ${entry.enumName}`));
4147
+ }
3949
4148
  if (migrationTableExists) {
3950
4149
  const qualifiedMigTable = `"${config.migrationsSchema}"."${config.migrationsTable}"`;
3951
4150
  await sql2.unsafe(`DROP TABLE IF EXISTS ${qualifiedMigTable} CASCADE`);
@@ -3955,7 +4154,7 @@ async function runDrop(config, opts = {}) {
3955
4154
  await sql2.unsafe(`DROP TABLE IF EXISTS "${config.migrationsSchema}"."__bungres_push" CASCADE`);
3956
4155
  log.step(import_picocolors5.default.gray(`Dropped ${config.migrationsSchema}.__bungres_push`));
3957
4156
  }
3958
- exSpinner.stop("Tables dropped.");
4157
+ exSpinner.stop("Items dropped.");
3959
4158
  outro(import_picocolors5.default.cyan("\u2728 Drop complete."));
3960
4159
  } catch (err) {
3961
4160
  log.error(import_picocolors5.default.red(`Drop failed: ${err.message}`));
@@ -1,9 +1,24 @@
1
1
  import { type TableConfig } from "@bungres/orm";
2
- export interface SchemaEntry {
2
+ export interface TableSchemaEntry {
3
+ type: "table";
3
4
  exportName: string;
4
5
  config: TableConfig;
5
6
  table: any;
6
7
  filePath: string;
7
8
  }
9
+ export interface EnumSchemaEntry {
10
+ type: "enum";
11
+ exportName: string;
12
+ enumName: string;
13
+ enumValues: string[];
14
+ filePath: string;
15
+ }
16
+ export interface ViewSchemaEntry {
17
+ type: "view";
18
+ exportName: string;
19
+ config: any;
20
+ filePath: string;
21
+ }
22
+ export type SchemaEntry = TableSchemaEntry | EnumSchemaEntry | ViewSchemaEntry;
8
23
  export declare function loadSchemas(patterns: string | string[], cwd?: string): Promise<SchemaEntry[]>;
9
24
  //# sourceMappingURL=schema-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-loader.d.ts","sourceRoot":"","sources":["../src/schema-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAMnE,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,GAAG,SAAgB,GAClB,OAAO,CAAC,WAAW,EAAE,CAAC,CAwBxB"}
1
+ {"version":3,"file":"schema-loader.d.ts","sourceRoot":"","sources":["../src/schema-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAMnE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,GAAG,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,eAAe,GAAG,eAAe,CAAC;AAE/E,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,GAAG,SAAgB,GAClB,OAAO,CAAC,WAAW,EAAE,CAAC,CAwCxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bungres/kit",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "CLI toolkit for @bungres/orm — migrate, push, generate, pull",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -15,9 +15,10 @@
15
15
  "types": "./dist/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
- "bun": "./src/index.ts",
18
+ "types": "./dist/index.d.ts",
19
19
  "import": "./dist/index.js",
20
- "types": "./dist/index.d.ts"
20
+ "require": "./dist/index.js",
21
+ "default": "./dist/index.js"
21
22
  }
22
23
  },
23
24
  "files": [