cogsbox-shape 0.5.150 → 0.5.152
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 +9 -14
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -569,17 +569,17 @@ function createViewObject(initialRegistryKey, selection, registry, tableNameToRe
|
|
|
569
569
|
if (!registryEntry) {
|
|
570
570
|
throw new Error(`Schema with key "${currentRegistryKey}" not found in the registry.`);
|
|
571
571
|
}
|
|
572
|
-
// Check
|
|
572
|
+
// FIX: Check at the correct path - registryEntry.zodSchemas
|
|
573
573
|
if (!(currentRegistryKey in checkedTables)) {
|
|
574
|
-
const hasPks = !!(registryEntry.pk &&
|
|
575
|
-
registryEntry.pk.length > 0 &&
|
|
576
|
-
registryEntry.clientPk &&
|
|
577
|
-
registryEntry.clientPk.length > 0);
|
|
574
|
+
const hasPks = !!(registryEntry.zodSchemas?.pk &&
|
|
575
|
+
registryEntry.zodSchemas.pk.length > 0 &&
|
|
576
|
+
registryEntry.zodSchemas?.clientPk &&
|
|
577
|
+
registryEntry.zodSchemas.clientPk.length > 0);
|
|
578
578
|
checkedTables[currentRegistryKey] = hasPks;
|
|
579
579
|
if (!hasPks) {
|
|
580
580
|
console.log(`Table ${currentRegistryKey} missing pk/clientPk:`, {
|
|
581
|
-
pk: registryEntry.pk,
|
|
582
|
-
clientPk: registryEntry.clientPk,
|
|
581
|
+
pk: registryEntry.zodSchemas?.pk,
|
|
582
|
+
clientPk: registryEntry.zodSchemas?.clientPk,
|
|
583
583
|
});
|
|
584
584
|
allTablesSupportsReconciliation = false;
|
|
585
585
|
}
|
|
@@ -617,16 +617,11 @@ function createViewObject(initialRegistryKey, selection, registry, tableNameToRe
|
|
|
617
617
|
const finalShape = { ...primitiveShape, ...selectedRelationShapes };
|
|
618
618
|
return z.object(finalShape);
|
|
619
619
|
}
|
|
620
|
-
// For array schemas, handle the initial registry key check
|
|
621
|
-
const isArray = Array.isArray(selection);
|
|
622
|
-
const actualSelection = isArray ? true : selection;
|
|
623
620
|
return {
|
|
624
621
|
sql: registry[initialRegistryKey].zodSchemas.sqlSchema,
|
|
625
|
-
client: buildView(initialRegistryKey,
|
|
626
|
-
server: buildView(initialRegistryKey,
|
|
622
|
+
client: buildView(initialRegistryKey, selection, "client"),
|
|
623
|
+
server: buildView(initialRegistryKey, selection, "server"),
|
|
627
624
|
supportsReconciliation: allTablesSupportsReconciliation,
|
|
628
|
-
// Debug info
|
|
629
|
-
checkedTables,
|
|
630
625
|
};
|
|
631
626
|
}
|
|
632
627
|
export function createSchemaBox(schemas, resolver) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.152",
|
|
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",
|