@gustavo-valsechi/node 1.0.31 → 1.0.33

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/dist/index.d.mts CHANGED
@@ -6,3 +6,5 @@ export { IMiddlewareContract, TenantService } from './src/services/index.mjs';
6
6
  import 'typeorm';
7
7
  import 'fastify';
8
8
  import 'http';
9
+ import './src/schemas/index.mjs';
10
+ import 'zod';
package/dist/index.d.ts CHANGED
@@ -6,3 +6,5 @@ export { IMiddlewareContract, TenantService } from './src/services/index.js';
6
6
  import 'typeorm';
7
7
  import 'fastify';
8
8
  import 'http';
9
+ import './src/schemas/index.js';
10
+ import 'zod';
package/dist/index.js CHANGED
@@ -93,8 +93,7 @@ var responseWrapper = async (res, promise) => {
93
93
  const status = error.statusCode || 500;
94
94
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
95
95
  if (error instanceof import_zod.ZodError) {
96
- console.log(response);
97
- response = import_lodash.default.transform(response, (acc, item) => {
96
+ response = import_lodash.default.transform(JSON.parse(response || "[]"), (acc, item) => {
98
97
  var _a2;
99
98
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
100
99
  }, {});
@@ -149,6 +148,7 @@ var converter = (operator) => {
149
148
  return convertion;
150
149
  };
151
150
  var refactorWhere = (where) => {
151
+ if (!where) return where;
152
152
  for (const key in where) {
153
153
  let includeOp = existsOperator(where[key]);
154
154
  if (includeOp) {
@@ -181,26 +181,33 @@ var refactorWhere = (where) => {
181
181
  return where;
182
182
  };
183
183
 
184
- // src/tools/paginate.ts
184
+ // src/schemas/options.ts
185
+ var import_zod2 = require("zod");
185
186
  var import_lodash3 = __toESM(require("lodash"));
186
187
  var parse = (json) => {
187
188
  if (!json) return;
188
189
  if (import_lodash3.default.isString(json)) return JSON.parse(json);
189
190
  return json;
190
191
  };
192
+ var OptionsSchema = import_zod2.z.object({
193
+ take: import_zod2.z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
194
+ page: import_zod2.z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
195
+ select: import_zod2.z.array(import_zod2.z.string()).optional(),
196
+ relations: import_zod2.z.array(import_zod2.z.string()).optional(),
197
+ where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
198
+ order: import_zod2.z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
199
+ });
200
+
201
+ // src/tools/paginate.ts
191
202
  var paginate = async (repository, options) => {
192
- let where = parse(options.filters);
193
- if (where) where = refactorWhere(where);
203
+ var _a;
204
+ const params = await OptionsSchema.parseAsync(options);
194
205
  const [data, count] = await repository.findAndCount({
195
- select: options.fields,
196
- relations: options.relations,
197
- where,
198
- order: parse(options.order),
199
- take: options.limit,
200
- skip: Number(options.page) * (Number(options.limit) || 0) || 0
206
+ skip: Number(params.page) * (Number(params.take) || 0) || 0,
207
+ ...params
201
208
  });
202
209
  return {
203
- totalPage: Math.ceil(count / options.limit),
210
+ totalPage: options.take ? Math.ceil(count / options.take) : (_a = options.take) != null ? _a : 1,
204
211
  total: count,
205
212
  content: data
206
213
  };
package/dist/index.mjs CHANGED
@@ -52,8 +52,7 @@ var responseWrapper = async (res, promise) => {
52
52
  const status = error.statusCode || 500;
53
53
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
54
54
  if (error instanceof ZodError) {
55
- console.log(response);
56
- response = _.transform(response, (acc, item) => {
55
+ response = _.transform(JSON.parse(response || "[]"), (acc, item) => {
57
56
  var _a2;
58
57
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
59
58
  }, {});
@@ -119,6 +118,7 @@ var converter = (operator) => {
119
118
  return convertion;
120
119
  };
121
120
  var refactorWhere = (where) => {
121
+ if (!where) return where;
122
122
  for (const key in where) {
123
123
  let includeOp = existsOperator(where[key]);
124
124
  if (includeOp) {
@@ -151,26 +151,33 @@ var refactorWhere = (where) => {
151
151
  return where;
152
152
  };
153
153
 
154
- // src/tools/paginate.ts
154
+ // src/schemas/options.ts
155
+ import { z } from "zod";
155
156
  import _3 from "lodash";
156
157
  var parse = (json) => {
157
158
  if (!json) return;
158
159
  if (_3.isString(json)) return JSON.parse(json);
159
160
  return json;
160
161
  };
162
+ var OptionsSchema = z.object({
163
+ take: z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
164
+ page: z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
165
+ select: z.array(z.string()).optional(),
166
+ relations: z.array(z.string()).optional(),
167
+ where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
168
+ order: z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
169
+ });
170
+
171
+ // src/tools/paginate.ts
161
172
  var paginate = async (repository, options) => {
162
- let where = parse(options.filters);
163
- if (where) where = refactorWhere(where);
173
+ var _a;
174
+ const params = await OptionsSchema.parseAsync(options);
164
175
  const [data, count] = await repository.findAndCount({
165
- select: options.fields,
166
- relations: options.relations,
167
- where,
168
- order: parse(options.order),
169
- take: options.limit,
170
- skip: Number(options.page) * (Number(options.limit) || 0) || 0
176
+ skip: Number(params.page) * (Number(params.take) || 0) || 0,
177
+ ...params
171
178
  });
172
179
  return {
173
- totalPage: Math.ceil(count / options.limit),
180
+ totalPage: options.take ? Math.ceil(count / options.take) : (_a = options.take) != null ? _a : 1,
174
181
  total: count,
175
182
  content: data
176
183
  };
@@ -47,8 +47,7 @@ var responseWrapper = async (res, promise) => {
47
47
  const status = error.statusCode || 500;
48
48
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
49
49
  if (error instanceof import_zod.ZodError) {
50
- console.log(response);
51
- response = import_lodash.default.transform(response, (acc, item) => {
50
+ response = import_lodash.default.transform(JSON.parse(response || "[]"), (acc, item) => {
52
51
  var _a2;
53
52
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
54
53
  }, {});
@@ -61,9 +60,97 @@ var responseWrapper = async (res, promise) => {
61
60
  // src/tools/operators.ts
62
61
  var import_typeorm = require("typeorm");
63
62
  var import_lodash2 = __toESM(require("lodash"));
63
+ var OPERATORS = {
64
+ $in: (value) => (0, import_typeorm.In)(value),
65
+ $and: (value) => (0, import_typeorm.And)(value),
66
+ $notIn: (value) => (0, import_typeorm.Not)((0, import_typeorm.In)(value)),
67
+ $like: (value) => (0, import_typeorm.Like)(value),
68
+ $notLike: (value) => (0, import_typeorm.Not)((0, import_typeorm.Like)(value)),
69
+ $gt: (value) => (0, import_typeorm.MoreThan)(value),
70
+ $gte: (value) => (0, import_typeorm.MoreThanOrEqual)(value),
71
+ $lt: (value) => (0, import_typeorm.LessThan)(value),
72
+ $lte: (value) => (0, import_typeorm.LessThanOrEqual)(value),
73
+ $between: ([from, to]) => (0, import_typeorm.Between)(from, to),
74
+ $not: (value) => (0, import_typeorm.Not)(value),
75
+ $ne: (value) => (0, import_typeorm.Not)(value),
76
+ $raw: (value) => (0, import_typeorm.Raw)((alias) => import_lodash2.default.replace(value, "ALIAS", alias))
77
+ };
78
+ var existsOperator = (value) => {
79
+ let includeOp = false;
80
+ for (const op in OPERATORS) {
81
+ if (includeOp) continue;
82
+ includeOp = import_lodash2.default.includes(JSON.stringify(value), op);
83
+ }
84
+ return includeOp;
85
+ };
86
+ var converter = (operator) => {
87
+ operator = import_lodash2.default.isObject(operator) ? operator : JSON.parse(operator || "{}");
88
+ let convertion = operator;
89
+ for (const op in OPERATORS) {
90
+ if (!operator[op] && operator[op] !== 0) continue;
91
+ if (import_lodash2.default.isObject(operator[op]) && import_lodash2.default.isArray(operator[op])) {
92
+ import_lodash2.default.forEach(operator[op], (condition, index) => {
93
+ if (!existsOperator(condition)) return;
94
+ for (const opSecondary in OPERATORS) {
95
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
96
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
97
+ }
98
+ });
99
+ }
100
+ convertion = OPERATORS[op](operator[op]);
101
+ }
102
+ return convertion;
103
+ };
104
+ var refactorWhere = (where) => {
105
+ if (!where) return where;
106
+ for (const key in where) {
107
+ let includeOp = existsOperator(where[key]);
108
+ if (includeOp) {
109
+ where[key] = converter(where[key]);
110
+ if (import_lodash2.default.isObject(where[key]) && !import_lodash2.default.isArray(where[key])) {
111
+ for (const keyObject in where[key]) {
112
+ includeOp = existsOperator(where[key][keyObject]);
113
+ if (!includeOp) continue;
114
+ where[key][keyObject] = converter(where[key][keyObject]);
115
+ }
116
+ }
117
+ if (import_lodash2.default.isObject(where[key]) && import_lodash2.default.isArray(where[key])) {
118
+ import_lodash2.default.forEach(where[key], (condition, index) => {
119
+ includeOp = existsOperator(condition);
120
+ if (includeOp) {
121
+ condition = converter(condition);
122
+ if (import_lodash2.default.isObject(condition) && !import_lodash2.default.isArray(condition)) {
123
+ for (const keyObject in condition) {
124
+ includeOp = existsOperator(condition[keyObject]);
125
+ if (!includeOp) continue;
126
+ condition[keyObject] = converter(condition[keyObject]);
127
+ }
128
+ }
129
+ }
130
+ where[key][index] = condition;
131
+ });
132
+ }
133
+ }
134
+ }
135
+ return where;
136
+ };
64
137
 
65
- // src/tools/paginate.ts
138
+ // src/schemas/options.ts
139
+ var import_zod2 = require("zod");
66
140
  var import_lodash3 = __toESM(require("lodash"));
141
+ var parse = (json) => {
142
+ if (!json) return;
143
+ if (import_lodash3.default.isString(json)) return JSON.parse(json);
144
+ return json;
145
+ };
146
+ var OptionsSchema = import_zod2.z.object({
147
+ take: import_zod2.z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
148
+ page: import_zod2.z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
149
+ select: import_zod2.z.array(import_zod2.z.string()).optional(),
150
+ relations: import_zod2.z.array(import_zod2.z.string()).optional(),
151
+ where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
152
+ order: import_zod2.z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
153
+ });
67
154
 
68
155
  // src/router/health.ts
69
156
  var healthRouter = (router, options, done) => {
@@ -10,8 +10,7 @@ var responseWrapper = async (res, promise) => {
10
10
  const status = error.statusCode || 500;
11
11
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
12
12
  if (error instanceof ZodError) {
13
- console.log(response);
14
- response = _.transform(response, (acc, item) => {
13
+ response = _.transform(JSON.parse(response || "[]"), (acc, item) => {
15
14
  var _a2;
16
15
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
17
16
  }, {});
@@ -35,9 +34,97 @@ import {
35
34
  LessThanOrEqual
36
35
  } from "typeorm";
37
36
  import _2 from "lodash";
37
+ var OPERATORS = {
38
+ $in: (value) => In(value),
39
+ $and: (value) => And(value),
40
+ $notIn: (value) => Not(In(value)),
41
+ $like: (value) => Like(value),
42
+ $notLike: (value) => Not(Like(value)),
43
+ $gt: (value) => MoreThan(value),
44
+ $gte: (value) => MoreThanOrEqual(value),
45
+ $lt: (value) => LessThan(value),
46
+ $lte: (value) => LessThanOrEqual(value),
47
+ $between: ([from, to]) => Between(from, to),
48
+ $not: (value) => Not(value),
49
+ $ne: (value) => Not(value),
50
+ $raw: (value) => Raw((alias) => _2.replace(value, "ALIAS", alias))
51
+ };
52
+ var existsOperator = (value) => {
53
+ let includeOp = false;
54
+ for (const op in OPERATORS) {
55
+ if (includeOp) continue;
56
+ includeOp = _2.includes(JSON.stringify(value), op);
57
+ }
58
+ return includeOp;
59
+ };
60
+ var converter = (operator) => {
61
+ operator = _2.isObject(operator) ? operator : JSON.parse(operator || "{}");
62
+ let convertion = operator;
63
+ for (const op in OPERATORS) {
64
+ if (!operator[op] && operator[op] !== 0) continue;
65
+ if (_2.isObject(operator[op]) && _2.isArray(operator[op])) {
66
+ _2.forEach(operator[op], (condition, index) => {
67
+ if (!existsOperator(condition)) return;
68
+ for (const opSecondary in OPERATORS) {
69
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
70
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
71
+ }
72
+ });
73
+ }
74
+ convertion = OPERATORS[op](operator[op]);
75
+ }
76
+ return convertion;
77
+ };
78
+ var refactorWhere = (where) => {
79
+ if (!where) return where;
80
+ for (const key in where) {
81
+ let includeOp = existsOperator(where[key]);
82
+ if (includeOp) {
83
+ where[key] = converter(where[key]);
84
+ if (_2.isObject(where[key]) && !_2.isArray(where[key])) {
85
+ for (const keyObject in where[key]) {
86
+ includeOp = existsOperator(where[key][keyObject]);
87
+ if (!includeOp) continue;
88
+ where[key][keyObject] = converter(where[key][keyObject]);
89
+ }
90
+ }
91
+ if (_2.isObject(where[key]) && _2.isArray(where[key])) {
92
+ _2.forEach(where[key], (condition, index) => {
93
+ includeOp = existsOperator(condition);
94
+ if (includeOp) {
95
+ condition = converter(condition);
96
+ if (_2.isObject(condition) && !_2.isArray(condition)) {
97
+ for (const keyObject in condition) {
98
+ includeOp = existsOperator(condition[keyObject]);
99
+ if (!includeOp) continue;
100
+ condition[keyObject] = converter(condition[keyObject]);
101
+ }
102
+ }
103
+ }
104
+ where[key][index] = condition;
105
+ });
106
+ }
107
+ }
108
+ }
109
+ return where;
110
+ };
38
111
 
39
- // src/tools/paginate.ts
112
+ // src/schemas/options.ts
113
+ import { z } from "zod";
40
114
  import _3 from "lodash";
115
+ var parse = (json) => {
116
+ if (!json) return;
117
+ if (_3.isString(json)) return JSON.parse(json);
118
+ return json;
119
+ };
120
+ var OptionsSchema = z.object({
121
+ take: z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
122
+ page: z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
123
+ select: z.array(z.string()).optional(),
124
+ relations: z.array(z.string()).optional(),
125
+ where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
126
+ order: z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
127
+ });
41
128
 
42
129
  // src/router/health.ts
43
130
  var healthRouter = (router, options, done) => {
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const OptionsSchema: z.ZodObject<{
4
+ take: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number | undefined, string>>;
5
+ page: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
6
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ relations: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ where: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<any, any>>>;
9
+ order: z.ZodPipe<z.ZodDefault<z.ZodAny>, z.ZodTransform<any, any>>;
10
+ }, z.core.$strip>;
11
+
12
+ export { OptionsSchema };
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const OptionsSchema: z.ZodObject<{
4
+ take: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number | undefined, string>>;
5
+ page: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
6
+ select: z.ZodOptional<z.ZodArray<z.ZodString>>;
7
+ relations: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ where: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<any, any>>>;
9
+ order: z.ZodPipe<z.ZodDefault<z.ZodAny>, z.ZodTransform<any, any>>;
10
+ }, z.core.$strip>;
11
+
12
+ export { OptionsSchema };
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/schemas/index.ts
31
+ var schemas_exports = {};
32
+ __export(schemas_exports, {
33
+ OptionsSchema: () => OptionsSchema
34
+ });
35
+ module.exports = __toCommonJS(schemas_exports);
36
+
37
+ // src/tools/operators.ts
38
+ var import_typeorm = require("typeorm");
39
+ var import_lodash = __toESM(require("lodash"));
40
+ var OPERATORS = {
41
+ $in: (value) => (0, import_typeorm.In)(value),
42
+ $and: (value) => (0, import_typeorm.And)(value),
43
+ $notIn: (value) => (0, import_typeorm.Not)((0, import_typeorm.In)(value)),
44
+ $like: (value) => (0, import_typeorm.Like)(value),
45
+ $notLike: (value) => (0, import_typeorm.Not)((0, import_typeorm.Like)(value)),
46
+ $gt: (value) => (0, import_typeorm.MoreThan)(value),
47
+ $gte: (value) => (0, import_typeorm.MoreThanOrEqual)(value),
48
+ $lt: (value) => (0, import_typeorm.LessThan)(value),
49
+ $lte: (value) => (0, import_typeorm.LessThanOrEqual)(value),
50
+ $between: ([from, to]) => (0, import_typeorm.Between)(from, to),
51
+ $not: (value) => (0, import_typeorm.Not)(value),
52
+ $ne: (value) => (0, import_typeorm.Not)(value),
53
+ $raw: (value) => (0, import_typeorm.Raw)((alias) => import_lodash.default.replace(value, "ALIAS", alias))
54
+ };
55
+ var existsOperator = (value) => {
56
+ let includeOp = false;
57
+ for (const op in OPERATORS) {
58
+ if (includeOp) continue;
59
+ includeOp = import_lodash.default.includes(JSON.stringify(value), op);
60
+ }
61
+ return includeOp;
62
+ };
63
+ var converter = (operator) => {
64
+ operator = import_lodash.default.isObject(operator) ? operator : JSON.parse(operator || "{}");
65
+ let convertion = operator;
66
+ for (const op in OPERATORS) {
67
+ if (!operator[op] && operator[op] !== 0) continue;
68
+ if (import_lodash.default.isObject(operator[op]) && import_lodash.default.isArray(operator[op])) {
69
+ import_lodash.default.forEach(operator[op], (condition, index) => {
70
+ if (!existsOperator(condition)) return;
71
+ for (const opSecondary in OPERATORS) {
72
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
73
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
74
+ }
75
+ });
76
+ }
77
+ convertion = OPERATORS[op](operator[op]);
78
+ }
79
+ return convertion;
80
+ };
81
+ var refactorWhere = (where) => {
82
+ if (!where) return where;
83
+ for (const key in where) {
84
+ let includeOp = existsOperator(where[key]);
85
+ if (includeOp) {
86
+ where[key] = converter(where[key]);
87
+ if (import_lodash.default.isObject(where[key]) && !import_lodash.default.isArray(where[key])) {
88
+ for (const keyObject in where[key]) {
89
+ includeOp = existsOperator(where[key][keyObject]);
90
+ if (!includeOp) continue;
91
+ where[key][keyObject] = converter(where[key][keyObject]);
92
+ }
93
+ }
94
+ if (import_lodash.default.isObject(where[key]) && import_lodash.default.isArray(where[key])) {
95
+ import_lodash.default.forEach(where[key], (condition, index) => {
96
+ includeOp = existsOperator(condition);
97
+ if (includeOp) {
98
+ condition = converter(condition);
99
+ if (import_lodash.default.isObject(condition) && !import_lodash.default.isArray(condition)) {
100
+ for (const keyObject in condition) {
101
+ includeOp = existsOperator(condition[keyObject]);
102
+ if (!includeOp) continue;
103
+ condition[keyObject] = converter(condition[keyObject]);
104
+ }
105
+ }
106
+ }
107
+ where[key][index] = condition;
108
+ });
109
+ }
110
+ }
111
+ }
112
+ return where;
113
+ };
114
+
115
+ // src/schemas/options.ts
116
+ var import_zod = require("zod");
117
+ var import_lodash2 = __toESM(require("lodash"));
118
+ var parse = (json) => {
119
+ if (!json) return;
120
+ if (import_lodash2.default.isString(json)) return JSON.parse(json);
121
+ return json;
122
+ };
123
+ var OptionsSchema = import_zod.z.object({
124
+ take: import_zod.z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
125
+ page: import_zod.z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
126
+ select: import_zod.z.array(import_zod.z.string()).optional(),
127
+ relations: import_zod.z.array(import_zod.z.string()).optional(),
128
+ where: import_zod.z.any().transform((value) => refactorWhere(parse(value))).optional(),
129
+ order: import_zod.z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
130
+ });
131
+ // Annotate the CommonJS export names for ESM import in node:
132
+ 0 && (module.exports = {
133
+ OptionsSchema
134
+ });
@@ -0,0 +1,108 @@
1
+ // src/tools/operators.ts
2
+ import {
3
+ Like,
4
+ MoreThan,
5
+ MoreThanOrEqual,
6
+ In,
7
+ Not,
8
+ LessThan,
9
+ Between,
10
+ Raw,
11
+ And,
12
+ LessThanOrEqual
13
+ } from "typeorm";
14
+ import _ from "lodash";
15
+ var OPERATORS = {
16
+ $in: (value) => In(value),
17
+ $and: (value) => And(value),
18
+ $notIn: (value) => Not(In(value)),
19
+ $like: (value) => Like(value),
20
+ $notLike: (value) => Not(Like(value)),
21
+ $gt: (value) => MoreThan(value),
22
+ $gte: (value) => MoreThanOrEqual(value),
23
+ $lt: (value) => LessThan(value),
24
+ $lte: (value) => LessThanOrEqual(value),
25
+ $between: ([from, to]) => Between(from, to),
26
+ $not: (value) => Not(value),
27
+ $ne: (value) => Not(value),
28
+ $raw: (value) => Raw((alias) => _.replace(value, "ALIAS", alias))
29
+ };
30
+ var existsOperator = (value) => {
31
+ let includeOp = false;
32
+ for (const op in OPERATORS) {
33
+ if (includeOp) continue;
34
+ includeOp = _.includes(JSON.stringify(value), op);
35
+ }
36
+ return includeOp;
37
+ };
38
+ var converter = (operator) => {
39
+ operator = _.isObject(operator) ? operator : JSON.parse(operator || "{}");
40
+ let convertion = operator;
41
+ for (const op in OPERATORS) {
42
+ if (!operator[op] && operator[op] !== 0) continue;
43
+ if (_.isObject(operator[op]) && _.isArray(operator[op])) {
44
+ _.forEach(operator[op], (condition, index) => {
45
+ if (!existsOperator(condition)) return;
46
+ for (const opSecondary in OPERATORS) {
47
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
48
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
49
+ }
50
+ });
51
+ }
52
+ convertion = OPERATORS[op](operator[op]);
53
+ }
54
+ return convertion;
55
+ };
56
+ var refactorWhere = (where) => {
57
+ if (!where) return where;
58
+ for (const key in where) {
59
+ let includeOp = existsOperator(where[key]);
60
+ if (includeOp) {
61
+ where[key] = converter(where[key]);
62
+ if (_.isObject(where[key]) && !_.isArray(where[key])) {
63
+ for (const keyObject in where[key]) {
64
+ includeOp = existsOperator(where[key][keyObject]);
65
+ if (!includeOp) continue;
66
+ where[key][keyObject] = converter(where[key][keyObject]);
67
+ }
68
+ }
69
+ if (_.isObject(where[key]) && _.isArray(where[key])) {
70
+ _.forEach(where[key], (condition, index) => {
71
+ includeOp = existsOperator(condition);
72
+ if (includeOp) {
73
+ condition = converter(condition);
74
+ if (_.isObject(condition) && !_.isArray(condition)) {
75
+ for (const keyObject in condition) {
76
+ includeOp = existsOperator(condition[keyObject]);
77
+ if (!includeOp) continue;
78
+ condition[keyObject] = converter(condition[keyObject]);
79
+ }
80
+ }
81
+ }
82
+ where[key][index] = condition;
83
+ });
84
+ }
85
+ }
86
+ }
87
+ return where;
88
+ };
89
+
90
+ // src/schemas/options.ts
91
+ import { z } from "zod";
92
+ import _2 from "lodash";
93
+ var parse = (json) => {
94
+ if (!json) return;
95
+ if (_2.isString(json)) return JSON.parse(json);
96
+ return json;
97
+ };
98
+ var OptionsSchema = z.object({
99
+ take: z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
100
+ page: z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
101
+ select: z.array(z.string()).optional(),
102
+ relations: z.array(z.string()).optional(),
103
+ where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
104
+ order: z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
105
+ });
106
+ export {
107
+ OptionsSchema
108
+ };
@@ -48,8 +48,7 @@ var responseWrapper = async (res, promise) => {
48
48
  const status = error.statusCode || 500;
49
49
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
50
50
  if (error instanceof import_zod.ZodError) {
51
- console.log(response);
52
- response = import_lodash.default.transform(response, (acc, item) => {
51
+ response = import_lodash.default.transform(JSON.parse(response || "[]"), (acc, item) => {
53
52
  var _a2;
54
53
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
55
54
  }, {});
@@ -62,9 +61,97 @@ var responseWrapper = async (res, promise) => {
62
61
  // src/tools/operators.ts
63
62
  var import_typeorm = require("typeorm");
64
63
  var import_lodash2 = __toESM(require("lodash"));
64
+ var OPERATORS = {
65
+ $in: (value) => (0, import_typeorm.In)(value),
66
+ $and: (value) => (0, import_typeorm.And)(value),
67
+ $notIn: (value) => (0, import_typeorm.Not)((0, import_typeorm.In)(value)),
68
+ $like: (value) => (0, import_typeorm.Like)(value),
69
+ $notLike: (value) => (0, import_typeorm.Not)((0, import_typeorm.Like)(value)),
70
+ $gt: (value) => (0, import_typeorm.MoreThan)(value),
71
+ $gte: (value) => (0, import_typeorm.MoreThanOrEqual)(value),
72
+ $lt: (value) => (0, import_typeorm.LessThan)(value),
73
+ $lte: (value) => (0, import_typeorm.LessThanOrEqual)(value),
74
+ $between: ([from, to]) => (0, import_typeorm.Between)(from, to),
75
+ $not: (value) => (0, import_typeorm.Not)(value),
76
+ $ne: (value) => (0, import_typeorm.Not)(value),
77
+ $raw: (value) => (0, import_typeorm.Raw)((alias) => import_lodash2.default.replace(value, "ALIAS", alias))
78
+ };
79
+ var existsOperator = (value) => {
80
+ let includeOp = false;
81
+ for (const op in OPERATORS) {
82
+ if (includeOp) continue;
83
+ includeOp = import_lodash2.default.includes(JSON.stringify(value), op);
84
+ }
85
+ return includeOp;
86
+ };
87
+ var converter = (operator) => {
88
+ operator = import_lodash2.default.isObject(operator) ? operator : JSON.parse(operator || "{}");
89
+ let convertion = operator;
90
+ for (const op in OPERATORS) {
91
+ if (!operator[op] && operator[op] !== 0) continue;
92
+ if (import_lodash2.default.isObject(operator[op]) && import_lodash2.default.isArray(operator[op])) {
93
+ import_lodash2.default.forEach(operator[op], (condition, index) => {
94
+ if (!existsOperator(condition)) return;
95
+ for (const opSecondary in OPERATORS) {
96
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
97
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
98
+ }
99
+ });
100
+ }
101
+ convertion = OPERATORS[op](operator[op]);
102
+ }
103
+ return convertion;
104
+ };
105
+ var refactorWhere = (where) => {
106
+ if (!where) return where;
107
+ for (const key in where) {
108
+ let includeOp = existsOperator(where[key]);
109
+ if (includeOp) {
110
+ where[key] = converter(where[key]);
111
+ if (import_lodash2.default.isObject(where[key]) && !import_lodash2.default.isArray(where[key])) {
112
+ for (const keyObject in where[key]) {
113
+ includeOp = existsOperator(where[key][keyObject]);
114
+ if (!includeOp) continue;
115
+ where[key][keyObject] = converter(where[key][keyObject]);
116
+ }
117
+ }
118
+ if (import_lodash2.default.isObject(where[key]) && import_lodash2.default.isArray(where[key])) {
119
+ import_lodash2.default.forEach(where[key], (condition, index) => {
120
+ includeOp = existsOperator(condition);
121
+ if (includeOp) {
122
+ condition = converter(condition);
123
+ if (import_lodash2.default.isObject(condition) && !import_lodash2.default.isArray(condition)) {
124
+ for (const keyObject in condition) {
125
+ includeOp = existsOperator(condition[keyObject]);
126
+ if (!includeOp) continue;
127
+ condition[keyObject] = converter(condition[keyObject]);
128
+ }
129
+ }
130
+ }
131
+ where[key][index] = condition;
132
+ });
133
+ }
134
+ }
135
+ }
136
+ return where;
137
+ };
65
138
 
66
- // src/tools/paginate.ts
139
+ // src/schemas/options.ts
140
+ var import_zod2 = require("zod");
67
141
  var import_lodash3 = __toESM(require("lodash"));
142
+ var parse = (json) => {
143
+ if (!json) return;
144
+ if (import_lodash3.default.isString(json)) return JSON.parse(json);
145
+ return json;
146
+ };
147
+ var OptionsSchema = import_zod2.z.object({
148
+ take: import_zod2.z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
149
+ page: import_zod2.z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
150
+ select: import_zod2.z.array(import_zod2.z.string()).optional(),
151
+ relations: import_zod2.z.array(import_zod2.z.string()).optional(),
152
+ where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
153
+ order: import_zod2.z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
154
+ });
68
155
 
69
156
  // src/router/health.ts
70
157
  var healthRouter = (router, options, done) => {
@@ -13,8 +13,7 @@ var responseWrapper = async (res, promise) => {
13
13
  const status = error.statusCode || 500;
14
14
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
15
15
  if (error instanceof ZodError) {
16
- console.log(response);
17
- response = _.transform(response, (acc, item) => {
16
+ response = _.transform(JSON.parse(response || "[]"), (acc, item) => {
18
17
  var _a2;
19
18
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
20
19
  }, {});
@@ -38,9 +37,97 @@ import {
38
37
  LessThanOrEqual
39
38
  } from "typeorm";
40
39
  import _2 from "lodash";
40
+ var OPERATORS = {
41
+ $in: (value) => In(value),
42
+ $and: (value) => And(value),
43
+ $notIn: (value) => Not(In(value)),
44
+ $like: (value) => Like(value),
45
+ $notLike: (value) => Not(Like(value)),
46
+ $gt: (value) => MoreThan(value),
47
+ $gte: (value) => MoreThanOrEqual(value),
48
+ $lt: (value) => LessThan(value),
49
+ $lte: (value) => LessThanOrEqual(value),
50
+ $between: ([from, to]) => Between(from, to),
51
+ $not: (value) => Not(value),
52
+ $ne: (value) => Not(value),
53
+ $raw: (value) => Raw((alias) => _2.replace(value, "ALIAS", alias))
54
+ };
55
+ var existsOperator = (value) => {
56
+ let includeOp = false;
57
+ for (const op in OPERATORS) {
58
+ if (includeOp) continue;
59
+ includeOp = _2.includes(JSON.stringify(value), op);
60
+ }
61
+ return includeOp;
62
+ };
63
+ var converter = (operator) => {
64
+ operator = _2.isObject(operator) ? operator : JSON.parse(operator || "{}");
65
+ let convertion = operator;
66
+ for (const op in OPERATORS) {
67
+ if (!operator[op] && operator[op] !== 0) continue;
68
+ if (_2.isObject(operator[op]) && _2.isArray(operator[op])) {
69
+ _2.forEach(operator[op], (condition, index) => {
70
+ if (!existsOperator(condition)) return;
71
+ for (const opSecondary in OPERATORS) {
72
+ if (!condition[opSecondary] && condition[opSecondary] !== 0) continue;
73
+ operator[op][index] = OPERATORS[opSecondary](condition[opSecondary]);
74
+ }
75
+ });
76
+ }
77
+ convertion = OPERATORS[op](operator[op]);
78
+ }
79
+ return convertion;
80
+ };
81
+ var refactorWhere = (where) => {
82
+ if (!where) return where;
83
+ for (const key in where) {
84
+ let includeOp = existsOperator(where[key]);
85
+ if (includeOp) {
86
+ where[key] = converter(where[key]);
87
+ if (_2.isObject(where[key]) && !_2.isArray(where[key])) {
88
+ for (const keyObject in where[key]) {
89
+ includeOp = existsOperator(where[key][keyObject]);
90
+ if (!includeOp) continue;
91
+ where[key][keyObject] = converter(where[key][keyObject]);
92
+ }
93
+ }
94
+ if (_2.isObject(where[key]) && _2.isArray(where[key])) {
95
+ _2.forEach(where[key], (condition, index) => {
96
+ includeOp = existsOperator(condition);
97
+ if (includeOp) {
98
+ condition = converter(condition);
99
+ if (_2.isObject(condition) && !_2.isArray(condition)) {
100
+ for (const keyObject in condition) {
101
+ includeOp = existsOperator(condition[keyObject]);
102
+ if (!includeOp) continue;
103
+ condition[keyObject] = converter(condition[keyObject]);
104
+ }
105
+ }
106
+ }
107
+ where[key][index] = condition;
108
+ });
109
+ }
110
+ }
111
+ }
112
+ return where;
113
+ };
41
114
 
42
- // src/tools/paginate.ts
115
+ // src/schemas/options.ts
116
+ import { z } from "zod";
43
117
  import _3 from "lodash";
118
+ var parse = (json) => {
119
+ if (!json) return;
120
+ if (_3.isString(json)) return JSON.parse(json);
121
+ return json;
122
+ };
123
+ var OptionsSchema = z.object({
124
+ take: z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
125
+ page: z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
126
+ select: z.array(z.string()).optional(),
127
+ relations: z.array(z.string()).optional(),
128
+ where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
129
+ order: z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
130
+ });
44
131
 
45
132
  // src/router/health.ts
46
133
  var healthRouter = (router, options, done) => {
@@ -1,4 +1,6 @@
1
1
  import { FastifyReply } from 'fastify';
2
+ import { OptionsSchema } from '../schemas/index.mjs';
3
+ import { z } from 'zod';
2
4
 
3
5
  declare const responseWrapper: (res: FastifyReply, promise: Promise<any>) => Promise<void>;
4
6
 
@@ -7,18 +9,7 @@ declare const existsOperator: (value: any) => boolean;
7
9
  declare const converter: (operator: any) => any;
8
10
  declare const refactorWhere: (where: any) => any;
9
11
 
10
- declare const paginate: (repository: any, options: {
11
- fields: Array<string>;
12
- relations: Array<string>;
13
- filters: string | {
14
- [field: string]: any;
15
- };
16
- order: string | {
17
- [field: string]: "asc" | "desc";
18
- };
19
- limit: number;
20
- page: number;
21
- }) => Promise<{
12
+ declare const paginate: (repository: any, options: z.infer<typeof OptionsSchema>) => Promise<{
22
13
  totalPage: number;
23
14
  total: any;
24
15
  content: any;
@@ -1,4 +1,6 @@
1
1
  import { FastifyReply } from 'fastify';
2
+ import { OptionsSchema } from '../schemas/index.js';
3
+ import { z } from 'zod';
2
4
 
3
5
  declare const responseWrapper: (res: FastifyReply, promise: Promise<any>) => Promise<void>;
4
6
 
@@ -7,18 +9,7 @@ declare const existsOperator: (value: any) => boolean;
7
9
  declare const converter: (operator: any) => any;
8
10
  declare const refactorWhere: (where: any) => any;
9
11
 
10
- declare const paginate: (repository: any, options: {
11
- fields: Array<string>;
12
- relations: Array<string>;
13
- filters: string | {
14
- [field: string]: any;
15
- };
16
- order: string | {
17
- [field: string]: "asc" | "desc";
18
- };
19
- limit: number;
20
- page: number;
21
- }) => Promise<{
12
+ declare const paginate: (repository: any, options: z.infer<typeof OptionsSchema>) => Promise<{
22
13
  totalPage: number;
23
14
  total: any;
24
15
  content: any;
@@ -52,8 +52,7 @@ var responseWrapper = async (res, promise) => {
52
52
  const status = error.statusCode || 500;
53
53
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
54
54
  if (error instanceof import_zod.ZodError) {
55
- console.log(response);
56
- response = import_lodash.default.transform(response, (acc, item) => {
55
+ response = import_lodash.default.transform(JSON.parse(response || "[]"), (acc, item) => {
57
56
  var _a2;
58
57
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
59
58
  }, {});
@@ -108,6 +107,7 @@ var converter = (operator) => {
108
107
  return convertion;
109
108
  };
110
109
  var refactorWhere = (where) => {
110
+ if (!where) return where;
111
111
  for (const key in where) {
112
112
  let includeOp = existsOperator(where[key]);
113
113
  if (includeOp) {
@@ -140,26 +140,33 @@ var refactorWhere = (where) => {
140
140
  return where;
141
141
  };
142
142
 
143
- // src/tools/paginate.ts
143
+ // src/schemas/options.ts
144
+ var import_zod2 = require("zod");
144
145
  var import_lodash3 = __toESM(require("lodash"));
145
146
  var parse = (json) => {
146
147
  if (!json) return;
147
148
  if (import_lodash3.default.isString(json)) return JSON.parse(json);
148
149
  return json;
149
150
  };
151
+ var OptionsSchema = import_zod2.z.object({
152
+ take: import_zod2.z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
153
+ page: import_zod2.z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
154
+ select: import_zod2.z.array(import_zod2.z.string()).optional(),
155
+ relations: import_zod2.z.array(import_zod2.z.string()).optional(),
156
+ where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
157
+ order: import_zod2.z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
158
+ });
159
+
160
+ // src/tools/paginate.ts
150
161
  var paginate = async (repository, options) => {
151
- let where = parse(options.filters);
152
- if (where) where = refactorWhere(where);
162
+ var _a;
163
+ const params = await OptionsSchema.parseAsync(options);
153
164
  const [data, count] = await repository.findAndCount({
154
- select: options.fields,
155
- relations: options.relations,
156
- where,
157
- order: parse(options.order),
158
- take: options.limit,
159
- skip: Number(options.page) * (Number(options.limit) || 0) || 0
165
+ skip: Number(params.page) * (Number(params.take) || 0) || 0,
166
+ ...params
160
167
  });
161
168
  return {
162
- totalPage: Math.ceil(count / options.limit),
169
+ totalPage: options.take ? Math.ceil(count / options.take) : (_a = options.take) != null ? _a : 1,
163
170
  total: count,
164
171
  content: data
165
172
  };
@@ -17,8 +17,7 @@ var responseWrapper = async (res, promise) => {
17
17
  const status = error.statusCode || 500;
18
18
  let response = ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) || (error == null ? void 0 : error.message) || error;
19
19
  if (error instanceof ZodError) {
20
- console.log(response);
21
- response = _.transform(response, (acc, item) => {
20
+ response = _.transform(JSON.parse(response || "[]"), (acc, item) => {
22
21
  var _a2;
23
22
  acc[(_a2 = item == null ? void 0 : item.path) == null ? void 0 : _a2.join(",")] = (item == null ? void 0 : item.message) || "";
24
23
  }, {});
@@ -84,6 +83,7 @@ var converter = (operator) => {
84
83
  return convertion;
85
84
  };
86
85
  var refactorWhere = (where) => {
86
+ if (!where) return where;
87
87
  for (const key in where) {
88
88
  let includeOp = existsOperator(where[key]);
89
89
  if (includeOp) {
@@ -116,26 +116,33 @@ var refactorWhere = (where) => {
116
116
  return where;
117
117
  };
118
118
 
119
- // src/tools/paginate.ts
119
+ // src/schemas/options.ts
120
+ import { z } from "zod";
120
121
  import _3 from "lodash";
121
122
  var parse = (json) => {
122
123
  if (!json) return;
123
124
  if (_3.isString(json)) return JSON.parse(json);
124
125
  return json;
125
126
  };
127
+ var OptionsSchema = z.object({
128
+ take: z.string().default("20").transform((value) => Number(value) ? Number(value) : value === "infinity" ? void 0 : 20),
129
+ page: z.string().default("0").transform((value) => Number(value) ? Number(value) : 0),
130
+ select: z.array(z.string()).optional(),
131
+ relations: z.array(z.string()).optional(),
132
+ where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
133
+ order: z.any().default({ createdAt: "desc" }).transform((value) => parse(value))
134
+ });
135
+
136
+ // src/tools/paginate.ts
126
137
  var paginate = async (repository, options) => {
127
- let where = parse(options.filters);
128
- if (where) where = refactorWhere(where);
138
+ var _a;
139
+ const params = await OptionsSchema.parseAsync(options);
129
140
  const [data, count] = await repository.findAndCount({
130
- select: options.fields,
131
- relations: options.relations,
132
- where,
133
- order: parse(options.order),
134
- take: options.limit,
135
- skip: Number(options.page) * (Number(options.limit) || 0) || 0
141
+ skip: Number(params.page) * (Number(params.take) || 0) || 0,
142
+ ...params
136
143
  });
137
144
  return {
138
- totalPage: Math.ceil(count / options.limit),
145
+ totalPage: options.take ? Math.ceil(count / options.take) : (_a = options.take) != null ? _a : 1,
139
146
  total: count,
140
147
  content: data
141
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/node",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -67,6 +67,11 @@
67
67
  "require": "./dist/src/router/index.js",
68
68
  "import": "./dist/src/router/index.js"
69
69
  },
70
+ "./schemas": {
71
+ "types": "./dist/src/schemas/index.d.ts",
72
+ "require": "./dist/src/schemas/index.js",
73
+ "import": "./dist/src/schemas/index.js"
74
+ },
70
75
  "./server": {
71
76
  "types": "./dist/src/server/index.d.ts",
72
77
  "require": "./dist/src/server/index.js",