@navservice/core 1.116.0 → 1.120.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.
@@ -46,7 +46,7 @@ const _logger = new RequestLoggerClass();
46
46
  const helpers_logger = _logger;
47
47
  const set_response = new class {
48
48
  c = new class {
49
- SUCCESS({ message, results, c }) {
49
+ SUCCESS({ message, results, c, fn }) {
50
50
  const payload = {
51
51
  status: 200,
52
52
  code: "SUCCESS",
@@ -55,7 +55,7 @@ const set_response = new class {
55
55
  results: results || []
56
56
  };
57
57
  helpers_logger.add({
58
- fn: "SUCCESS",
58
+ fn: `${fn}_SUCCESS`,
59
59
  level: "info",
60
60
  message: payload?.message,
61
61
  results: payload?.results
@@ -64,7 +64,7 @@ const set_response = new class {
64
64
  status: 200
65
65
  });
66
66
  }
67
- ACTION_REQUIRED({ message, results, c }) {
67
+ ACTION_REQUIRED({ message, results, c, fn }) {
68
68
  const payload = {
69
69
  status: 428,
70
70
  code: "ACTION_REQUIRED",
@@ -73,7 +73,7 @@ const set_response = new class {
73
73
  results: results || []
74
74
  };
75
75
  helpers_logger.add({
76
- fn: "ACTION_REQUIRED",
76
+ fn: `${fn}_ACTION_REQUIRED`,
77
77
  level: "info",
78
78
  message: payload?.message,
79
79
  results: payload?.results
@@ -82,7 +82,7 @@ const set_response = new class {
82
82
  status: 428
83
83
  });
84
84
  }
85
- CREATED({ message, results, c }) {
85
+ CREATED({ message, results, c, fn }) {
86
86
  const payload = {
87
87
  status: 201,
88
88
  code: "CREATED",
@@ -91,7 +91,7 @@ const set_response = new class {
91
91
  results: results || []
92
92
  };
93
93
  helpers_logger.add({
94
- fn: "CREATED",
94
+ fn: `${fn}_CREATED`,
95
95
  level: "info",
96
96
  message: payload?.message,
97
97
  results: payload?.results
@@ -100,7 +100,7 @@ const set_response = new class {
100
100
  status: 201
101
101
  });
102
102
  }
103
- WARNING({ message, results, c }) {
103
+ WARNING({ message, results, c, fn }) {
104
104
  const payload = {
105
105
  status: 400,
106
106
  code: "WARNING",
@@ -109,7 +109,7 @@ const set_response = new class {
109
109
  results: results || []
110
110
  };
111
111
  helpers_logger.add({
112
- fn: "WARNING",
112
+ fn: `${fn}_WARNING`,
113
113
  level: "info",
114
114
  message: payload?.message,
115
115
  results: payload?.results
@@ -118,7 +118,7 @@ const set_response = new class {
118
118
  status: 400
119
119
  });
120
120
  }
121
- AUTHORIZATION_ERROR({ message, results, c }) {
121
+ AUTHORIZATION_ERROR({ message, results, c, fn }) {
122
122
  const payload = {
123
123
  status: 405,
124
124
  code: "WARNING",
@@ -127,7 +127,7 @@ const set_response = new class {
127
127
  results: results || []
128
128
  };
129
129
  helpers_logger.add({
130
- fn: "AUTHORIZATION_ERROR",
130
+ fn: `${fn}_AUTHORIZATION_ERROR`,
131
131
  level: "error",
132
132
  message: payload?.message,
133
133
  results: payload?.results
@@ -136,7 +136,7 @@ const set_response = new class {
136
136
  status: 405
137
137
  });
138
138
  }
139
- SERVER_ERROR({ error, c }) {
139
+ SERVER_ERROR({ error, c, fn }) {
140
140
  if (error instanceof v4.ZodError) {
141
141
  const payload = {
142
142
  status: 500,
@@ -146,7 +146,7 @@ const set_response = new class {
146
146
  results: v4.treeifyError(error)
147
147
  };
148
148
  helpers_logger.add({
149
- fn: "SCHEMA_VALIDATION",
149
+ fn: `${fn}_SCHEMA_VALIDATION`,
150
150
  level: "error",
151
151
  message: payload?.message,
152
152
  results: payload?.results
@@ -163,7 +163,7 @@ const set_response = new class {
163
163
  results: error?.results || []
164
164
  };
165
165
  if (payload?.type === "error") helpers_logger.add({
166
- fn: "SERVER_ERROR",
166
+ fn: `${fn}_SERVER_ERROR`,
167
167
  level: payload?.type,
168
168
  message: payload?.message,
169
169
  results: payload?.results
@@ -172,7 +172,7 @@ const set_response = new class {
172
172
  status: error?.status || error?.status || 500
173
173
  });
174
174
  }
175
- UNAUTHORIZED({ message, c }) {
175
+ UNAUTHORIZED({ message, c, fn }) {
176
176
  const payload = {
177
177
  status: 401,
178
178
  code: "UNAUTHORIZED",
@@ -181,7 +181,7 @@ const set_response = new class {
181
181
  results: []
182
182
  };
183
183
  helpers_logger.add({
184
- fn: "UNAUTHORIZED",
184
+ fn: `${fn}_UNAUTHORIZED`,
185
185
  level: "error",
186
186
  message: payload?.message,
187
187
  results: payload?.results
@@ -190,7 +190,7 @@ const set_response = new class {
190
190
  status: 401
191
191
  });
192
192
  }
193
- INVALID_TOKEN({ message, c }) {
193
+ INVALID_TOKEN({ message, c, fn }) {
194
194
  const payload = {
195
195
  status: 409,
196
196
  code: "INVALID_TOKEN",
@@ -199,7 +199,7 @@ const set_response = new class {
199
199
  results: []
200
200
  };
201
201
  helpers_logger.add({
202
- fn: "INVALID_TOKEN",
202
+ fn: `${fn}_INVALID_TOKEN`,
203
203
  level: "error",
204
204
  message: payload?.message,
205
205
  results: payload?.results
@@ -208,7 +208,7 @@ const set_response = new class {
208
208
  status: 409
209
209
  });
210
210
  }
211
- NOT_FOUND({ message, c }) {
211
+ NOT_FOUND({ message, c, fn }) {
212
212
  const payload = {
213
213
  status: 404,
214
214
  code: "NOT_FOUND",
@@ -217,7 +217,7 @@ const set_response = new class {
217
217
  results: []
218
218
  };
219
219
  helpers_logger.add({
220
- fn: "NOT_FOUND",
220
+ fn: `${fn}_NOT_FOUND`,
221
221
  level: "info",
222
222
  message: payload?.message,
223
223
  results: payload?.results
@@ -226,14 +226,14 @@ const set_response = new class {
226
226
  status: 404
227
227
  });
228
228
  }
229
- async SUCCESS_FILE({ message, file_buffer, content_type, filename, c }) {
229
+ async SUCCESS_FILE({ message, file_buffer, content_type, filename, c, fn }) {
230
230
  if (c && content_type) {
231
231
  const headers = {
232
232
  "Content-Type": content_type,
233
233
  "Content-Disposition": filename ? `inline; filename="${filename}"` : "inline"
234
234
  };
235
235
  helpers_logger.add({
236
- fn: "SUCCESS_FILE",
236
+ fn: `${fn}_SUCCESS_FILE`,
237
237
  level: "info",
238
238
  message: "",
239
239
  results: headers
@@ -251,7 +251,7 @@ const set_response = new class {
251
251
  results: []
252
252
  };
253
253
  helpers_logger.add({
254
- fn: "SUCCESS_FILE",
254
+ fn: `${fn}_SUCCESS_FILE`,
255
255
  level: "info",
256
256
  message: payload?.message,
257
257
  results: payload?.results
@@ -262,7 +262,7 @@ const set_response = new class {
262
262
  }
263
263
  };
264
264
  error = new class {
265
- ACTION_REQUIRED({ message, results }) {
265
+ ACTION_REQUIRED({ message, results, fn }) {
266
266
  const payload = {
267
267
  status: 428,
268
268
  code: "ACTION_REQUIRED",
@@ -271,14 +271,14 @@ const set_response = new class {
271
271
  results: results || []
272
272
  };
273
273
  helpers_logger.add({
274
- fn: "ACTION_REQUIRED",
274
+ fn: `${fn}_ACTION_REQUIRED`,
275
275
  level: "info",
276
276
  message: payload?.message,
277
277
  results: payload?.results
278
278
  });
279
279
  throw payload;
280
280
  }
281
- WARNING({ message, results }) {
281
+ WARNING({ message, results, fn }) {
282
282
  const payload = {
283
283
  status: 400,
284
284
  code: "WARNING",
@@ -287,14 +287,46 @@ const set_response = new class {
287
287
  results: results || []
288
288
  };
289
289
  helpers_logger.add({
290
- fn: "WARNING",
290
+ fn: `${fn}_WARNING`,
291
291
  level: "info",
292
292
  message: payload?.message,
293
293
  results: payload?.results
294
294
  });
295
295
  throw payload;
296
296
  }
297
- AUTHORIZATION_ERROR({ message, results }) {
297
+ ERROR({ message, results, fn }) {
298
+ const payload = {
299
+ status: 400,
300
+ code: "ERROR",
301
+ type: "error",
302
+ message: message || "Aviso!",
303
+ results: results || []
304
+ };
305
+ helpers_logger.add({
306
+ fn: `${fn}_ERROR`,
307
+ level: "info",
308
+ message: payload?.message,
309
+ results: payload?.results
310
+ });
311
+ throw payload;
312
+ }
313
+ TOKEN_AUTH_USER({ message, results, fn }) {
314
+ const payload = {
315
+ status: 410,
316
+ code: "TOKEN_AUTH_USER",
317
+ type: "warning",
318
+ message: message || "Erro processo de auth token!",
319
+ results: results || []
320
+ };
321
+ helpers_logger.add({
322
+ fn: `${fn}_REFRESH_TOKEN_AUTH_USER`,
323
+ level: "error",
324
+ message: payload?.message,
325
+ results: payload?.results
326
+ });
327
+ throw payload;
328
+ }
329
+ AUTHORIZATION_ERROR({ message, results, fn }) {
298
330
  const payload = {
299
331
  status: 400,
300
332
  code: "WARNING",
@@ -303,14 +335,14 @@ const set_response = new class {
303
335
  results: results || []
304
336
  };
305
337
  helpers_logger.add({
306
- fn: "AUTHORIZATION_ERROR",
338
+ fn: `${fn}_AUTHORIZATION_ERROR`,
307
339
  level: "error",
308
340
  message: payload?.message,
309
341
  results: payload?.results
310
342
  });
311
343
  throw payload;
312
344
  }
313
- DATABASE_ERROR({ message, erro }) {
345
+ DATABASE_ERROR({ message, erro, fn }) {
314
346
  const errorCode = erro?.cause?.code || erro?.cause?.cause?.code || erro?.code || "";
315
347
  const map = {
316
348
  SQLITE_CONSTRAINT_UNIQUE: {
@@ -354,14 +386,14 @@ const set_response = new class {
354
386
  results: []
355
387
  };
356
388
  helpers_logger.add({
357
- fn: "DATABASE_ERROR",
389
+ fn: `${fn}_DATABASE_ERROR`,
358
390
  level: "error",
359
391
  message: payload?.message,
360
392
  results: erro
361
393
  });
362
394
  throw payload;
363
395
  }
364
- SCHEMA_VALIDATION({ results }) {
396
+ SCHEMA_VALIDATION({ results, fn }) {
365
397
  const payload = {
366
398
  status: 500,
367
399
  code: "SCHEMA_VALIDATION",
@@ -370,14 +402,14 @@ const set_response = new class {
370
402
  results: results || []
371
403
  };
372
404
  helpers_logger.add({
373
- fn: "SCHEMA_VALIDATION",
405
+ fn: `${fn}_SCHEMA_VALIDATION`,
374
406
  level: "error",
375
407
  message: payload?.message,
376
408
  results: payload?.results
377
409
  });
378
410
  throw payload;
379
411
  }
380
- UNAUTHORIZED({ message }) {
412
+ UNAUTHORIZED({ message, fn }) {
381
413
  const payload = {
382
414
  status: 401,
383
415
  code: "UNAUTHORIZED",
@@ -385,60 +417,62 @@ const set_response = new class {
385
417
  message: message || "Não autorizado!"
386
418
  };
387
419
  helpers_logger.add({
388
- fn: "UNAUTHORIZED",
420
+ fn: `${fn}_UNAUTHORIZED`,
389
421
  level: "error",
390
422
  message: payload?.message,
391
423
  results: payload?.results
392
424
  });
393
425
  throw payload;
394
426
  }
395
- INTEGRATION_ERROR({ message }) {
427
+ INTEGRATION_ERROR({ message, fn, erro }) {
396
428
  const payload = {
397
429
  status: 401,
398
430
  code: "INTEGRATION_ERROR",
399
431
  type: "error",
400
- message: message || "Erro na camada de integração!"
432
+ message: message || "Erro na camada de integração!",
433
+ results: erro
401
434
  };
402
435
  helpers_logger.add({
403
- fn: "INTEGRATION_ERROR",
436
+ fn: `${fn}_INTEGRATION_ERROR`,
404
437
  level: "error",
405
438
  message: payload?.message,
406
- results: payload?.results
439
+ results: erro
407
440
  });
408
441
  throw payload;
409
442
  }
410
- INVALID_TOKEN({ message }) {
443
+ INVALID_TOKEN({ message, fn, results }) {
411
444
  const payload = {
412
445
  status: 401,
413
446
  code: "INVALID_TOKEN",
414
447
  type: "warning",
415
448
  message: message || "Token inválido!",
416
- results: []
449
+ results: results || []
417
450
  };
418
451
  helpers_logger.add({
419
- fn: "INVALID_TOKEN",
452
+ fn: `${fn}_INVALID_TOKEN`,
420
453
  level: "error",
421
454
  message: payload?.message,
422
455
  results: payload?.results
423
456
  });
424
457
  throw payload;
425
458
  }
426
- NOT_FOUND({ message }) {
459
+ NOT_FOUND({ message, fn, results }) {
427
460
  const payload = {
428
461
  status: 404,
429
462
  code: "NOT_FOUND",
430
463
  type: "error",
431
- message: message || "Recurso não encontrado!"
464
+ message: message || "Recurso não encontrado!",
465
+ results: results || []
432
466
  };
433
467
  helpers_logger.add({
434
- fn: "NOT_FOUND",
468
+ fn: `${fn}_NOT_FOUND`,
435
469
  level: "info",
436
470
  message: payload?.message,
437
471
  results: payload?.results
438
472
  });
439
473
  throw payload;
440
474
  }
441
- BUSINESS_RULE_VIOLATION({ message, results }) {
475
+ BUSINESS_RULE_VIOLATION({ message, results, fn }) {
442
476
  const payload = {
443
477
  status: 422,
444
478
  code: "BUSINESS_RULE_VIOLATION",
@@ -447,14 +481,14 @@ const set_response = new class {
447
481
  results: results || []
448
482
  };
449
483
  helpers_logger.add({
450
- fn: "BUSINESS_RULE_VIOLATION",
484
+ fn: `${fn}_BUSINESS_RULE_VIOLATION`,
451
485
  level: "info",
452
486
  message: payload?.message,
453
487
  results: payload?.results
454
488
  });
455
489
  throw payload;
456
490
  }
457
- PLAN_FORBIDDEN({ message, results }) {
491
+ PLAN_FORBIDDEN({ message, results, fn }) {
458
492
  const payload = {
459
493
  status: 403,
460
494
  code: "PLAN_FORBIDDEN",
@@ -463,7 +497,7 @@ const set_response = new class {
463
497
  results: results || []
464
498
  };
465
499
  helpers_logger.add({
466
- fn: "PLAN_FORBIDDEN",
500
+ fn: `${fn}_PLAN_FORBIDDEN`,
467
501
  level: "info",
468
502
  message: payload?.message,
469
503
  results: payload?.results
@@ -473,6 +507,7 @@ const set_response = new class {
473
507
  };
474
508
  };
475
509
  const _set_response = set_response;
510
+ const _token_fn = 'token';
476
511
  const _token = new class {
477
512
  async verificar_token(c, next) {
478
513
  try {
@@ -480,20 +515,23 @@ const _token = new class {
480
515
  if (!authHeader) return _set_response.c.INVALID_TOKEN({
481
516
  message: 'token não enviado!!!',
482
517
  c: c,
483
- results: []
518
+ results: [],
519
+ fn: _token_fn
484
520
  });
485
521
  const token = authHeader.split(" ")[1];
486
522
  if (!token) return _set_response.c.INVALID_TOKEN({
487
523
  message: 'Acesso negado!!!',
488
524
  c: c,
489
- results: []
525
+ results: [],
526
+ fn: _token_fn
490
527
  });
491
528
  const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_USER);
492
529
  const { payload } = await jwtVerify(token, secret);
493
530
  if (!payload._id || !payload.email) return _set_response.c.INVALID_TOKEN({
494
531
  message: 'Token inválido!!!!',
495
532
  c: c,
496
- results: []
533
+ results: [],
534
+ fn: _token_fn
497
535
  });
498
536
  const setar_token = {
499
537
  _id: payload._id,
@@ -513,14 +551,16 @@ const _token = new class {
513
551
  return _set_response.c.INVALID_TOKEN({
514
552
  message: 'Token inválido!!!',
515
553
  c: c,
516
- results: []
554
+ results: [],
555
+ fn: _token_fn
517
556
  });
518
557
  }
519
558
  }
520
559
  async criar_token_login_usuario(props) {
521
560
  if (!props?.c.env.JSON_WEB_TOKEN_AUTH_USER) _set_response.error.WARNING({
522
- message: "Erro ao gerar token!!",
523
- results: []
561
+ message: "Erro ao gerar token auth!!",
562
+ results: [],
563
+ fn: _token_fn
524
564
  });
525
565
  const token = await new SignJWT({
526
566
  _id: props?._id,
@@ -534,9 +574,10 @@ const _token = new class {
534
574
  plano_status: props?.plano_status
535
575
  }).setProtectedHeader({
536
576
  alg: "HS256"
537
- }).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(props?.c.env.JSON_WEB_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.WARNING({
538
- message: "Erro ao gerar token!",
539
- results: error?.message
577
+ }).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(props?.c.env.JSON_WEB_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
578
+ message: "Erro ao gerar token auth user!",
579
+ results: error?.message,
580
+ fn: _token_fn
540
581
  }));
541
582
  return token;
542
583
  }
@@ -546,20 +587,23 @@ const _token = new class {
546
587
  if (!authHeader) return _set_response.c.INVALID_TOKEN({
547
588
  message: 'token service não enviado!',
548
589
  c: c,
549
- results: []
590
+ results: [],
591
+ fn: _token_fn
550
592
  });
551
593
  const token = authHeader.split(" ")[1];
552
594
  if (!token) return _set_response.c.INVALID_TOKEN({
553
595
  message: 'Acesso negado ao serviço!',
554
596
  c: c,
555
- results: []
597
+ results: [],
598
+ fn: _token_fn
556
599
  });
557
600
  const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO);
558
601
  const { payload } = await jwtVerify(token, secret);
559
602
  if (!payload._id || !payload.email) return _set_response.c.INVALID_TOKEN({
560
603
  message: 'Token inválido para o serviço!',
561
604
  c: c,
562
- results: []
605
+ results: [],
606
+ fn: _token_fn
563
607
  });
564
608
  const setar_token = {
565
609
  _id: payload._id,
@@ -578,14 +622,16 @@ const _token = new class {
578
622
  return _set_response.c.INVALID_TOKEN({
579
623
  message: 'Erro token inválido!',
580
624
  c: c,
581
- results: []
625
+ results: [],
626
+ fn: _token_fn
582
627
  });
583
628
  }
584
629
  }
585
630
  async criar_token_micro_servico({ c }) {
586
- if (!c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO) return _set_response.error.WARNING({
631
+ if (!c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO) _set_response.error.WARNING({
587
632
  message: "Erro ao gerar token!!",
588
- results: []
633
+ results: [],
634
+ fn: _token_fn
589
635
  });
590
636
  const usuario_auth = c.get("usuario_auth");
591
637
  const token = await new SignJWT({
@@ -600,23 +646,26 @@ const _token = new class {
600
646
  plano_status: usuario_auth?.plano_status
601
647
  }).setProtectedHeader({
602
648
  alg: "HS256"
603
- }).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO)).catch((error)=>_set_response.error.WARNING({
604
- message: "Erro ao gerar token!",
605
- results: error?.message
649
+ }).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
650
+ message: "Erro ao gerar token micro serviço!",
651
+ results: error?.message,
652
+ fn: _token_fn
606
653
  }));
607
654
  return token;
608
655
  }
609
656
  async criar_refresh_token({ env, usuario_id }) {
610
- if (!env.JSON_WEB_REFRESH_TOKEN_AUTH_USER) return _set_response.error.WARNING({
657
+ if (!env.JSON_WEB_REFRESH_TOKEN_AUTH_USER) _set_response.error.TOKEN_AUTH_USER({
611
658
  message: "Erro ao gerar refresh token!!",
612
- results: []
659
+ results: [],
660
+ fn: _token_fn
613
661
  });
614
662
  const token = await new SignJWT({
615
663
  usuario_id: usuario_id
616
664
  }).setProtectedHeader({
617
665
  alg: "HS256"
618
- }).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.WARNING({
619
- message: "Erro ao gerar refresh token!"
666
+ }).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
667
+ message: "Erro ao gerar refresh token!",
668
+ fn: _token_fn
620
669
  }));
621
670
  return token;
622
671
  }
package/build/es/index.js CHANGED
@@ -82,6 +82,7 @@ var _usuario_TypeControllerUsuario;
82
82
  v4.literal("ACTION_REQUIRED"),
83
83
  v4.literal("CREATED"),
84
84
  v4.literal("WARNING"),
85
+ v4.literal("ERROR"),
85
86
  v4.literal("AUTHORIZATION_ERROR"),
86
87
  v4.literal("SCHEMA_VALIDATION"),
87
88
  v4.literal("SERVER_ERROR"),
@@ -92,7 +93,8 @@ var _usuario_TypeControllerUsuario;
92
93
  v4.literal("DATABASE_ERROR"),
93
94
  v4.literal("BUSINESS_RULE_VIOLATION"),
94
95
  v4.literal("PLAN_FORBIDDEN"),
95
- v4.literal("INTEGRATION_ERROR")
96
+ v4.literal("INTEGRATION_ERROR"),
97
+ v4.literal("TOKEN_AUTH_USER")
96
98
  ]);
97
99
  v4.object({
98
100
  status: StatusSchema,
@@ -114,6 +116,7 @@ var _usuario_TypeControllerUsuario;
114
116
  v4.object({
115
117
  status: StatusSchema,
116
118
  message: v4.string().optional(),
119
+ fn: v4.string(),
117
120
  file_buffer: v4.union([
118
121
  v4["instanceof"](Blob),
119
122
  v4["instanceof"](ArrayBuffer),
@@ -133,8 +136,7 @@ var _usuario_TypeControllerUsuario;
133
136
  ]).optional(),
134
137
  type: TypeSchema.optional().default("success"),
135
138
  code: CodeSchema,
136
- status: v4.number().optional().default(200),
137
- fn: v4.string().optional()
139
+ status: v4.number().optional().default(200)
138
140
  });
139
141
  })(TypeControllerResponse.Error || (TypeControllerResponse.Error = {}));
140
142
  })(_type_response_TypeControllerResponse || (_type_response_TypeControllerResponse = {}));
@@ -3,7 +3,7 @@ import z4 from "zod/v4";
3
3
  declare namespace TypeControllerResponse {
4
4
  const BaseResponseSchema: z4.ZodObject<{
5
5
  status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
6
- code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">]>;
6
+ code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"ERROR">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">, z4.ZodLiteral<"TOKEN_AUTH_USER">]>;
7
7
  type: z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>;
8
8
  message: z4.ZodString;
9
9
  results: z4.ZodOptional<z4.ZodUnknown>;
@@ -15,7 +15,7 @@ declare namespace TypeControllerResponse {
15
15
  export namespace C {
16
16
  export const InputSchema: z4.ZodObject<{
17
17
  status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
18
- code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">]>;
18
+ code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"ERROR">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">, z4.ZodLiteral<"TOKEN_AUTH_USER">]>;
19
19
  type: z4.ZodDefault<z4.ZodOptional<z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>>>;
20
20
  message: z4.ZodOptional<z4.ZodString>;
21
21
  results: z4.ZodAny;
@@ -28,6 +28,7 @@ declare namespace TypeControllerResponse {
28
28
  const FileResponseParamsSchema: z4.ZodObject<{
29
29
  status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
30
30
  message: z4.ZodOptional<z4.ZodString>;
31
+ fn: z4.ZodString;
31
32
  file_buffer: z4.ZodUnion<readonly [z4.ZodCustom<Blob, Blob>, z4.ZodCustom<ArrayBuffer, ArrayBuffer>, z4.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
32
33
  content_type: z4.ZodString;
33
34
  filename: z4.ZodOptional<z4.ZodString>;
@@ -41,9 +42,8 @@ declare namespace TypeControllerResponse {
41
42
  message: z4.ZodOptional<z4.ZodString>;
42
43
  results: z4.ZodOptional<z4.ZodUnion<readonly [z4.ZodArray<z4.ZodUnknown>, z4.ZodUnknown]>>;
43
44
  type: z4.ZodDefault<z4.ZodOptional<z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>>>;
44
- code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">]>;
45
+ code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"ERROR">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">, z4.ZodLiteral<"BUSINESS_RULE_VIOLATION">, z4.ZodLiteral<"PLAN_FORBIDDEN">, z4.ZodLiteral<"INTEGRATION_ERROR">, z4.ZodLiteral<"TOKEN_AUTH_USER">]>;
45
46
  status: z4.ZodDefault<z4.ZodOptional<z4.ZodNumber>>;
46
- fn: z4.ZodOptional<z4.ZodString>;
47
47
  }, z4.core.$strip>;
48
48
  type Input<T = unknown> = z4.infer<typeof InputSchema> & {
49
49
  results?: T;