@ai0x0/utils 0.0.5 → 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>>>({ name, columns, extraConfig, }: {
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"], import("drizzle-zod").BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
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"], import("drizzle-zod").BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
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.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null> | z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">>> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>>;
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.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null> | z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">>> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>>>;
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>>>({ name, columns, extraConfig, }: {
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"], import("drizzle-zod").BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
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"], import("drizzle-zod").BuildRefine<Pick<import("drizzle-orm/pg-core").PgTableWithColumns<{
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.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null> | z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">>> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>>;
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.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null> | z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">> | z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<z.ZodArray<any | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many"> | z.ZodTuple<[any, ...any[]], null>, "many">>> | z.ZodNullable<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodTuple<[any, ...any[]], null>> | z.ZodOptional<z.ZodNullable<z.ZodTuple<[any, ...any[]], null>>>>;
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)(table);
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai0x0/utils",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "AI0x0 utils",
5
5
  "keywords": [
6
6
  "ai0x0"
@@ -42,14 +42,6 @@
42
42
  "tsc-files --noEmit"
43
43
  ]
44
44
  },
45
- "dependencies": {
46
- "dayjs": "^1.11.13",
47
- "drizzle-orm": "^0.38.3",
48
- "drizzle-zod": "^0.7.1",
49
- "next": "^15.3.2",
50
- "next-rest-framework": "npm:@infoxchange/next-rest-framework-patch@^6.0.6",
51
- "zod": "^3.24.4"
52
- },
53
45
  "devDependencies": {
54
46
  "@commitlint/cli": "^19.8.0",
55
47
  "@testing-library/react": "^16.2.0",
@@ -61,8 +53,11 @@
61
53
  "clean-package": "^2.2.0",
62
54
  "commitlint": "^19.8.0",
63
55
  "cross-env": "^7.0.3",
56
+ "dayjs": "^1.11.13",
57
+ "drizzle-orm": "^0.38.3",
58
+ "drizzle-zod": "^0.7.1",
64
59
  "dumi": "^2.4.18",
65
- "dumi-theme-lobehub": "^2.0.0",
60
+ "dumi-theme-lobehub": "^2.0.1",
66
61
  "eslint": "^8.57.1",
67
62
  "eslint-config-next": "^15.3.2",
68
63
  "eslint-config-prettier": "^10.1.5",
@@ -70,6 +65,8 @@
70
65
  "father": "^4.5.2",
71
66
  "husky": "^9.1.7",
72
67
  "lint-staged": "^15.5.0",
68
+ "next": "^15.3.2",
69
+ "next-rest-framework": "^6.0.7",
73
70
  "prettier": "^3.5.3",
74
71
  "pretty-quick": "^4.1.1",
75
72
  "react": "^19.0.0",
@@ -77,7 +74,8 @@
77
74
  "remark-cli": "^11",
78
75
  "tsc-files": "^1.1.4",
79
76
  "tsx": "^4.19.3",
80
- "typescript": "^5.8.2"
77
+ "typescript": "^5.8.2",
78
+ "zod": "^3.24.4"
81
79
  },
82
80
  "publishConfig": {
83
81
  "access": "public",