@ai0x0/utils 0.0.6 → 0.0.7
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyZodObject, z } from "zod";
|
|
2
2
|
import { PgColumnBuilderBase, PgTableExtraConfigValue } from "drizzle-orm/pg-core";
|
|
3
|
-
import { BuildExtraConfigColumns } from "drizzle-orm";
|
|
3
|
+
import { BuildExtraConfigColumns, Table } from "drizzle-orm";
|
|
4
|
+
import { BuildRefine, NoUnknownKeys } from "drizzle-zod";
|
|
4
5
|
import { BuildSchema } from "drizzle-zod/schema.types.internal";
|
|
5
6
|
export declare const basicFields: {
|
|
6
7
|
id: import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgUUIDBuilderInitial<"id">>>>;
|
|
@@ -45,9 +46,10 @@ export declare const listBodySchema: <T extends z.ZodTypeAny>(schema: T) => z.Zo
|
|
|
45
46
|
data: T["_input"][];
|
|
46
47
|
total: number;
|
|
47
48
|
}>;
|
|
48
|
-
export declare const createTableSchema: <TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object
|
|
49
|
+
export declare const createTableSchema: <TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>>, TTable extends Table<import("drizzle-orm").TableConfig<import("drizzle-orm").Column<any, object, object>>>, TRefine extends BuildRefine<TTable["_"]["columns"]>>({ name, columns, refineSchema, extraConfig, }: {
|
|
49
50
|
name: TTableName;
|
|
50
51
|
columns: TColumnsMap;
|
|
52
|
+
refineSchema?: NoUnknownKeys<TRefine, TTable["$inferSelect"]> | undefined;
|
|
51
53
|
extraConfig?: ((self: BuildExtraConfigColumns<string, Record<string, PgColumnBuilderBase>, "pg">) => PgTableExtraConfigValue[]) | undefined;
|
|
52
54
|
}) => {
|
|
53
55
|
table: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
@@ -1370,7 +1372,7 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
1370
1372
|
} & TColumnsMap)[Key]["_"]["name"];
|
|
1371
1373
|
}, "name" | "data" | "driverParam" | "tableName" | "notNull" | "hasDefault" | "isPrimaryKey" | "isAutoincrement" | "hasRuntimeDefault" | "dataType" | "columnType" | "enumValues" | "identity" | "dialect" | "brand" | "generated" | "baseColumn">[K_1]; } : never>; } : never;
|
|
1372
1374
|
dialect: "pg";
|
|
1373
|
-
}>["_"]["columns"],
|
|
1375
|
+
}>["_"]["columns"], BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
1374
1376
|
name: TTableName;
|
|
1375
1377
|
schema: undefined;
|
|
1376
1378
|
columns: {
|
|
@@ -3348,7 +3350,7 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
3348
3350
|
} & TColumnsMap)[Key]["_"]["name"];
|
|
3349
3351
|
}, "name" | "data" | "driverParam" | "tableName" | "notNull" | "hasDefault" | "isPrimaryKey" | "isAutoincrement" | "hasRuntimeDefault" | "dataType" | "columnType" | "enumValues" | "identity" | "dialect" | "brand" | "generated" | "baseColumn">[K_1]; } : never>; } : never;
|
|
3350
3352
|
dialect: "pg";
|
|
3351
|
-
}>["_"]["columns"],
|
|
3353
|
+
}>["_"]["columns"], BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3352
3354
|
name: TTableName;
|
|
3353
3355
|
schema: undefined;
|
|
3354
3356
|
columns: {
|
|
@@ -4668,10 +4670,10 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
4668
4670
|
dialect: "pg";
|
|
4669
4671
|
}>["$inferInsert"]>>>;
|
|
4670
4672
|
querySchema: z.ZodObject<Pick<{
|
|
4671
|
-
[x: string]: z.
|
|
4673
|
+
[x: string]: z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many"> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>> | z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">>>;
|
|
4672
4674
|
}, never>, "strip", z.ZodTypeAny, {}, {}>;
|
|
4673
4675
|
queryListSchema: z.ZodObject<{} & {
|
|
4674
|
-
[x: string]: z.ZodOptional<z.
|
|
4676
|
+
[x: string]: z.ZodOptional<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many"> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>> | z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">>>>;
|
|
4675
4677
|
}, "strip", z.ZodTypeAny, {
|
|
4676
4678
|
[x: string]: unknown[] | [any, ...any[]] | null | undefined;
|
|
4677
4679
|
}, {
|
|
@@ -60,22 +60,23 @@ export var listBodySchema = function listBodySchema(schema) {
|
|
|
60
60
|
export var createTableSchema = function createTableSchema(_ref) {
|
|
61
61
|
var name = _ref.name,
|
|
62
62
|
columns = _ref.columns,
|
|
63
|
+
refineSchema = _ref.refineSchema,
|
|
63
64
|
extraConfig = _ref.extraConfig;
|
|
64
65
|
// 创建表
|
|
65
66
|
var table = pgTable(name, _objectSpread(_objectSpread({}, basicFields), columns), extraConfig);
|
|
66
67
|
// 创建基础的schema
|
|
67
|
-
var selectSchema = createSelectSchema(table);
|
|
68
|
+
var selectSchema = createSelectSchema(table, refineSchema);
|
|
68
69
|
return {
|
|
69
70
|
table: table,
|
|
70
71
|
selectSchema: selectSchema,
|
|
71
72
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
72
73
|
// @ts-ignore
|
|
73
|
-
insertSchema: createInsertSchema(table,
|
|
74
|
+
insertSchema: createInsertSchema(table, refineSchema),
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
76
|
// @ts-ignore
|
|
76
|
-
updateSchema: createUpdateSchema(table, {
|
|
77
|
+
updateSchema: createUpdateSchema(table, _objectSpread({
|
|
77
78
|
id: z.string()
|
|
78
|
-
}),
|
|
79
|
+
}, refineSchema)),
|
|
79
80
|
querySchema: selectSchema.pick({
|
|
80
81
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
82
|
// @ts-ignore
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyZodObject, z } from "zod";
|
|
2
2
|
import { PgColumnBuilderBase, PgTableExtraConfigValue } from "drizzle-orm/pg-core";
|
|
3
|
-
import { BuildExtraConfigColumns } from "drizzle-orm";
|
|
3
|
+
import { BuildExtraConfigColumns, Table } from "drizzle-orm";
|
|
4
|
+
import { BuildRefine, NoUnknownKeys } from "drizzle-zod";
|
|
4
5
|
import { BuildSchema } from "drizzle-zod/schema.types.internal";
|
|
5
6
|
export declare const basicFields: {
|
|
6
7
|
id: import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm").HasDefault<import("drizzle-orm/pg-core").PgUUIDBuilderInitial<"id">>>>;
|
|
@@ -45,9 +46,10 @@ export declare const listBodySchema: <T extends z.ZodTypeAny>(schema: T) => z.Zo
|
|
|
45
46
|
data: T["_input"][];
|
|
46
47
|
total: number;
|
|
47
48
|
}>;
|
|
48
|
-
export declare const createTableSchema: <TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object
|
|
49
|
+
export declare const createTableSchema: <TTableName extends string, TColumnsMap extends Record<string, PgColumnBuilderBase<import("drizzle-orm").ColumnBuilderBaseConfig<import("drizzle-orm").ColumnDataType, string>, object>>, TTable extends Table<import("drizzle-orm").TableConfig<import("drizzle-orm").Column<any, object, object>>>, TRefine extends BuildRefine<TTable["_"]["columns"]>>({ name, columns, refineSchema, extraConfig, }: {
|
|
49
50
|
name: TTableName;
|
|
50
51
|
columns: TColumnsMap;
|
|
52
|
+
refineSchema?: NoUnknownKeys<TRefine, TTable["$inferSelect"]> | undefined;
|
|
51
53
|
extraConfig?: ((self: BuildExtraConfigColumns<string, Record<string, PgColumnBuilderBase>, "pg">) => PgTableExtraConfigValue[]) | undefined;
|
|
52
54
|
}) => {
|
|
53
55
|
table: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
@@ -1370,7 +1372,7 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
1370
1372
|
} & TColumnsMap)[Key]["_"]["name"];
|
|
1371
1373
|
}, "name" | "data" | "driverParam" | "tableName" | "notNull" | "hasDefault" | "isPrimaryKey" | "isAutoincrement" | "hasRuntimeDefault" | "dataType" | "columnType" | "enumValues" | "identity" | "dialect" | "brand" | "generated" | "baseColumn">[K_1]; } : never>; } : never;
|
|
1372
1374
|
dialect: "pg";
|
|
1373
|
-
}>["_"]["columns"],
|
|
1375
|
+
}>["_"]["columns"], BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
1374
1376
|
name: TTableName;
|
|
1375
1377
|
schema: undefined;
|
|
1376
1378
|
columns: {
|
|
@@ -3348,7 +3350,7 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
3348
3350
|
} & TColumnsMap)[Key]["_"]["name"];
|
|
3349
3351
|
}, "name" | "data" | "driverParam" | "tableName" | "notNull" | "hasDefault" | "isPrimaryKey" | "isAutoincrement" | "hasRuntimeDefault" | "dataType" | "columnType" | "enumValues" | "identity" | "dialect" | "brand" | "generated" | "baseColumn">[K_1]; } : never>; } : never;
|
|
3350
3352
|
dialect: "pg";
|
|
3351
|
-
}>["_"]["columns"],
|
|
3353
|
+
}>["_"]["columns"], BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3352
3354
|
name: TTableName;
|
|
3353
3355
|
schema: undefined;
|
|
3354
3356
|
columns: {
|
|
@@ -4668,10 +4670,10 @@ export declare const createTableSchema: <TTableName extends string, TColumnsMap
|
|
|
4668
4670
|
dialect: "pg";
|
|
4669
4671
|
}>["$inferInsert"]>>>;
|
|
4670
4672
|
querySchema: z.ZodObject<Pick<{
|
|
4671
|
-
[x: string]: z.
|
|
4673
|
+
[x: string]: z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many"> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>> | z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">>>;
|
|
4672
4674
|
}, never>, "strip", z.ZodTypeAny, {}, {}>;
|
|
4673
4675
|
queryListSchema: z.ZodObject<{} & {
|
|
4674
|
-
[x: string]: z.ZodOptional<z.
|
|
4676
|
+
[x: string]: z.ZodOptional<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many"> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>> | z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | z.ZodArray<z.ZodTuple<[any, ...any[]], null> | any, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">, "many">>>>;
|
|
4675
4677
|
}, "strip", z.ZodTypeAny, {
|
|
4676
4678
|
[x: string]: unknown[] | [any, ...any[]] | null | undefined;
|
|
4677
4679
|
}, {
|
|
@@ -60,6 +60,7 @@ var listBodySchema = (schema) => import_zod.z.object({
|
|
|
60
60
|
var createTableSchema = ({
|
|
61
61
|
name,
|
|
62
62
|
columns,
|
|
63
|
+
refineSchema,
|
|
63
64
|
extraConfig
|
|
64
65
|
}) => {
|
|
65
66
|
const table = (0, import_pg_core.pgTable)(
|
|
@@ -70,17 +71,21 @@ var createTableSchema = ({
|
|
|
70
71
|
},
|
|
71
72
|
extraConfig
|
|
72
73
|
);
|
|
73
|
-
const selectSchema = (0, import_drizzle_zod.createSelectSchema)(
|
|
74
|
+
const selectSchema = (0, import_drizzle_zod.createSelectSchema)(
|
|
75
|
+
table,
|
|
76
|
+
refineSchema
|
|
77
|
+
);
|
|
74
78
|
return {
|
|
75
79
|
table,
|
|
76
80
|
selectSchema,
|
|
77
81
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
78
82
|
// @ts-ignore
|
|
79
|
-
insertSchema: (0, import_drizzle_zod.createInsertSchema)(table,
|
|
83
|
+
insertSchema: (0, import_drizzle_zod.createInsertSchema)(table, refineSchema),
|
|
80
84
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
85
|
// @ts-ignore
|
|
82
86
|
updateSchema: (0, import_drizzle_zod.createUpdateSchema)(table, {
|
|
83
|
-
id: import_zod.z.string()
|
|
87
|
+
id: import_zod.z.string(),
|
|
88
|
+
...refineSchema
|
|
84
89
|
}),
|
|
85
90
|
querySchema: selectSchema.pick({
|
|
86
91
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|