cogsbox-shape 0.5.128 → 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.
- package/dist/schema.js +16 -8
- 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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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.
|
|
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",
|