@navservice/core 1.29.0 → 1.30.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.
@@ -0,0 +1,9 @@
1
+ interface TypesConfigEnv {
2
+ SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL: string;
3
+ }
4
+ declare class config_env {
5
+ private static SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
6
+ static init(config: TypesConfigEnv): void;
7
+ static get PUBLIC_BASE_URL_BACKEND_PRINCIPAL(): string;
8
+ }
9
+ export default config_env;
@@ -0,0 +1,10 @@
1
+ declare class _secret {
2
+ private static readonly SALT_LENGTH;
3
+ private static readonly KEY_LENGTH;
4
+ static gerar_hash_senha(password: string): Promise<string>;
5
+ static verify({ password, dashed_senha }: {
6
+ password: string;
7
+ dashed_senha: string;
8
+ }): Promise<boolean>;
9
+ }
10
+ export default _secret;
@@ -0,0 +1,84 @@
1
+ import t from "../types";
2
+ type ResponseCOmmit = Omit<t.Geral.Response.C.Input, "type" | "code" | "status">;
3
+ type ResponseErrorOmmit = Omit<t.Geral.Response.Error.Input, "type" | "code" | "status">;
4
+ export type ResponseCPayload<T = unknown> = Omit<t.Geral.Response.C.Input<T>, "c">;
5
+ declare const set_response: {
6
+ new (): {};
7
+ c: {
8
+ new (): {};
9
+ SUCCESS<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
10
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
11
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
12
+ type: "success" | "warning" | "error";
13
+ message?: string | undefined;
14
+ results: any;
15
+ }, 200, "json">);
16
+ ACTION_REQUIRED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
17
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
18
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
19
+ type: "success" | "warning" | "error";
20
+ message?: string | undefined;
21
+ results: any;
22
+ }, 428, "json">);
23
+ CREATED<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
24
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
25
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
26
+ type: "success" | "warning" | "error";
27
+ message?: string | undefined;
28
+ results: any;
29
+ }, 201, "json">);
30
+ WARNING<T>({ message, results, c }: ResponseCOmmit): void;
31
+ AUTHORIZATION_ERROR<T>({ message, results, c }: ResponseCOmmit): void;
32
+ DATABASE_ERROR<T>({ message, results, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
33
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
34
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
35
+ type: "success" | "warning" | "error";
36
+ message?: string | undefined;
37
+ results: any;
38
+ }, 500, "json">);
39
+ SERVER_ERROR<T>({ error, c }: {
40
+ error: any;
41
+ c: t.Context;
42
+ }): Response & import("hono").TypedResponse<{
43
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
44
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
45
+ type: "success" | "warning" | "error";
46
+ message?: string | undefined;
47
+ results: any;
48
+ }, any, "json">;
49
+ UNAUTHORIZED<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
50
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
51
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
52
+ type: "success" | "warning" | "error";
53
+ message?: string | undefined;
54
+ results: any;
55
+ }, 401, "json">);
56
+ INVALID_TOKEN<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (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
+ }, 401, "json">);
63
+ NOT_FOUND<T>({ message, c }: ResponseCOmmit): ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
64
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
65
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
66
+ type: "success" | "warning" | "error";
67
+ message?: string | undefined;
68
+ results: any;
69
+ }, 404, "json">);
70
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: t.Geral.Response.C.FileResponseParams): Promise<Response | ResponseCPayload<unknown>>;
71
+ };
72
+ error: {
73
+ new (): {};
74
+ ACTION_REQUIRED({ message, results }: ResponseErrorOmmit): void;
75
+ WARNING({ message, results }: ResponseErrorOmmit): void;
76
+ AUTHORIZATION_ERROR({ message, results }: ResponseErrorOmmit): void;
77
+ DATABASE_ERROR({ message, results }: ResponseErrorOmmit): void;
78
+ SCHEMA_VALIDATION({ results }: ResponseErrorOmmit): void;
79
+ UNAUTHORIZED({ message }: ResponseErrorOmmit): void;
80
+ INVALID_TOKEN({ message }: ResponseErrorOmmit): void;
81
+ NOT_FOUND({ message }: ResponseErrorOmmit): void;
82
+ };
83
+ };
84
+ export default set_response;
@@ -0,0 +1,16 @@
1
+ import type { Next } from 'hono';
2
+ import t from '../types';
3
+ declare const _token: {
4
+ new (): {};
5
+ verificar_token(c: t.Context, next: Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
6
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
7
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
8
+ type: "success" | "warning" | "error";
9
+ message?: string | undefined;
10
+ results: any;
11
+ }, 401, "json">)>;
12
+ criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: t.Controller.Usuario.TokenPayload & {
13
+ c: t.Context;
14
+ }): Promise<string>;
15
+ };
16
+ export default _token;
@@ -0,0 +1,157 @@
1
+ import _secret from "./_secret";
2
+ declare class helpers {
3
+ static set_response: {
4
+ new (): {};
5
+ c: {
6
+ new (): {};
7
+ SUCCESS<T>({ message, results, c }: {
8
+ message?: string | undefined;
9
+ results: any;
10
+ c: import("../types").default.Context;
11
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
12
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
13
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
14
+ type: "success" | "warning" | "error";
15
+ message?: string | undefined;
16
+ results: any;
17
+ }, 200, "json">);
18
+ ACTION_REQUIRED<T>({ message, results, c }: {
19
+ message?: string | undefined;
20
+ results: any;
21
+ c: import("../types").default.Context;
22
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
23
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
24
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
25
+ type: "success" | "warning" | "error";
26
+ message?: string | undefined;
27
+ results: any;
28
+ }, 428, "json">);
29
+ CREATED<T>({ message, results, c }: {
30
+ message?: string | undefined;
31
+ results: any;
32
+ c: import("../types").default.Context;
33
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
34
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
35
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
36
+ type: "success" | "warning" | "error";
37
+ message?: string | undefined;
38
+ results: any;
39
+ }, 201, "json">);
40
+ WARNING<T>({ message, results, c }: {
41
+ message?: string | undefined;
42
+ results: any;
43
+ c: import("../types").default.Context;
44
+ }): void;
45
+ AUTHORIZATION_ERROR<T>({ message, results, c }: {
46
+ message?: string | undefined;
47
+ results: any;
48
+ c: import("../types").default.Context;
49
+ }): void;
50
+ DATABASE_ERROR<T>({ message, results, c }: {
51
+ message?: string | undefined;
52
+ results: any;
53
+ c: import("../types").default.Context;
54
+ }): import("./_set_response").ResponseCPayload<T> | (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
+ }, 500, "json">);
61
+ SERVER_ERROR<T>({ error, c }: {
62
+ error: any;
63
+ c: import("../types").default.Context;
64
+ }): Response & import("hono").TypedResponse<{
65
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
66
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
67
+ type: "success" | "warning" | "error";
68
+ message?: string | undefined;
69
+ results: any;
70
+ }, any, "json">;
71
+ UNAUTHORIZED<T>({ message, c }: {
72
+ message?: string | undefined;
73
+ results: any;
74
+ c: import("../types").default.Context;
75
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
76
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
77
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
78
+ type: "success" | "warning" | "error";
79
+ message?: string | undefined;
80
+ results: any;
81
+ }, 401, "json">);
82
+ INVALID_TOKEN<T>({ message, c }: {
83
+ message?: string | undefined;
84
+ results: any;
85
+ c: import("../types").default.Context;
86
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
87
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
88
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
89
+ type: "success" | "warning" | "error";
90
+ message?: string | undefined;
91
+ results: any;
92
+ }, 401, "json">);
93
+ NOT_FOUND<T>({ message, c }: {
94
+ message?: string | undefined;
95
+ results: any;
96
+ c: import("../types").default.Context;
97
+ }): import("./_set_response").ResponseCPayload<T> | (Response & import("hono").TypedResponse<{
98
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
99
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
100
+ type: "success" | "warning" | "error";
101
+ message?: string | undefined;
102
+ results: any;
103
+ }, 404, "json">);
104
+ SUCCESS_FILE({ message, file_buffer, content_type, filename, c }: import("../types/_type_response").default.C.FileResponseParams): Promise<Response | import("./_set_response").ResponseCPayload<unknown>>;
105
+ };
106
+ error: {
107
+ new (): {};
108
+ ACTION_REQUIRED({ message, results }: {
109
+ message?: string | undefined;
110
+ results?: unknown;
111
+ }): void;
112
+ WARNING({ message, results }: {
113
+ message?: string | undefined;
114
+ results?: unknown;
115
+ }): void;
116
+ AUTHORIZATION_ERROR({ message, results }: {
117
+ message?: string | undefined;
118
+ results?: unknown;
119
+ }): void;
120
+ DATABASE_ERROR({ message, results }: {
121
+ message?: string | undefined;
122
+ results?: unknown;
123
+ }): void;
124
+ SCHEMA_VALIDATION({ results }: {
125
+ message?: string | undefined;
126
+ results?: unknown;
127
+ }): void;
128
+ UNAUTHORIZED({ message }: {
129
+ message?: string | undefined;
130
+ results?: unknown;
131
+ }): void;
132
+ INVALID_TOKEN({ message }: {
133
+ message?: string | undefined;
134
+ results?: unknown;
135
+ }): void;
136
+ NOT_FOUND({ message }: {
137
+ message?: string | undefined;
138
+ results?: unknown;
139
+ }): void;
140
+ };
141
+ };
142
+ static token: {
143
+ new (): {};
144
+ verificar_token(c: import("../types").default.Context, next: import("hono").Next): Promise<void | import("./_set_response").ResponseCPayload<unknown> | (Response & import("hono").TypedResponse<{
145
+ status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
146
+ code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
147
+ type: "success" | "warning" | "error";
148
+ message?: string | undefined;
149
+ results: any;
150
+ }, 401, "json">)>;
151
+ criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: import("../types/_usuario").default.TokenPayload & {
152
+ c: import("../types").default.Context;
153
+ }): Promise<string>;
154
+ };
155
+ static secret: typeof _secret;
156
+ }
157
+ export default helpers;