cogsbox-shape 0.5.93 → 0.5.94
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 +3 -3
- package/dist/schema.js +2 -2
- package/package.json +1 -1
package/dist/schema.d.ts
CHANGED
|
@@ -55,10 +55,10 @@ export interface IBuilderMethods<T extends SQLType | RelationConfig<any>, TSql e
|
|
|
55
55
|
z.ZodLiteral<TDefaultNext extends () => infer R ? R : TDefaultNext>
|
|
56
56
|
]>>>;
|
|
57
57
|
};
|
|
58
|
-
|
|
58
|
+
reference: <TRefSchema extends {
|
|
59
59
|
_tableName: string;
|
|
60
60
|
}>(fieldGetter: () => any) => Builder<"sql", T & {
|
|
61
|
-
|
|
61
|
+
reference: typeof fieldGetter;
|
|
62
62
|
}, TSql, TNew, TInitialValue, TClient, TValidation>;
|
|
63
63
|
client: <TClientNext extends z.ZodTypeAny>(schema: ((tools: {
|
|
64
64
|
sql: TSql;
|
|
@@ -95,7 +95,7 @@ export type RelationConfig<T extends Schema<any>> = (BaseRelationConfig<T> & {
|
|
|
95
95
|
});
|
|
96
96
|
type Stage = "sql" | "relation" | "new" | "client" | "validation" | "done";
|
|
97
97
|
type StageMethods = {
|
|
98
|
-
sql: "initialState" | "client" | "validation" | "transform" | "
|
|
98
|
+
sql: "initialState" | "client" | "validation" | "transform" | "reference";
|
|
99
99
|
relation: "validation" | "transform";
|
|
100
100
|
new: "client" | "validation" | "transform";
|
|
101
101
|
client: "validation" | "transform";
|
package/dist/schema.js
CHANGED
|
@@ -206,12 +206,12 @@ function createBuilder(config) {
|
|
|
206
206
|
completedStages: newCompletedStages,
|
|
207
207
|
});
|
|
208
208
|
},
|
|
209
|
-
|
|
209
|
+
reference: (fieldGetter) => {
|
|
210
210
|
return createBuilder({
|
|
211
211
|
...config,
|
|
212
212
|
sqlConfig: {
|
|
213
213
|
...config.sqlConfig,
|
|
214
|
-
|
|
214
|
+
reference: fieldGetter,
|
|
215
215
|
},
|
|
216
216
|
});
|
|
217
217
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cogsbox-shape",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.94",
|
|
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",
|