@ai0x0/utils 0.0.38 → 0.0.39
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 +12 -8
- package/SKILL.md +12 -8
- package/es/backend/route-operation/delete-operation.d.ts +3 -2
- package/es/backend/route-operation/delete-operation.js +35 -22
- package/es/backend/route-operation/get-list-operation.d.ts +6 -5
- package/es/backend/route-operation/get-list-operation.js +37 -22
- package/es/backend/route-operation/get-operation.d.ts +5 -4
- package/es/backend/route-operation/get-operation.js +34 -22
- package/es/backend/route-operation/post-operation.d.ts +5 -4
- package/es/backend/route-operation/post-operation.js +39 -34
- package/es/backend/route-operation/put-operation.d.ts +5 -4
- package/es/backend/route-operation/put-operation.js +44 -29
- package/es/backend/sqlite/route-operation/delete-operation.d.ts +2 -1
- package/es/backend/sqlite/route-operation/delete-operation.js +35 -25
- package/es/backend/sqlite/route-operation/get-list-operation.d.ts +2 -1
- package/es/backend/sqlite/route-operation/get-list-operation.js +37 -24
- package/es/backend/sqlite/route-operation/get-operation.d.ts +2 -1
- package/es/backend/sqlite/route-operation/get-operation.js +34 -24
- package/es/backend/sqlite/route-operation/post-operation.d.ts +2 -1
- package/es/backend/sqlite/route-operation/post-operation.js +39 -35
- package/es/backend/sqlite/route-operation/put-operation.d.ts +2 -1
- package/es/backend/sqlite/route-operation/put-operation.js +44 -32
- package/lib/backend/route-operation/delete-operation.d.ts +3 -2
- package/lib/backend/route-operation/delete-operation.js +5 -3
- package/lib/backend/route-operation/get-list-operation.d.ts +6 -5
- package/lib/backend/route-operation/get-list-operation.js +8 -8
- package/lib/backend/route-operation/get-operation.d.ts +5 -4
- package/lib/backend/route-operation/get-operation.js +8 -8
- package/lib/backend/route-operation/post-operation.d.ts +5 -4
- package/lib/backend/route-operation/post-operation.js +4 -3
- package/lib/backend/route-operation/put-operation.d.ts +5 -4
- package/lib/backend/route-operation/put-operation.js +6 -4
- package/lib/backend/sqlite/route-operation/delete-operation.d.ts +2 -1
- package/lib/backend/sqlite/route-operation/delete-operation.js +3 -2
- package/lib/backend/sqlite/route-operation/get-list-operation.d.ts +2 -1
- package/lib/backend/sqlite/route-operation/get-list-operation.js +8 -8
- package/lib/backend/sqlite/route-operation/get-operation.d.ts +2 -1
- package/lib/backend/sqlite/route-operation/get-operation.js +8 -8
- package/lib/backend/sqlite/route-operation/post-operation.d.ts +2 -1
- package/lib/backend/sqlite/route-operation/post-operation.js +4 -3
- package/lib/backend/sqlite/route-operation/put-operation.d.ts +2 -1
- package/lib/backend/sqlite/route-operation/put-operation.js +4 -3
- package/package.json +1 -1
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
8
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -13,7 +7,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
7
|
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); }
|
|
14
8
|
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); } }
|
|
15
9
|
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); }); }; }
|
|
16
|
-
/* eslint-disable no-unused-vars */
|
|
17
10
|
import { z } from "zod";
|
|
18
11
|
import { routeOperation, TypedNextResponse } from "next-rest-framework";
|
|
19
12
|
import getTableName from "./get-table-name.js";
|
|
@@ -26,6 +19,7 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
26
19
|
outputBodySchema = _ref2.outputBodySchema,
|
|
27
20
|
setBody = _ref2.setBody,
|
|
28
21
|
summary = _ref2.summary,
|
|
22
|
+
tags = _ref2.tags,
|
|
29
23
|
table = _ref2.table,
|
|
30
24
|
onSuccess = _ref2.onSuccess,
|
|
31
25
|
onError = _ref2.onError;
|
|
@@ -33,7 +27,7 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
33
27
|
method: "POST",
|
|
34
28
|
openApiOperation: {
|
|
35
29
|
summary: summary,
|
|
36
|
-
tags: [getTableName(table)]
|
|
30
|
+
tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
|
|
37
31
|
}
|
|
38
32
|
}).input({
|
|
39
33
|
body: bodySchema,
|
|
@@ -46,7 +40,7 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
46
40
|
status: 200
|
|
47
41
|
}]).handler( /*#__PURE__*/function () {
|
|
48
42
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
49
|
-
var _ref4, userId, body, extraBody, mergedBody,
|
|
43
|
+
var _ref4, userId, body, extraBody, mergedBody, raw, data, response;
|
|
50
44
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
51
45
|
while (1) switch (_context.prev = _context.next) {
|
|
52
46
|
case 0:
|
|
@@ -79,7 +73,11 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
79
73
|
case 16:
|
|
80
74
|
extraBody = _context.t1;
|
|
81
75
|
mergedBody = _objectSpread(_objectSpread({}, body), extraBody);
|
|
82
|
-
|
|
76
|
+
if (!table) {
|
|
77
|
+
_context.next = 24;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
_context.next = 21;
|
|
83
81
|
return createPostAction({
|
|
84
82
|
bodySchema: bodySchema,
|
|
85
83
|
db: db,
|
|
@@ -87,47 +85,53 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
87
85
|
})(_objectSpread({
|
|
88
86
|
creatorId: userId
|
|
89
87
|
}, mergedBody));
|
|
90
|
-
case
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
case 21:
|
|
89
|
+
_context.t2 = _context.sent[0];
|
|
90
|
+
_context.next = 25;
|
|
91
|
+
break;
|
|
92
|
+
case 24:
|
|
93
|
+
_context.t2 = _objectSpread({
|
|
94
|
+
creatorId: userId
|
|
95
|
+
}, mergedBody);
|
|
96
|
+
case 25:
|
|
97
|
+
raw = _context.t2;
|
|
94
98
|
if (!onSuccess) {
|
|
95
|
-
_context.next =
|
|
99
|
+
_context.next = 32;
|
|
96
100
|
break;
|
|
97
101
|
}
|
|
98
|
-
_context.next =
|
|
102
|
+
_context.next = 29;
|
|
99
103
|
return onSuccess(raw);
|
|
100
|
-
case 26:
|
|
101
|
-
_context.t2 = _context.sent;
|
|
102
|
-
_context.next = 30;
|
|
103
|
-
break;
|
|
104
104
|
case 29:
|
|
105
|
-
_context.
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
_context.t3 = _context.sent;
|
|
106
|
+
_context.next = 33;
|
|
107
|
+
break;
|
|
108
|
+
case 32:
|
|
109
|
+
_context.t3 = raw;
|
|
110
|
+
case 33:
|
|
111
|
+
data = _context.t3;
|
|
108
112
|
return _context.abrupt("return", TypedNextResponse.json(data, {
|
|
109
113
|
status: 200
|
|
110
114
|
}));
|
|
111
|
-
case
|
|
112
|
-
_context.prev =
|
|
113
|
-
_context.
|
|
114
|
-
console.error(_context.
|
|
115
|
-
_context.next =
|
|
116
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.
|
|
117
|
-
case
|
|
115
|
+
case 37:
|
|
116
|
+
_context.prev = 37;
|
|
117
|
+
_context.t4 = _context["catch"](0);
|
|
118
|
+
console.error(_context.t4);
|
|
119
|
+
_context.next = 42;
|
|
120
|
+
return onError === null || onError === void 0 ? void 0 : onError(_context.t4);
|
|
121
|
+
case 42:
|
|
118
122
|
response = _context.sent;
|
|
119
123
|
if (!response) {
|
|
120
|
-
_context.next =
|
|
124
|
+
_context.next = 47;
|
|
121
125
|
break;
|
|
122
126
|
}
|
|
123
127
|
return _context.abrupt("return", response);
|
|
124
|
-
case
|
|
125
|
-
throw _context.
|
|
126
|
-
case
|
|
128
|
+
case 47:
|
|
129
|
+
throw _context.t4;
|
|
130
|
+
case 48:
|
|
127
131
|
case "end":
|
|
128
132
|
return _context.stop();
|
|
129
133
|
}
|
|
130
|
-
}, _callee, null, [[0,
|
|
134
|
+
}, _callee, null, [[0, 37]]);
|
|
131
135
|
}));
|
|
132
136
|
return function (_x) {
|
|
133
137
|
return _ref3.apply(this, arguments);
|
|
@@ -4,8 +4,9 @@ import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
|
|
|
4
4
|
export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends SQLiteTable> {
|
|
5
5
|
bodySchema: IB;
|
|
6
6
|
outputBodySchema?: OB;
|
|
7
|
-
table
|
|
7
|
+
table?: TTable;
|
|
8
8
|
summary?: string;
|
|
9
|
+
tags?: string[];
|
|
9
10
|
setBody?: (_req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>) => Promise<Partial<z.infer<IB>>>;
|
|
10
11
|
onSuccess?: (_data: z.infer<OB>) => Promise<z.infer<OB>>;
|
|
11
12
|
onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
@@ -7,7 +7,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
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); }
|
|
8
8
|
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); } }
|
|
9
9
|
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); }); }; }
|
|
10
|
-
/* eslint-disable no-unused-vars */
|
|
11
10
|
import { z } from "zod";
|
|
12
11
|
import { routeOperation, TypedNextResponse } from "next-rest-framework";
|
|
13
12
|
import getTableName from "./get-table-name.js";
|
|
@@ -21,6 +20,7 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
21
20
|
outputBodySchema = _ref2.outputBodySchema,
|
|
22
21
|
table = _ref2.table,
|
|
23
22
|
summary = _ref2.summary,
|
|
23
|
+
tags = _ref2.tags,
|
|
24
24
|
setBody = _ref2.setBody,
|
|
25
25
|
onSuccess = _ref2.onSuccess,
|
|
26
26
|
_ref2$byCreator = _ref2.byCreator,
|
|
@@ -30,7 +30,7 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
30
30
|
method: "PUT",
|
|
31
31
|
openApiOperation: {
|
|
32
32
|
summary: summary,
|
|
33
|
-
tags: [getTableName(table)]
|
|
33
|
+
tags: tags !== null && tags !== void 0 ? tags : table ? [getTableName(table)] : []
|
|
34
34
|
}
|
|
35
35
|
}).input({
|
|
36
36
|
body: bodySchema,
|
|
@@ -74,7 +74,11 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
74
74
|
case 16:
|
|
75
75
|
extraBody = _context.t1;
|
|
76
76
|
mergedBody = _objectSpread(_objectSpread({}, body), extraBody);
|
|
77
|
-
|
|
77
|
+
if (!table) {
|
|
78
|
+
_context.next = 24;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
_context.next = 21;
|
|
78
82
|
return createPutAction({
|
|
79
83
|
bodySchema: bodySchema,
|
|
80
84
|
table: table,
|
|
@@ -84,57 +88,65 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
84
88
|
}, mergedBody), {
|
|
85
89
|
byCreator: byCreator
|
|
86
90
|
});
|
|
87
|
-
case
|
|
88
|
-
|
|
91
|
+
case 21:
|
|
92
|
+
_context.t2 = _context.sent;
|
|
93
|
+
_context.next = 25;
|
|
94
|
+
break;
|
|
95
|
+
case 24:
|
|
96
|
+
_context.t2 = _objectSpread({
|
|
97
|
+
editorId: userId
|
|
98
|
+
}, mergedBody);
|
|
99
|
+
case 25:
|
|
100
|
+
raw = _context.t2;
|
|
89
101
|
if (!onSuccess) {
|
|
90
|
-
_context.next =
|
|
102
|
+
_context.next = 32;
|
|
91
103
|
break;
|
|
92
104
|
}
|
|
93
|
-
_context.next =
|
|
105
|
+
_context.next = 29;
|
|
94
106
|
return onSuccess(raw);
|
|
95
|
-
case
|
|
96
|
-
_context.
|
|
97
|
-
_context.next =
|
|
107
|
+
case 29:
|
|
108
|
+
_context.t3 = _context.sent;
|
|
109
|
+
_context.next = 33;
|
|
98
110
|
break;
|
|
99
|
-
case
|
|
100
|
-
_context.
|
|
101
|
-
case
|
|
102
|
-
data = _context.
|
|
111
|
+
case 32:
|
|
112
|
+
_context.t3 = raw;
|
|
113
|
+
case 33:
|
|
114
|
+
data = _context.t3;
|
|
103
115
|
return _context.abrupt("return", TypedNextResponse.json(data, {
|
|
104
116
|
status: 200
|
|
105
117
|
}));
|
|
106
|
-
case 32:
|
|
107
|
-
_context.prev = 32;
|
|
108
|
-
_context.t3 = _context["catch"](0);
|
|
109
|
-
if (!(_context.t3 instanceof HttpError)) {
|
|
110
|
-
console.error(_context.t3);
|
|
111
|
-
}
|
|
112
|
-
_context.next = 37;
|
|
113
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.t3);
|
|
114
118
|
case 37:
|
|
119
|
+
_context.prev = 37;
|
|
120
|
+
_context.t4 = _context["catch"](0);
|
|
121
|
+
if (!(_context.t4 instanceof HttpError)) {
|
|
122
|
+
console.error(_context.t4);
|
|
123
|
+
}
|
|
124
|
+
_context.next = 42;
|
|
125
|
+
return onError === null || onError === void 0 ? void 0 : onError(_context.t4);
|
|
126
|
+
case 42:
|
|
115
127
|
response = _context.sent;
|
|
116
128
|
if (!response) {
|
|
117
|
-
_context.next =
|
|
129
|
+
_context.next = 45;
|
|
118
130
|
break;
|
|
119
131
|
}
|
|
120
132
|
return _context.abrupt("return", response);
|
|
121
|
-
case
|
|
122
|
-
if (!(_context.
|
|
123
|
-
_context.next =
|
|
133
|
+
case 45:
|
|
134
|
+
if (!(_context.t4 instanceof HttpError)) {
|
|
135
|
+
_context.next = 47;
|
|
124
136
|
break;
|
|
125
137
|
}
|
|
126
138
|
return _context.abrupt("return", TypedNextResponse.json({
|
|
127
|
-
message: _context.
|
|
139
|
+
message: _context.t4.message
|
|
128
140
|
}, {
|
|
129
|
-
status: _context.
|
|
141
|
+
status: _context.t4.status
|
|
130
142
|
}));
|
|
131
|
-
case
|
|
132
|
-
throw _context.
|
|
133
|
-
case
|
|
143
|
+
case 47:
|
|
144
|
+
throw _context.t4;
|
|
145
|
+
case 48:
|
|
134
146
|
case "end":
|
|
135
147
|
return _context.stop();
|
|
136
148
|
}
|
|
137
|
-
}, _callee, null, [[0,
|
|
149
|
+
}, _callee, null, [[0, 37]]);
|
|
138
150
|
}));
|
|
139
151
|
return function (_x) {
|
|
140
152
|
return _ref3.apply(this, arguments);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { TypedNextResponse } from "next-rest-framework";
|
|
2
2
|
import { BaseTable } from "../types.js";
|
|
3
3
|
export interface DeleteOperationOptions<TTable extends BaseTable> {
|
|
4
|
-
table
|
|
4
|
+
table?: TTable;
|
|
5
5
|
summary?: string;
|
|
6
|
+
tags?: string[];
|
|
6
7
|
onSuccess?: () => Promise<void>;
|
|
7
|
-
onError
|
|
8
|
+
onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
8
9
|
byCreator?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export declare const createDeleteOperation: any;
|
|
@@ -43,6 +43,7 @@ var createDeleteOperation = ({
|
|
|
43
43
|
}) => ({
|
|
44
44
|
table,
|
|
45
45
|
summary,
|
|
46
|
+
tags,
|
|
46
47
|
onSuccess,
|
|
47
48
|
onError,
|
|
48
49
|
byCreator = true
|
|
@@ -50,7 +51,7 @@ var createDeleteOperation = ({
|
|
|
50
51
|
method: "DELETE",
|
|
51
52
|
openApiOperation: {
|
|
52
53
|
summary,
|
|
53
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
54
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
54
55
|
}
|
|
55
56
|
}).input({
|
|
56
57
|
body: import_zod.z.object({
|
|
@@ -64,14 +65,15 @@ var createDeleteOperation = ({
|
|
|
64
65
|
const { userId } = await getSession(req) || {};
|
|
65
66
|
body.creatorId = userId;
|
|
66
67
|
}
|
|
67
|
-
const data = await (0, import_actions.createDeleteAction)({ table, db })(body);
|
|
68
|
+
const data = table ? await (0, import_actions.createDeleteAction)({ table, db })(body) : body;
|
|
68
69
|
await (onSuccess == null ? void 0 : onSuccess());
|
|
69
70
|
return import_next_rest_framework.TypedNextResponse.json(data, {
|
|
70
71
|
status: 200
|
|
71
72
|
});
|
|
72
73
|
} catch (e) {
|
|
73
|
-
if (!(e instanceof import_errors.HttpError))
|
|
74
|
+
if (!(e instanceof import_errors.HttpError)) {
|
|
74
75
|
console.error(e);
|
|
76
|
+
}
|
|
75
77
|
const response = await (onError == null ? void 0 : onError(e));
|
|
76
78
|
if (response) {
|
|
77
79
|
return response;
|
|
@@ -6,17 +6,18 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
|
|
|
6
6
|
jsonArrayFields?: string[];
|
|
7
7
|
querySchema: Q;
|
|
8
8
|
relations?: GetListRelations;
|
|
9
|
-
setParams
|
|
9
|
+
setParams?(req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>): Promise<Record<string, unknown>>;
|
|
10
10
|
byCreator?: boolean;
|
|
11
11
|
summary?: string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
tags?: string[];
|
|
13
|
+
table?: TTable;
|
|
14
|
+
onSuccess?<D extends T>(data: {
|
|
14
15
|
data: z.infer<D>[];
|
|
15
16
|
total: number;
|
|
16
|
-
})
|
|
17
|
+
}): Promise<{
|
|
17
18
|
data: z.infer<T>[];
|
|
18
19
|
total: number;
|
|
19
20
|
}>;
|
|
20
|
-
onError
|
|
21
|
+
onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
21
22
|
}
|
|
22
23
|
export declare const createGetListOperation: any;
|
|
@@ -44,6 +44,7 @@ var createGetListOperation = ({
|
|
|
44
44
|
bodySchema,
|
|
45
45
|
table,
|
|
46
46
|
summary,
|
|
47
|
+
tags,
|
|
47
48
|
relations,
|
|
48
49
|
jsonArrayFields,
|
|
49
50
|
setParams,
|
|
@@ -54,7 +55,7 @@ var createGetListOperation = ({
|
|
|
54
55
|
method: "GET",
|
|
55
56
|
openApiOperation: {
|
|
56
57
|
summary,
|
|
57
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
58
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
58
59
|
}
|
|
59
60
|
}).input({
|
|
60
61
|
query: querySchema
|
|
@@ -73,18 +74,17 @@ var createGetListOperation = ({
|
|
|
73
74
|
const { userId } = await getSession(req) || {};
|
|
74
75
|
params.creatorId = userId;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
const mergedParams = Object.assign(
|
|
78
|
+
Object.fromEntries(new URL(req.url).searchParams),
|
|
79
|
+
params
|
|
80
|
+
);
|
|
81
|
+
let result = table ? await (0, import_actions.createGetListAction)({
|
|
77
82
|
bodySchema,
|
|
78
83
|
db,
|
|
79
84
|
jsonArrayFields,
|
|
80
85
|
relations,
|
|
81
86
|
table
|
|
82
|
-
})(
|
|
83
|
-
Object.assign(
|
|
84
|
-
Object.fromEntries(new URL(req.url).searchParams),
|
|
85
|
-
params
|
|
86
|
-
)
|
|
87
|
-
);
|
|
87
|
+
})(mergedParams) : { data: [], total: 0 };
|
|
88
88
|
if (onSuccess) {
|
|
89
89
|
result = await onSuccess(result);
|
|
90
90
|
}
|
|
@@ -6,11 +6,12 @@ export interface GetOperationOptions<T extends ZodSchema, Q extends ZodSchema, T
|
|
|
6
6
|
jsonArrayFields?: string[];
|
|
7
7
|
querySchema: Q;
|
|
8
8
|
relations?: GetListRelations;
|
|
9
|
-
setParams
|
|
10
|
-
onSuccess
|
|
11
|
-
onError
|
|
9
|
+
setParams?(req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>): Promise<Record<string, unknown>>;
|
|
10
|
+
onSuccess?(data: z.infer<T>): Promise<z.infer<T>>;
|
|
11
|
+
onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
12
12
|
summary?: string;
|
|
13
|
-
|
|
13
|
+
tags?: string[];
|
|
14
|
+
table?: TTable;
|
|
14
15
|
byCreator?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare const createGetOperation: any;
|
|
@@ -43,6 +43,7 @@ var createGetOperation = ({
|
|
|
43
43
|
bodySchema,
|
|
44
44
|
table,
|
|
45
45
|
summary,
|
|
46
|
+
tags,
|
|
46
47
|
relations,
|
|
47
48
|
setParams,
|
|
48
49
|
jsonArrayFields,
|
|
@@ -53,7 +54,7 @@ var createGetOperation = ({
|
|
|
53
54
|
method: "GET",
|
|
54
55
|
openApiOperation: {
|
|
55
56
|
summary,
|
|
56
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
57
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
57
58
|
}
|
|
58
59
|
}).input({
|
|
59
60
|
query: querySchema
|
|
@@ -72,18 +73,17 @@ var createGetOperation = ({
|
|
|
72
73
|
const { userId } = await getSession(req) || {};
|
|
73
74
|
params.creatorId = userId;
|
|
74
75
|
}
|
|
75
|
-
const
|
|
76
|
+
const mergedParams = Object.assign(
|
|
77
|
+
Object.fromEntries(new URL(req.url).searchParams),
|
|
78
|
+
params
|
|
79
|
+
);
|
|
80
|
+
const rawResult = table ? await (0, import_actions.createGetAction)({
|
|
76
81
|
bodySchema,
|
|
77
82
|
db,
|
|
78
83
|
jsonArrayFields,
|
|
79
84
|
relations,
|
|
80
85
|
table
|
|
81
|
-
})(
|
|
82
|
-
Object.assign(
|
|
83
|
-
Object.fromEntries(new URL(req.url).searchParams),
|
|
84
|
-
params
|
|
85
|
-
)
|
|
86
|
-
);
|
|
86
|
+
})(mergedParams) : mergedParams;
|
|
87
87
|
let result = rawResult ?? {};
|
|
88
88
|
if (onSuccess) {
|
|
89
89
|
result = await onSuccess(result);
|
|
@@ -4,10 +4,11 @@ import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
|
|
|
4
4
|
export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
|
|
5
5
|
bodySchema: IB;
|
|
6
6
|
outputBodySchema?: IB;
|
|
7
|
-
setBody
|
|
7
|
+
setBody?(req: TypedNextRequest<"POST", "application/json", z.infer<IB>>): Promise<Partial<z.infer<IB>>>;
|
|
8
8
|
summary?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
tags?: string[];
|
|
10
|
+
onSuccess?(data: z.infer<OB>): Promise<z.infer<OB>>;
|
|
11
|
+
onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
12
|
+
table?: TTable;
|
|
12
13
|
}
|
|
13
14
|
export declare const createPostOperation: any;
|
|
@@ -44,6 +44,7 @@ var createPostOperation = ({
|
|
|
44
44
|
outputBodySchema,
|
|
45
45
|
setBody,
|
|
46
46
|
summary,
|
|
47
|
+
tags,
|
|
47
48
|
table,
|
|
48
49
|
onSuccess,
|
|
49
50
|
onError
|
|
@@ -51,7 +52,7 @@ var createPostOperation = ({
|
|
|
51
52
|
method: "POST",
|
|
52
53
|
openApiOperation: {
|
|
53
54
|
summary,
|
|
54
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
55
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
55
56
|
}
|
|
56
57
|
}).input({
|
|
57
58
|
body: bodySchema,
|
|
@@ -70,10 +71,10 @@ var createPostOperation = ({
|
|
|
70
71
|
req
|
|
71
72
|
)) || {};
|
|
72
73
|
const mergedBody = { ...body, ...extraBody };
|
|
73
|
-
const
|
|
74
|
+
const raw = table ? (await (0, import_actions.createPostAction)({ bodySchema, db, table })({
|
|
74
75
|
creatorId: userId,
|
|
75
76
|
...mergedBody
|
|
76
|
-
});
|
|
77
|
+
}))[0] : { creatorId: userId, ...mergedBody };
|
|
77
78
|
const data = onSuccess ? await onSuccess(raw) : raw;
|
|
78
79
|
return import_next_rest_framework.TypedNextResponse.json(data, {
|
|
79
80
|
status: 200
|
|
@@ -4,11 +4,12 @@ import { TypedNextRequest, TypedNextResponse } from "next-rest-framework";
|
|
|
4
4
|
export interface PutOperationOptions<IB extends ZodSchema, OB extends ZodSchema, TTable extends PgTable> {
|
|
5
5
|
bodySchema: IB;
|
|
6
6
|
outputBodySchema?: OB;
|
|
7
|
-
table
|
|
7
|
+
table?: TTable;
|
|
8
8
|
summary?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
tags?: string[];
|
|
10
|
+
setBody?(req: TypedNextRequest<"PUT", "application/json", z.infer<IB>>): Promise<Partial<z.infer<IB>>>;
|
|
11
|
+
onSuccess?(data: z.infer<OB>): Promise<z.infer<OB>>;
|
|
12
|
+
onError?(error: Error): Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
12
13
|
byCreator?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const createPutOperation: any;
|
|
@@ -45,6 +45,7 @@ var createPutOperation = ({
|
|
|
45
45
|
outputBodySchema,
|
|
46
46
|
table,
|
|
47
47
|
summary,
|
|
48
|
+
tags,
|
|
48
49
|
setBody,
|
|
49
50
|
onSuccess,
|
|
50
51
|
byCreator = true,
|
|
@@ -53,7 +54,7 @@ var createPutOperation = ({
|
|
|
53
54
|
method: "PUT",
|
|
54
55
|
openApiOperation: {
|
|
55
56
|
summary,
|
|
56
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
57
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
57
58
|
}
|
|
58
59
|
}).input({
|
|
59
60
|
body: bodySchema,
|
|
@@ -72,18 +73,19 @@ var createPutOperation = ({
|
|
|
72
73
|
req
|
|
73
74
|
)) || {};
|
|
74
75
|
const mergedBody = { ...body, ...extraBody };
|
|
75
|
-
const raw = await (0, import_actions.createPutAction)({
|
|
76
|
+
const raw = table ? await (0, import_actions.createPutAction)({
|
|
76
77
|
bodySchema,
|
|
77
78
|
table,
|
|
78
79
|
db
|
|
79
|
-
})({ editorId: userId, ...mergedBody }, { byCreator });
|
|
80
|
+
})({ editorId: userId, ...mergedBody }, { byCreator }) : { editorId: userId, ...mergedBody };
|
|
80
81
|
const data = onSuccess ? await onSuccess(raw) : raw;
|
|
81
82
|
return import_next_rest_framework.TypedNextResponse.json(data, {
|
|
82
83
|
status: 200
|
|
83
84
|
});
|
|
84
85
|
} catch (e) {
|
|
85
|
-
if (!(e instanceof import_errors.HttpError))
|
|
86
|
+
if (!(e instanceof import_errors.HttpError)) {
|
|
86
87
|
console.error(e);
|
|
88
|
+
}
|
|
87
89
|
const response = await (onError == null ? void 0 : onError(e));
|
|
88
90
|
if (response) {
|
|
89
91
|
return response;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TypedNextResponse } from "next-rest-framework";
|
|
2
2
|
import { BaseTable } from "../types.js";
|
|
3
3
|
export interface DeleteOperationOptions<TTable extends BaseTable> {
|
|
4
|
-
table
|
|
4
|
+
table?: TTable;
|
|
5
5
|
summary?: string;
|
|
6
|
+
tags?: string[];
|
|
6
7
|
onSuccess?: () => Promise<void>;
|
|
7
8
|
onError?: (_error: Error) => Promise<ReturnType<(typeof TypedNextResponse)["json"]> | undefined>;
|
|
8
9
|
byCreator?: boolean;
|
|
@@ -43,6 +43,7 @@ var createDeleteOperation = ({
|
|
|
43
43
|
}) => ({
|
|
44
44
|
table,
|
|
45
45
|
summary,
|
|
46
|
+
tags,
|
|
46
47
|
onSuccess,
|
|
47
48
|
onError,
|
|
48
49
|
byCreator = true
|
|
@@ -50,7 +51,7 @@ var createDeleteOperation = ({
|
|
|
50
51
|
method: "DELETE",
|
|
51
52
|
openApiOperation: {
|
|
52
53
|
summary,
|
|
53
|
-
tags: [(0, import_get_table_name.default)(table)]
|
|
54
|
+
tags: tags ?? (table ? [(0, import_get_table_name.default)(table)] : [])
|
|
54
55
|
}
|
|
55
56
|
}).input({
|
|
56
57
|
body: import_zod.z.object({
|
|
@@ -64,7 +65,7 @@ var createDeleteOperation = ({
|
|
|
64
65
|
const { userId } = await getSession(req) || {};
|
|
65
66
|
body.creatorId = userId;
|
|
66
67
|
}
|
|
67
|
-
const data = await (0, import_actions.createDeleteAction)({ table, db })(body);
|
|
68
|
+
const data = table ? await (0, import_actions.createDeleteAction)({ table, db })(body) : body;
|
|
68
69
|
await (onSuccess == null ? void 0 : onSuccess());
|
|
69
70
|
return import_next_rest_framework.TypedNextResponse.json(data, {
|
|
70
71
|
status: 200
|
|
@@ -9,7 +9,8 @@ export interface GetListOperationOptions<T extends ZodSchema, Q extends ZodSchem
|
|
|
9
9
|
setParams?: (_req: TypedNextRequest<"GET", "application/json", unknown, z.infer<Q>>) => Promise<Record<string, unknown>>;
|
|
10
10
|
byCreator?: boolean;
|
|
11
11
|
summary?: string;
|
|
12
|
-
|
|
12
|
+
tags?: string[];
|
|
13
|
+
table?: TTable;
|
|
13
14
|
onSuccess?: <D extends T>(_data: {
|
|
14
15
|
data: z.infer<D>[];
|
|
15
16
|
total: number;
|