pg2zod 2.1.1 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **New Features:**
8
+
9
+ - **Database Type Generation**: Added a top-level `Database` interface that organizes all generated types by schema, similar to Supabase's type generator. This provides a structured way to access all table, view, function, enum, and composite type definitions.
10
+
11
+ - **Views now generated by default**: Database views are now included in the output by default. Use `--no-views` to skip them.
12
+
13
+ - **Routines (functions/procedures) now generated by default**: Database functions and procedures are now included by default. Use `--no-routines` to skip them.
14
+
15
+ - **Composite types now generated by default**: Composite types are now included by default. Use `--no-composite-types` to skip them.
16
+
17
+ **Breaking Changes:**
18
+
19
+ - **View schema naming**: View schemas now include a `View` suffix to prevent naming conflicts with tables (e.g., `PublicPersonSummaryViewSchema` instead of `PublicPersonSummarySchema`).
20
+
21
+ - **Default behavior change**: Views, routines, and composite types are now generated by default. Users who want the old behavior should use `--no-views`, `--no-routines`, and `--no-composite-types` flags.
22
+
23
+ **Improvements:**
24
+
25
+ - Functions without parameters now correctly generate `Args: Record<string, never>` in the Database type
26
+ - Functions without return values now correctly generate `Returns: void` in the Database type
27
+ - Better handling of edge cases in function parameter and return type generation
28
+
29
+ ## 2.1.2
30
+
31
+ ### Patch Changes
32
+
33
+ - 9cd667c: Filter internal PostgreSQL functions and handle duplicates
34
+
35
+ **Bug Fixes:**
36
+
37
+ - Fixed type errors in view column metadata generation
38
+ - Removed invalid fields (ordinalPosition, isIdentity, etc.) from ColumnMetadata
39
+
40
+ **Improvements:**
41
+
42
+ - Filter out internal PostgreSQL system functions (functions using internal, trigger, cstring, "char", and other low-level types)
43
+ - Skip functions with duplicate parameter names that would cause invalid TypeScript
44
+ - Skip overloaded functions - only keep first occurrence to avoid naming conflicts
45
+ - Significantly reduces generated function count (from 261 to ~50-60 for typical databases)
46
+ - Generated schemas now compile without TypeScript errors
47
+
48
+ **Quality:**
49
+
50
+ - Ensures only user-facing, application-relevant functions are included in generated schemas
51
+ - Cleaner output with fewer warnings about unmapped internal types
52
+
3
53
  ## 2.1.0
4
54
 
5
55
  ### Minor Changes