@ai0x0/utils 0.0.17 → 0.0.20

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.
Files changed (34) hide show
  1. package/es/backend/actions/create-delete-action.d.ts +4 -3
  2. package/es/backend/actions/create-get-action.d.ts +3 -2
  3. package/es/backend/actions/create-get-list-action.d.ts +3 -2
  4. package/es/backend/actions/create-post-action.d.ts +4 -4
  5. package/es/backend/actions/create-put-action.d.ts +3 -2
  6. package/es/backend/actions/get-list-query.d.ts +12 -4
  7. package/es/backend/actions/get-list-query.js +8 -11
  8. package/es/backend/route-operation/delete-operation.d.ts +3 -2
  9. package/es/backend/route-operation/get-list-operation.d.ts +3 -2
  10. package/es/backend/route-operation/get-operation.d.ts +3 -2
  11. package/es/backend/route-operation/get-table-name.d.ts +2 -2
  12. package/es/backend/route-operation/post-operation.d.ts +5 -5
  13. package/es/backend/route-operation/put-operation.d.ts +5 -4
  14. package/es/backend/schemas/index.d.ts +17714 -633
  15. package/es/backend/schemas/index.js +54 -30
  16. package/es/backend/types.d.ts +8 -14
  17. package/lib/backend/actions/create-delete-action.d.ts +4 -3
  18. package/lib/backend/actions/create-get-action.d.ts +3 -2
  19. package/lib/backend/actions/create-get-list-action.d.ts +3 -2
  20. package/lib/backend/actions/create-post-action.d.ts +4 -4
  21. package/lib/backend/actions/create-post-action.js +4 -1
  22. package/lib/backend/actions/create-put-action.d.ts +3 -2
  23. package/lib/backend/actions/get-list-query.d.ts +12 -4
  24. package/lib/backend/actions/get-list-query.js +6 -7
  25. package/lib/backend/route-operation/delete-operation.d.ts +3 -2
  26. package/lib/backend/route-operation/get-list-operation.d.ts +3 -2
  27. package/lib/backend/route-operation/get-operation.d.ts +3 -2
  28. package/lib/backend/route-operation/get-table-name.d.ts +2 -2
  29. package/lib/backend/route-operation/post-operation.d.ts +5 -5
  30. package/lib/backend/route-operation/put-operation.d.ts +5 -4
  31. package/lib/backend/schemas/index.d.ts +17714 -633
  32. package/lib/backend/schemas/index.js +32 -44
  33. package/lib/backend/types.d.ts +8 -14
  34. package/package.json +1 -1
@@ -5,35 +5,44 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { z } from "zod";
8
- import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
8
+ import { pgTable, timestamp, uuid } from "drizzle-orm/pg-core";
9
9
  import { createInsertSchema, createSelectSchema, createUpdateSchema } from "drizzle-zod";
10
10
 
11
11
  //============================基本字段============================//
12
- // SQLite / D1:用 text 存 ISO 时间戳,用 text 存 uuid(crypto.randomUUID())
13
- var timestamp = function timestamp(name) {
14
- return text(name).$defaultFn(function () {
15
- return new Date().toISOString();
12
+ var timestamptz = function timestamptz(name) {
13
+ return timestamp(name, {
14
+ withTimezone: true
16
15
  });
17
16
  };
17
+ var createdAt = function createdAt() {
18
+ return timestamptz("created_at").notNull().defaultNow();
19
+ };
20
+ var updatedAt = function updatedAt() {
21
+ return timestamptz("updated_at").notNull().defaultNow();
22
+ };
23
+ var accessedAt = function accessedAt() {
24
+ return timestamptz("accessed_at").notNull().defaultNow();
25
+ };
18
26
  export var basicFields = {
19
- id: text("id").primaryKey().$defaultFn(function () {
20
- return crypto.randomUUID();
21
- }),
22
- creatorId: text("creator_id"),
23
- editorId: text("editor_id"),
24
- accessedAt: timestamp("accessed_at").notNull(),
25
- createdAt: timestamp("created_at").notNull(),
26
- updatedAt: timestamp("updated_at").notNull()
27
+ id: uuid("id").defaultRandom().primaryKey(),
28
+ creatorId: uuid("creator_id"),
29
+ editorId: uuid("editor_id"),
30
+ accessedAt: accessedAt(),
31
+ createdAt: createdAt(),
32
+ updatedAt: updatedAt()
27
33
  };
28
- export { integer, text };
29
34
 
30
35
  //============================列表查询字段============================//
31
36
  export var queryListSchema = function queryListSchema(schema) {
32
37
  return z.object({
33
38
  current: z.string().optional().default("1"),
39
+ // 默认页码为 1
34
40
  pageSize: z.string().optional().default("10"),
41
+ // 默认每页条数为 10
35
42
  createdAtFrom: z.string().optional(),
43
+ // 筛选开始日期
36
44
  createdAtTo: z.string().optional(),
45
+ // 筛选结束日期
37
46
  orderBy: z.string().optional(),
38
47
  creatorId: z.string().optional(),
39
48
  orderDir: z.enum(["asc", "desc"]).optional()
@@ -48,29 +57,44 @@ export var listBodySchema = function listBodySchema(schema) {
48
57
  });
49
58
  };
50
59
 
51
- //============================创建一个 SQLite 表(D1)============================//
60
+ //============================创建一个pg表============================//
61
+ /**
62
+ * 基于 drizzle + drizzle-zod 快速生成带基础字段(id / 创建时间等)的
63
+ * 表定义以及 select / insert / update / query / list zod schema。
64
+ *
65
+ * 关键点:把合并后的 `basicFields & TColumnsMap` 交给 pgTable 时同时
66
+ * 提供显式泛型参数,返回的 table 会携带完整列类型;drizzle-zod 由此
67
+ * 推导出的 selectSchema 才是强类型的,而不是退化成
68
+ * `z.ZodObject<Record<string, any[] | null>>`。
69
+ */
52
70
  export var createTableSchema = function createTableSchema(_ref) {
53
71
  var name = _ref.name,
54
72
  columns = _ref.columns,
55
- refineSchema = _ref.refineSchema,
56
73
  extraConfig = _ref.extraConfig;
57
- var table = sqliteTable(name, _objectSpread(_objectSpread({}, basicFields), columns), extraConfig);
58
- var selectSchema = createSelectSchema(table, refineSchema);
59
- var insertTable = sqliteTable(name, columns);
60
- var updateTable = sqliteTable(name, _objectSpread({
61
- id: text("id")
62
- }, columns));
74
+ var mergedColumns = _objectSpread(_objectSpread({}, basicFields), columns);
75
+ var table = pgTable(name, mergedColumns, extraConfig);
76
+ var selectSchema = createSelectSchema(table);
77
+ var insertSchema = createInsertSchema(pgTable(name, columns));
78
+ // id 用 defaultRandom() 避免进入 insert 必填;随后在 zod 层把 id 标为必填
79
+ var updateSchema = createUpdateSchema(pgTable(name, _objectSpread({
80
+ id: uuid("id")
81
+ }, columns))).extend({
82
+ id: z.string()
83
+ });
84
+
85
+ // querySchema / queryListSchema 使用手写 zod,避免 selectSchema 泛型通过 .pick / .partial
86
+ // 扩散,导致外部类型声明过长(TS7056)。运行时行为不变。
87
+ var querySchema = z.object({
88
+ id: z.string()
89
+ });
90
+ var queryListWithSchema = queryListSchema(z.object({}).catchall(z.unknown()));
63
91
  return {
64
92
  table: table,
65
93
  selectSchema: selectSchema,
66
- insertSchema: createInsertSchema(insertTable, refineSchema),
67
- updateSchema: createUpdateSchema(updateTable, _objectSpread({
68
- id: z.string()
69
- }, refineSchema)),
70
- querySchema: selectSchema.pick({
71
- id: true
72
- }),
73
- queryListSchema: queryListSchema(selectSchema.partial()),
94
+ insertSchema: insertSchema,
95
+ updateSchema: updateSchema,
96
+ querySchema: querySchema,
97
+ queryListSchema: queryListWithSchema,
74
98
  queryListSelectSchema: selectSchema
75
99
  };
76
100
  };
@@ -1,18 +1,12 @@
1
- import { SQLiteColumn, SQLiteTable } from "drizzle-orm/sqlite-core";
1
+ import { PgColumn, PgTable } from "drizzle-orm/pg-core";
2
2
  import { SQL } from "drizzle-orm";
3
- /**
4
- * 对底层 drizzle 数据库实例做最宽松的约束:
5
- * 只要能 `select / insert / update / delete` 并支持 drizzle 语法即可,
6
- * 从而允许在不同 driver(如 drizzle-orm/d1)之间切换。
7
- */
8
- export type AnyDatabase = any;
9
- export interface BaseTable extends SQLiteTable {
10
- id: SQLiteColumn;
11
- creatorId: SQLiteColumn;
12
- editorId: SQLiteColumn;
13
- accessedAt: SQLiteColumn;
14
- createdAt: SQLiteColumn;
15
- updatedAt: SQLiteColumn;
3
+ export interface BaseTable extends PgTable {
4
+ id: PgColumn;
5
+ creatorId: PgColumn;
6
+ editorId: PgColumn;
7
+ accessedAt: PgColumn;
8
+ createdAt: PgColumn;
9
+ updatedAt: PgColumn;
16
10
  }
17
11
  export type GetListRelations = {
18
12
  groupBy?: boolean;
@@ -1,8 +1,9 @@
1
- import { BaseTable, AnyDatabase } from "../types";
1
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
2
+ import { BaseTable } from "../types";
2
3
  export declare function createDeleteAction<TTable extends BaseTable>({ table, db, }: {
3
- db: AnyDatabase;
4
+ db: NodePgDatabase<Record<string, unknown>>;
4
5
  table: TTable;
5
6
  }): ({ id, creatorId }: {
6
7
  id: string;
7
8
  creatorId?: string | undefined;
8
- }) => Promise<any>;
9
+ }) => Promise<TTable["$inferSelect"] extends infer T ? T extends TTable["$inferSelect"] ? T extends undefined ? QueryResult<import("drizzle-orm").Assume<this["row"], QueryResultRow>> : T[] : never : never>;
@@ -1,8 +1,9 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { BaseTable, GetListRelations, AnyDatabase } from "../types";
2
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
+ import { BaseTable, GetListRelations } from "../types";
3
4
  export declare function createGetAction<T extends ZodSchema, TTable extends BaseTable>({ bodySchema, db, jsonArrayFields, relations, table, }: {
4
5
  bodySchema: T;
5
- db: AnyDatabase;
6
+ db: NodePgDatabase<Record<string, unknown>>;
6
7
  jsonArrayFields?: string[];
7
8
  relations?: GetListRelations;
8
9
  table: TTable;
@@ -1,8 +1,9 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { BaseTable, GetListRelations, AnyDatabase } from "../types";
2
+ import { BaseTable, GetListRelations } from "../types";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
4
  export declare function createGetListAction<T extends ZodSchema, TTable extends BaseTable>({ bodySchema, db, jsonArrayFields, relations, table, }: {
4
5
  bodySchema: T;
5
- db: AnyDatabase;
6
+ db: NodePgDatabase<Record<string, unknown>>;
6
7
  jsonArrayFields?: string[];
7
8
  relations?: GetListRelations;
8
9
  table: TTable;
@@ -1,8 +1,8 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { AnyDatabase } from "../types";
3
- import { SQLiteTable } from "drizzle-orm/sqlite-core";
4
- export declare function createPostAction<T extends ZodSchema, TTable extends SQLiteTable>({ table, db }: {
2
+ import { PgTable } from "drizzle-orm/pg-core";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
+ export declare function createPostAction<T extends ZodSchema, TTable extends PgTable>({ table, db, }: {
5
5
  bodySchema: T;
6
- db: AnyDatabase;
6
+ db: NodePgDatabase<Record<string, unknown>>;
7
7
  table: TTable;
8
8
  }): (body: z.infer<T>) => Promise<z.infer<T>[]>;
@@ -23,7 +23,10 @@ __export(create_post_action_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(create_post_action_exports);
25
25
  var import_transform_body = require("./transform-body");
26
- function createPostAction({ table, db }) {
26
+ function createPostAction({
27
+ table,
28
+ db
29
+ }) {
27
30
  return async (body) => {
28
31
  const values = (0, import_transform_body.transformBody)(body);
29
32
  const result = await db.insert(table).values(values).returning();
@@ -1,8 +1,9 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { BaseTable, AnyDatabase } from "../types";
2
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
+ import { BaseTable } from "../types";
3
4
  export declare function createPutAction<T extends ZodSchema, TTable extends BaseTable>({ db, table, }: {
4
5
  bodySchema: T;
5
- db: AnyDatabase;
6
+ db: NodePgDatabase<Record<string, unknown>>;
6
7
  table: TTable;
7
8
  }): (body: Partial<z.infer<T>> & Record<string, unknown>, { byCreator, }?: {
8
9
  byCreator?: boolean | undefined;
@@ -1,7 +1,9 @@
1
- import { BaseTable, GetListRelations, AnyDatabase } from "../types";
2
- import { SelectedFields } from "drizzle-orm/sqlite-core/query-builders/select.types";
1
+ import { BaseTable, GetListRelations } from "../types";
2
+ import { SelectedFields } from "drizzle-orm/pg-core/query-builders/select.types";
3
+ import { SQL } from "drizzle-orm";
4
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
5
  export declare function getListQuery<TTable extends BaseTable, TSelection extends SelectedFields>({ db, fields, jsonArrayFields, params, relations, table, }: {
4
- db: AnyDatabase;
6
+ db: NodePgDatabase<Record<string, unknown>>;
5
7
  fields: TSelection;
6
8
  jsonArrayFields?: string[];
7
9
  params: {
@@ -14,6 +16,12 @@ export declare function getListQuery<TTable extends BaseTable, TSelection extend
14
16
  relations?: GetListRelations;
15
17
  table: TTable;
16
18
  }): {
17
- countQuery: any;
19
+ countQuery: Omit<import("drizzle-orm/pg-core").PgSelectBase<string, {
20
+ count: SQL<unknown>;
21
+ }, "partial", Record<string, "not-null">, false, "where", {
22
+ count: unknown;
23
+ }[], {
24
+ count: import("drizzle-orm").DrizzleTypeError<"You cannot reference this field without assigning it an alias first - use `.as(<alias>)`">;
25
+ }>, "where">;
18
26
  query: any;
19
27
  };
@@ -23,7 +23,6 @@ __export(get_list_query_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(get_list_query_exports);
25
25
  var import_drizzle_orm = require("drizzle-orm");
26
- var ciLike = (col, value) => import_drizzle_orm.sql`LOWER(${col}) LIKE ${value.toLowerCase()}`;
27
26
  function getListQuery({
28
27
  db,
29
28
  fields,
@@ -72,8 +71,8 @@ function getListQuery({
72
71
  conditions2.push(
73
72
  import_drizzle_orm.sql`
74
73
  EXISTS (
75
- SELECT 1 FROM json_each(${targetColumn})
76
- WHERE LOWER(json_each.value) LIKE ${`%${values[0]}%`}
74
+ SELECT 1 FROM jsonb_array_elements_text(${targetColumn}) tag
75
+ WHERE tag LIKE ${`%${values[0]}%`}
77
76
  )
78
77
  `
79
78
  );
@@ -82,7 +81,7 @@ function getListQuery({
82
81
  } else {
83
82
  conditions2.push(
84
83
  (0, import_drizzle_orm.or)(
85
- ...values.map((v) => ciLike(targetColumn, `%${v}%`))
84
+ ...values.map((v) => (0, import_drizzle_orm.ilike)(targetColumn, `%${v}%`))
86
85
  )
87
86
  );
88
87
  }
@@ -92,15 +91,15 @@ function getListQuery({
92
91
  conditions2.push(
93
92
  import_drizzle_orm.sql`
94
93
  EXISTS (
95
- SELECT 1 FROM json_each(${targetColumn})
96
- WHERE LOWER(json_each.value) LIKE ${`%${value}%`}
94
+ SELECT 1 FROM jsonb_array_elements_text(${targetColumn}) tag
95
+ WHERE tag LIKE ${`%${value}%`}
97
96
  )
98
97
  `
99
98
  );
100
99
  } else if (isIdField) {
101
100
  conditions2.push((0, import_drizzle_orm.eq)(targetColumn, value));
102
101
  } else {
103
- conditions2.push(ciLike(targetColumn, `%${value}%`));
102
+ conditions2.push((0, import_drizzle_orm.ilike)(targetColumn, `%${value}%`));
104
103
  }
105
104
  }
106
105
  } else {
@@ -1,5 +1,6 @@
1
1
  import { TypedNextResponse } from "next-rest-framework";
2
- import { BaseTable, AnyDatabase } from "../types";
2
+ import { BaseTable } from "../types";
3
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
3
4
  import { NextRequest } from "next/server";
4
5
  export interface DeleteOperationOptions<TTable extends BaseTable> {
5
6
  table: TTable;
@@ -9,7 +10,7 @@ export interface DeleteOperationOptions<TTable extends BaseTable> {
9
10
  byCreator?: boolean;
10
11
  }
11
12
  export declare const createDeleteOperation: ({ db, getSession, }: {
12
- db: AnyDatabase;
13
+ db: NodePgDatabase<Record<string, unknown>>;
13
14
  getSession: (req: NextRequest) => Promise<{
14
15
  userId?: string;
15
16
  } | undefined>;
@@ -1,7 +1,8 @@
1
1
  import { z, ZodSchema } from "zod";
2
2
  import { NextRequest } from "next/server";
3
3
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
- import { BaseTable, GetListRelations, AnyDatabase } from "../types";
4
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
5
+ import { BaseTable, GetListRelations } from "../types";
5
6
  export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchema, TTable extends BaseTable> {
6
7
  bodySchema: T;
7
8
  jsonArrayFields?: string[];
@@ -21,7 +22,7 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
21
22
  onError?: (error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
22
23
  }
23
24
  export declare const createGetListOperation: ({ db, getSession, }: {
24
- db: AnyDatabase;
25
+ db: NodePgDatabase<Record<string, unknown>>;
25
26
  getSession: (req: NextRequest) => Promise<{
26
27
  userId?: string;
27
28
  } | undefined>;
@@ -1,7 +1,8 @@
1
1
  import { z, ZodSchema } from "zod";
2
2
  import { NextRequest } from "next/server";
3
3
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
- import { BaseTable, GetListRelations, AnyDatabase } from "../types";
4
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
5
+ import { BaseTable, GetListRelations } from "../types";
5
6
  export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, TTable extends BaseTable> {
6
7
  bodySchema: T;
7
8
  jsonArrayFields?: string[];
@@ -15,7 +16,7 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
15
16
  byCreator?: boolean;
16
17
  }
17
18
  export declare const createGetOperation: ({ getSession, db, }: {
18
- db: AnyDatabase;
19
+ db: NodePgDatabase<Record<string, unknown>>;
19
20
  getSession: (req: NextRequest) => Promise<{
20
21
  userId?: string;
21
22
  } | undefined>;
@@ -1,3 +1,3 @@
1
- import { SQLiteTable } from "drizzle-orm/sqlite-core";
2
- declare function getTableName(table: SQLiteTable): string;
1
+ import { PgTable } from "drizzle-orm/pg-core";
2
+ declare function getTableName(table: PgTable): string;
3
3
  export default getTableName;
@@ -1,9 +1,9 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { AnyDatabase } from "../types";
3
- import { SQLiteTable } from "drizzle-orm/sqlite-core";
2
+ import { PgTable } from "drizzle-orm/pg-core";
4
3
  import { NextRequest } from "next/server";
5
4
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
6
- export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
5
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
6
+ export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
7
7
  bodySchema: IB;
8
8
  outputBodySchema?: IB;
9
9
  setBody?: (req: TypedNextRequest<"POST", "application/json", z.infer<IB>>) => Promise<Partial<z.infer<IB>>>;
@@ -13,8 +13,8 @@ export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema
13
13
  table: TTable;
14
14
  }
15
15
  export declare const createPostOperation: ({ getSession, db, }: {
16
- db: AnyDatabase;
16
+ db: NodePgDatabase<Record<string, unknown>>;
17
17
  getSession: (req: NextRequest) => Promise<{
18
18
  userId?: string;
19
19
  } | undefined>;
20
- }) => <IB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, OB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends SQLiteTable<import("drizzle-orm/sqlite-core").TableConfig>>({ bodySchema, outputBodySchema, setBody, summary, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
20
+ }) => <IB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, OB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends PgTable<import("drizzle-orm/pg-core").TableConfig>>({ bodySchema, outputBodySchema, setBody, summary, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
@@ -1,9 +1,10 @@
1
1
  import { z, ZodSchema } from "zod";
2
- import { SQLiteTable } from "drizzle-orm/sqlite-core";
2
+ import { PgTable } from "drizzle-orm/pg-core";
3
3
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
+ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
5
  import { NextRequest } from "next/server";
5
- import { BaseTable, AnyDatabase } from "../types";
6
- export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
6
+ import { BaseTable } from "../types";
7
+ export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
7
8
  bodySchema: IB;
8
9
  outputBodySchema?: OB;
9
10
  table: TTable;
@@ -17,5 +18,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
17
18
  getSession: (req: NextRequest) => Promise<{
18
19
  userId?: string;
19
20
  } | undefined>;
20
- db: AnyDatabase;
21
+ db: NodePgDatabase<Record<string, unknown>>;
21
22
  }) => <IB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, OB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ bodySchema, outputBodySchema, table, summary, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;