@ai0x0/utils 0.0.46 → 0.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/ai0x0-utils/backend/SKILL.md +40 -38
- package/SKILL.md +39 -37
- package/es/__shims__/next-rest-framework.d.ts +2 -0
- package/es/backend/route-operation/delete-operation.d.ts +7 -18
- package/es/backend/route-operation/delete-operation.js +10 -122
- package/es/backend/route-operation/get-list-operation.d.ts +5 -27
- package/es/backend/route-operation/get-list-operation.js +10 -135
- package/es/backend/route-operation/get-operation.d.ts +5 -21
- package/es/backend/route-operation/get-operation.js +10 -132
- package/es/backend/route-operation/get-table-name.js +0 -2
- package/es/backend/route-operation/index.d.ts +1 -0
- package/es/backend/route-operation/index.js +2 -1
- package/es/backend/route-operation/open-api-operation.d.ts +6 -0
- package/es/backend/route-operation/open-api-operation.js +13 -0
- package/es/backend/route-operation/operation-common.d.ts +38 -0
- package/es/backend/route-operation/operation-common.js +148 -0
- package/es/backend/route-operation/operation-core.d.ts +3 -0
- package/es/backend/route-operation/operation-core.js +3 -0
- package/es/backend/route-operation/post-operation.d.ts +5 -25
- package/es/backend/route-operation/post-operation.js +13 -189
- package/es/backend/route-operation/put-operation.d.ts +4 -23
- package/es/backend/route-operation/put-operation.js +10 -155
- package/es/backend/route-operation/read-operation-core.d.ts +55 -0
- package/es/backend/route-operation/read-operation-core.js +224 -0
- package/es/backend/route-operation/write-operation-core.d.ts +94 -0
- package/es/backend/route-operation/write-operation-core.js +390 -0
- package/es/backend/sqlite/route-operation/delete-operation.d.ts +9 -20
- package/es/backend/sqlite/route-operation/delete-operation.js +10 -122
- package/es/backend/sqlite/route-operation/get-list-operation.d.ts +6 -28
- package/es/backend/sqlite/route-operation/get-list-operation.js +10 -135
- package/es/backend/sqlite/route-operation/get-operation.d.ts +6 -22
- package/es/backend/sqlite/route-operation/get-operation.js +10 -132
- package/es/backend/sqlite/route-operation/index.d.ts +1 -0
- package/es/backend/sqlite/route-operation/index.js +2 -1
- package/es/backend/sqlite/route-operation/post-operation.d.ts +6 -26
- package/es/backend/sqlite/route-operation/post-operation.js +13 -189
- package/es/backend/sqlite/route-operation/put-operation.d.ts +6 -25
- package/es/backend/sqlite/route-operation/put-operation.js +10 -155
- package/es/backend/sqlite/schemas/index.d.ts +69 -5
- package/es/backend/sqlite/schemas/index.js +0 -1
- package/lib/__shims__/next-rest-framework.d.ts +2 -0
- package/lib/backend/route-operation/delete-operation.d.ts +7 -18
- package/lib/backend/route-operation/delete-operation.js +7 -52
- package/lib/backend/route-operation/get-list-operation.d.ts +5 -27
- package/lib/backend/route-operation/get-list-operation.js +7 -68
- package/lib/backend/route-operation/get-operation.d.ts +5 -21
- package/lib/backend/route-operation/get-operation.js +7 -67
- package/lib/backend/route-operation/index.d.ts +1 -0
- package/lib/backend/route-operation/index.js +3 -1
- package/lib/backend/route-operation/open-api-operation.d.ts +6 -0
- package/lib/backend/route-operation/open-api-operation.js +37 -0
- package/lib/backend/route-operation/operation-common.d.ts +38 -0
- package/lib/backend/route-operation/operation-common.js +90 -0
- package/lib/backend/route-operation/operation-core.d.ts +3 -0
- package/lib/backend/route-operation/operation-core.js +27 -0
- package/lib/backend/route-operation/post-operation.d.ts +5 -25
- package/lib/backend/route-operation/post-operation.js +7 -71
- package/lib/backend/route-operation/put-operation.d.ts +4 -23
- package/lib/backend/route-operation/put-operation.js +7 -68
- package/lib/backend/route-operation/read-operation-core.d.ts +55 -0
- package/lib/backend/route-operation/read-operation-core.js +151 -0
- package/lib/backend/route-operation/write-operation-core.d.ts +94 -0
- package/lib/backend/route-operation/write-operation-core.js +181 -0
- package/lib/backend/sqlite/route-operation/delete-operation.d.ts +9 -20
- package/lib/backend/sqlite/route-operation/delete-operation.js +7 -52
- package/lib/backend/sqlite/route-operation/get-list-operation.d.ts +6 -28
- package/lib/backend/sqlite/route-operation/get-list-operation.js +7 -71
- package/lib/backend/sqlite/route-operation/get-operation.d.ts +6 -22
- package/lib/backend/sqlite/route-operation/get-operation.js +7 -67
- package/lib/backend/sqlite/route-operation/index.d.ts +1 -0
- package/lib/backend/sqlite/route-operation/index.js +3 -1
- package/lib/backend/sqlite/route-operation/post-operation.d.ts +6 -26
- package/lib/backend/sqlite/route-operation/post-operation.js +7 -71
- package/lib/backend/sqlite/route-operation/put-operation.d.ts +6 -25
- package/lib/backend/sqlite/route-operation/put-operation.js +7 -68
- package/lib/backend/sqlite/schemas/index.d.ts +69 -5
- package/package.json +1 -1
|
@@ -1,140 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
import { routeOperation, TypedNextResponse } from "next-rest-framework";
|
|
1
|
+
import { createGetListAction } from "../actions/create-get-list-action.js";
|
|
2
|
+
import { createGetListOperationFactory } from "../../route-operation/operation-core.js";
|
|
6
3
|
import getTableName from "./get-table-name.js";
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var createOperation = createGetListOperationFactory({
|
|
5
|
+
createAction: createGetListAction,
|
|
6
|
+
getTableName: getTableName
|
|
7
|
+
});
|
|
9
8
|
export var createGetListOperation = function createGetListOperation(_ref) {
|
|
10
9
|
var db = _ref.db,
|
|
11
10
|
getSession = _ref.getSession;
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
description = _ref2.description,
|
|
17
|
-
summary = _ref2.summary,
|
|
18
|
-
tags = _ref2.tags,
|
|
19
|
-
relations = _ref2.relations,
|
|
20
|
-
jsonArrayFields = _ref2.jsonArrayFields,
|
|
21
|
-
setParams = _ref2.setParams,
|
|
22
|
-
onSuccess = _ref2.onSuccess,
|
|
23
|
-
onError = _ref2.onError,
|
|
24
|
-
_ref2$byCreator = _ref2.byCreator,
|
|
25
|
-
byCreator = _ref2$byCreator === void 0 ? true : _ref2$byCreator;
|
|
26
|
-
return routeOperation({
|
|
27
|
-
method: "GET",
|
|
28
|
-
openApiOperation: {
|
|
29
|
-
description: description,
|
|
30
|
-
summary: summary,
|
|
31
|
-
tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
|
|
32
|
-
}
|
|
33
|
-
}).input({
|
|
34
|
-
query: querySchema
|
|
35
|
-
}).outputs([{
|
|
36
|
-
body: listBodySchema(bodySchema),
|
|
37
|
-
contentType: "application/json",
|
|
38
|
-
status: 200
|
|
39
|
-
}]).handler( /*#__PURE__*/function () {
|
|
40
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
41
|
-
var params, _ref4, userId, mergedParams, result, response;
|
|
42
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43
|
-
while (1) switch (_context.prev = _context.next) {
|
|
44
|
-
case 0:
|
|
45
|
-
_context.prev = 0;
|
|
46
|
-
_context.next = 3;
|
|
47
|
-
return setParams === null || setParams === void 0 ? void 0 : setParams(req);
|
|
48
|
-
case 3:
|
|
49
|
-
_context.t0 = _context.sent;
|
|
50
|
-
if (_context.t0) {
|
|
51
|
-
_context.next = 6;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
_context.t0 = {};
|
|
55
|
-
case 6:
|
|
56
|
-
params = _context.t0;
|
|
57
|
-
if (!byCreator) {
|
|
58
|
-
_context.next = 16;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
_context.next = 10;
|
|
62
|
-
return getSession(req);
|
|
63
|
-
case 10:
|
|
64
|
-
_context.t1 = _context.sent;
|
|
65
|
-
if (_context.t1) {
|
|
66
|
-
_context.next = 13;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
_context.t1 = {};
|
|
70
|
-
case 13:
|
|
71
|
-
_ref4 = _context.t1;
|
|
72
|
-
userId = _ref4.userId;
|
|
73
|
-
params.creatorId = userId;
|
|
74
|
-
case 16:
|
|
75
|
-
mergedParams = Object.assign(Object.fromEntries(new URL(req.url).searchParams), params);
|
|
76
|
-
if (!(table && db)) {
|
|
77
|
-
_context.next = 23;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
_context.next = 20;
|
|
81
|
-
return createGetListAction({
|
|
82
|
-
bodySchema: bodySchema,
|
|
83
|
-
db: db,
|
|
84
|
-
jsonArrayFields: jsonArrayFields,
|
|
85
|
-
relations: relations,
|
|
86
|
-
table: table
|
|
87
|
-
})(mergedParams);
|
|
88
|
-
case 20:
|
|
89
|
-
_context.t2 = _context.sent;
|
|
90
|
-
_context.next = 24;
|
|
91
|
-
break;
|
|
92
|
-
case 23:
|
|
93
|
-
_context.t2 = {
|
|
94
|
-
data: [],
|
|
95
|
-
total: 0
|
|
96
|
-
};
|
|
97
|
-
case 24:
|
|
98
|
-
result = _context.t2;
|
|
99
|
-
if (!onSuccess) {
|
|
100
|
-
_context.next = 29;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
_context.next = 28;
|
|
104
|
-
return onSuccess({
|
|
105
|
-
data: result,
|
|
106
|
-
params: mergedParams
|
|
107
|
-
});
|
|
108
|
-
case 28:
|
|
109
|
-
result = _context.sent;
|
|
110
|
-
case 29:
|
|
111
|
-
return _context.abrupt("return", TypedNextResponse.json(result, {
|
|
112
|
-
status: 200
|
|
113
|
-
}));
|
|
114
|
-
case 32:
|
|
115
|
-
_context.prev = 32;
|
|
116
|
-
_context.t3 = _context["catch"](0);
|
|
117
|
-
console.error(_context.t3);
|
|
118
|
-
_context.next = 37;
|
|
119
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.t3);
|
|
120
|
-
case 37:
|
|
121
|
-
response = _context.sent;
|
|
122
|
-
if (!response) {
|
|
123
|
-
_context.next = 42;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
return _context.abrupt("return", response);
|
|
127
|
-
case 42:
|
|
128
|
-
throw _context.t3;
|
|
129
|
-
case 43:
|
|
130
|
-
case "end":
|
|
131
|
-
return _context.stop();
|
|
132
|
-
}
|
|
133
|
-
}, _callee, null, [[0, 32]]);
|
|
134
|
-
}));
|
|
135
|
-
return function (_x) {
|
|
136
|
-
return _ref3.apply(this, arguments);
|
|
137
|
-
};
|
|
138
|
-
}());
|
|
139
|
-
};
|
|
11
|
+
return createOperation({
|
|
12
|
+
db: db,
|
|
13
|
+
getSession: getSession
|
|
14
|
+
});
|
|
140
15
|
};
|
|
@@ -1,27 +1,11 @@
|
|
|
1
|
-
import { z, ZodSchema } from "zod";
|
|
2
1
|
import { NextRequest } from "next/server";
|
|
3
|
-
import {
|
|
2
|
+
import { ZodSchema } from "zod";
|
|
4
3
|
import { BaseTable, GetListRelations } from "../types.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
jsonArrayFields?: string[];
|
|
8
|
-
querySchema: Q;
|
|
9
|
-
relations?: GetListRelations;
|
|
10
|
-
setParams?: (_req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>) => Promise<Record<string, unknown>>;
|
|
11
|
-
onSuccess?: (_payload: {
|
|
12
|
-
params: Partial<z.infer<T>> & Record<string, unknown>;
|
|
13
|
-
data: z.infer<T>;
|
|
14
|
-
}) => Promise<z.infer<T>>;
|
|
15
|
-
onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
16
|
-
description?: string;
|
|
17
|
-
summary?: string;
|
|
18
|
-
tags?: string[];
|
|
19
|
-
table?: TTable;
|
|
20
|
-
byCreator?: boolean;
|
|
21
|
-
}
|
|
4
|
+
import { type GetOperationOptions as CoreGetOperationOptions } from "../../route-operation/operation-core.js";
|
|
5
|
+
export type GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, TTable extends BaseTable> = CoreGetOperationOptions<T, Q, TTable, GetListRelations>;
|
|
22
6
|
export declare const createGetOperation: ({ getSession, db, }: {
|
|
23
|
-
db?:
|
|
24
|
-
getSession
|
|
7
|
+
db?: unknown;
|
|
8
|
+
getSession(req: NextRequest): Promise<{
|
|
25
9
|
userId?: string;
|
|
26
10
|
} | undefined>;
|
|
27
|
-
}) => <T extends
|
|
11
|
+
}) => <T extends ZodSchema<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, Q extends ZodSchema<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>({ schemas, access, table, openApiOperation, relations, setParams, jsonArrayFields, handler, catch: catchHandler, }: CoreGetOperationOptions<T, Q, BaseTable, GetListRelations>) => import("next-rest-framework").RouteOperationDefinition<"GET">;
|
|
@@ -1,137 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
-
import { routeOperation, TypedNextResponse } from "next-rest-framework";
|
|
1
|
+
import { createGetAction } from "../actions/create-get-action.js";
|
|
2
|
+
import { createGetOperationFactory } from "../../route-operation/operation-core.js";
|
|
6
3
|
import getTableName from "./get-table-name.js";
|
|
7
|
-
|
|
4
|
+
var createOperation = createGetOperationFactory({
|
|
5
|
+
createAction: createGetAction,
|
|
6
|
+
getTableName: getTableName
|
|
7
|
+
});
|
|
8
8
|
export var createGetOperation = function createGetOperation(_ref) {
|
|
9
9
|
var getSession = _ref.getSession,
|
|
10
10
|
db = _ref.db;
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
description = _ref2.description,
|
|
16
|
-
summary = _ref2.summary,
|
|
17
|
-
tags = _ref2.tags,
|
|
18
|
-
relations = _ref2.relations,
|
|
19
|
-
setParams = _ref2.setParams,
|
|
20
|
-
jsonArrayFields = _ref2.jsonArrayFields,
|
|
21
|
-
onSuccess = _ref2.onSuccess,
|
|
22
|
-
onError = _ref2.onError,
|
|
23
|
-
_ref2$byCreator = _ref2.byCreator,
|
|
24
|
-
byCreator = _ref2$byCreator === void 0 ? true : _ref2$byCreator;
|
|
25
|
-
return routeOperation({
|
|
26
|
-
method: "GET",
|
|
27
|
-
openApiOperation: {
|
|
28
|
-
description: description,
|
|
29
|
-
summary: summary,
|
|
30
|
-
tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
|
|
31
|
-
}
|
|
32
|
-
}).input({
|
|
33
|
-
query: querySchema
|
|
34
|
-
}).outputs([{
|
|
35
|
-
body: bodySchema,
|
|
36
|
-
contentType: "application/json",
|
|
37
|
-
status: 200
|
|
38
|
-
}]).handler( /*#__PURE__*/function () {
|
|
39
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
40
|
-
var params, _ref4, userId, mergedParams, rawResult, result, response;
|
|
41
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
42
|
-
while (1) switch (_context.prev = _context.next) {
|
|
43
|
-
case 0:
|
|
44
|
-
_context.prev = 0;
|
|
45
|
-
_context.next = 3;
|
|
46
|
-
return setParams === null || setParams === void 0 ? void 0 : setParams(req);
|
|
47
|
-
case 3:
|
|
48
|
-
_context.t0 = _context.sent;
|
|
49
|
-
if (_context.t0) {
|
|
50
|
-
_context.next = 6;
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
_context.t0 = {};
|
|
54
|
-
case 6:
|
|
55
|
-
params = _context.t0;
|
|
56
|
-
if (!byCreator) {
|
|
57
|
-
_context.next = 16;
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
_context.next = 10;
|
|
61
|
-
return getSession(req);
|
|
62
|
-
case 10:
|
|
63
|
-
_context.t1 = _context.sent;
|
|
64
|
-
if (_context.t1) {
|
|
65
|
-
_context.next = 13;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
_context.t1 = {};
|
|
69
|
-
case 13:
|
|
70
|
-
_ref4 = _context.t1;
|
|
71
|
-
userId = _ref4.userId;
|
|
72
|
-
params.creatorId = userId;
|
|
73
|
-
case 16:
|
|
74
|
-
mergedParams = Object.assign(Object.fromEntries(new URL(req.url).searchParams), params);
|
|
75
|
-
if (!(table && db)) {
|
|
76
|
-
_context.next = 23;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
_context.next = 20;
|
|
80
|
-
return createGetAction({
|
|
81
|
-
bodySchema: bodySchema,
|
|
82
|
-
db: db,
|
|
83
|
-
jsonArrayFields: jsonArrayFields,
|
|
84
|
-
relations: relations,
|
|
85
|
-
table: table
|
|
86
|
-
})(mergedParams);
|
|
87
|
-
case 20:
|
|
88
|
-
_context.t2 = _context.sent;
|
|
89
|
-
_context.next = 24;
|
|
90
|
-
break;
|
|
91
|
-
case 23:
|
|
92
|
-
_context.t2 = mergedParams;
|
|
93
|
-
case 24:
|
|
94
|
-
rawResult = _context.t2;
|
|
95
|
-
result = rawResult !== null && rawResult !== void 0 ? rawResult : {};
|
|
96
|
-
if (!onSuccess) {
|
|
97
|
-
_context.next = 30;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
_context.next = 29;
|
|
101
|
-
return onSuccess({
|
|
102
|
-
data: result,
|
|
103
|
-
params: mergedParams
|
|
104
|
-
});
|
|
105
|
-
case 29:
|
|
106
|
-
result = _context.sent;
|
|
107
|
-
case 30:
|
|
108
|
-
return _context.abrupt("return", TypedNextResponse.json(result, {
|
|
109
|
-
status: 200
|
|
110
|
-
}));
|
|
111
|
-
case 33:
|
|
112
|
-
_context.prev = 33;
|
|
113
|
-
_context.t3 = _context["catch"](0);
|
|
114
|
-
console.error(_context.t3);
|
|
115
|
-
_context.next = 38;
|
|
116
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.t3);
|
|
117
|
-
case 38:
|
|
118
|
-
response = _context.sent;
|
|
119
|
-
if (!response) {
|
|
120
|
-
_context.next = 43;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
return _context.abrupt("return", response);
|
|
124
|
-
case 43:
|
|
125
|
-
throw _context.t3;
|
|
126
|
-
case 44:
|
|
127
|
-
case "end":
|
|
128
|
-
return _context.stop();
|
|
129
|
-
}
|
|
130
|
-
}, _callee, null, [[0, 33]]);
|
|
131
|
-
}));
|
|
132
|
-
return function (_x) {
|
|
133
|
-
return _ref3.apply(this, arguments);
|
|
134
|
-
};
|
|
135
|
-
}());
|
|
136
|
-
};
|
|
11
|
+
return createOperation({
|
|
12
|
+
db: db,
|
|
13
|
+
getSession: getSession
|
|
14
|
+
});
|
|
137
15
|
};
|
|
@@ -2,4 +2,5 @@ export * from "./get-operation.js";
|
|
|
2
2
|
export * from "./get-list-operation.js";
|
|
3
3
|
export * from "./delete-operation.js";
|
|
4
4
|
export * from "./post-operation.js";
|
|
5
|
-
export * from "./put-operation.js";
|
|
5
|
+
export * from "./put-operation.js";
|
|
6
|
+
export * from "../../route-operation/open-api-operation.js";
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import { z, ZodSchema } from "zod";
|
|
2
1
|
import { SQLiteTable } from "drizzle-orm/sqlite-core";
|
|
3
2
|
import { NextRequest } from "next/server";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
|
|
9
|
-
bodySchema: IB;
|
|
10
|
-
contentType?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
outputBodySchema?: OB;
|
|
13
|
-
parseBody?: (_req: NextRequest) => Promise<Record<string, unknown>>;
|
|
14
|
-
setBody?: (_req: NextRequest) => Promise<Partial<z.infer<IB>>>;
|
|
15
|
-
summary?: string;
|
|
16
|
-
tags?: string[];
|
|
17
|
-
onSuccess?: (_payload: {
|
|
18
|
-
params: PostOperationParams<IB>;
|
|
19
|
-
data: z.infer<OB>;
|
|
20
|
-
req: NextRequest;
|
|
21
|
-
}) => Promise<z.infer<OB>>;
|
|
22
|
-
onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
23
|
-
table?: TTable;
|
|
24
|
-
}
|
|
3
|
+
import { ZodSchema } from "zod";
|
|
4
|
+
import { type PostOperationOptions as CorePostOperationOptions } from "../../route-operation/operation-core.js";
|
|
5
|
+
export type PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> = CorePostOperationOptions<IB, OB, TTable>;
|
|
25
6
|
export declare const createPostOperation: ({ getSession, db, }: {
|
|
26
|
-
db?:
|
|
27
|
-
getSession
|
|
7
|
+
db?: unknown;
|
|
8
|
+
getSession(req: NextRequest): Promise<{
|
|
28
9
|
userId?: string;
|
|
29
10
|
} | undefined>;
|
|
30
|
-
}) => <IB extends
|
|
31
|
-
export {};
|
|
11
|
+
}) => <IB extends ZodSchema<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>, OB extends ZodSchema<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>({ schemas, contentType, openApiOperation, parseBody, setBody, table, handler, catch: catchHandler, }: CorePostOperationOptions<IB, OB, SQLiteTable<import("drizzle-orm/sqlite-core").TableConfig>>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
|