cogsbox-shape 0.5.46 → 0.5.47
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 +4 -1
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -340,7 +340,7 @@ function isRelation(value) {
|
|
|
340
340
|
typeof value === "object" &&
|
|
341
341
|
"type" in value &&
|
|
342
342
|
"fromKey" in value &&
|
|
343
|
-
|
|
343
|
+
"toKey" in value &&
|
|
344
344
|
"schema" in value);
|
|
345
345
|
}
|
|
346
346
|
export function createSchema(schema) {
|
|
@@ -352,9 +352,12 @@ export function createSchema(schema) {
|
|
|
352
352
|
if (key === "_tableName" || key.startsWith("__"))
|
|
353
353
|
continue;
|
|
354
354
|
const field = schema[key];
|
|
355
|
+
console.log("FIELD", field);
|
|
356
|
+
console.log("is fucntion", isFunction(field));
|
|
355
357
|
// Case 1: Handle relation functions (hasMany, hasOne, etc.)
|
|
356
358
|
if (isFunction(field)) {
|
|
357
359
|
const relation = field();
|
|
360
|
+
console.log("isRelation(relation)", isRelation(relation));
|
|
358
361
|
if (!isRelation(relation)) {
|
|
359
362
|
continue;
|
|
360
363
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.47",
|
|
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",
|