cogsbox-shape 0.5.127 → 0.5.129

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.
Files changed (2) hide show
  1. package/dist/schema.js +16 -8
  2. package/package.json +1 -1
package/dist/schema.js CHANGED
@@ -152,10 +152,14 @@ function createBuilder(config) {
152
152
  else if (isFunction(schemaOrModifier)) {
153
153
  // It's a schema modifier function
154
154
  // Create base Zod schema from the value type
155
- if (typeof actualValue === "string" ||
156
- typeof actualValue === "number" ||
157
- typeof actualValue === "boolean") {
158
- baseSchema = z.literal(actualValue);
155
+ if (typeof actualValue === "string") {
156
+ baseSchema = z.string();
157
+ }
158
+ else if (typeof actualValue === "number") {
159
+ baseSchema = z.number();
160
+ }
161
+ else if (typeof actualValue === "boolean") {
162
+ baseSchema = z.boolean();
159
163
  }
160
164
  else if (actualValue instanceof Date) {
161
165
  baseSchema = z.date();
@@ -174,10 +178,14 @@ function createBuilder(config) {
174
178
  }
175
179
  else {
176
180
  // No schema provided, create from value type
177
- if (typeof actualValue === "string" ||
178
- typeof actualValue === "number" ||
179
- typeof actualValue === "boolean") {
180
- baseSchema = z.literal(actualValue);
181
+ if (typeof actualValue === "string") {
182
+ baseSchema = z.string();
183
+ }
184
+ else if (typeof actualValue === "number") {
185
+ baseSchema = z.number();
186
+ }
187
+ else if (typeof actualValue === "boolean") {
188
+ baseSchema = z.boolean();
181
189
  }
182
190
  else if (actualValue instanceof Date) {
183
191
  baseSchema = z.date();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cogsbox-shape",
3
- "version": "0.5.127",
3
+ "version": "0.5.129",
4
4
  "description": "A TypeScript library for creating type-safe database schemas with Zod validation, SQL type definitions, and automatic client/server transformations. Unifies client, server, and database types through a single schema definition, with built-in support for relationships and serialization.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",