zodvex 0.5.0 → 0.5.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/README.md CHANGED
@@ -9,6 +9,7 @@ Type-safe Convex functions with Zod schemas. Preserve Convex's optional/nullable
9
9
  ## Table of Contents
10
10
 
11
11
  - [Installation](#installation)
12
+ - [Import Paths](#import-paths)
12
13
  - [Quick Start](#quick-start)
13
14
  - [Defining Schemas](#defining-schemas)
14
15
  - [Table Definitions](#table-definitions)
@@ -41,6 +42,45 @@ npm install zodvex zod@^4.1.0 convex convex-helpers
41
42
  - `convex` (>= 1.27.0)
42
43
  - `convex-helpers` (>= 0.1.104)
43
44
 
45
+ ## Import Paths
46
+
47
+ zodvex provides multiple entry points for optimal bundle sizes:
48
+
49
+ ### `zodvex/core` - Client-Safe (Recommended for client code)
50
+
51
+ Use this in React components, hooks, and any client-side code:
52
+
53
+ ```typescript
54
+ import { zx, zodToConvex } from 'zodvex/core'
55
+
56
+ // Define schemas that can be used anywhere
57
+ const userSchema = z.object({
58
+ id: zx.id('users'),
59
+ createdAt: zx.date(),
60
+ })
61
+ ```
62
+
63
+ ### `zodvex/server` - Server-Only
64
+
65
+ Use this in Convex functions and schema definitions:
66
+
67
+ ```typescript
68
+ import { zodTable, zCustomQuery } from 'zodvex/server'
69
+
70
+ // In convex/schema.ts
71
+ const Users = zodTable('users', userShape)
72
+ ```
73
+
74
+ ### `zodvex` - Full Library (Backwards Compatible)
75
+
76
+ For convenience or when you don't care about bundle size:
77
+
78
+ ```typescript
79
+ import { zx, zodTable } from 'zodvex'
80
+ ```
81
+
82
+ > **Note:** This pulls in server code. Use `zodvex/core` for client bundles.
83
+
44
84
  ## Quick Start
45
85
 
46
86
  ### 1. Set up your builders
@@ -0,0 +1,19 @@
1
+ /**
2
+ * zodvex/core - Client-safe validators and utilities
3
+ *
4
+ * This module contains no server imports and is safe to use in:
5
+ * - React components
6
+ * - Client-side hooks
7
+ * - Shared validation logic
8
+ * - Any code that runs in the browser
9
+ */
10
+ export * from '../codec';
11
+ export * from '../ids';
12
+ export * from '../mapping';
13
+ export * from '../registry';
14
+ export * from '../results';
15
+ export * from '../transform';
16
+ export * from '../types';
17
+ export * from '../utils';
18
+ export * from '../zx';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,UAAU,CAAA;AAExB,cAAc,QAAQ,CAAA;AAEtB,cAAc,YAAY,CAAA;AAE1B,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA;AAE1B,cAAc,cAAc,CAAA;AAG5B,cAAc,UAAU,CAAA;AAGxB,cAAc,UAAU,CAAA;AAExB,cAAc,OAAO,CAAA"}