@drax/crud-back 0.50.0 → 1.0.0

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.
@@ -1,9 +1,8 @@
1
1
  import z from 'zod';
2
- import { zodToJsonSchema } from 'zod-to-json-schema';
3
2
  import { IdParamSchema, DeleteBodyResponseSchema, PaginateQuerySchema, PaginateBodyResponseSchema, FindQuerySchema, SearchQuerySchema, FindByParamSchema, ErrorBodyResponseSchema, ValidationErrorBodyResponseSchema, ExportBodyResponseSchema, GroupByQuerySchema } from '../index.js';
4
3
  export class CrudSchemaBuilder {
5
- constructor(entitySchema, entityCreateSchema, entityUpdateSchema, entityName, target = 'openApi3', tags = []) {
6
- this.target = 'openApi3'; //"jsonSchema7" | "jsonSchema2019-09" | "openApi3" | "openAi"
4
+ constructor(entitySchema, entityCreateSchema, entityUpdateSchema, entityName, target = 'openapi-3.0', tags = []) {
5
+ this.target = 'openapi-3.0'; //"jsonSchema7" | "jsonSchema2019-09" | "openapi-3.0" | "openAi"
7
6
  this.entitySchema = entitySchema;
8
7
  this.entityCreateSchema = entityCreateSchema;
9
8
  this.entityUpdateSchema = entityUpdateSchema;
@@ -18,56 +17,56 @@ export class CrudSchemaBuilder {
18
17
  return [];
19
18
  }
20
19
  get jsonEntityCreateSchema() {
21
- return zodToJsonSchema(this.entityCreateSchema, { target: this.target });
20
+ return z.toJSONSchema(this.entityCreateSchema, { target: this.target });
22
21
  }
23
22
  get jsonEntityUpdateSchema() {
24
- return zodToJsonSchema(this.entityUpdateSchema, { target: this.target });
23
+ return z.toJSONSchema(this.entityUpdateSchema, { target: this.target });
25
24
  }
26
25
  get jsonEntitySchema() {
27
- return zodToJsonSchema(this.entitySchema, { target: this.target });
26
+ return z.toJSONSchema(this.entitySchema, { target: this.target });
28
27
  }
29
28
  get jsonEntityArraySchema() {
30
- return zodToJsonSchema(z.array(this.entitySchema), { target: this.target });
29
+ return z.toJSONSchema(z.array(this.entitySchema), { target: this.target });
31
30
  }
32
31
  get jsonEntityGroupBySchema() {
33
- return zodToJsonSchema(z.array(z.object({
32
+ return z.toJSONSchema(z.array(z.object({
34
33
  count: z.number()
35
34
  }).catchall(z.any())), { target: this.target });
36
35
  }
37
36
  get jsonExportBodyResponse() {
38
- return zodToJsonSchema(ExportBodyResponseSchema, { target: this.target });
37
+ return z.toJSONSchema(ExportBodyResponseSchema, { target: this.target });
39
38
  }
40
39
  get jsonErrorBodyResponse() {
41
- return zodToJsonSchema(ErrorBodyResponseSchema, { target: this.target });
40
+ return z.toJSONSchema(ErrorBodyResponseSchema, { target: this.target });
42
41
  }
43
42
  get jsonValidationErrorBodyResponse() {
44
- return zodToJsonSchema(ValidationErrorBodyResponseSchema, { target: this.target });
43
+ return z.toJSONSchema(ValidationErrorBodyResponseSchema, { target: this.target });
45
44
  }
46
45
  get jsonFindQuerySchema() {
47
- return zodToJsonSchema(FindQuerySchema, { target: this.target });
46
+ return z.toJSONSchema(FindQuerySchema, { target: this.target });
48
47
  }
49
48
  get jsonGroupByQuerySchema() {
50
- return zodToJsonSchema(GroupByQuerySchema, { target: this.target });
49
+ return z.toJSONSchema(GroupByQuerySchema, { target: this.target });
51
50
  }
52
51
  get jsonSearchQuerySchema() {
53
- return zodToJsonSchema(SearchQuerySchema, { target: this.target });
52
+ return z.toJSONSchema(SearchQuerySchema, { target: this.target });
54
53
  }
55
54
  get jsonPaginateQuerySchema() {
56
- return zodToJsonSchema(PaginateQuerySchema, { target: this.target });
55
+ return z.toJSONSchema(PaginateQuerySchema, { target: this.target });
57
56
  }
58
57
  get jsonDeleteBodyResponseSchema() {
59
- return zodToJsonSchema(DeleteBodyResponseSchema, { target: this.target });
58
+ return z.toJSONSchema(DeleteBodyResponseSchema, { target: this.target });
60
59
  }
61
60
  get jsonFindByParamSchema() {
62
- return zodToJsonSchema(FindByParamSchema, { target: this.target });
61
+ return z.toJSONSchema(FindByParamSchema, { target: this.target });
63
62
  }
64
63
  get jsonPaginateBodyResponseSchema() {
65
- return zodToJsonSchema(PaginateBodyResponseSchema.extend({
64
+ return z.toJSONSchema(PaginateBodyResponseSchema.extend({
66
65
  items: z.array(this.entitySchema)
67
66
  }), { target: this.target });
68
67
  }
69
68
  get jsonIdParamSchema() {
70
- return zodToJsonSchema(IdParamSchema, { target: this.target });
69
+ return z.toJSONSchema(IdParamSchema, { target: this.target });
71
70
  }
72
71
  /**
73
72
  * Get JSON schema for export
@@ -107,7 +106,7 @@ export class CrudSchemaBuilder {
107
106
  get findByIdsSchema() {
108
107
  return {
109
108
  ...(this.getTags),
110
- params: zodToJsonSchema(z.object({
109
+ params: z.toJSONSchema(z.object({
111
110
  ids: z.string().regex(/^[^,]+(,[^,]+)*$/, "Debe ser una lista de valores separados por coma sin comas consecutivas")
112
111
  }), { target: this.target }),
113
112
  response: {
@@ -283,7 +282,7 @@ export class CrudSchemaBuilder {
283
282
  return {
284
283
  ...(this.getTags),
285
284
  params: this.jsonIdParamSchema,
286
- body: zodToJsonSchema(this.entityUpdateSchema.partial(), { target: this.target }),
285
+ body: z.toJSONSchema(this.entityUpdateSchema.partial(), { target: this.target }),
287
286
  response: {
288
287
  200: this.jsonEntitySchema,
289
288
  401: this.jsonErrorBodyResponse,
@@ -22,7 +22,11 @@ class AbstractService {
22
22
  return item;
23
23
  }
24
24
  catch (e) {
25
- console.error("Error creating", e);
25
+ console.error("Error create", {
26
+ name: e?.name,
27
+ message: e?.message,
28
+ stack: e?.stack,
29
+ });
26
30
  if (e instanceof ZodError) {
27
31
  throw ZodErrorToValidationError(e, data);
28
32
  }
@@ -44,7 +48,11 @@ class AbstractService {
44
48
  return item;
45
49
  }
46
50
  catch (e) {
47
- console.error("Error updating", e);
51
+ console.error("Error update", {
52
+ name: e?.name,
53
+ message: e?.message,
54
+ stack: e?.stack,
55
+ });
48
56
  if (e instanceof ZodError) {
49
57
  throw ZodErrorToValidationError(e, data);
50
58
  }
@@ -63,7 +71,11 @@ class AbstractService {
63
71
  return item;
64
72
  }
65
73
  catch (e) {
66
- console.error("Error updating", e);
74
+ console.error("Error updatePartial", {
75
+ name: e?.name,
76
+ message: e?.message,
77
+ stack: e?.stack,
78
+ });
67
79
  if (e instanceof ZodError) {
68
80
  throw ZodErrorToValidationError(e, data);
69
81
  }
@@ -82,7 +94,11 @@ class AbstractService {
82
94
  return result;
83
95
  }
84
96
  catch (e) {
85
- console.error("Error deleting", e);
97
+ console.error("Error delete", {
98
+ name: e?.name,
99
+ message: e?.message,
100
+ stack: e?.stack,
101
+ });
86
102
  throw e;
87
103
  }
88
104
  }
@@ -95,7 +111,11 @@ class AbstractService {
95
111
  return item;
96
112
  }
97
113
  catch (e) {
98
- console.error("Error finding Auto by id", e);
114
+ console.error("Error findById", {
115
+ name: e?.name,
116
+ message: e?.message,
117
+ stack: e?.stack,
118
+ });
99
119
  throw e;
100
120
  }
101
121
  }
@@ -108,7 +128,11 @@ class AbstractService {
108
128
  return items;
109
129
  }
110
130
  catch (e) {
111
- console.error("Error finding Auto by id", e);
131
+ console.error("Error findByIds", {
132
+ name: e?.name,
133
+ message: e?.message,
134
+ stack: e?.stack,
135
+ });
112
136
  throw e;
113
137
  }
114
138
  }
@@ -121,7 +145,11 @@ class AbstractService {
121
145
  return item;
122
146
  }
123
147
  catch (e) {
124
- console.error("Error finding Auto findOneBy", e);
148
+ console.error("Error findOneBy", {
149
+ name: e?.name,
150
+ message: e?.message,
151
+ stack: e?.stack,
152
+ });
125
153
  throw e;
126
154
  }
127
155
  }
@@ -134,7 +162,11 @@ class AbstractService {
134
162
  return items;
135
163
  }
136
164
  catch (e) {
137
- console.error("Error finding Auto findBy", e);
165
+ console.error("Error findBy", {
166
+ name: e?.name,
167
+ message: e?.message,
168
+ stack: e?.stack,
169
+ });
138
170
  throw e;
139
171
  }
140
172
  }
@@ -147,7 +179,11 @@ class AbstractService {
147
179
  return items;
148
180
  }
149
181
  catch (e) {
150
- console.error("Error fetching all Autos", e);
182
+ console.error("Error fetchAll", {
183
+ name: e?.name,
184
+ message: e?.message,
185
+ stack: e?.stack,
186
+ });
151
187
  throw e;
152
188
  }
153
189
  }
@@ -160,7 +196,11 @@ class AbstractService {
160
196
  return items;
161
197
  }
162
198
  catch (e) {
163
- console.error("Error fetching all Autos", e);
199
+ console.error("Error search", {
200
+ name: e?.name,
201
+ message: e?.message,
202
+ stack: e?.stack,
203
+ });
164
204
  throw e;
165
205
  }
166
206
  }
@@ -173,7 +213,11 @@ class AbstractService {
173
213
  return pagination;
174
214
  }
175
215
  catch (e) {
176
- console.error("Error paginating", e);
216
+ console.error("Error paginate", {
217
+ name: e?.name,
218
+ message: e?.message,
219
+ stack: e?.stack,
220
+ });
177
221
  throw e;
178
222
  }
179
223
  }
@@ -186,7 +230,11 @@ class AbstractService {
186
230
  return items;
187
231
  }
188
232
  catch (e) {
189
- console.error("Error find", e);
233
+ console.error("Error find", {
234
+ name: e?.name,
235
+ message: e?.message,
236
+ stack: e?.stack,
237
+ });
190
238
  throw e;
191
239
  }
192
240
  }
@@ -196,7 +244,11 @@ class AbstractService {
196
244
  return item;
197
245
  }
198
246
  catch (e) {
199
- console.error("Error findOne", e);
247
+ console.error("Error findOne", {
248
+ name: e?.name,
249
+ message: e?.message,
250
+ stack: e?.stack,
251
+ });
200
252
  throw e;
201
253
  }
202
254
  }
@@ -225,7 +277,11 @@ class AbstractService {
225
277
  }
226
278
  }
227
279
  catch (e) {
228
- console.error("Error exporting", e);
280
+ console.error("Error export", {
281
+ name: e?.name,
282
+ message: e?.message,
283
+ stack: e?.stack,
284
+ });
229
285
  throw e;
230
286
  }
231
287
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.50.0",
6
+ "version": "1.0.0",
7
7
  "description": "Crud utils across modules",
8
8
  "main": "dist/index.js",
9
9
  "types": "types/index.d.ts",
@@ -22,10 +22,10 @@
22
22
  "author": "Cristian Incarnato & Drax Team",
23
23
  "license": "ISC",
24
24
  "dependencies": {
25
- "@drax/common-back": "^0.50.0",
26
- "@drax/common-share": "^0.50.0",
27
- "@drax/identity-share": "^0.50.0",
28
- "@drax/media-back": "^0.50.0",
25
+ "@drax/common-back": "^1.0.0",
26
+ "@drax/common-share": "^1.0.0",
27
+ "@drax/identity-share": "^1.0.0",
28
+ "@drax/media-back": "^1.0.0",
29
29
  "@graphql-tools/load-files": "^7.0.0",
30
30
  "@graphql-tools/merge": "^9.0.4",
31
31
  "mongoose": "^8.21.0",
@@ -35,8 +35,7 @@
35
35
  "peerDependencies": {
36
36
  "dayjs": "^1.11.19",
37
37
  "mongoose-paginate-v2": "^1.8.3",
38
- "zod": "^3.25.76",
39
- "zod-to-json-schema": "3.24.6"
38
+ "zod": "^4.3.6"
40
39
  },
41
40
  "devDependencies": {
42
41
  "@types/node": "^20.12.10",
@@ -47,5 +46,5 @@
47
46
  "tsc-alias": "^1.8.10",
48
47
  "typescript": "^5.6.2"
49
48
  },
50
- "gitHead": "92cb8fa7600090791ace14afa4518f3f4c7113e1"
49
+ "gitHead": "8e60f7548448f339e7e9bb665ceacd3e051ef32e"
51
50
  }
@@ -1,6 +1,5 @@
1
1
  import z from 'zod';
2
- import { zodToJsonSchema } from 'zod-to-json-schema';
3
- import type { Targets } from 'zod-to-json-schema';
2
+
4
3
  import {
5
4
  IdParamSchema,
6
5
  DeleteBodyResponseSchema,
@@ -21,9 +20,9 @@ export class CrudSchemaBuilder<T extends z.ZodObject<z.ZodRawShape>, TCreate ext
21
20
  private entityUpdateSchema: TUpdate;
22
21
  private entityName: string;
23
22
  private tags: string[];
24
- private target: Targets = 'openApi3'; //"jsonSchema7" | "jsonSchema2019-09" | "openApi3" | "openAi"
23
+ private target: string = 'openapi-3.0'; //"jsonSchema7" | "jsonSchema2019-09" | "openapi-3.0" | "openAi"
25
24
 
26
- constructor(entitySchema: T, entityCreateSchema: TCreate, entityUpdateSchema: TUpdate, entityName: string, target:Targets = 'openApi3', tags: string[] = []) {
25
+ constructor(entitySchema: T, entityCreateSchema: TCreate, entityUpdateSchema: TUpdate, entityName: string, target:string = 'openapi-3.0', tags: string[] = []) {
27
26
  this.entitySchema = entitySchema;
28
27
  this.entityCreateSchema = entityCreateSchema;
29
28
  this.entityUpdateSchema = entityUpdateSchema;
@@ -40,23 +39,23 @@ export class CrudSchemaBuilder<T extends z.ZodObject<z.ZodRawShape>, TCreate ext
40
39
  }
41
40
 
42
41
  get jsonEntityCreateSchema(){
43
- return zodToJsonSchema(this.entityCreateSchema, {target: this.target})
42
+ return z.toJSONSchema(this.entityCreateSchema, {target: this.target})
44
43
  }
45
44
 
46
45
  get jsonEntityUpdateSchema(){
47
- return zodToJsonSchema(this.entityUpdateSchema, {target: this.target})
46
+ return z.toJSONSchema(this.entityUpdateSchema, {target: this.target})
48
47
  }
49
48
 
50
49
  get jsonEntitySchema() {
51
- return zodToJsonSchema(this.entitySchema, {target: this.target})
50
+ return z.toJSONSchema(this.entitySchema, {target: this.target})
52
51
  }
53
52
 
54
53
  get jsonEntityArraySchema() {
55
- return zodToJsonSchema(z.array(this.entitySchema), {target: this.target})
54
+ return z.toJSONSchema(z.array(this.entitySchema), {target: this.target})
56
55
  }
57
56
 
58
57
  get jsonEntityGroupBySchema() {
59
- return zodToJsonSchema(
58
+ return z.toJSONSchema(
60
59
  z.array(
61
60
  z.object({
62
61
  count: z.number()
@@ -67,49 +66,49 @@ export class CrudSchemaBuilder<T extends z.ZodObject<z.ZodRawShape>, TCreate ext
67
66
  }
68
67
 
69
68
  get jsonExportBodyResponse() {
70
- return zodToJsonSchema(ExportBodyResponseSchema, {target: this.target})
69
+ return z.toJSONSchema(ExportBodyResponseSchema, {target: this.target})
71
70
  }
72
71
 
73
72
  get jsonErrorBodyResponse() {
74
- return zodToJsonSchema(ErrorBodyResponseSchema, {target: this.target})
73
+ return z.toJSONSchema(ErrorBodyResponseSchema, {target: this.target})
75
74
  }
76
75
 
77
76
  get jsonValidationErrorBodyResponse() {
78
- return zodToJsonSchema(ValidationErrorBodyResponseSchema, {target: this.target})
77
+ return z.toJSONSchema(ValidationErrorBodyResponseSchema, {target: this.target})
79
78
  }
80
79
 
81
80
  get jsonFindQuerySchema(){
82
- return zodToJsonSchema(FindQuerySchema, {target: this.target})
81
+ return z.toJSONSchema(FindQuerySchema, {target: this.target})
83
82
  }
84
83
 
85
84
  get jsonGroupByQuerySchema(){
86
- return zodToJsonSchema(GroupByQuerySchema, {target: this.target})
85
+ return z.toJSONSchema(GroupByQuerySchema, {target: this.target})
87
86
  }
88
87
 
89
88
  get jsonSearchQuerySchema(){
90
- return zodToJsonSchema(SearchQuerySchema, {target: this.target})
89
+ return z.toJSONSchema(SearchQuerySchema, {target: this.target})
91
90
  }
92
91
 
93
92
  get jsonPaginateQuerySchema(){
94
- return zodToJsonSchema(PaginateQuerySchema, {target: this.target})
93
+ return z.toJSONSchema(PaginateQuerySchema, {target: this.target})
95
94
  }
96
95
 
97
96
  get jsonDeleteBodyResponseSchema(){
98
- return zodToJsonSchema(DeleteBodyResponseSchema, {target: this.target})
97
+ return z.toJSONSchema(DeleteBodyResponseSchema, {target: this.target})
99
98
  }
100
99
 
101
100
  get jsonFindByParamSchema(){
102
- return zodToJsonSchema(FindByParamSchema, {target: this.target})
101
+ return z.toJSONSchema(FindByParamSchema, {target: this.target})
103
102
  }
104
103
 
105
104
  get jsonPaginateBodyResponseSchema(){
106
- return zodToJsonSchema(PaginateBodyResponseSchema.extend({
105
+ return z.toJSONSchema(PaginateBodyResponseSchema.extend({
107
106
  items: z.array(this.entitySchema)
108
107
  }), {target: this.target})
109
108
  }
110
109
 
111
110
  get jsonIdParamSchema(){
112
- return zodToJsonSchema(IdParamSchema, {target: this.target})
111
+ return z.toJSONSchema(IdParamSchema, {target: this.target})
113
112
  }
114
113
 
115
114
  /**
@@ -152,7 +151,7 @@ export class CrudSchemaBuilder<T extends z.ZodObject<z.ZodRawShape>, TCreate ext
152
151
  get findByIdsSchema() {
153
152
  return {
154
153
  ...(this.getTags),
155
- params: zodToJsonSchema(z.object({
154
+ params: z.toJSONSchema(z.object({
156
155
  ids: z.string().regex(/^[^,]+(,[^,]+)*$/, "Debe ser una lista de valores separados por coma sin comas consecutivas")
157
156
  }), {target: this.target}),
158
157
  response: {
@@ -339,7 +338,7 @@ export class CrudSchemaBuilder<T extends z.ZodObject<z.ZodRawShape>, TCreate ext
339
338
  return {
340
339
  ...(this.getTags),
341
340
  params: this.jsonIdParamSchema,
342
- body: zodToJsonSchema(this.entityUpdateSchema.partial(), {target: this.target}),
341
+ body: z.toJSONSchema(this.entityUpdateSchema.partial(), {target: this.target}),
343
342
  response: {
344
343
  200: this.jsonEntitySchema,
345
344
  401: this.jsonErrorBodyResponse,
@@ -50,7 +50,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
50
50
  }
51
51
  return item
52
52
  } catch (e) {
53
- console.error("Error creating", e)
53
+ console.error("Error create", {
54
+ name: e?.name,
55
+ message: e?.message,
56
+ stack: e?.stack,
57
+ });
54
58
  if (e instanceof ZodError) {
55
59
  throw ZodErrorToValidationError(e, data)
56
60
  }
@@ -72,7 +76,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
72
76
  }
73
77
  return item
74
78
  } catch (e) {
75
- console.error("Error updating", e)
79
+ console.error("Error update", {
80
+ name: e?.name,
81
+ message: e?.message,
82
+ stack: e?.stack,
83
+ });
76
84
  if (e instanceof ZodError) {
77
85
  throw ZodErrorToValidationError(e, data)
78
86
  }
@@ -93,7 +101,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
93
101
  }
94
102
  return item
95
103
  } catch (e) {
96
- console.error("Error updating", e)
104
+ console.error("Error updatePartial", {
105
+ name: e?.name,
106
+ message: e?.message,
107
+ stack: e?.stack,
108
+ });
97
109
  if (e instanceof ZodError) {
98
110
  throw ZodErrorToValidationError(e, data)
99
111
  }
@@ -112,7 +124,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
112
124
  }
113
125
  return result;
114
126
  } catch (e) {
115
- console.error("Error deleting", e)
127
+ console.error("Error delete", {
128
+ name: e?.name,
129
+ message: e?.message,
130
+ stack: e?.stack,
131
+ });
116
132
  throw e;
117
133
  }
118
134
 
@@ -126,7 +142,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
126
142
  }
127
143
  return item
128
144
  } catch (e) {
129
- console.error("Error finding Auto by id", e)
145
+ console.error("Error findById", {
146
+ name: e?.name,
147
+ message: e?.message,
148
+ stack: e?.stack,
149
+ });
130
150
  throw e;
131
151
  }
132
152
  }
@@ -139,7 +159,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
139
159
  }
140
160
  return items
141
161
  } catch (e) {
142
- console.error("Error finding Auto by id", e)
162
+ console.error("Error findByIds", {
163
+ name: e?.name,
164
+ message: e?.message,
165
+ stack: e?.stack,
166
+ });
143
167
  throw e;
144
168
  }
145
169
  }
@@ -152,7 +176,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
152
176
  }
153
177
  return item
154
178
  } catch (e) {
155
- console.error("Error finding Auto findOneBy", e)
179
+ console.error("Error findOneBy", {
180
+ name: e?.name,
181
+ message: e?.message,
182
+ stack: e?.stack,
183
+ });
156
184
  throw e;
157
185
  }
158
186
 
@@ -167,7 +195,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
167
195
  }
168
196
  return items
169
197
  } catch (e) {
170
- console.error("Error finding Auto findBy", e)
198
+ console.error("Error findBy", {
199
+ name: e?.name,
200
+ message: e?.message,
201
+ stack: e?.stack,
202
+ });
171
203
  throw e;
172
204
  }
173
205
 
@@ -181,7 +213,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
181
213
  }
182
214
  return items
183
215
  } catch (e) {
184
- console.error("Error fetching all Autos", e)
216
+ console.error("Error fetchAll", {
217
+ name: e?.name,
218
+ message: e?.message,
219
+ stack: e?.stack,
220
+ });
185
221
  throw e;
186
222
  }
187
223
 
@@ -196,7 +232,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
196
232
  }
197
233
  return items
198
234
  } catch (e) {
199
- console.error("Error fetching all Autos", e)
235
+ console.error("Error search", {
236
+ name: e?.name,
237
+ message: e?.message,
238
+ stack: e?.stack,
239
+ });
200
240
  throw e;
201
241
  }
202
242
 
@@ -221,7 +261,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
221
261
 
222
262
  return pagination;
223
263
  } catch (e) {
224
- console.error("Error paginating", e)
264
+ console.error("Error paginate", {
265
+ name: e?.name,
266
+ message: e?.message,
267
+ stack: e?.stack,
268
+ });
225
269
  throw e;
226
270
  }
227
271
 
@@ -242,7 +286,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
242
286
  }
243
287
  return items;
244
288
  } catch (e) {
245
- console.error("Error find", e)
289
+ console.error("Error find", {
290
+ name: e?.name,
291
+ message: e?.message,
292
+ stack: e?.stack,
293
+ });
246
294
  throw e;
247
295
  }
248
296
 
@@ -256,7 +304,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
256
304
  let item = await this._repository.findOne({search, filters});
257
305
  return item;
258
306
  } catch (e) {
259
- console.error("Error findOne", e)
307
+ console.error("Error findOne", {
308
+ name: e?.name,
309
+ message: e?.message,
310
+ stack: e?.stack,
311
+ });
260
312
  throw e;
261
313
  }
262
314
 
@@ -301,7 +353,11 @@ abstract class AbstractService<T, C, U> implements IDraxCrudService<T, C, U> {
301
353
  }
302
354
 
303
355
  } catch (e) {
304
- console.error("Error exporting", e)
356
+ console.error("Error export", {
357
+ name: e?.name,
358
+ message: e?.message,
359
+ stack: e?.stack,
360
+ });
305
361
  throw e;
306
362
  }
307
363