@ai0x0/utils 0.0.14 → 0.0.16
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/SKILL.md +336 -0
- package/es/__shims__/next-rest-framework.d.ts +48 -0
- package/es/backend/actions/create-delete-action.d.ts +1 -1
- package/es/backend/actions/create-get-action.d.ts +2 -2
- package/es/backend/actions/create-get-action.js +1 -1
- package/es/backend/actions/create-get-list-action.d.ts +3 -3
- package/es/backend/actions/create-get-list-action.js +3 -3
- package/es/backend/actions/create-post-action.d.ts +2 -2
- package/es/backend/actions/create-post-action.js +8 -2
- package/es/backend/actions/create-put-action.d.ts +3 -3
- package/es/backend/actions/get-list-data.d.ts +3 -15
- package/es/backend/actions/get-list-query.d.ts +5 -7
- package/es/backend/actions/transform-body.d.ts +1 -1
- package/es/backend/actions/transform-body.js +0 -2
- package/es/backend/route-operation/delete-operation.d.ts +2 -2
- package/es/backend/route-operation/get-list-operation.d.ts +2 -2
- package/es/backend/route-operation/get-operation.d.ts +3 -3
- package/es/backend/route-operation/get-operation.js +18 -24
- package/es/backend/route-operation/post-operation.d.ts +2 -2
- package/es/backend/route-operation/post-operation.js +21 -16
- package/es/backend/route-operation/put-operation.d.ts +2 -2
- package/es/backend/route-operation/put-operation.js +21 -16
- package/es/backend/schemas/index.d.ts +76 -1249
- package/es/backend/schemas/index.js +1 -6
- package/lib/__shims__/next-rest-framework.d.ts +48 -0
- package/lib/backend/actions/create-delete-action.d.ts +1 -1
- package/lib/backend/actions/create-get-action.d.ts +2 -2
- package/lib/backend/actions/create-get-list-action.d.ts +3 -3
- package/lib/backend/actions/create-post-action.d.ts +2 -2
- package/lib/backend/actions/create-post-action.js +3 -1
- package/lib/backend/actions/create-put-action.d.ts +3 -3
- package/lib/backend/actions/create-put-action.js +4 -1
- package/lib/backend/actions/get-list-data.d.ts +3 -15
- package/lib/backend/actions/get-list-query.d.ts +5 -7
- package/lib/backend/actions/transform-body.d.ts +1 -1
- package/lib/backend/actions/transform-body.js +3 -1
- package/lib/backend/route-operation/delete-operation.d.ts +2 -2
- package/lib/backend/route-operation/get-list-operation.d.ts +2 -2
- package/lib/backend/route-operation/get-list-operation.js +7 -2
- package/lib/backend/route-operation/get-operation.d.ts +3 -3
- package/lib/backend/route-operation/get-operation.js +6 -3
- package/lib/backend/route-operation/post-operation.d.ts +2 -2
- package/lib/backend/route-operation/post-operation.js +5 -5
- package/lib/backend/route-operation/put-operation.d.ts +2 -2
- package/lib/backend/route-operation/put-operation.js +5 -5
- package/lib/backend/schemas/index.d.ts +76 -1249
- package/lib/backend/schemas/index.js +12 -14
- package/package.json +39 -35
|
@@ -34,7 +34,7 @@ export var createGetOperation = function createGetOperation(_ref) {
|
|
|
34
34
|
status: 200
|
|
35
35
|
}]).handler( /*#__PURE__*/function () {
|
|
36
36
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
37
|
-
var params, _ref4, userId, result, response;
|
|
37
|
+
var params, _ref4, userId, rawResult, result, response;
|
|
38
38
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39
39
|
while (1) switch (_context.prev = _context.next) {
|
|
40
40
|
case 0:
|
|
@@ -77,45 +77,39 @@ export var createGetOperation = function createGetOperation(_ref) {
|
|
|
77
77
|
table: table
|
|
78
78
|
})(Object.assign(Object.fromEntries(new URL(req.url).searchParams), params));
|
|
79
79
|
case 18:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_context.next = 21;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
_context.t2 = {};
|
|
86
|
-
case 21:
|
|
87
|
-
result = _context.t2;
|
|
80
|
+
rawResult = _context.sent;
|
|
81
|
+
result = rawResult !== null && rawResult !== void 0 ? rawResult : {};
|
|
88
82
|
if (!onSuccess) {
|
|
89
|
-
_context.next =
|
|
83
|
+
_context.next = 24;
|
|
90
84
|
break;
|
|
91
85
|
}
|
|
92
|
-
_context.next =
|
|
86
|
+
_context.next = 23;
|
|
93
87
|
return onSuccess(result);
|
|
94
|
-
case
|
|
88
|
+
case 23:
|
|
95
89
|
result = _context.sent;
|
|
96
|
-
case
|
|
90
|
+
case 24:
|
|
97
91
|
return _context.abrupt("return", TypedNextResponse.json(result, {
|
|
98
92
|
status: 200
|
|
99
93
|
}));
|
|
100
|
-
case
|
|
101
|
-
_context.prev =
|
|
102
|
-
_context.
|
|
103
|
-
_context.next =
|
|
104
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.
|
|
105
|
-
case
|
|
94
|
+
case 27:
|
|
95
|
+
_context.prev = 27;
|
|
96
|
+
_context.t2 = _context["catch"](0);
|
|
97
|
+
_context.next = 31;
|
|
98
|
+
return onError === null || onError === void 0 ? void 0 : onError(_context.t2);
|
|
99
|
+
case 31:
|
|
106
100
|
response = _context.sent;
|
|
107
101
|
if (!response) {
|
|
108
|
-
_context.next =
|
|
102
|
+
_context.next = 36;
|
|
109
103
|
break;
|
|
110
104
|
}
|
|
111
105
|
return _context.abrupt("return", response);
|
|
112
|
-
case
|
|
113
|
-
throw _context.
|
|
114
|
-
case
|
|
106
|
+
case 36:
|
|
107
|
+
throw _context.t2;
|
|
108
|
+
case 37:
|
|
115
109
|
case "end":
|
|
116
110
|
return _context.stop();
|
|
117
111
|
}
|
|
118
|
-
}, _callee, null, [[0,
|
|
112
|
+
}, _callee, null, [[0, 27]]);
|
|
119
113
|
}));
|
|
120
114
|
return function (_x) {
|
|
121
115
|
return _ref3.apply(this, arguments);
|
|
@@ -13,8 +13,8 @@ export interface PostOperationOptions<IB extends ZodSchema, OB extends ZodSchema
|
|
|
13
13
|
table: TTable;
|
|
14
14
|
}
|
|
15
15
|
export declare const createPostOperation: ({ getSession, db, }: {
|
|
16
|
-
db: NodePgDatabase<
|
|
16
|
+
db: NodePgDatabase<Record<string, unknown>>;
|
|
17
17
|
getSession: (req: NextRequest) => Promise<{
|
|
18
18
|
userId?: string;
|
|
19
19
|
} | undefined>;
|
|
20
|
-
}) => <IB extends z.ZodType<
|
|
20
|
+
}) => <IB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, OB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends PgTable<import("drizzle-orm/pg-core").TableConfig>>({ bodySchema, outputBodySchema, setBody, summary, table, onSuccess, onError, }: PostOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"POST">;
|
|
@@ -45,7 +45,7 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
45
45
|
status: 200
|
|
46
46
|
}]).handler( /*#__PURE__*/function () {
|
|
47
47
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
48
|
-
var _ref4, userId, body, _yield$createPostActi, _yield$createPostActi2, _data, response;
|
|
48
|
+
var _ref4, userId, body, _yield$createPostActi, _yield$createPostActi2, raw, _data, response;
|
|
49
49
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
50
50
|
while (1) switch (_context.prev = _context.next) {
|
|
51
51
|
case 0:
|
|
@@ -90,38 +90,43 @@ export var createPostOperation = function createPostOperation(_ref) {
|
|
|
90
90
|
case 21:
|
|
91
91
|
_yield$createPostActi = _context.sent;
|
|
92
92
|
_yield$createPostActi2 = _slicedToArray(_yield$createPostActi, 1);
|
|
93
|
-
|
|
93
|
+
raw = _yield$createPostActi2[0];
|
|
94
94
|
if (!onSuccess) {
|
|
95
|
-
_context.next =
|
|
95
|
+
_context.next = 30;
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
_context.next = 27;
|
|
99
|
-
return onSuccess(
|
|
99
|
+
return onSuccess(raw);
|
|
100
100
|
case 27:
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
_context.t5 = _context.sent;
|
|
102
|
+
_context.next = 31;
|
|
103
|
+
break;
|
|
104
|
+
case 30:
|
|
105
|
+
_context.t5 = raw;
|
|
106
|
+
case 31:
|
|
107
|
+
_data = _context.t5;
|
|
103
108
|
return _context.abrupt("return", TypedNextResponse.json(_data, {
|
|
104
109
|
status: 200
|
|
105
110
|
}));
|
|
106
|
-
case 31:
|
|
107
|
-
_context.prev = 31;
|
|
108
|
-
_context.t5 = _context["catch"](0);
|
|
109
|
-
_context.next = 35;
|
|
110
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.t5);
|
|
111
111
|
case 35:
|
|
112
|
+
_context.prev = 35;
|
|
113
|
+
_context.t6 = _context["catch"](0);
|
|
114
|
+
_context.next = 39;
|
|
115
|
+
return onError === null || onError === void 0 ? void 0 : onError(_context.t6);
|
|
116
|
+
case 39:
|
|
112
117
|
response = _context.sent;
|
|
113
118
|
if (!response) {
|
|
114
|
-
_context.next =
|
|
119
|
+
_context.next = 44;
|
|
115
120
|
break;
|
|
116
121
|
}
|
|
117
122
|
return _context.abrupt("return", response);
|
|
118
|
-
case
|
|
119
|
-
throw _context.
|
|
120
|
-
case
|
|
123
|
+
case 44:
|
|
124
|
+
throw _context.t6;
|
|
125
|
+
case 45:
|
|
121
126
|
case "end":
|
|
122
127
|
return _context.stop();
|
|
123
128
|
}
|
|
124
|
-
}, _callee, null, [[0,
|
|
129
|
+
}, _callee, null, [[0, 35]]);
|
|
125
130
|
}));
|
|
126
131
|
return function (_x) {
|
|
127
132
|
return _ref3.apply(this, arguments);
|
|
@@ -18,5 +18,5 @@ export declare const createPutOperation: ({ getSession, db, }: {
|
|
|
18
18
|
getSession: (req: NextRequest) => Promise<{
|
|
19
19
|
userId?: string;
|
|
20
20
|
} | undefined>;
|
|
21
|
-
db: NodePgDatabase<
|
|
22
|
-
}) => <IB extends z.ZodType<
|
|
21
|
+
db: NodePgDatabase<Record<string, unknown>>;
|
|
22
|
+
}) => <IB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, OB extends z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, TTable extends BaseTable>({ bodySchema, outputBodySchema, table, summary, setBody, onSuccess, byCreator, onError, }: PutOperationOptions<IB, OB, TTable>) => import("next-rest-framework").RouteOperationDefinition<"PUT">;
|
|
@@ -39,7 +39,7 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
39
39
|
contentType: "application/json"
|
|
40
40
|
}]).handler( /*#__PURE__*/function () {
|
|
41
41
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req) {
|
|
42
|
-
var _ref4, userId, body, _data, response;
|
|
42
|
+
var _ref4, userId, body, raw, _data, response;
|
|
43
43
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
44
|
while (1) switch (_context.prev = _context.next) {
|
|
45
45
|
case 0:
|
|
@@ -84,38 +84,43 @@ export var createPutOperation = function createPutOperation(_ref) {
|
|
|
84
84
|
byCreator: byCreator
|
|
85
85
|
});
|
|
86
86
|
case 21:
|
|
87
|
-
|
|
87
|
+
raw = _context.sent;
|
|
88
88
|
if (!onSuccess) {
|
|
89
|
-
_context.next =
|
|
89
|
+
_context.next = 28;
|
|
90
90
|
break;
|
|
91
91
|
}
|
|
92
92
|
_context.next = 25;
|
|
93
|
-
return onSuccess(
|
|
93
|
+
return onSuccess(raw);
|
|
94
94
|
case 25:
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
_context.t5 = _context.sent;
|
|
96
|
+
_context.next = 29;
|
|
97
|
+
break;
|
|
98
|
+
case 28:
|
|
99
|
+
_context.t5 = raw;
|
|
100
|
+
case 29:
|
|
101
|
+
_data = _context.t5;
|
|
97
102
|
return _context.abrupt("return", TypedNextResponse.json(_data, {
|
|
98
103
|
status: 200
|
|
99
104
|
}));
|
|
100
|
-
case 29:
|
|
101
|
-
_context.prev = 29;
|
|
102
|
-
_context.t5 = _context["catch"](0);
|
|
103
|
-
_context.next = 33;
|
|
104
|
-
return onError === null || onError === void 0 ? void 0 : onError(_context.t5);
|
|
105
105
|
case 33:
|
|
106
|
+
_context.prev = 33;
|
|
107
|
+
_context.t6 = _context["catch"](0);
|
|
108
|
+
_context.next = 37;
|
|
109
|
+
return onError === null || onError === void 0 ? void 0 : onError(_context.t6);
|
|
110
|
+
case 37:
|
|
106
111
|
response = _context.sent;
|
|
107
112
|
if (!response) {
|
|
108
|
-
_context.next =
|
|
113
|
+
_context.next = 42;
|
|
109
114
|
break;
|
|
110
115
|
}
|
|
111
116
|
return _context.abrupt("return", response);
|
|
112
|
-
case
|
|
113
|
-
throw _context.
|
|
114
|
-
case
|
|
117
|
+
case 42:
|
|
118
|
+
throw _context.t6;
|
|
119
|
+
case 43:
|
|
115
120
|
case "end":
|
|
116
121
|
return _context.stop();
|
|
117
122
|
}
|
|
118
|
-
}, _callee, null, [[0,
|
|
123
|
+
}, _callee, null, [[0, 33]]);
|
|
119
124
|
}));
|
|
120
125
|
return function (_x) {
|
|
121
126
|
return _ref3.apply(this, arguments);
|