cogsbox-shape 0.5.96 → 0.5.98
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 +9 -4
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -278,23 +278,28 @@ type Prettify<T> = {
|
|
|
278
278
|
[K in keyof T]: T[K];
|
|
279
279
|
} & {};
|
|
280
280
|
type DeriveSchemaByKey<T, Key extends "zodSqlSchema" | "zodClientSchema" | "zodValidationSchema", Depth extends any[] = []> = Depth["length"] extends 10 ? any : {
|
|
281
|
-
[K in keyof T as K extends "_tableName" | typeof SchemaWrapperBrand ? never : K
|
|
281
|
+
[K in keyof T as K extends "_tableName" | typeof SchemaWrapperBrand ? never : K extends keyof T ? T[K] extends {
|
|
282
|
+
config: {
|
|
283
|
+
sql: {
|
|
284
|
+
type: "hasMany" | "manyToMany" | "hasOne" | "belongsTo";
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
} ? Key extends "zodSqlSchema" ? never : K : K : never]: T[K] extends {
|
|
282
288
|
config: {
|
|
283
289
|
sql: {
|
|
284
290
|
type: "hasMany" | "manyToMany";
|
|
285
291
|
schema: () => infer S;
|
|
286
292
|
};
|
|
287
293
|
};
|
|
288
|
-
} ?
|
|
294
|
+
} ? S extends {
|
|
289
295
|
_tableName: string;
|
|
290
296
|
} ? z.ZodArray<z.ZodObject<Prettify<DeriveSchemaByKey<S, Key, [...Depth, 1]>>>> : never : T[K] extends {
|
|
291
297
|
config: {
|
|
292
298
|
sql: {
|
|
293
|
-
type: "hasOne" | "belongsTo";
|
|
294
299
|
schema: () => infer S;
|
|
295
300
|
};
|
|
296
301
|
};
|
|
297
|
-
} ?
|
|
302
|
+
} ? S extends {
|
|
298
303
|
_tableName: string;
|
|
299
304
|
} ? z.ZodObject<Prettify<DeriveSchemaByKey<S, Key, [...Depth, 1]>>> : z.ZodObject<any> : T[K] extends {
|
|
300
305
|
type: "reference";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.98",
|
|
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",
|