cogsbox-shape 0.5.91 → 0.5.92
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 +0 -4
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -486,19 +486,15 @@ export function createSchema(schema, relations) {
|
|
|
486
486
|
["hasMany", "hasOne", "belongsTo", "manyToMany"].includes(sqlConfig.type)) {
|
|
487
487
|
const relatedSchemaFactory = sqlConfig.schema;
|
|
488
488
|
const childSchemaResult = createSchema(relatedSchemaFactory());
|
|
489
|
-
let baseSqlSchema;
|
|
490
489
|
let baseClientSchema;
|
|
491
490
|
if (sqlConfig.type === "hasMany" || sqlConfig.type === "manyToMany") {
|
|
492
|
-
baseSqlSchema = z.array(childSchemaResult.sqlSchema);
|
|
493
491
|
baseClientSchema = z.array(childSchemaResult.clientSchema);
|
|
494
492
|
defaultValues[key] = Array.from({ length: sqlConfig.defaultCount || 0 }, () => childSchemaResult.defaultValues);
|
|
495
493
|
}
|
|
496
494
|
else {
|
|
497
|
-
baseSqlSchema = childSchemaResult.sqlSchema;
|
|
498
495
|
baseClientSchema = childSchemaResult.clientSchema;
|
|
499
496
|
defaultValues[key] = childSchemaResult.defaultValues;
|
|
500
497
|
}
|
|
501
|
-
sqlFields[key] = baseSqlSchema.optional();
|
|
502
498
|
clientFields[key] = config.clientTransform
|
|
503
499
|
? config.clientTransform(baseClientSchema)
|
|
504
500
|
: baseClientSchema;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.92",
|
|
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",
|