cogsbox-shape 0.5.54 → 0.5.55
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 +3 -3
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -396,7 +396,7 @@ export function createSchema(schema) {
|
|
|
396
396
|
else if (resolvedDefinition &&
|
|
397
397
|
["hasMany", "manyToMany", "hasOne", "belongsTo"].includes(resolvedDefinition.type)) {
|
|
398
398
|
const relation = resolvedDefinition;
|
|
399
|
-
const childSchemaResult = createSchema(relation.schema
|
|
399
|
+
const childSchemaResult = createSchema(relation.schema);
|
|
400
400
|
if (relation.type === "hasMany" || relation.type === "manyToMany") {
|
|
401
401
|
sqlFields[key] = z.array(childSchemaResult.sqlSchema).optional();
|
|
402
402
|
clientFields[key] = z.array(childSchemaResult.clientSchema).optional();
|
|
@@ -443,12 +443,12 @@ function serializeSchemaMetadata(schema) {
|
|
|
443
443
|
const relation = definition;
|
|
444
444
|
let toKeyName = null;
|
|
445
445
|
try {
|
|
446
|
-
let targetFieldDefinition = relation.toKey
|
|
446
|
+
let targetFieldDefinition = relation.toKey;
|
|
447
447
|
if (targetFieldDefinition &&
|
|
448
448
|
targetFieldDefinition.type === "reference") {
|
|
449
449
|
targetFieldDefinition = targetFieldDefinition.to;
|
|
450
450
|
}
|
|
451
|
-
const targetSchemaObject = relation.schema
|
|
451
|
+
const targetSchemaObject = relation.schema;
|
|
452
452
|
for (const targetKey in targetSchemaObject) {
|
|
453
453
|
if (targetSchemaObject[targetKey] === targetFieldDefinition) {
|
|
454
454
|
toKeyName = targetKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.55",
|
|
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",
|