cogsbox-shape 0.5.94 → 0.5.96
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 +11 -7
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export interface IBuilderMethods<T extends SQLType | RelationConfig<any>, TSql e
|
|
|
58
58
|
reference: <TRefSchema extends {
|
|
59
59
|
_tableName: string;
|
|
60
60
|
}>(fieldGetter: () => any) => Builder<"sql", T & {
|
|
61
|
-
|
|
61
|
+
references: typeof fieldGetter;
|
|
62
62
|
}, TSql, TNew, TInitialValue, TClient, TValidation>;
|
|
63
63
|
client: <TClientNext extends z.ZodTypeAny>(schema: ((tools: {
|
|
64
64
|
sql: TSql;
|
|
@@ -216,10 +216,13 @@ type InferSchemaByKey<T, Key extends "zodSqlSchema" | "zodClientSchema" | "zodVa
|
|
|
216
216
|
[P in Key]: infer ZodSchema;
|
|
217
217
|
};
|
|
218
218
|
} ? ZodSchema : never : T[K] extends {
|
|
219
|
-
config:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
config: infer Config;
|
|
220
|
+
} ? Key extends "zodSqlSchema" ? Config extends {
|
|
221
|
+
sql: infer SqlConfig;
|
|
222
|
+
zodSqlSchema: infer ZodSchema extends z.ZodTypeAny;
|
|
223
|
+
} ? ZodSchema : never : Config extends {
|
|
224
|
+
[P in Key]: infer ZodSchema extends z.ZodTypeAny;
|
|
225
|
+
} ? ZodSchema : never : never;
|
|
223
226
|
};
|
|
224
227
|
type InferSqlSchema<T> = InferSchemaByKey<T, "zodSqlSchema">;
|
|
225
228
|
type InferClientSchema<T> = InferSchemaByKey<T, "zodClientSchema">;
|
|
@@ -282,15 +285,16 @@ type DeriveSchemaByKey<T, Key extends "zodSqlSchema" | "zodClientSchema" | "zodV
|
|
|
282
285
|
schema: () => infer S;
|
|
283
286
|
};
|
|
284
287
|
};
|
|
285
|
-
} ? S extends {
|
|
288
|
+
} ? Key extends "zodSqlSchema" ? never : S extends {
|
|
286
289
|
_tableName: string;
|
|
287
290
|
} ? z.ZodArray<z.ZodObject<Prettify<DeriveSchemaByKey<S, Key, [...Depth, 1]>>>> : never : T[K] extends {
|
|
288
291
|
config: {
|
|
289
292
|
sql: {
|
|
293
|
+
type: "hasOne" | "belongsTo";
|
|
290
294
|
schema: () => infer S;
|
|
291
295
|
};
|
|
292
296
|
};
|
|
293
|
-
} ? S extends {
|
|
297
|
+
} ? Key extends "zodSqlSchema" ? never : S extends {
|
|
294
298
|
_tableName: string;
|
|
295
299
|
} ? z.ZodObject<Prettify<DeriveSchemaByKey<S, Key, [...Depth, 1]>>> : z.ZodObject<any> : T[K] extends {
|
|
296
300
|
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.96",
|
|
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",
|