@navservice/core 1.92.0 → 1.93.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,29 +6,41 @@ declare const set_response: {
6
6
  new (): {};
7
7
  c: {
8
8
  new (): {};
9
- SUCCESS<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
9
+ SUCCESS<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
10
10
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
11
11
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
12
12
  type: "success" | "warning" | "error";
13
13
  message?: string | undefined;
14
14
  results: any;
15
- }, 200, "json">);
16
- ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
15
+ }, 200, "json">;
16
+ ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
17
17
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
18
18
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
19
19
  type: "success" | "warning" | "error";
20
20
  message?: string | undefined;
21
21
  results: any;
22
- }, 428, "json">);
23
- CREATED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
22
+ }, 428, "json">;
23
+ CREATED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
24
24
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
25
25
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
26
26
  type: "success" | "warning" | "error";
27
27
  message?: string | undefined;
28
28
  results: any;
29
- }, 201, "json">);
30
- WARNING<T>({ message, results, c }: ResponseCOmmit): void;
31
- AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): void;
29
+ }, 201, "json">;
30
+ WARNING<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
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";
33
+ type: "success" | "warning" | "error";
34
+ message?: string | undefined;
35
+ results: any;
36
+ }, 400, "json">;
37
+ AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
38
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
39
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
40
+ type: "success" | "warning" | "error";
41
+ message?: string | undefined;
42
+ results: any;
43
+ }, 405, "json">;
32
44
  SERVER_ERROR<T>({ error, c }: {
33
45
  error: any;
34
46
  c: t.Context;
@@ -39,28 +51,87 @@ declare const set_response: {
39
51
  message?: string | undefined;
40
52
  results: any;
41
53
  }, any, "json">;
42
- UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
54
+ UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
55
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
56
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
57
+ type: "success" | "warning" | "error";
58
+ message?: string | undefined;
59
+ results: any;
60
+ }, 401, "json">;
61
+ INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
43
62
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
44
63
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
45
64
  type: "success" | "warning" | "error";
46
65
  message?: string | undefined;
47
66
  results: any;
48
- }, 401, "json">);
49
- INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
67
+ }, 409, "json">;
68
+ NOT_FOUND<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
50
69
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
51
70
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
52
71
  type: "success" | "warning" | "error";
53
72
  message?: string | undefined;
54
73
  results: any;
55
- }, 401, "json">);
56
- NOT_FOUND<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
74
+ }, 404, "json">;
75
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: t.Geral.Response.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
76
+ readonly byteLength: number;
77
+ slice: never;
78
+ readonly maxByteLength: number;
79
+ readonly resizable: boolean;
80
+ resize: never;
81
+ readonly detached: boolean;
82
+ transfer: never;
83
+ transferToFixedLength: never;
84
+ } | {
85
+ readonly size: number;
86
+ readonly type: string;
87
+ slice: never;
88
+ } | {
89
+ [x: number]: number;
90
+ readonly BYTES_PER_ELEMENT: number;
91
+ readonly buffer: {
92
+ readonly byteLength: number;
93
+ slice: never;
94
+ readonly maxByteLength: number;
95
+ readonly resizable: boolean;
96
+ resize: never;
97
+ readonly detached: boolean;
98
+ transfer: never;
99
+ transferToFixedLength: never;
100
+ };
101
+ readonly byteLength: number;
102
+ readonly byteOffset: number;
103
+ copyWithin: never;
104
+ every: never;
105
+ fill: never;
106
+ filter: never;
107
+ find: never;
108
+ findIndex: never;
109
+ forEach: never;
110
+ indexOf: never;
111
+ join: never;
112
+ lastIndexOf: never;
113
+ readonly length: number;
114
+ map: never;
115
+ reduce: never;
116
+ reduceRight: never;
117
+ set: never;
118
+ slice: never;
119
+ some: never;
120
+ sort: never;
121
+ subarray: never;
122
+ includes: never;
123
+ at: never;
124
+ findLast: never;
125
+ findLastIndex: never;
126
+ toSorted: never;
127
+ with: never;
128
+ }, 200, "json">) | (Response & import("hono").TypedResponse<{
57
129
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
58
130
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
59
131
  type: "success" | "warning" | "error";
60
132
  message?: string | undefined;
61
133
  results: any;
62
- }, 404, "json">);
63
- SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: t.Geral.Response.C.FileResponseParams): Promise<Response | ResponseCPayload<unknown>>;
134
+ }, 200, "json">)>;
64
135
  };
65
136
  error: {
66
137
  new (): {};
@@ -2,13 +2,13 @@ import type { Next } from 'hono';
2
2
  import t from '../types';
3
3
  declare const _token: {
4
4
  new (): {};
5
- verificar_token(c: t.Context, next: Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
5
+ verificar_token(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
6
6
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
7
7
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
8
8
  type: "success" | "warning" | "error";
9
9
  message?: string | undefined;
10
10
  results: any;
11
- }, 401, "json">)>;
11
+ }, 409, "json">)>;
12
12
  criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: t.Controller.Usuario.TokenPayload & {
13
13
  c: t.Context;
14
14
  }): Promise<string>;
@@ -9,45 +9,57 @@ declare const helpers: {
9
9
  message?: string | undefined;
10
10
  results: any;
11
11
  c: import("..").TypesCore.Context;
12
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
12
+ }): Response & import("hono").TypedResponse<{
13
13
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
14
14
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
15
15
  type: "success" | "warning" | "error";
16
16
  message?: string | undefined;
17
17
  results: any;
18
- }, 200, "json">);
18
+ }, 200, "json">;
19
19
  ACTION_REQUIRED<T>({ message, results, c }: {
20
20
  message?: string | undefined;
21
21
  results: any;
22
22
  c: import("..").TypesCore.Context;
23
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
23
+ }): Response & import("hono").TypedResponse<{
24
24
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
25
25
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
26
26
  type: "success" | "warning" | "error";
27
27
  message?: string | undefined;
28
28
  results: any;
29
- }, 428, "json">);
29
+ }, 428, "json">;
30
30
  CREATED<T>({ message, results, c }: {
31
31
  message?: string | undefined;
32
32
  results: any;
33
33
  c: import("..").TypesCore.Context;
34
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
34
+ }): Response & import("hono").TypedResponse<{
35
35
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
36
36
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
37
37
  type: "success" | "warning" | "error";
38
38
  message?: string | undefined;
39
39
  results: any;
40
- }, 201, "json">);
40
+ }, 201, "json">;
41
41
  WARNING<T>({ message, results, c }: {
42
42
  message?: string | undefined;
43
43
  results: any;
44
44
  c: import("..").TypesCore.Context;
45
- }): void;
45
+ }): Response & import("hono").TypedResponse<{
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";
48
+ type: "success" | "warning" | "error";
49
+ message?: string | undefined;
50
+ results: any;
51
+ }, 400, "json">;
46
52
  AUTHORIZATION_ERROR<T>({ message, results, c }: {
47
53
  message?: string | undefined;
48
54
  results: any;
49
55
  c: import("..").TypesCore.Context;
50
- }): void;
56
+ }): Response & import("hono").TypedResponse<{
57
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
58
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
59
+ type: "success" | "warning" | "error";
60
+ message?: string | undefined;
61
+ results: any;
62
+ }, 405, "json">;
51
63
  SERVER_ERROR<T>({ error, c }: {
52
64
  error: any;
53
65
  c: import("..").TypesCore.Context;
@@ -62,36 +74,95 @@ declare const helpers: {
62
74
  message?: string | undefined;
63
75
  results: any;
64
76
  c: import("..").TypesCore.Context;
65
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
77
+ }): Response & import("hono").TypedResponse<{
66
78
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
67
79
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
68
80
  type: "success" | "warning" | "error";
69
81
  message?: string | undefined;
70
82
  results: any;
71
- }, 401, "json">);
83
+ }, 401, "json">;
72
84
  INVALID_TOKEN<T>({ message, c }: {
73
85
  message?: string | undefined;
74
86
  results: any;
75
87
  c: import("..").TypesCore.Context;
76
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
88
+ }): Response & import("hono").TypedResponse<{
77
89
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
78
90
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
79
91
  type: "success" | "warning" | "error";
80
92
  message?: string | undefined;
81
93
  results: any;
82
- }, 401, "json">);
94
+ }, 409, "json">;
83
95
  NOT_FOUND<T>({ message, c }: {
84
96
  message?: string | undefined;
85
97
  results: any;
86
98
  c: import("..").TypesCore.Context;
87
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
99
+ }): Response & import("hono").TypedResponse<{
100
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
101
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
102
+ type: "success" | "warning" | "error";
103
+ message?: string | undefined;
104
+ results: any;
105
+ }, 404, "json">;
106
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: import("../types/_type_response").default.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
107
+ readonly byteLength: number;
108
+ slice: never;
109
+ readonly maxByteLength: number;
110
+ readonly resizable: boolean;
111
+ resize: never;
112
+ readonly detached: boolean;
113
+ transfer: never;
114
+ transferToFixedLength: never;
115
+ } | {
116
+ readonly size: number;
117
+ readonly type: string;
118
+ slice: never;
119
+ } | {
120
+ [x: number]: number;
121
+ readonly BYTES_PER_ELEMENT: number;
122
+ readonly buffer: {
123
+ readonly byteLength: number;
124
+ slice: never;
125
+ readonly maxByteLength: number;
126
+ readonly resizable: boolean;
127
+ resize: never;
128
+ readonly detached: boolean;
129
+ transfer: never;
130
+ transferToFixedLength: never;
131
+ };
132
+ readonly byteLength: number;
133
+ readonly byteOffset: number;
134
+ copyWithin: never;
135
+ every: never;
136
+ fill: never;
137
+ filter: never;
138
+ find: never;
139
+ findIndex: never;
140
+ forEach: never;
141
+ indexOf: never;
142
+ join: never;
143
+ lastIndexOf: never;
144
+ readonly length: number;
145
+ map: never;
146
+ reduce: never;
147
+ reduceRight: never;
148
+ set: never;
149
+ slice: never;
150
+ some: never;
151
+ sort: never;
152
+ subarray: never;
153
+ includes: never;
154
+ at: never;
155
+ findLast: never;
156
+ findLastIndex: never;
157
+ toSorted: never;
158
+ with: never;
159
+ }, 200, "json">) | (Response & import("hono").TypedResponse<{
88
160
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
89
161
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
90
162
  type: "success" | "warning" | "error";
91
163
  message?: string | undefined;
92
164
  results: any;
93
- }, 404, "json">);
94
- SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: import("../types/_type_response").default.C.FileResponseParams): Promise<Response | import("./_set_response").ResponseCPayload<unknown>>;
165
+ }, 200, "json">)>;
95
166
  };
96
167
  error: {
97
168
  new (): {};
@@ -133,13 +204,13 @@ declare const helpers: {
133
204
  };
134
205
  token: {
135
206
  new (): {};
136
- verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
207
+ verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
137
208
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
138
209
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
139
210
  type: "success" | "warning" | "error";
140
211
  message?: string | undefined;
141
212
  results: any;
142
- }, 401, "json">)>;
213
+ }, 409, "json">)>;
143
214
  criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: import("../types/_usuario").default.TokenPayload & {
144
215
  c: import("..").TypesCore.Context;
145
216
  }): Promise<string>;
@@ -12,10 +12,9 @@ const set_response = class {
12
12
  message: message || "Realizado com sucesso!",
13
13
  results: results || []
14
14
  };
15
- if (c) return c.json(payload, {
15
+ return c.json(payload, {
16
16
  status: 200
17
17
  });
18
- return payload;
19
18
  }
20
19
  static ACTION_REQUIRED({ message, results, c }) {
21
20
  const payload = {
@@ -25,10 +24,9 @@ const set_response = class {
25
24
  message: message || "Ação adicional necessária!",
26
25
  results: results || []
27
26
  };
28
- if (c) return c.json(payload, {
27
+ return c.json(payload, {
29
28
  status: 428
30
29
  });
31
- return payload;
32
30
  }
33
31
  static CREATED({ message, results, c }) {
34
32
  const payload = {
@@ -38,9 +36,9 @@ const set_response = class {
38
36
  message: message || "Criado com sucesso!",
39
37
  results: results || []
40
38
  };
41
- return c ? c.json(payload, {
39
+ return c.json(payload, {
42
40
  status: 201
43
- }) : payload;
41
+ });
44
42
  }
45
43
  static WARNING({ message, results, c }) {
46
44
  const payload = {
@@ -50,10 +48,9 @@ const set_response = class {
50
48
  message: message || "Aviso!",
51
49
  results: results || []
52
50
  };
53
- if (c) c.json(payload, {
51
+ return c.json(payload, {
54
52
  status: 400
55
53
  });
56
- throw payload;
57
54
  }
58
55
  static AUTHORIZATION_ERROR({ message, results, c }) {
59
56
  const payload = {
@@ -63,10 +60,9 @@ const set_response = class {
63
60
  message: message || "Aviso!",
64
61
  results: results || []
65
62
  };
66
- if (c) c.json(payload, {
63
+ return c.json(payload, {
67
64
  status: 405
68
65
  });
69
- throw payload;
70
66
  }
71
67
  static SERVER_ERROR({ error, c }) {
72
68
  if (error instanceof v4.ZodError) {
@@ -100,21 +96,21 @@ const set_response = class {
100
96
  message: message || "Não autorizado!",
101
97
  results: []
102
98
  };
103
- return c ? c.json(payload, {
99
+ return c.json(payload, {
104
100
  status: 401
105
- }) : payload;
101
+ });
106
102
  }
107
103
  static INVALID_TOKEN({ message, c }) {
108
104
  const payload = {
109
- status: 401,
105
+ status: 409,
110
106
  code: "INVALID_TOKEN",
111
107
  type: "warning",
112
108
  message: message || "Token inválido!",
113
109
  results: []
114
110
  };
115
- return c ? c.json(payload, {
116
- status: 401
117
- }) : payload;
111
+ return c.json(payload, {
112
+ status: 409
113
+ });
118
114
  }
119
115
  static NOT_FOUND({ message, c }) {
120
116
  const payload = {
@@ -124,9 +120,9 @@ const set_response = class {
124
120
  message: message || "Recurso não encontrado!",
125
121
  results: []
126
122
  };
127
- return c ? c.json(payload, {
123
+ return c.json(payload, {
128
124
  status: 404
129
- }) : payload;
125
+ });
130
126
  }
131
127
  static async SUCCESS_FILE({ message, file_buffer, content_type, filename, c }) {
132
128
  if (c && content_type) {
@@ -134,7 +130,7 @@ const set_response = class {
134
130
  "Content-Type": content_type,
135
131
  "Content-Disposition": filename ? `inline; filename="${filename}"` : "inline"
136
132
  };
137
- return new Response(file_buffer, {
133
+ return c.json(file_buffer, {
138
134
  status: 200,
139
135
  headers
140
136
  });
@@ -146,9 +142,9 @@ const set_response = class {
146
142
  message: message || "Erro ao retornar arquivo!",
147
143
  results: []
148
144
  };
149
- return c ? c.json(payload, {
145
+ return c.json(payload, {
150
146
  status: 200
151
- }) : payload;
147
+ });
152
148
  }
153
149
  };
154
150
  static error = class {
package/build/es/index.js CHANGED
@@ -81,7 +81,7 @@ var _usuario_TypeControllerUsuario;
81
81
  ]),
82
82
  content_type: v4.string(),
83
83
  filename: v4.string().optional(),
84
- c: v4.custom().optional()
84
+ c: v4.custom()
85
85
  });
86
86
  })(TypeControllerResponse.C || (TypeControllerResponse.C = {}));
87
87
  (function(Error1) {
@@ -31,7 +31,7 @@ declare namespace TypeControllerResponse {
31
31
  file_buffer: z4.ZodUnion<readonly [z4.ZodCustom<Blob, Blob>, z4.ZodCustom<ArrayBuffer, ArrayBuffer>, z4.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
32
32
  content_type: z4.ZodString;
33
33
  filename: z4.ZodOptional<z4.ZodString>;
34
- c: z4.ZodOptional<z4.ZodCustom<t.Context, t.Context>>;
34
+ c: z4.ZodCustom<t.Context, t.Context>;
35
35
  }, z4.core.$strip>;
36
36
  export type FileResponseParams = z4.infer<typeof FileResponseParamsSchema>;
37
37
  export {};
@@ -6,29 +6,41 @@ declare const set_response: {
6
6
  new (): {};
7
7
  c: {
8
8
  new (): {};
9
- SUCCESS<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
9
+ SUCCESS<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
10
10
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
11
11
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
12
12
  type: "success" | "warning" | "error";
13
13
  message?: string | undefined;
14
14
  results: any;
15
- }, 200, "json">);
16
- ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
15
+ }, 200, "json">;
16
+ ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
17
17
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
18
18
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
19
19
  type: "success" | "warning" | "error";
20
20
  message?: string | undefined;
21
21
  results: any;
22
- }, 428, "json">);
23
- CREATED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
22
+ }, 428, "json">;
23
+ CREATED<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
24
24
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
25
25
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
26
26
  type: "success" | "warning" | "error";
27
27
  message?: string | undefined;
28
28
  results: any;
29
- }, 201, "json">);
30
- WARNING<T>({ message, results, c }: ResponseCOmmit): void;
31
- AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): void;
29
+ }, 201, "json">;
30
+ WARNING<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
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";
33
+ type: "success" | "warning" | "error";
34
+ message?: string | undefined;
35
+ results: any;
36
+ }, 400, "json">;
37
+ AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
38
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
39
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
40
+ type: "success" | "warning" | "error";
41
+ message?: string | undefined;
42
+ results: any;
43
+ }, 405, "json">;
32
44
  SERVER_ERROR<T>({ error, c }: {
33
45
  error: any;
34
46
  c: t.Context;
@@ -39,28 +51,87 @@ declare const set_response: {
39
51
  message?: string | undefined;
40
52
  results: any;
41
53
  }, any, "json">;
42
- UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
54
+ UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
55
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
56
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
57
+ type: "success" | "warning" | "error";
58
+ message?: string | undefined;
59
+ results: any;
60
+ }, 401, "json">;
61
+ INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
43
62
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
44
63
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
45
64
  type: "success" | "warning" | "error";
46
65
  message?: string | undefined;
47
66
  results: any;
48
- }, 401, "json">);
49
- INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
67
+ }, 409, "json">;
68
+ NOT_FOUND<T>({ message, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
50
69
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
51
70
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
52
71
  type: "success" | "warning" | "error";
53
72
  message?: string | undefined;
54
73
  results: any;
55
- }, 401, "json">);
56
- NOT_FOUND<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
74
+ }, 404, "json">;
75
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: t.Geral.Response.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
76
+ readonly byteLength: number;
77
+ slice: never;
78
+ readonly maxByteLength: number;
79
+ readonly resizable: boolean;
80
+ resize: never;
81
+ readonly detached: boolean;
82
+ transfer: never;
83
+ transferToFixedLength: never;
84
+ } | {
85
+ readonly size: number;
86
+ readonly type: string;
87
+ slice: never;
88
+ } | {
89
+ [x: number]: number;
90
+ readonly BYTES_PER_ELEMENT: number;
91
+ readonly buffer: {
92
+ readonly byteLength: number;
93
+ slice: never;
94
+ readonly maxByteLength: number;
95
+ readonly resizable: boolean;
96
+ resize: never;
97
+ readonly detached: boolean;
98
+ transfer: never;
99
+ transferToFixedLength: never;
100
+ };
101
+ readonly byteLength: number;
102
+ readonly byteOffset: number;
103
+ copyWithin: never;
104
+ every: never;
105
+ fill: never;
106
+ filter: never;
107
+ find: never;
108
+ findIndex: never;
109
+ forEach: never;
110
+ indexOf: never;
111
+ join: never;
112
+ lastIndexOf: never;
113
+ readonly length: number;
114
+ map: never;
115
+ reduce: never;
116
+ reduceRight: never;
117
+ set: never;
118
+ slice: never;
119
+ some: never;
120
+ sort: never;
121
+ subarray: never;
122
+ includes: never;
123
+ at: never;
124
+ findLast: never;
125
+ findLastIndex: never;
126
+ toSorted: never;
127
+ with: never;
128
+ }, 200, "json">) | (Response & import("hono").TypedResponse<{
57
129
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
58
130
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
59
131
  type: "success" | "warning" | "error";
60
132
  message?: string | undefined;
61
133
  results: any;
62
- }, 404, "json">);
63
- SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: t.Geral.Response.C.FileResponseParams): Promise<Response | ResponseCPayload<unknown>>;
134
+ }, 200, "json">)>;
64
135
  };
65
136
  error: {
66
137
  new (): {};
@@ -2,13 +2,13 @@ import type { Next } from 'hono';
2
2
  import t from '../types';
3
3
  declare const _token: {
4
4
  new (): {};
5
- verificar_token(c: t.Context, next: Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
5
+ verificar_token(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
6
6
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
7
7
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
8
8
  type: "success" | "warning" | "error";
9
9
  message?: string | undefined;
10
10
  results: any;
11
- }, 401, "json">)>;
11
+ }, 409, "json">)>;
12
12
  criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: t.Controller.Usuario.TokenPayload & {
13
13
  c: t.Context;
14
14
  }): Promise<string>;
@@ -9,45 +9,57 @@ declare const helpers: {
9
9
  message?: string | undefined;
10
10
  results: any;
11
11
  c: import("..").TypesCore.Context;
12
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
12
+ }): Response & import("hono").TypedResponse<{
13
13
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
14
14
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
15
15
  type: "success" | "warning" | "error";
16
16
  message?: string | undefined;
17
17
  results: any;
18
- }, 200, "json">);
18
+ }, 200, "json">;
19
19
  ACTION_REQUIRED<T>({ message, results, c }: {
20
20
  message?: string | undefined;
21
21
  results: any;
22
22
  c: import("..").TypesCore.Context;
23
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
23
+ }): Response & import("hono").TypedResponse<{
24
24
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
25
25
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
26
26
  type: "success" | "warning" | "error";
27
27
  message?: string | undefined;
28
28
  results: any;
29
- }, 428, "json">);
29
+ }, 428, "json">;
30
30
  CREATED<T>({ message, results, c }: {
31
31
  message?: string | undefined;
32
32
  results: any;
33
33
  c: import("..").TypesCore.Context;
34
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
34
+ }): Response & import("hono").TypedResponse<{
35
35
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
36
36
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
37
37
  type: "success" | "warning" | "error";
38
38
  message?: string | undefined;
39
39
  results: any;
40
- }, 201, "json">);
40
+ }, 201, "json">;
41
41
  WARNING<T>({ message, results, c }: {
42
42
  message?: string | undefined;
43
43
  results: any;
44
44
  c: import("..").TypesCore.Context;
45
- }): void;
45
+ }): Response & import("hono").TypedResponse<{
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";
48
+ type: "success" | "warning" | "error";
49
+ message?: string | undefined;
50
+ results: any;
51
+ }, 400, "json">;
46
52
  AUTHORIZATION_ERROR<T>({ message, results, c }: {
47
53
  message?: string | undefined;
48
54
  results: any;
49
55
  c: import("..").TypesCore.Context;
50
- }): void;
56
+ }): Response & import("hono").TypedResponse<{
57
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
58
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
59
+ type: "success" | "warning" | "error";
60
+ message?: string | undefined;
61
+ results: any;
62
+ }, 405, "json">;
51
63
  SERVER_ERROR<T>({ error, c }: {
52
64
  error: any;
53
65
  c: import("..").TypesCore.Context;
@@ -62,36 +74,95 @@ declare const helpers: {
62
74
  message?: string | undefined;
63
75
  results: any;
64
76
  c: import("..").TypesCore.Context;
65
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
77
+ }): Response & import("hono").TypedResponse<{
66
78
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
67
79
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
68
80
  type: "success" | "warning" | "error";
69
81
  message?: string | undefined;
70
82
  results: any;
71
- }, 401, "json">);
83
+ }, 401, "json">;
72
84
  INVALID_TOKEN<T>({ message, c }: {
73
85
  message?: string | undefined;
74
86
  results: any;
75
87
  c: import("..").TypesCore.Context;
76
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
88
+ }): Response & import("hono").TypedResponse<{
77
89
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
78
90
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
79
91
  type: "success" | "warning" | "error";
80
92
  message?: string | undefined;
81
93
  results: any;
82
- }, 401, "json">);
94
+ }, 409, "json">;
83
95
  NOT_FOUND<T>({ message, c }: {
84
96
  message?: string | undefined;
85
97
  results: any;
86
98
  c: import("..").TypesCore.Context;
87
- }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
99
+ }): Response & import("hono").TypedResponse<{
100
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
101
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
102
+ type: "success" | "warning" | "error";
103
+ message?: string | undefined;
104
+ results: any;
105
+ }, 404, "json">;
106
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: import("../types/_type_response").default.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
107
+ readonly byteLength: number;
108
+ slice: never;
109
+ readonly maxByteLength: number;
110
+ readonly resizable: boolean;
111
+ resize: never;
112
+ readonly detached: boolean;
113
+ transfer: never;
114
+ transferToFixedLength: never;
115
+ } | {
116
+ readonly size: number;
117
+ readonly type: string;
118
+ slice: never;
119
+ } | {
120
+ [x: number]: number;
121
+ readonly BYTES_PER_ELEMENT: number;
122
+ readonly buffer: {
123
+ readonly byteLength: number;
124
+ slice: never;
125
+ readonly maxByteLength: number;
126
+ readonly resizable: boolean;
127
+ resize: never;
128
+ readonly detached: boolean;
129
+ transfer: never;
130
+ transferToFixedLength: never;
131
+ };
132
+ readonly byteLength: number;
133
+ readonly byteOffset: number;
134
+ copyWithin: never;
135
+ every: never;
136
+ fill: never;
137
+ filter: never;
138
+ find: never;
139
+ findIndex: never;
140
+ forEach: never;
141
+ indexOf: never;
142
+ join: never;
143
+ lastIndexOf: never;
144
+ readonly length: number;
145
+ map: never;
146
+ reduce: never;
147
+ reduceRight: never;
148
+ set: never;
149
+ slice: never;
150
+ some: never;
151
+ sort: never;
152
+ subarray: never;
153
+ includes: never;
154
+ at: never;
155
+ findLast: never;
156
+ findLastIndex: never;
157
+ toSorted: never;
158
+ with: never;
159
+ }, 200, "json">) | (Response & import("hono").TypedResponse<{
88
160
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
89
161
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
90
162
  type: "success" | "warning" | "error";
91
163
  message?: string | undefined;
92
164
  results: any;
93
- }, 404, "json">);
94
- SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: import("../types/_type_response").default.C.FileResponseParams): Promise<Response | import("./_set_response").ResponseCPayload<unknown>>;
165
+ }, 200, "json">)>;
95
166
  };
96
167
  error: {
97
168
  new (): {};
@@ -133,13 +204,13 @@ declare const helpers: {
133
204
  };
134
205
  token: {
135
206
  new (): {};
136
- verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
207
+ verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
137
208
  status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
138
209
  code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
139
210
  type: "success" | "warning" | "error";
140
211
  message?: string | undefined;
141
212
  results: any;
142
- }, 401, "json">)>;
213
+ }, 409, "json">)>;
143
214
  criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: import("../types/_usuario").default.TokenPayload & {
144
215
  c: import("..").TypesCore.Context;
145
216
  }): Promise<string>;
@@ -70,12 +70,9 @@ const set_response = class set_response {
70
70
  message: message || "Realizado com sucesso!",
71
71
  results: results || []
72
72
  };
73
- if (c) {
74
- return c.json(payload, {
75
- status: 200
76
- });
77
- }
78
- return payload;
73
+ return c.json(payload, {
74
+ status: 200
75
+ });
79
76
  }
80
77
  static ACTION_REQUIRED({ message, results, c }) {
81
78
  const payload = {
@@ -85,12 +82,9 @@ const set_response = class set_response {
85
82
  message: message || "Ação adicional necessária!",
86
83
  results: results || []
87
84
  };
88
- if (c) {
89
- return c.json(payload, {
90
- status: 428
91
- });
92
- }
93
- return payload;
85
+ return c.json(payload, {
86
+ status: 428
87
+ });
94
88
  }
95
89
  static CREATED({ message, results, c }) {
96
90
  const payload = {
@@ -100,9 +94,9 @@ const set_response = class set_response {
100
94
  message: message || "Criado com sucesso!",
101
95
  results: results || []
102
96
  };
103
- return c ? c.json(payload, {
97
+ return c.json(payload, {
104
98
  status: 201
105
- }) : payload;
99
+ });
106
100
  }
107
101
  static WARNING({ message, results, c }) {
108
102
  const payload = {
@@ -112,10 +106,9 @@ const set_response = class set_response {
112
106
  message: message || "Aviso!",
113
107
  results: results || []
114
108
  };
115
- if (c) c.json(payload, {
109
+ return c.json(payload, {
116
110
  status: 400
117
111
  });
118
- throw payload;
119
112
  }
120
113
  static AUTHORIZATION_ERROR({ message, results, c }) {
121
114
  const payload = {
@@ -125,10 +118,9 @@ const set_response = class set_response {
125
118
  message: message || "Aviso!",
126
119
  results: results || []
127
120
  };
128
- if (c) c.json(payload, {
121
+ return c.json(payload, {
129
122
  status: 405
130
123
  });
131
- throw payload;
132
124
  }
133
125
  static SERVER_ERROR({ error, c }) {
134
126
  if (error instanceof (v4_default()).ZodError) {
@@ -162,21 +154,21 @@ const set_response = class set_response {
162
154
  message: message || "Não autorizado!",
163
155
  results: []
164
156
  };
165
- return c ? c.json(payload, {
157
+ return c.json(payload, {
166
158
  status: 401
167
- }) : payload;
159
+ });
168
160
  }
169
161
  static INVALID_TOKEN({ message, c }) {
170
162
  const payload = {
171
- status: 401,
163
+ status: 409,
172
164
  code: "INVALID_TOKEN",
173
165
  type: "warning",
174
166
  message: message || "Token inválido!",
175
167
  results: []
176
168
  };
177
- return c ? c.json(payload, {
178
- status: 401
179
- }) : payload;
169
+ return c.json(payload, {
170
+ status: 409
171
+ });
180
172
  }
181
173
  static NOT_FOUND({ message, c }) {
182
174
  const payload = {
@@ -186,9 +178,9 @@ const set_response = class set_response {
186
178
  message: message || "Recurso não encontrado!",
187
179
  results: []
188
180
  };
189
- return c ? c.json(payload, {
181
+ return c.json(payload, {
190
182
  status: 404
191
- }) : payload;
183
+ });
192
184
  }
193
185
  static async SUCCESS_FILE({ message, file_buffer, content_type, filename, c }) {
194
186
  if (c && content_type) {
@@ -196,7 +188,7 @@ const set_response = class set_response {
196
188
  "Content-Type": content_type,
197
189
  "Content-Disposition": filename ? `inline; filename="${filename}"` : "inline"
198
190
  };
199
- return new Response(file_buffer, {
191
+ return c.json(file_buffer, {
200
192
  status: 200,
201
193
  headers
202
194
  });
@@ -208,9 +200,9 @@ const set_response = class set_response {
208
200
  message: message || "Erro ao retornar arquivo!",
209
201
  results: []
210
202
  };
211
- return c ? c.json(payload, {
203
+ return c.json(payload, {
212
204
  status: 200
213
- }) : payload;
205
+ });
214
206
  }
215
207
  };
216
208
  static error = class error {
@@ -143,7 +143,7 @@ var _usuario_TypeControllerUsuario;
143
143
  ]),
144
144
  content_type: v4_default().string(),
145
145
  filename: v4_default().string().optional(),
146
- c: v4_default().custom().optional()
146
+ c: v4_default().custom()
147
147
  });
148
148
  })(TypeControllerResponse.C || (TypeControllerResponse.C = {}));
149
149
  (function(Error) {
@@ -31,7 +31,7 @@ declare namespace TypeControllerResponse {
31
31
  file_buffer: z4.ZodUnion<readonly [z4.ZodCustom<Blob, Blob>, z4.ZodCustom<ArrayBuffer, ArrayBuffer>, z4.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
32
32
  content_type: z4.ZodString;
33
33
  filename: z4.ZodOptional<z4.ZodString>;
34
- c: z4.ZodOptional<z4.ZodCustom<t.Context, t.Context>>;
34
+ c: z4.ZodCustom<t.Context, t.Context>;
35
35
  }, z4.core.$strip>;
36
36
  export type FileResponseParams = z4.infer<typeof FileResponseParamsSchema>;
37
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.92.0",
3
+ "version": "1.93.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {