@ai0x0/utils 0.0.44 → 0.0.46

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 (45) hide show
  1. package/.agents/skills/ai0x0-utils/backend/SKILL.md +13 -9
  2. package/SKILL.md +13 -9
  3. package/es/__shims__/next-rest-framework.d.ts +5 -1
  4. package/es/backend/route-operation/delete-operation.d.ts +2 -1
  5. package/es/backend/route-operation/delete-operation.js +2 -0
  6. package/es/backend/route-operation/get-list-operation.d.ts +2 -1
  7. package/es/backend/route-operation/get-list-operation.js +2 -0
  8. package/es/backend/route-operation/get-operation.d.ts +2 -1
  9. package/es/backend/route-operation/get-operation.js +2 -0
  10. package/es/backend/route-operation/post-operation.d.ts +7 -2
  11. package/es/backend/route-operation/post-operation.js +2 -0
  12. package/es/backend/route-operation/put-operation.d.ts +7 -2
  13. package/es/backend/route-operation/put-operation.js +2 -0
  14. package/es/backend/sqlite/route-operation/delete-operation.d.ts +2 -1
  15. package/es/backend/sqlite/route-operation/delete-operation.js +2 -0
  16. package/es/backend/sqlite/route-operation/get-list-operation.d.ts +2 -1
  17. package/es/backend/sqlite/route-operation/get-list-operation.js +2 -0
  18. package/es/backend/sqlite/route-operation/get-operation.d.ts +2 -1
  19. package/es/backend/sqlite/route-operation/get-operation.js +2 -0
  20. package/es/backend/sqlite/route-operation/post-operation.d.ts +7 -2
  21. package/es/backend/sqlite/route-operation/post-operation.js +2 -0
  22. package/es/backend/sqlite/route-operation/put-operation.d.ts +7 -2
  23. package/es/backend/sqlite/route-operation/put-operation.js +2 -0
  24. package/lib/__shims__/next-rest-framework.d.ts +5 -1
  25. package/lib/backend/route-operation/delete-operation.d.ts +2 -1
  26. package/lib/backend/route-operation/delete-operation.js +2 -0
  27. package/lib/backend/route-operation/get-list-operation.d.ts +2 -1
  28. package/lib/backend/route-operation/get-list-operation.js +2 -0
  29. package/lib/backend/route-operation/get-operation.d.ts +2 -1
  30. package/lib/backend/route-operation/get-operation.js +2 -0
  31. package/lib/backend/route-operation/post-operation.d.ts +7 -2
  32. package/lib/backend/route-operation/post-operation.js +2 -0
  33. package/lib/backend/route-operation/put-operation.d.ts +7 -2
  34. package/lib/backend/route-operation/put-operation.js +2 -0
  35. package/lib/backend/sqlite/route-operation/delete-operation.d.ts +2 -1
  36. package/lib/backend/sqlite/route-operation/delete-operation.js +2 -0
  37. package/lib/backend/sqlite/route-operation/get-list-operation.d.ts +2 -1
  38. package/lib/backend/sqlite/route-operation/get-list-operation.js +2 -0
  39. package/lib/backend/sqlite/route-operation/get-operation.d.ts +2 -1
  40. package/lib/backend/sqlite/route-operation/get-operation.js +2 -0
  41. package/lib/backend/sqlite/route-operation/post-operation.d.ts +7 -2
  42. package/lib/backend/sqlite/route-operation/post-operation.js +2 -0
  43. package/lib/backend/sqlite/route-operation/put-operation.d.ts +7 -2
  44. package/lib/backend/sqlite/route-operation/put-operation.js +2 -0
  45. package/package.json +1 -1
@@ -87,19 +87,23 @@ export const getListOperation = createGetListOperation({ db, getSession });
87
87
 
88
88
  ## Factory Catalog
89
89
 
90
- | Export | Purpose | Required options | Notable optional options |
91
- | ------------------- | -------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------- |
92
- | `createTableSchema` | pg `Table` + 5 zod schemas | `name`, `columns` | `refineSchema`, `extraConfig` |
93
- | `getOperation` | GET one by filters | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
94
- | `getListOperation` | GET paginated list | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `onSuccess`, `onError`, `summary`, `tags` |
95
- | `postOperation` | POST create | `bodySchema` | `table`, `contentType`, `parseBody`, `outputBodySchema`, `setBody`, `onSuccess`, `onError`, `summary`, `tags` |
96
- | `putOperation` | PUT update | `bodySchema` | `table`, `outputBodySchema`, `setBody`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
97
- | `deleteOperation` | DELETE | — | `table`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
90
+ | Export | Purpose | Required options | Notable optional options |
91
+ | ------------------- | -------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
92
+ | `createTableSchema` | pg `Table` + 5 zod schemas | `name`, `columns` | `refineSchema`, `extraConfig` |
93
+ | `getOperation` | GET one by filters | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
94
+ | `getListOperation` | GET paginated list | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
95
+ | `postOperation` | POST create | `bodySchema` | `table`, `contentType`, `parseBody`, `outputBodySchema`, `setBody`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
96
+ | `putOperation` | PUT update | `bodySchema` | `table`, `outputBodySchema`, `setBody`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
97
+ | `deleteOperation` | DELETE | — | `table`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
98
98
 
99
99
  `tags` can be passed manually to override the default OpenAPI tag inferred from `table`.
100
100
 
101
+ `summary` and `description` are forwarded into the OpenAPI operation object.
102
+
101
103
  `postOperation` defaults to `contentType: "application/json"`. Pass `contentType: "multipart/form-data"` to read `await req.formData()` as body, or pass both a custom `contentType` and `parseBody(req)` for custom payload parsing.
102
104
 
105
+ In `postOperation` and `putOperation`, `onSuccess({ params })` is typed from `bodySchema` plus the injected `creatorId` / `editorId`, so custom action helpers can usually consume `params` directly without reparsing the body schema.
106
+
103
107
  `table` and factory-level `db` are optional for route operations. When `table` is omitted or `db` is not provided, the operation still parses input, applies `setParams` / `setBody`, session-derived fields, and `onSuccess`, but skips the built-in table action (`select` / `insert` / `update` / `delete`). Use this for custom endpoints that want the same OpenAPI and response wiring without a direct table operation.
104
108
 
105
109
  ## Canonical Examples
@@ -350,7 +354,7 @@ export const { GET } = route({
350
354
 
351
355
  - Extra server-side filters — `setParams(req) => Promise<Record<string, unknown>>` on GET/GET_LIST; returned keys are merged into the filter.
352
356
  - Extra columns on write — `setBody(req) => Promise<Partial<infer<IB>>>` on POST/PUT; returned fields are merged into the body before validation runs against `bodySchema`.
353
- - Post-processing output — `onSuccess({ params, data, req }) => Promise<data>`; on GET_LIST `data` is `{ data, total }`.
357
+ - Post-processing output — `onSuccess({ params, data, req }) => Promise<data>`; POST/PUT params are inferred from `bodySchema`, and on GET_LIST `data` is `{ data, total }`.
354
358
  - Error rewriting — `onError(err) => Promise<Response | undefined>`. Return `undefined` to rethrow.
355
359
 
356
360
  ## Imports
package/SKILL.md CHANGED
@@ -66,19 +66,23 @@ export const getListOperation = createGetListOperation({ db, getSession });
66
66
 
67
67
  ## Factory Catalog
68
68
 
69
- | Export | Purpose | Required options | Notable optional options |
70
- | ------------------- | -------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------- |
71
- | `createTableSchema` | pg `Table` + 5 zod schemas | `name`, `columns` | `refineSchema`, `extraConfig` |
72
- | `getOperation` | GET one by filters | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
73
- | `getListOperation` | GET paginated list | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `onSuccess`, `onError`, `summary`, `tags` |
74
- | `postOperation` | POST create | `bodySchema` | `table`, `contentType`, `parseBody`, `outputBodySchema`, `setBody`, `onSuccess`, `onError`, `summary`, `tags` |
75
- | `putOperation` | PUT update | `bodySchema` | `table`, `outputBodySchema`, `setBody`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
76
- | `deleteOperation` | DELETE | — | `table`, `byCreator`, `onSuccess`, `onError`, `summary`, `tags` |
69
+ | Export | Purpose | Required options | Notable optional options |
70
+ | ------------------- | -------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
71
+ | `createTableSchema` | pg `Table` + 5 zod schemas | `name`, `columns` | `refineSchema`, `extraConfig` |
72
+ | `getOperation` | GET one by filters | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
73
+ | `getListOperation` | GET paginated list | `bodySchema`, `querySchema` | `table`, `setParams`, `relations`, `jsonArrayFields`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
74
+ | `postOperation` | POST create | `bodySchema` | `table`, `contentType`, `parseBody`, `outputBodySchema`, `setBody`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
75
+ | `putOperation` | PUT update | `bodySchema` | `table`, `outputBodySchema`, `setBody`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
76
+ | `deleteOperation` | DELETE | — | `table`, `byCreator`, `onSuccess`, `onError`, `summary`, `description`, `tags` |
77
77
 
78
78
  `tags` can be passed manually to override the default OpenAPI tag inferred from `table`.
79
79
 
80
+ `summary` and `description` are forwarded into the OpenAPI operation object.
81
+
80
82
  `postOperation` defaults to `contentType: "application/json"`. Pass `contentType: "multipart/form-data"` to read `await req.formData()` as body, or pass both a custom `contentType` and `parseBody(req)` for custom payload parsing.
81
83
 
84
+ In `postOperation` and `putOperation`, `onSuccess({ params })` is typed from `bodySchema` plus the injected `creatorId` / `editorId`, so custom action helpers can usually consume `params` directly without reparsing the body schema.
85
+
82
86
  `table` and factory-level `db` are optional for route operations. When `table` is omitted or `db` is not provided, the operation still parses input, applies `setParams` / `setBody`, session-derived fields, and `onSuccess`, but skips the built-in table action (`select` / `insert` / `update` / `delete`). Use this for custom endpoints that want the same OpenAPI and response wiring without a direct table operation.
83
87
 
84
88
  ## Canonical Examples
@@ -329,7 +333,7 @@ export const { GET } = route({
329
333
 
330
334
  - Extra server-side filters — `setParams(req) => Promise<Record<string, unknown>>` on GET/GET_LIST; returned keys are merged into the filter.
331
335
  - Extra columns on write — `setBody(req) => Promise<Partial<infer<IB>>>` on POST/PUT; returned fields are merged into the body before validation runs against `bodySchema`.
332
- - Post-processing output — `onSuccess({ params, data, req }) => Promise<data>`; on GET_LIST `data` is `{ data, total }`.
336
+ - Post-processing output — `onSuccess({ params, data, req }) => Promise<data>`; POST/PUT params are inferred from `bodySchema`, and on GET_LIST `data` is `{ data, total }`.
333
337
  - Error rewriting — `onError(err) => Promise<Response | undefined>`. Return `undefined` to rethrow.
334
338
 
335
339
  ## Imports
@@ -22,7 +22,11 @@ declare module "next-rest-framework" {
22
22
 
23
23
  export const routeOperation: <M extends string>(opts: {
24
24
  method: M;
25
- openApiOperation?: { summary?: string; tags?: string[] };
25
+ openApiOperation?: {
26
+ description?: string;
27
+ summary?: string;
28
+ tags?: string[];
29
+ };
26
30
  }) => RouteOperationBuilder<M>;
27
31
 
28
32
  export const rpcOperation: () => {
@@ -4,6 +4,7 @@ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
4
  import { NextRequest } from "next/server";
5
5
  export interface DeleteOperationOptions<TTable extends BaseTable> {
6
6
  table?: TTable;
7
+ description?: string;
7
8
  summary?: string;
8
9
  tags?: string[];
9
10
  onSuccess?: (payload: {
@@ -21,4 +22,4 @@ export declare const createDeleteOperation: ({ db, getSession, }: {
21
22
  getSession(req: NextRequest): Promise<{
22
23
  userId?: string;
23
24
  } | undefined>;
24
- }) => <TTable extends BaseTable>({ table, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
25
+ }) => <TTable extends BaseTable>({ table, description, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
@@ -12,6 +12,7 @@ export var createDeleteOperation = function createDeleteOperation(_ref) {
12
12
  getSession = _ref.getSession;
13
13
  return function (_ref2) {
14
14
  var table = _ref2.table,
15
+ description = _ref2.description,
15
16
  summary = _ref2.summary,
16
17
  tags = _ref2.tags,
17
18
  onSuccess = _ref2.onSuccess,
@@ -21,6 +22,7 @@ export var createDeleteOperation = function createDeleteOperation(_ref) {
21
22
  return routeOperation({
22
23
  method: "DELETE",
23
24
  openApiOperation: {
25
+ description: description,
24
26
  summary: summary,
25
27
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
26
28
  }
@@ -10,6 +10,7 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
10
10
  relations?: GetListRelations;
11
11
  setParams?(req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>): Promise<Record<string, unknown>>;
12
12
  byCreator?: boolean;
13
+ description?: string;
13
14
  summary?: string;
14
15
  tags?: string[];
15
16
  table?: TTable;
@@ -30,4 +31,4 @@ export declare const createGetListOperation: ({ db, getSession, }: {
30
31
  getSession(req: NextRequest): Promise<{
31
32
  userId?: string;
32
33
  } | undefined>;
33
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
34
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -13,6 +13,7 @@ export var createGetListOperation = function createGetListOperation(_ref) {
13
13
  var querySchema = _ref2.querySchema,
14
14
  bodySchema = _ref2.bodySchema,
15
15
  table = _ref2.table,
16
+ description = _ref2.description,
16
17
  summary = _ref2.summary,
17
18
  tags = _ref2.tags,
18
19
  relations = _ref2.relations,
@@ -25,6 +26,7 @@ export var createGetListOperation = function createGetListOperation(_ref) {
25
26
  return routeOperation({
26
27
  method: "GET",
27
28
  openApiOperation: {
29
+ description: description,
28
30
  summary: summary,
29
31
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
30
32
  }
@@ -14,6 +14,7 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
14
14
  data: z.infer<T>;
15
15
  }): Promise<z.infer<T>>;
16
16
  onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
17
+ description?: string;
17
18
  summary?: string;
18
19
  tags?: string[];
19
20
  table?: TTable;
@@ -24,4 +25,4 @@ export declare const createGetOperation: ({ getSession, db, }: {
24
25
  getSession(req: NextRequest): Promise<{
25
26
  userId?: string;
26
27
  } | undefined>;
27
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
28
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -12,6 +12,7 @@ export var createGetOperation = function createGetOperation(_ref) {
12
12
  var querySchema = _ref2.querySchema,
13
13
  bodySchema = _ref2.bodySchema,
14
14
  table = _ref2.table,
15
+ description = _ref2.description,
15
16
  summary = _ref2.summary,
16
17
  tags = _ref2.tags,
17
18
  relations = _ref2.relations,
@@ -24,6 +25,7 @@ export var createGetOperation = function createGetOperation(_ref) {
24
25
  return routeOperation({
25
26
  method: "GET",
26
27
  openApiOperation: {
28
+ description: description,
27
29
  summary: summary,
28
30
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
29
31
  }
@@ -3,16 +3,20 @@ import { PgTable } from "drizzle-orm/pg-core";
3
3
  import { NextRequest } from "next/server";
4
4
  import { TypedNextResponse } from "next-rest-framework";
5
5
  import { NodePgDatabase } from "drizzle-orm/node-postgres";
6
+ type PostOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
7
+ creatorId?: string;
8
+ };
6
9
  export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
7
10
  bodySchema: IB;
8
11
  contentType?: string;
12
+ description?: string;
9
13
  outputBodySchema?: OB;
10
14
  parseBody?(req: NextRequest): Promise<Record<string, unknown>>;
11
15
  setBody?(req: NextRequest): Promise<Partial<z.infer<IB>>>;
12
16
  summary?: string;
13
17
  tags?: string[];
14
18
  onSuccess?(payload: {
15
- params: Record<string, unknown>;
19
+ params: PostOperationParams<IB>;
16
20
  data: z.infer<OB>;
17
21
  req: NextRequest;
18
22
  }): Promise<z.infer<OB>>;
@@ -24,4 +28,5 @@ export declare const createPostOperation: ({ getSession, db, }: {
24
28
  getSession(req: NextRequest): Promise<{
25
29
  userId?: string;
26
30
  } | undefined>;
27
- }) => <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, contentType, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
31
+ }) => <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, contentType, description, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
32
+ export {};
@@ -57,6 +57,7 @@ export var createPostOperation = function createPostOperation(_ref2) {
57
57
  var bodySchema = _ref3.bodySchema,
58
58
  _ref3$contentType = _ref3.contentType,
59
59
  contentType = _ref3$contentType === void 0 ? "application/json" : _ref3$contentType,
60
+ description = _ref3.description,
60
61
  outputBodySchema = _ref3.outputBodySchema,
61
62
  parseBody = _ref3.parseBody,
62
63
  setBody = _ref3.setBody,
@@ -68,6 +69,7 @@ export var createPostOperation = function createPostOperation(_ref2) {
68
69
  return routeOperation({
69
70
  method: "POST",
70
71
  openApiOperation: {
72
+ description: description,
71
73
  summary: summary,
72
74
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
73
75
  }
@@ -4,15 +4,19 @@ import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
4
  import { NodePgDatabase } from "drizzle-orm/node-postgres";
5
5
  import { NextRequest } from "next/server";
6
6
  import { BaseTable } from "../types.js";
7
+ type PutOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
8
+ editorId?: string;
9
+ };
7
10
  export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
8
11
  bodySchema: IB;
12
+ description?: string;
9
13
  outputBodySchema?: OB;
10
14
  table?: TTable;
11
15
  summary?: string;
12
16
  tags?: string[];
13
17
  setBody?(req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>): Promise<Partial<z.infer<IB>>>;
14
18
  onSuccess?(payload: {
15
- params: Record<string, unknown>;
19
+ params: PutOperationParams<IB>;
16
20
  data: z.infer<OB>;
17
21
  }): Promise<z.infer<OB>>;
18
22
  onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
@@ -23,4 +27,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
23
27
  userId?: string;
24
28
  } | undefined>;
25
29
  db?: NodePgDatabase<Record<string, unknown>> | undefined;
26
- }) => <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, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
30
+ }) => <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, description, outputBodySchema, table, summary, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
31
+ export {};
@@ -17,6 +17,7 @@ export var createPutOperation = function createPutOperation(_ref) {
17
17
  db = _ref.db;
18
18
  return function (_ref2) {
19
19
  var bodySchema = _ref2.bodySchema,
20
+ description = _ref2.description,
20
21
  outputBodySchema = _ref2.outputBodySchema,
21
22
  table = _ref2.table,
22
23
  summary = _ref2.summary,
@@ -29,6 +30,7 @@ export var createPutOperation = function createPutOperation(_ref) {
29
30
  return routeOperation({
30
31
  method: "PUT",
31
32
  openApiOperation: {
33
+ description: description,
32
34
  summary: summary,
33
35
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
34
36
  }
@@ -3,6 +3,7 @@ import { BaseTable } from "../types.js";
3
3
  import { NextRequest } from "next/server";
4
4
  export interface DeleteOperationOptions<TTable extends BaseTable> {
5
5
  table?: TTable;
6
+ description?: string;
6
7
  summary?: string;
7
8
  tags?: string[];
8
9
  onSuccess?: (_payload: {
@@ -20,4 +21,4 @@ export declare const createDeleteOperation: ({ db, getSession, }: {
20
21
  getSession: (_req: NextRequest) => Promise<{
21
22
  userId?: string;
22
23
  } | undefined>;
23
- }) => <TTable extends BaseTable>({ table, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
24
+ }) => <TTable extends BaseTable>({ table, description, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
@@ -12,6 +12,7 @@ export var createDeleteOperation = function createDeleteOperation(_ref) {
12
12
  getSession = _ref.getSession;
13
13
  return function (_ref2) {
14
14
  var table = _ref2.table,
15
+ description = _ref2.description,
15
16
  summary = _ref2.summary,
16
17
  tags = _ref2.tags,
17
18
  onSuccess = _ref2.onSuccess,
@@ -21,6 +22,7 @@ export var createDeleteOperation = function createDeleteOperation(_ref) {
21
22
  return routeOperation({
22
23
  method: "DELETE",
23
24
  openApiOperation: {
25
+ description: description,
24
26
  summary: summary,
25
27
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
26
28
  }
@@ -9,6 +9,7 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
9
9
  relations?: GetListRelations;
10
10
  setParams?: (_req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>) => Promise<Record<string, unknown>>;
11
11
  byCreator?: boolean;
12
+ description?: string;
12
13
  summary?: string;
13
14
  tags?: string[];
14
15
  table?: TTable;
@@ -29,4 +30,4 @@ export declare const createGetListOperation: ({ db, getSession, }: {
29
30
  getSession: (_req: NextRequest) => Promise<{
30
31
  userId?: string;
31
32
  } | undefined>;
32
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
33
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -13,6 +13,7 @@ export var createGetListOperation = function createGetListOperation(_ref) {
13
13
  var querySchema = _ref2.querySchema,
14
14
  bodySchema = _ref2.bodySchema,
15
15
  table = _ref2.table,
16
+ description = _ref2.description,
16
17
  summary = _ref2.summary,
17
18
  tags = _ref2.tags,
18
19
  relations = _ref2.relations,
@@ -25,6 +26,7 @@ export var createGetListOperation = function createGetListOperation(_ref) {
25
26
  return routeOperation({
26
27
  method: "GET",
27
28
  openApiOperation: {
29
+ description: description,
28
30
  summary: summary,
29
31
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
30
32
  }
@@ -13,6 +13,7 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
13
13
  data: z.infer<T>;
14
14
  }) => Promise<z.infer<T>>;
15
15
  onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
16
+ description?: string;
16
17
  summary?: string;
17
18
  tags?: string[];
18
19
  table?: TTable;
@@ -23,4 +24,4 @@ export declare const createGetOperation: ({ getSession, db, }: {
23
24
  getSession: (_req: NextRequest) => Promise<{
24
25
  userId?: string;
25
26
  } | undefined>;
26
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
27
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -12,6 +12,7 @@ export var createGetOperation = function createGetOperation(_ref) {
12
12
  var querySchema = _ref2.querySchema,
13
13
  bodySchema = _ref2.bodySchema,
14
14
  table = _ref2.table,
15
+ description = _ref2.description,
15
16
  summary = _ref2.summary,
16
17
  tags = _ref2.tags,
17
18
  relations = _ref2.relations,
@@ -24,6 +25,7 @@ export var createGetOperation = function createGetOperation(_ref) {
24
25
  return routeOperation({
25
26
  method: "GET",
26
27
  openApiOperation: {
28
+ description: description,
27
29
  summary: summary,
28
30
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
29
31
  }
@@ -2,16 +2,20 @@ import { z, ZodSchema } from "zod";
2
2
  import { SQLiteTable } from "drizzle-orm/sqlite-core";
3
3
  import { NextRequest } from "next/server";
4
4
  import { TypedNextResponse } from "next-rest-framework";
5
+ type PostOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
6
+ creatorId?: string;
7
+ };
5
8
  export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
6
9
  bodySchema: IB;
7
10
  contentType?: string;
11
+ description?: string;
8
12
  outputBodySchema?: OB;
9
13
  parseBody?: (_req: NextRequest) => Promise<Record<string, unknown>>;
10
14
  setBody?: (_req: NextRequest) => Promise<Partial<z.infer<IB>>>;
11
15
  summary?: string;
12
16
  tags?: string[];
13
17
  onSuccess?: (_payload: {
14
- params: Record<string, unknown>;
18
+ params: PostOperationParams<IB>;
15
19
  data: z.infer<OB>;
16
20
  req: NextRequest;
17
21
  }) => Promise<z.infer<OB>>;
@@ -23,4 +27,5 @@ export declare const createPostOperation: ({ getSession, db, }: {
23
27
  getSession: (_req: NextRequest) => Promise<{
24
28
  userId?: string;
25
29
  } | undefined>;
26
- }) => <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, contentType, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
30
+ }) => <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, contentType, description, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
31
+ export {};
@@ -57,6 +57,7 @@ export var createPostOperation = function createPostOperation(_ref2) {
57
57
  var bodySchema = _ref3.bodySchema,
58
58
  _ref3$contentType = _ref3.contentType,
59
59
  contentType = _ref3$contentType === void 0 ? "application/json" : _ref3$contentType,
60
+ description = _ref3.description,
60
61
  outputBodySchema = _ref3.outputBodySchema,
61
62
  parseBody = _ref3.parseBody,
62
63
  setBody = _ref3.setBody,
@@ -68,6 +69,7 @@ export var createPostOperation = function createPostOperation(_ref2) {
68
69
  return routeOperation({
69
70
  method: "POST",
70
71
  openApiOperation: {
72
+ description: description,
71
73
  summary: summary,
72
74
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
73
75
  }
@@ -3,15 +3,19 @@ import { SQLiteTable } from "drizzle-orm/sqlite-core";
3
3
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
4
  import { NextRequest } from "next/server";
5
5
  import { BaseTable } from "../types.js";
6
+ type PutOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
7
+ editorId?: string;
8
+ };
6
9
  export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
7
10
  bodySchema: IB;
11
+ description?: string;
8
12
  outputBodySchema?: OB;
9
13
  table?: TTable;
10
14
  summary?: string;
11
15
  tags?: string[];
12
16
  setBody?: (_req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>) => Promise<Partial<z.infer<IB>>>;
13
17
  onSuccess?: (_payload: {
14
- params: Record<string, unknown>;
18
+ params: PutOperationParams<IB>;
15
19
  data: z.infer<OB>;
16
20
  }) => Promise<z.infer<OB>>;
17
21
  onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
@@ -22,4 +26,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
22
26
  userId?: string;
23
27
  } | undefined>;
24
28
  db?: any;
25
- }) => <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, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
29
+ }) => <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, description, outputBodySchema, table, summary, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
30
+ export {};
@@ -17,6 +17,7 @@ export var createPutOperation = function createPutOperation(_ref) {
17
17
  db = _ref.db;
18
18
  return function (_ref2) {
19
19
  var bodySchema = _ref2.bodySchema,
20
+ description = _ref2.description,
20
21
  outputBodySchema = _ref2.outputBodySchema,
21
22
  table = _ref2.table,
22
23
  summary = _ref2.summary,
@@ -29,6 +30,7 @@ export var createPutOperation = function createPutOperation(_ref) {
29
30
  return routeOperation({
30
31
  method: "PUT",
31
32
  openApiOperation: {
33
+ description: description,
32
34
  summary: summary,
33
35
  tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
34
36
  }
@@ -22,7 +22,11 @@ declare module "next-rest-framework" {
22
22
 
23
23
  export const routeOperation: <M extends string>(opts: {
24
24
  method: M;
25
- openApiOperation?: { summary?: string; tags?: string[] };
25
+ openApiOperation?: {
26
+ description?: string;
27
+ summary?: string;
28
+ tags?: string[];
29
+ };
26
30
  }) => RouteOperationBuilder<M>;
27
31
 
28
32
  export const rpcOperation: () => {
@@ -4,6 +4,7 @@ import { NodePgDatabase } from "drizzle-orm/node-postgres";
4
4
  import { NextRequest } from "next/server";
5
5
  export interface DeleteOperationOptions<TTable extends BaseTable> {
6
6
  table?: TTable;
7
+ description?: string;
7
8
  summary?: string;
8
9
  tags?: string[];
9
10
  onSuccess?: (payload: {
@@ -21,4 +22,4 @@ export declare const createDeleteOperation: ({ db, getSession, }: {
21
22
  getSession(req: NextRequest): Promise<{
22
23
  userId?: string;
23
24
  } | undefined>;
24
- }) => <TTable extends BaseTable>({ table, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
25
+ }) => <TTable extends BaseTable>({ table, description, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
@@ -42,6 +42,7 @@ var createDeleteOperation = ({
42
42
  getSession
43
43
  }) => ({
44
44
  table,
45
+ description,
45
46
  summary,
46
47
  tags,
47
48
  onSuccess,
@@ -50,6 +51,7 @@ var createDeleteOperation = ({
50
51
  }) => (0, import_next_rest_framework.routeOperation)({
51
52
  method: "DELETE",
52
53
  openApiOperation: {
54
+ description,
53
55
  summary,
54
56
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
55
57
  }
@@ -10,6 +10,7 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
10
10
  relations?: GetListRelations;
11
11
  setParams?(req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>): Promise<Record<string, unknown>>;
12
12
  byCreator?: boolean;
13
+ description?: string;
13
14
  summary?: string;
14
15
  tags?: string[];
15
16
  table?: TTable;
@@ -30,4 +31,4 @@ export declare const createGetListOperation: ({ db, getSession, }: {
30
31
  getSession(req: NextRequest): Promise<{
31
32
  userId?: string;
32
33
  } | undefined>;
33
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
34
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -43,6 +43,7 @@ var createGetListOperation = ({
43
43
  querySchema,
44
44
  bodySchema,
45
45
  table,
46
+ description,
46
47
  summary,
47
48
  tags,
48
49
  relations,
@@ -54,6 +55,7 @@ var createGetListOperation = ({
54
55
  }) => (0, import_next_rest_framework.routeOperation)({
55
56
  method: "GET",
56
57
  openApiOperation: {
58
+ description,
57
59
  summary,
58
60
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
59
61
  }
@@ -14,6 +14,7 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
14
14
  data: z.infer<T>;
15
15
  }): Promise<z.infer<T>>;
16
16
  onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
17
+ description?: string;
17
18
  summary?: string;
18
19
  tags?: string[];
19
20
  table?: TTable;
@@ -24,4 +25,4 @@ export declare const createGetOperation: ({ getSession, db, }: {
24
25
  getSession(req: NextRequest): Promise<{
25
26
  userId?: string;
26
27
  } | undefined>;
27
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
28
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -42,6 +42,7 @@ var createGetOperation = ({
42
42
  querySchema,
43
43
  bodySchema,
44
44
  table,
45
+ description,
45
46
  summary,
46
47
  tags,
47
48
  relations,
@@ -53,6 +54,7 @@ var createGetOperation = ({
53
54
  }) => (0, import_next_rest_framework.routeOperation)({
54
55
  method: "GET",
55
56
  openApiOperation: {
57
+ description,
56
58
  summary,
57
59
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
58
60
  }
@@ -3,16 +3,20 @@ import { PgTable } from "drizzle-orm/pg-core";
3
3
  import { NextRequest } from "next/server";
4
4
  import { TypedNextResponse } from "next-rest-framework";
5
5
  import { NodePgDatabase } from "drizzle-orm/node-postgres";
6
+ type PostOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
7
+ creatorId?: string;
8
+ };
6
9
  export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
7
10
  bodySchema: IB;
8
11
  contentType?: string;
12
+ description?: string;
9
13
  outputBodySchema?: OB;
10
14
  parseBody?(req: NextRequest): Promise<Record<string, unknown>>;
11
15
  setBody?(req: NextRequest): Promise<Partial<z.infer<IB>>>;
12
16
  summary?: string;
13
17
  tags?: string[];
14
18
  onSuccess?(payload: {
15
- params: Record<string, unknown>;
19
+ params: PostOperationParams<IB>;
16
20
  data: z.infer<OB>;
17
21
  req: NextRequest;
18
22
  }): Promise<z.infer<OB>>;
@@ -24,4 +28,5 @@ export declare const createPostOperation: ({ getSession, db, }: {
24
28
  getSession(req: NextRequest): Promise<{
25
29
  userId?: string;
26
30
  } | undefined>;
27
- }) => <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, contentType, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
31
+ }) => <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, contentType, description, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
32
+ export {};
@@ -54,6 +54,7 @@ var createPostOperation = ({
54
54
  }) => ({
55
55
  bodySchema,
56
56
  contentType = "application/json",
57
+ description,
57
58
  outputBodySchema,
58
59
  parseBody,
59
60
  setBody,
@@ -65,6 +66,7 @@ var createPostOperation = ({
65
66
  }) => (0, import_next_rest_framework.routeOperation)({
66
67
  method: "POST",
67
68
  openApiOperation: {
69
+ description,
68
70
  summary,
69
71
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
70
72
  }
@@ -4,15 +4,19 @@ import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
4
  import { NodePgDatabase } from "drizzle-orm/node-postgres";
5
5
  import { NextRequest } from "next/server";
6
6
  import { BaseTable } from "../types.js";
7
+ type PutOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
8
+ editorId?: string;
9
+ };
7
10
  export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
8
11
  bodySchema: IB;
12
+ description?: string;
9
13
  outputBodySchema?: OB;
10
14
  table?: TTable;
11
15
  summary?: string;
12
16
  tags?: string[];
13
17
  setBody?(req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>): Promise<Partial<z.infer<IB>>>;
14
18
  onSuccess?(payload: {
15
- params: Record<string, unknown>;
19
+ params: PutOperationParams<IB>;
16
20
  data: z.infer<OB>;
17
21
  }): Promise<z.infer<OB>>;
18
22
  onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
@@ -23,4 +27,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
23
27
  userId?: string;
24
28
  } | undefined>;
25
29
  db?: NodePgDatabase<Record<string, unknown>> | undefined;
26
- }) => <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, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
30
+ }) => <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, description, outputBodySchema, table, summary, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
31
+ export {};
@@ -42,6 +42,7 @@ var createPutOperation = ({
42
42
  db
43
43
  }) => ({
44
44
  bodySchema,
45
+ description,
45
46
  outputBodySchema,
46
47
  table,
47
48
  summary,
@@ -53,6 +54,7 @@ var createPutOperation = ({
53
54
  }) => (0, import_next_rest_framework.routeOperation)({
54
55
  method: "PUT",
55
56
  openApiOperation: {
57
+ description,
56
58
  summary,
57
59
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
58
60
  }
@@ -3,6 +3,7 @@ import { BaseTable } from "../types.js";
3
3
  import { NextRequest } from "next/server";
4
4
  export interface DeleteOperationOptions<TTable extends BaseTable> {
5
5
  table?: TTable;
6
+ description?: string;
6
7
  summary?: string;
7
8
  tags?: string[];
8
9
  onSuccess?: (_payload: {
@@ -20,4 +21,4 @@ export declare const createDeleteOperation: ({ db, getSession, }: {
20
21
  getSession: (_req: NextRequest) => Promise<{
21
22
  userId?: string;
22
23
  } | undefined>;
23
- }) => <TTable extends BaseTable>({ table, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
24
+ }) => <TTable extends BaseTable>({ table, description, summary, tags, onSuccess, onError, byCreator, }: DeleteOperationOptions<TTable>) => import("next-rest-framework").RouteOperationDefinition<"DELETE">;
@@ -42,6 +42,7 @@ var createDeleteOperation = ({
42
42
  getSession
43
43
  }) => ({
44
44
  table,
45
+ description,
45
46
  summary,
46
47
  tags,
47
48
  onSuccess,
@@ -50,6 +51,7 @@ var createDeleteOperation = ({
50
51
  }) => (0, import_next_rest_framework.routeOperation)({
51
52
  method: "DELETE",
52
53
  openApiOperation: {
54
+ description,
53
55
  summary,
54
56
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
55
57
  }
@@ -9,6 +9,7 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
9
9
  relations?: GetListRelations;
10
10
  setParams?: (_req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>) => Promise<Record<string, unknown>>;
11
11
  byCreator?: boolean;
12
+ description?: string;
12
13
  summary?: string;
13
14
  tags?: string[];
14
15
  table?: TTable;
@@ -29,4 +30,4 @@ export declare const createGetListOperation: ({ db, getSession, }: {
29
30
  getSession: (_req: NextRequest) => Promise<{
30
31
  userId?: string;
31
32
  } | undefined>;
32
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
33
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, jsonArrayFields, setParams, onSuccess, onError, byCreator, }: GetListOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -43,6 +43,7 @@ var createGetListOperation = ({
43
43
  querySchema,
44
44
  bodySchema,
45
45
  table,
46
+ description,
46
47
  summary,
47
48
  tags,
48
49
  relations,
@@ -54,6 +55,7 @@ var createGetListOperation = ({
54
55
  }) => (0, import_next_rest_framework.routeOperation)({
55
56
  method: "GET",
56
57
  openApiOperation: {
58
+ description,
57
59
  summary,
58
60
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
59
61
  }
@@ -13,6 +13,7 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
13
13
  data: z.infer<T>;
14
14
  }) => Promise<z.infer<T>>;
15
15
  onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
16
+ description?: string;
16
17
  summary?: string;
17
18
  tags?: string[];
18
19
  table?: TTable;
@@ -23,4 +24,4 @@ export declare const createGetOperation: ({ getSession, db, }: {
23
24
  getSession: (_req: NextRequest) => Promise<{
24
25
  userId?: string;
25
26
  } | undefined>;
26
- }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
27
+ }) => <T extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, Q extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ querySchema, bodySchema, table, description, summary, tags, relations, setParams, jsonArrayFields, onSuccess, onError, byCreator, }: GetOperationOptions<T, Q, TTable>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
@@ -42,6 +42,7 @@ var createGetOperation = ({
42
42
  querySchema,
43
43
  bodySchema,
44
44
  table,
45
+ description,
45
46
  summary,
46
47
  tags,
47
48
  relations,
@@ -53,6 +54,7 @@ var createGetOperation = ({
53
54
  }) => (0, import_next_rest_framework.routeOperation)({
54
55
  method: "GET",
55
56
  openApiOperation: {
57
+ description,
56
58
  summary,
57
59
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
58
60
  }
@@ -2,16 +2,20 @@ import { z, ZodSchema } from "zod";
2
2
  import { SQLiteTable } from "drizzle-orm/sqlite-core";
3
3
  import { NextRequest } from "next/server";
4
4
  import { TypedNextResponse } from "next-rest-framework";
5
+ type PostOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
6
+ creatorId?: string;
7
+ };
5
8
  export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
6
9
  bodySchema: IB;
7
10
  contentType?: string;
11
+ description?: string;
8
12
  outputBodySchema?: OB;
9
13
  parseBody?: (_req: NextRequest) => Promise<Record<string, unknown>>;
10
14
  setBody?: (_req: NextRequest) => Promise<Partial<z.infer<IB>>>;
11
15
  summary?: string;
12
16
  tags?: string[];
13
17
  onSuccess?: (_payload: {
14
- params: Record<string, unknown>;
18
+ params: PostOperationParams<IB>;
15
19
  data: z.infer<OB>;
16
20
  req: NextRequest;
17
21
  }) => Promise<z.infer<OB>>;
@@ -23,4 +27,5 @@ export declare const createPostOperation: ({ getSession, db, }: {
23
27
  getSession: (_req: NextRequest) => Promise<{
24
28
  userId?: string;
25
29
  } | undefined>;
26
- }) => <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, contentType, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
30
+ }) => <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, contentType, description, outputBodySchema, parseBody, setBody, summary, tags, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
31
+ export {};
@@ -54,6 +54,7 @@ var createPostOperation = ({
54
54
  }) => ({
55
55
  bodySchema,
56
56
  contentType = "application/json",
57
+ description,
57
58
  outputBodySchema,
58
59
  parseBody,
59
60
  setBody,
@@ -65,6 +66,7 @@ var createPostOperation = ({
65
66
  }) => (0, import_next_rest_framework.routeOperation)({
66
67
  method: "POST",
67
68
  openApiOperation: {
69
+ description,
68
70
  summary,
69
71
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
70
72
  }
@@ -3,15 +3,19 @@ import { SQLiteTable } from "drizzle-orm/sqlite-core";
3
3
  import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
4
4
  import { NextRequest } from "next/server";
5
5
  import { BaseTable } from "../types.js";
6
+ type PutOperationParams<IB extends ZodSchema> = z.infer<IB> & Record<string, unknown> & {
7
+ editorId?: string;
8
+ };
6
9
  export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
7
10
  bodySchema: IB;
11
+ description?: string;
8
12
  outputBodySchema?: OB;
9
13
  table?: TTable;
10
14
  summary?: string;
11
15
  tags?: string[];
12
16
  setBody?: (_req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>) => Promise<Partial<z.infer<IB>>>;
13
17
  onSuccess?: (_payload: {
14
- params: Record<string, unknown>;
18
+ params: PutOperationParams<IB>;
15
19
  data: z.infer<OB>;
16
20
  }) => Promise<z.infer<OB>>;
17
21
  onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
@@ -22,4 +26,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
22
26
  userId?: string;
23
27
  } | undefined>;
24
28
  db?: any;
25
- }) => <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, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
29
+ }) => <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, description, outputBodySchema, table, summary, tags, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
30
+ export {};
@@ -42,6 +42,7 @@ var createPutOperation = ({
42
42
  db
43
43
  }) => ({
44
44
  bodySchema,
45
+ description,
45
46
  outputBodySchema,
46
47
  table,
47
48
  summary,
@@ -53,6 +54,7 @@ var createPutOperation = ({
53
54
  }) => (0, import_next_rest_framework.routeOperation)({
54
55
  method: "PUT",
55
56
  openApiOperation: {
57
+ description,
56
58
  summary,
57
59
  tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
58
60
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai0x0/utils",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "AI0x0 utils",
5
5
  "keywords": [
6
6
  "ai0x0"