@navservice/core 1.114.0 → 1.116.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.
@@ -6,35 +6,35 @@ declare const set_response: {
6
6
  c: {
7
7
  SUCCESS<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
8
8
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
9
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
9
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
10
10
  type: "success" | "warning" | "error";
11
11
  message?: string | undefined;
12
12
  results: any;
13
13
  }, 200, "json">;
14
14
  ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
15
15
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
16
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
16
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
17
17
  type: "success" | "warning" | "error";
18
18
  message?: string | undefined;
19
19
  results: any;
20
20
  }, 428, "json">;
21
21
  CREATED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
22
22
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
23
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
23
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
24
24
  type: "success" | "warning" | "error";
25
25
  message?: string | undefined;
26
26
  results: any;
27
27
  }, 201, "json">;
28
28
  WARNING<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
29
29
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
30
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
30
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
31
31
  type: "success" | "warning" | "error";
32
32
  message?: string | undefined;
33
33
  results: any;
34
34
  }, 400, "json">;
35
35
  AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
36
36
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
37
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
37
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
38
38
  type: "success" | "warning" | "error";
39
39
  message?: string | undefined;
40
40
  results: any;
@@ -44,28 +44,28 @@ declare const set_response: {
44
44
  c: t.Context;
45
45
  }): Response & import("hono").TypedResponse<{
46
46
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
47
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
47
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
48
48
  type: "success" | "warning" | "error";
49
49
  message?: string | undefined;
50
50
  results: any;
51
51
  }, any, "json">;
52
52
  UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
53
53
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
54
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
54
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
55
55
  type: "success" | "warning" | "error";
56
56
  message?: string | undefined;
57
57
  results: any;
58
58
  }, 401, "json">;
59
59
  INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
60
60
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
61
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
61
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
62
62
  type: "success" | "warning" | "error";
63
63
  message?: string | undefined;
64
64
  results: any;
65
65
  }, 409, "json">;
66
66
  NOT_FOUND<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
67
67
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
68
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
68
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
69
69
  type: "success" | "warning" | "error";
70
70
  message?: string | undefined;
71
71
  results: any;
@@ -125,7 +125,7 @@ declare const set_response: {
125
125
  with: never;
126
126
  }, 200, "json">) | (Response & import("hono").TypedResponse<{
127
127
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
128
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
128
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
129
129
  type: "success" | "warning" | "error";
130
130
  message?: string | undefined;
131
131
  results: any;
@@ -135,11 +135,12 @@ declare const set_response: {
135
135
  ACTION_REQUIRED({ message, results }: ResponseErrorOmmit): void;
136
136
  WARNING({ message, results }: ResponseErrorOmmit): void;
137
137
  AUTHORIZATION_ERROR({ message, results }: ResponseErrorOmmit): void;
138
- DATABASE_ERROR({ message, results, erro }: ResponseErrorOmmit & {
138
+ DATABASE_ERROR({ message, erro }: ResponseErrorOmmit & {
139
139
  erro: any;
140
140
  }): void;
141
141
  SCHEMA_VALIDATION({ results }: ResponseErrorOmmit): void;
142
142
  UNAUTHORIZED({ message }: ResponseErrorOmmit): void;
143
+ INTEGRATION_ERROR({ message }: ResponseErrorOmmit): void;
143
144
  INVALID_TOKEN({ message }: ResponseErrorOmmit): void;
144
145
  NOT_FOUND({ message }: ResponseErrorOmmit): void;
145
146
  BUSINESS_RULE_VIOLATION({ message, results }: ResponseErrorOmmit): void;
@@ -3,7 +3,7 @@ import t from '../types';
3
3
  declare const _token: {
4
4
  verificar_token(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
5
5
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
6
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
6
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
7
7
  type: "success" | "warning" | "error";
8
8
  message?: string | undefined;
9
9
  results: any;
@@ -13,7 +13,7 @@ declare const _token: {
13
13
  }): Promise<string>;
14
14
  verificar_token_micro_servico(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
15
15
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
16
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
16
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
17
17
  type: "success" | "warning" | "error";
18
18
  message?: string | undefined;
19
19
  results: any;
@@ -7,7 +7,7 @@ declare const helpers: {
7
7
  c: import("..").TypesCore.Context;
8
8
  }): Response & import("hono").TypedResponse<{
9
9
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
10
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
10
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
11
11
  type: "success" | "warning" | "error";
12
12
  message?: string | undefined;
13
13
  results: any;
@@ -18,7 +18,7 @@ declare const helpers: {
18
18
  c: import("..").TypesCore.Context;
19
19
  }): Response & import("hono").TypedResponse<{
20
20
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
21
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
21
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
22
22
  type: "success" | "warning" | "error";
23
23
  message?: string | undefined;
24
24
  results: any;
@@ -29,7 +29,7 @@ declare const helpers: {
29
29
  c: import("..").TypesCore.Context;
30
30
  }): Response & import("hono").TypedResponse<{
31
31
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
32
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
32
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
33
33
  type: "success" | "warning" | "error";
34
34
  message?: string | undefined;
35
35
  results: any;
@@ -40,7 +40,7 @@ declare const helpers: {
40
40
  c: import("..").TypesCore.Context;
41
41
  }): Response & import("hono").TypedResponse<{
42
42
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
43
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
43
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
44
44
  type: "success" | "warning" | "error";
45
45
  message?: string | undefined;
46
46
  results: any;
@@ -51,7 +51,7 @@ declare const helpers: {
51
51
  c: import("..").TypesCore.Context;
52
52
  }): Response & import("hono").TypedResponse<{
53
53
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
54
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
54
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
55
55
  type: "success" | "warning" | "error";
56
56
  message?: string | undefined;
57
57
  results: any;
@@ -61,7 +61,7 @@ declare const helpers: {
61
61
  c: import("..").TypesCore.Context;
62
62
  }): Response & import("hono").TypedResponse<{
63
63
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
64
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
64
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
65
65
  type: "success" | "warning" | "error";
66
66
  message?: string | undefined;
67
67
  results: any;
@@ -72,7 +72,7 @@ declare const helpers: {
72
72
  c: import("..").TypesCore.Context;
73
73
  }): Response & import("hono").TypedResponse<{
74
74
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
75
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
75
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
76
76
  type: "success" | "warning" | "error";
77
77
  message?: string | undefined;
78
78
  results: any;
@@ -83,7 +83,7 @@ declare const helpers: {
83
83
  c: import("..").TypesCore.Context;
84
84
  }): Response & import("hono").TypedResponse<{
85
85
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
86
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
86
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
87
87
  type: "success" | "warning" | "error";
88
88
  message?: string | undefined;
89
89
  results: any;
@@ -94,7 +94,7 @@ declare const helpers: {
94
94
  c: import("..").TypesCore.Context;
95
95
  }): Response & import("hono").TypedResponse<{
96
96
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
97
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
97
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
98
98
  type: "success" | "warning" | "error";
99
99
  message?: string | undefined;
100
100
  results: any;
@@ -154,7 +154,7 @@ declare const helpers: {
154
154
  with: never;
155
155
  }, 200, "json">) | (Response & import("hono").TypedResponse<{
156
156
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
157
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
157
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
158
158
  type: "success" | "warning" | "error";
159
159
  message?: string | undefined;
160
160
  results: any;
@@ -176,7 +176,7 @@ declare const helpers: {
176
176
  results?: unknown;
177
177
  fn?: string | undefined;
178
178
  }): void;
179
- DATABASE_ERROR({ message, results, erro }: {
179
+ DATABASE_ERROR({ message, erro }: {
180
180
  message?: string | undefined;
181
181
  results?: unknown;
182
182
  fn?: string | undefined;
@@ -193,6 +193,11 @@ declare const helpers: {
193
193
  results?: unknown;
194
194
  fn?: string | undefined;
195
195
  }): void;
196
+ INTEGRATION_ERROR({ message }: {
197
+ message?: string | undefined;
198
+ results?: unknown;
199
+ fn?: string | undefined;
200
+ }): void;
196
201
  INVALID_TOKEN({ message }: {
197
202
  message?: string | undefined;
198
203
  results?: unknown;
@@ -218,7 +223,7 @@ declare const helpers: {
218
223
  token: {
219
224
  verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
220
225
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
221
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
226
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
222
227
  type: "success" | "warning" | "error";
223
228
  message?: string | undefined;
224
229
  results: any;
@@ -228,7 +233,7 @@ declare const helpers: {
228
233
  }): Promise<string>;
229
234
  verificar_token_micro_servico(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
230
235
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
231
- code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN";
236
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR";
232
237
  type: "success" | "warning" | "error";
233
238
  message?: string | undefined;
234
239
  results: any;
@@ -1,8 +1,49 @@
1
1
  import v4 from "zod/v4";
2
+ import { AsyncLocalStorage } from "node:async_hooks";
2
3
  import { SignJWT, jwtVerify } from "jose";
3
4
  import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
4
5
  import { promisify } from "node:util";
5
- import { AsyncLocalStorage } from "node:async_hooks";
6
+ class RequestLoggerClass {
7
+ storage = new AsyncLocalStorage();
8
+ run(callback) {
9
+ return this.storage.run({
10
+ requestId: crypto.randomUUID(),
11
+ logs: [],
12
+ startedAt: Date.now()
13
+ }, callback);
14
+ }
15
+ add(entry) {
16
+ const store = this.storage.getStore();
17
+ if (!store) return;
18
+ store.logs.push({
19
+ ...entry,
20
+ timestamp: Date.now()
21
+ });
22
+ }
23
+ build() {
24
+ const store = this.storage.getStore();
25
+ if (!store || 0 === store.logs.length) return null;
26
+ const durationMs = Date.now() - store.startedAt;
27
+ const level = this.resolveLevel(store.logs);
28
+ const payload = {
29
+ requestId: store.requestId,
30
+ durationMs,
31
+ level,
32
+ logs: store.logs
33
+ };
34
+ const output = JSON.stringify(payload);
35
+ if ("error" === level) console.error(output);
36
+ else console.log(output);
37
+ return payload;
38
+ }
39
+ resolveLevel(logs) {
40
+ if (logs.some((l)=>"error" === l.level)) return "error";
41
+ if (logs.some((l)=>"warn" === l.level)) return "warn";
42
+ return "info";
43
+ }
44
+ }
45
+ const _logger = new RequestLoggerClass();
46
+ const helpers_logger = _logger;
6
47
  const set_response = new class {
7
48
  c = new class {
8
49
  SUCCESS({ message, results, c }) {
@@ -13,6 +54,12 @@ const set_response = new class {
13
54
  message: message || "Realizado com sucesso!",
14
55
  results: results || []
15
56
  };
57
+ helpers_logger.add({
58
+ fn: "SUCCESS",
59
+ level: "info",
60
+ message: payload?.message,
61
+ results: payload?.results
62
+ });
16
63
  return c.json(payload, {
17
64
  status: 200
18
65
  });
@@ -25,6 +72,12 @@ const set_response = new class {
25
72
  message: message || "Ação adicional necessária!",
26
73
  results: results || []
27
74
  };
75
+ helpers_logger.add({
76
+ fn: "ACTION_REQUIRED",
77
+ level: "info",
78
+ message: payload?.message,
79
+ results: payload?.results
80
+ });
28
81
  return c.json(payload, {
29
82
  status: 428
30
83
  });
@@ -37,6 +90,12 @@ const set_response = new class {
37
90
  message: message || "Criado com sucesso!",
38
91
  results: results || []
39
92
  };
93
+ helpers_logger.add({
94
+ fn: "CREATED",
95
+ level: "info",
96
+ message: payload?.message,
97
+ results: payload?.results
98
+ });
40
99
  return c.json(payload, {
41
100
  status: 201
42
101
  });
@@ -49,6 +108,12 @@ const set_response = new class {
49
108
  message: message || "Aviso!",
50
109
  results: results || []
51
110
  };
111
+ helpers_logger.add({
112
+ fn: "WARNING",
113
+ level: "info",
114
+ message: payload?.message,
115
+ results: payload?.results
116
+ });
52
117
  return c.json(payload, {
53
118
  status: 400
54
119
  });
@@ -61,6 +126,12 @@ const set_response = new class {
61
126
  message: message || "Aviso!",
62
127
  results: results || []
63
128
  };
129
+ helpers_logger.add({
130
+ fn: "AUTHORIZATION_ERROR",
131
+ level: "error",
132
+ message: payload?.message,
133
+ results: payload?.results
134
+ });
64
135
  return c.json(payload, {
65
136
  status: 405
66
137
  });
@@ -74,6 +145,12 @@ const set_response = new class {
74
145
  message: "Erro ao validar dados!",
75
146
  results: v4.treeifyError(error)
76
147
  };
148
+ helpers_logger.add({
149
+ fn: "SCHEMA_VALIDATION",
150
+ level: "error",
151
+ message: payload?.message,
152
+ results: payload?.results
153
+ });
77
154
  return c.json(payload, {
78
155
  status: 500
79
156
  });
@@ -85,6 +162,12 @@ const set_response = new class {
85
162
  message: error?.message || "Erro interno no servidor!",
86
163
  results: error?.results || []
87
164
  };
165
+ if (payload?.type === "error") helpers_logger.add({
166
+ fn: "SERVER_ERROR",
167
+ level: payload?.type,
168
+ message: payload?.message,
169
+ results: payload?.results
170
+ });
88
171
  return c.json(payload, {
89
172
  status: error?.status || error?.status || 500
90
173
  });
@@ -97,6 +180,12 @@ const set_response = new class {
97
180
  message: message || "Não autorizado!",
98
181
  results: []
99
182
  };
183
+ helpers_logger.add({
184
+ fn: "UNAUTHORIZED",
185
+ level: "error",
186
+ message: payload?.message,
187
+ results: payload?.results
188
+ });
100
189
  return c.json(payload, {
101
190
  status: 401
102
191
  });
@@ -109,6 +198,12 @@ const set_response = new class {
109
198
  message: message || "Token inválido!",
110
199
  results: []
111
200
  };
201
+ helpers_logger.add({
202
+ fn: "INVALID_TOKEN",
203
+ level: "error",
204
+ message: payload?.message,
205
+ results: payload?.results
206
+ });
112
207
  return c.json(payload, {
113
208
  status: 409
114
209
  });
@@ -121,6 +216,12 @@ const set_response = new class {
121
216
  message: message || "Recurso não encontrado!",
122
217
  results: []
123
218
  };
219
+ helpers_logger.add({
220
+ fn: "NOT_FOUND",
221
+ level: "info",
222
+ message: payload?.message,
223
+ results: payload?.results
224
+ });
124
225
  return c.json(payload, {
125
226
  status: 404
126
227
  });
@@ -131,6 +232,12 @@ const set_response = new class {
131
232
  "Content-Type": content_type,
132
233
  "Content-Disposition": filename ? `inline; filename="${filename}"` : "inline"
133
234
  };
235
+ helpers_logger.add({
236
+ fn: "SUCCESS_FILE",
237
+ level: "info",
238
+ message: "",
239
+ results: headers
240
+ });
134
241
  return c.json(file_buffer, {
135
242
  status: 200,
136
243
  headers
@@ -143,6 +250,12 @@ const set_response = new class {
143
250
  message: message || "Erro ao retornar arquivo!",
144
251
  results: []
145
252
  };
253
+ helpers_logger.add({
254
+ fn: "SUCCESS_FILE",
255
+ level: "info",
256
+ message: payload?.message,
257
+ results: payload?.results
258
+ });
146
259
  return c.json(payload, {
147
260
  status: 200
148
261
  });
@@ -157,6 +270,12 @@ const set_response = new class {
157
270
  message: message || "Ação adicional necessária!",
158
271
  results: results || []
159
272
  };
273
+ helpers_logger.add({
274
+ fn: "ACTION_REQUIRED",
275
+ level: "info",
276
+ message: payload?.message,
277
+ results: payload?.results
278
+ });
160
279
  throw payload;
161
280
  }
162
281
  WARNING({ message, results }) {
@@ -167,6 +286,12 @@ const set_response = new class {
167
286
  message: message || "Aviso!",
168
287
  results: results || []
169
288
  };
289
+ helpers_logger.add({
290
+ fn: "WARNING",
291
+ level: "info",
292
+ message: payload?.message,
293
+ results: payload?.results
294
+ });
170
295
  throw payload;
171
296
  }
172
297
  AUTHORIZATION_ERROR({ message, results }) {
@@ -177,9 +302,15 @@ const set_response = new class {
177
302
  message: message || "Aviso!",
178
303
  results: results || []
179
304
  };
305
+ helpers_logger.add({
306
+ fn: "AUTHORIZATION_ERROR",
307
+ level: "error",
308
+ message: payload?.message,
309
+ results: payload?.results
310
+ });
180
311
  throw payload;
181
312
  }
182
- DATABASE_ERROR({ message, results, erro }) {
313
+ DATABASE_ERROR({ message, erro }) {
183
314
  const errorCode = erro?.cause?.code || erro?.cause?.cause?.code || erro?.code || "";
184
315
  const map = {
185
316
  SQLITE_CONSTRAINT_UNIQUE: {
@@ -222,6 +353,12 @@ const set_response = new class {
222
353
  message: mapped?.message || message || "Erro no banco de dados!",
223
354
  results: []
224
355
  };
356
+ helpers_logger.add({
357
+ fn: "DATABASE_ERROR",
358
+ level: "error",
359
+ message: payload?.message,
360
+ results: erro
361
+ });
225
362
  throw payload;
226
363
  }
227
364
  SCHEMA_VALIDATION({ results }) {
@@ -232,6 +369,12 @@ const set_response = new class {
232
369
  message: "Erro ao validar dados!",
233
370
  results: results || []
234
371
  };
372
+ helpers_logger.add({
373
+ fn: "SCHEMA_VALIDATION",
374
+ level: "error",
375
+ message: payload?.message,
376
+ results: payload?.results
377
+ });
235
378
  throw payload;
236
379
  }
237
380
  UNAUTHORIZED({ message }) {
@@ -241,6 +384,27 @@ const set_response = new class {
241
384
  type: "error",
242
385
  message: message || "Não autorizado!"
243
386
  };
387
+ helpers_logger.add({
388
+ fn: "UNAUTHORIZED",
389
+ level: "error",
390
+ message: payload?.message,
391
+ results: payload?.results
392
+ });
393
+ throw payload;
394
+ }
395
+ INTEGRATION_ERROR({ message }) {
396
+ const payload = {
397
+ status: 401,
398
+ code: "INTEGRATION_ERROR",
399
+ type: "error",
400
+ message: message || "Erro na camada de integração!"
401
+ };
402
+ helpers_logger.add({
403
+ fn: "INTEGRATION_ERROR",
404
+ level: "error",
405
+ message: payload?.message,
406
+ results: payload?.results
407
+ });
244
408
  throw payload;
245
409
  }
246
410
  INVALID_TOKEN({ message }) {
@@ -251,6 +415,12 @@ const set_response = new class {
251
415
  message: message || "Token inválido!",
252
416
  results: []
253
417
  };
418
+ helpers_logger.add({
419
+ fn: "INVALID_TOKEN",
420
+ level: "error",
421
+ message: payload?.message,
422
+ results: payload?.results
423
+ });
254
424
  throw payload;
255
425
  }
256
426
  NOT_FOUND({ message }) {
@@ -260,6 +430,12 @@ const set_response = new class {
260
430
  type: "error",
261
431
  message: message || "Recurso não encontrado!"
262
432
  };
433
+ helpers_logger.add({
434
+ fn: "NOT_FOUND",
435
+ level: "info",
436
+ message: payload?.message,
437
+ results: payload?.results
438
+ });
263
439
  throw payload;
264
440
  }
265
441
  BUSINESS_RULE_VIOLATION({ message, results }) {
@@ -270,6 +446,12 @@ const set_response = new class {
270
446
  message: message || "Limite atingido ou regra de negócio violada!",
271
447
  results: results || []
272
448
  };
449
+ helpers_logger.add({
450
+ fn: "BUSINESS_RULE_VIOLATION",
451
+ level: "info",
452
+ message: payload?.message,
453
+ results: payload?.results
454
+ });
273
455
  throw payload;
274
456
  }
275
457
  PLAN_FORBIDDEN({ message, results }) {
@@ -280,6 +462,12 @@ const set_response = new class {
280
462
  message: message || "Plano inativo ou sem permissão para esta ação!",
281
463
  results: results || []
282
464
  };
465
+ helpers_logger.add({
466
+ fn: "PLAN_FORBIDDEN",
467
+ level: "info",
468
+ message: payload?.message,
469
+ results: payload?.results
470
+ });
283
471
  throw payload;
284
472
  }
285
473
  };
@@ -477,47 +665,6 @@ class _data {
477
665
  }
478
666
  }
479
667
  const helpers_data = new _data;
480
- class RequestLoggerClass {
481
- storage = new AsyncLocalStorage();
482
- run(callback) {
483
- return this.storage.run({
484
- requestId: crypto.randomUUID(),
485
- logs: [],
486
- startedAt: Date.now()
487
- }, callback);
488
- }
489
- add(entry) {
490
- const store = this.storage.getStore();
491
- if (!store) return;
492
- store.logs.push({
493
- ...entry,
494
- timestamp: Date.now()
495
- });
496
- }
497
- build() {
498
- const store = this.storage.getStore();
499
- if (!store || 0 === store.logs.length) return null;
500
- const durationMs = Date.now() - store.startedAt;
501
- const level = this.resolveLevel(store.logs);
502
- const payload = {
503
- requestId: store.requestId,
504
- durationMs,
505
- level,
506
- logs: store.logs
507
- };
508
- const output = JSON.stringify(payload);
509
- if ("error" === level) console.error(output);
510
- else console.log(output);
511
- return payload;
512
- }
513
- resolveLevel(logs) {
514
- if (logs.some((l)=>"error" === l.level)) return "error";
515
- if (logs.some((l)=>"warn" === l.level)) return "warn";
516
- return "info";
517
- }
518
- }
519
- const _logger = new RequestLoggerClass();
520
- const helpers_logger = _logger;
521
668
  const helpers = {
522
669
  set_response: _set_response,
523
670
  token: helpers_token,