Skip to content

Commit c79bdb2

Browse files
brainkimclaude
andcommitted
fix: align README type docs with actual exports
- Remove non-existent types from README (SQLFragment, DDLFragment, DBExpression) - Add SQLTemplate as the actual fragment type - Export missing types from zen.ts (PartialTable, DerivedTable, SetValues, FieldDBMeta, ReferenceInfo, CompoundReference, TaggedQuery, SQLDialect, isTable) - Reorganize zen.ts exports into logical groups 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 579d17f commit c79bdb2

File tree

2 files changed

+55
-25
lines changed

2 files changed

+55
-25
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -980,19 +980,15 @@ import type {
980980

981981
// Fragment types
982982
SetValues, // Values accepted by Table.set()
983-
SQLFragment, // SQL fragment object
984-
DDLFragment, // DDL fragment object
983+
SQLTemplate, // SQL template object (return type of set(), on(), etc.)
985984
SQLDialect, // "sqlite" | "postgresql" | "mysql"
986985

987986
// Driver types
988987
Driver, // Driver interface for adapters
989988
TaggedQuery, // Tagged template query function
990989

991-
// Expression types
992-
DBExpression, // Runtime database expression
993-
994990
// Error types
995-
DatabaseErrorCode, // Error code string literals
991+
DatabaseErrorCode, // Error code string literals
996992
} from "@b9g/zen";
997993
```
998994

src/zen.ts

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,43 @@ export {zod as z};
1818
// ============================================================================
1919

2020
export {
21+
// Functions
2122
table,
2223
view,
24+
extendZod,
25+
26+
// Type guards
27+
isTable,
28+
isView,
29+
30+
// View helpers
31+
getViewMeta,
32+
33+
// Table types
2334
type Table,
35+
type PartialTable,
36+
type DerivedTable,
2437
type View,
2538
type Queryable,
2639
type TableOptions,
40+
41+
// Row types
2742
type Row,
2843
type Insert,
2944
type Update,
45+
type SetValues,
46+
47+
// Field types
3048
type FieldMeta,
3149
type FieldType,
50+
type FieldDBMeta,
51+
52+
// Reference types
3253
type Relation,
33-
isView,
34-
getViewMeta,
54+
type ReferenceInfo,
55+
type CompoundReference,
56+
57+
// View types
3558
type ViewMeta,
3659
} from "./impl/table.js";
3760

@@ -40,64 +63,75 @@ export {
4063
// ============================================================================
4164

4265
export {
66+
// Classes
4367
Database,
4468
Transaction,
4569
DatabaseUpgradeEvent,
70+
71+
// Types
4672
type Driver,
73+
type TaggedQuery,
74+
type EnsureResult,
4775
} from "./impl/database.js";
4876

4977
// ============================================================================
50-
// SQL Primitives (for drivers and custom queries)
78+
// SQL Primitives
5179
// ============================================================================
5280

5381
export {
54-
// SQL builtins - SQL-native values with no JS equivalent
82+
// SQL builtins (for .db.inserted() / .db.updated())
83+
NOW,
84+
TODAY,
5585
CURRENT_TIMESTAMP,
5686
CURRENT_DATE,
5787
CURRENT_TIME,
58-
NOW,
59-
TODAY,
6088
isSQLBuiltin,
6189
} from "./impl/database.js";
6290

6391
export {
6492
// SQL identifiers
6593
ident,
6694
isSQLIdentifier,
67-
} from "./impl/template.js";
6895

69-
export {
70-
// SQL template (return type of table methods like deleted(), set(), etc.)
96+
// SQL templates
7197
type SQLTemplate,
7298
isSQLTemplate,
7399
} from "./impl/template.js";
74100

75-
export {
76-
// Schema ensure result
77-
type EnsureResult,
78-
} from "./impl/database.js";
101+
export {type SQLDialect} from "./impl/sql.js";
79102

80103
// ============================================================================
81104
// Errors
82105
// ============================================================================
83106

84107
export {
108+
// Base error
85109
DatabaseError,
110+
isDatabaseError,
111+
hasErrorCode,
112+
113+
// Validation errors
86114
ValidationError,
87115
TableDefinitionError,
88-
MigrationError,
89-
MigrationLockError,
116+
117+
// Query errors
90118
QueryError,
91119
NotFoundError,
92120
AlreadyExistsError,
93121
ConstraintViolationError,
94-
ConnectionError,
95-
TransactionError,
122+
123+
// Migration errors
124+
MigrationError,
125+
MigrationLockError,
96126
EnsureError,
97127
SchemaDriftError,
98128
ConstraintPreflightError,
99-
isDatabaseError,
100-
hasErrorCode,
129+
130+
// Connection errors
131+
ConnectionError,
132+
TransactionError,
133+
134+
// Error types
101135
type DatabaseErrorCode,
102136
type EnsureOperation,
103137
} from "./impl/errors.js";

0 commit comments

Comments
 (0)