cogsbox-shape 0.5.183 → 0.5.185
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.d.ts +2 -2
- package/dist/schema.js +4 -6
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -413,8 +413,8 @@ export type DeriveViewResult<TTableName extends keyof TRegistry, TSelection, TRe
|
|
|
413
413
|
parseForDb: (appData: z.input<z.ZodObject<_DeriveViewShape<TTableName, TSelection, TRegistry, "serverSchema">>>) => z.infer<z.ZodObject<_DeriveViewShape<TTableName, TSelection, TRegistry, "sqlSchema">>>;
|
|
414
414
|
parseFromDb: (dbData: Partial<z.infer<z.ZodObject<_DeriveViewShape<TTableName, TSelection, TRegistry, "sqlSchema">>>>) => z.infer<z.ZodObject<_DeriveViewShape<TTableName, TSelection, TRegistry, "clientSchema">>>;
|
|
415
415
|
};
|
|
416
|
-
defaults: DeriveViewDefaults<TTableName, TSelection, TRegistry>;
|
|
417
|
-
defaultsDefinition: DeriveViewDefaultsDefinition<TTableName, TSelection, TRegistry>;
|
|
416
|
+
defaults: () => DeriveViewDefaults<TTableName, TSelection, TRegistry>;
|
|
417
|
+
defaultsDefinition: () => DeriveViewDefaultsDefinition<TTableName, TSelection, TRegistry>;
|
|
418
418
|
pk: string[] | null;
|
|
419
419
|
clientPk: string[] | null;
|
|
420
420
|
supportsReconciliation: boolean;
|
package/dist/schema.js
CHANGED
|
@@ -655,8 +655,8 @@ export function createSchema(schema, relations) {
|
|
|
655
655
|
return toDb(validData);
|
|
656
656
|
},
|
|
657
657
|
parseFromDb: (dbData) => {
|
|
658
|
-
finalSqlSchema.parse(dbData);
|
|
659
|
-
return toClient(
|
|
658
|
+
const parsed = finalSqlSchema.parse(dbData);
|
|
659
|
+
return toClient(parsed);
|
|
660
660
|
},
|
|
661
661
|
};
|
|
662
662
|
}
|
|
@@ -888,8 +888,6 @@ export function createSchemaBox(schemas, resolutions) {
|
|
|
888
888
|
nav: createNavProxy(tableName, finalRegistry),
|
|
889
889
|
createView: (selection) => {
|
|
890
890
|
const view = createViewObject(tableName, selection, finalRegistry, tableNameToRegistryKeyMap);
|
|
891
|
-
const defaults = computeViewDefaults(tableName, selection, finalRegistry, tableNameToRegistryKeyMap);
|
|
892
|
-
const defaultsDefinition = computeViewDefaultsDefinition(tableName, selection, finalRegistry, tableNameToRegistryKeyMap);
|
|
893
891
|
const deepToClient = (dbData, currentSelection, currentKey) => {
|
|
894
892
|
if (!dbData)
|
|
895
893
|
return dbData;
|
|
@@ -969,8 +967,8 @@ export function createSchemaBox(schemas, resolutions) {
|
|
|
969
967
|
return viewToClient(mappedData);
|
|
970
968
|
},
|
|
971
969
|
},
|
|
972
|
-
defaults:
|
|
973
|
-
defaultsDefinition:
|
|
970
|
+
defaults: () => computeViewDefaults(tableName, selection, finalRegistry, tableNameToRegistryKeyMap),
|
|
971
|
+
defaultsDefinition: () => computeViewDefaultsDefinition(tableName, selection, finalRegistry, tableNameToRegistryKeyMap),
|
|
974
972
|
pk: entry.zodSchemas.pk,
|
|
975
973
|
clientPk: entry.zodSchemas.clientPk,
|
|
976
974
|
supportsReconciliation: view.supportsReconciliation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.185",
|
|
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",
|