@navservice/core 1.129.0 → 1.132.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.
- package/build/es/helpers/_secret.d.ts +0 -1
- package/build/es/helpers/_set_response.d.ts +20 -20
- package/build/es/helpers/_token.d.ts +4 -4
- package/build/es/helpers/index.d.ts +45 -46
- package/build/es/helpers.js +32 -36
- package/build/es/types/_usuario.d.ts +3 -3
- package/build/es/types/index.d.ts +3 -4
- package/build/lib/helpers/_secret.d.ts +0 -1
- package/build/lib/helpers/_set_response.d.ts +20 -20
- package/build/lib/helpers/_token.d.ts +4 -4
- package/build/lib/helpers/index.d.ts +45 -46
- package/build/lib/helpers.cjs +40 -45
- package/build/lib/types/_usuario.d.ts +3 -3
- package/build/lib/types/index.d.ts +3 -4
- package/package.json +1 -2
|
@@ -9,38 +9,38 @@ export type ResponseCPayload<T = unknown> = Omit<t.Geral.Response.C.Input<T>, "c
|
|
|
9
9
|
declare const set_response: {
|
|
10
10
|
c: {
|
|
11
11
|
SUCCESS<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
12
|
-
message?: string | undefined;
|
|
13
|
-
type: "error" | "success" | "warning";
|
|
14
12
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
15
13
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
14
|
+
type: "success" | "warning" | "error";
|
|
15
|
+
message?: string | undefined;
|
|
16
16
|
results: any;
|
|
17
17
|
}, 200, "json">;
|
|
18
18
|
ACTION_REQUIRED<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
19
|
-
message?: string | undefined;
|
|
20
|
-
type: "error" | "success" | "warning";
|
|
21
19
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
22
20
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
21
|
+
type: "success" | "warning" | "error";
|
|
22
|
+
message?: string | undefined;
|
|
23
23
|
results: any;
|
|
24
24
|
}, 428, "json">;
|
|
25
25
|
CREATED<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
26
|
-
message?: string | undefined;
|
|
27
|
-
type: "error" | "success" | "warning";
|
|
28
26
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
29
27
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
28
|
+
type: "success" | "warning" | "error";
|
|
29
|
+
message?: string | undefined;
|
|
30
30
|
results: any;
|
|
31
31
|
}, 201, "json">;
|
|
32
32
|
WARNING<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
33
|
-
message?: string | undefined;
|
|
34
|
-
type: "error" | "success" | "warning";
|
|
35
33
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
36
34
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
35
|
+
type: "success" | "warning" | "error";
|
|
36
|
+
message?: string | undefined;
|
|
37
37
|
results: any;
|
|
38
38
|
}, 400, "json">;
|
|
39
39
|
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
40
|
-
message?: string | undefined;
|
|
41
|
-
type: "error" | "success" | "warning";
|
|
42
40
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
43
41
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
42
|
+
type: "success" | "warning" | "error";
|
|
43
|
+
message?: string | undefined;
|
|
44
44
|
results: any;
|
|
45
45
|
}, 405, "json">;
|
|
46
46
|
SERVER_ERROR<T>({ error, c, fn }: {
|
|
@@ -48,31 +48,31 @@ declare const set_response: {
|
|
|
48
48
|
c: t.Context;
|
|
49
49
|
fn: string;
|
|
50
50
|
}): Response & import("hono").TypedResponse<{
|
|
51
|
-
message?: string | undefined;
|
|
52
|
-
type: "error" | "success" | "warning";
|
|
53
51
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
54
52
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
53
|
+
type: "success" | "warning" | "error";
|
|
54
|
+
message?: string | undefined;
|
|
55
55
|
results: any;
|
|
56
56
|
}, any, "json">;
|
|
57
57
|
UNAUTHORIZED<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
58
|
-
message?: string | undefined;
|
|
59
|
-
type: "error" | "success" | "warning";
|
|
60
58
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
61
59
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
60
|
+
type: "success" | "warning" | "error";
|
|
61
|
+
message?: string | undefined;
|
|
62
62
|
results: any;
|
|
63
63
|
}, 401, "json">;
|
|
64
64
|
INVALID_TOKEN<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
65
|
-
message?: string | undefined;
|
|
66
|
-
type: "error" | "success" | "warning";
|
|
67
65
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
68
66
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
67
|
+
type: "success" | "warning" | "error";
|
|
68
|
+
message?: string | undefined;
|
|
69
69
|
results: any;
|
|
70
70
|
}, 409, "json">;
|
|
71
71
|
NOT_FOUND<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
72
|
-
message?: string | undefined;
|
|
73
|
-
type: "error" | "success" | "warning";
|
|
74
72
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
75
73
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
74
|
+
type: "success" | "warning" | "error";
|
|
75
|
+
message?: string | undefined;
|
|
76
76
|
results: any;
|
|
77
77
|
}, 404, "json">;
|
|
78
78
|
SUCCESS_FILE({ message, file_buffer, content_type, filename, c, fn }: t.Geral.Response.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
|
|
@@ -129,10 +129,10 @@ declare const set_response: {
|
|
|
129
129
|
toSorted: never;
|
|
130
130
|
with: never;
|
|
131
131
|
}, 200, "json">) | (Response & import("hono").TypedResponse<{
|
|
132
|
-
message?: string | undefined;
|
|
133
|
-
type: "error" | "success" | "warning";
|
|
134
132
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
135
133
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
134
|
+
type: "success" | "warning" | "error";
|
|
135
|
+
message?: string | undefined;
|
|
136
136
|
results: any;
|
|
137
137
|
}, 200, "json">)>;
|
|
138
138
|
};
|
|
@@ -2,20 +2,20 @@ import type { Next } from 'hono';
|
|
|
2
2
|
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
|
-
message?: string | undefined;
|
|
6
|
-
type: "error" | "success" | "warning";
|
|
7
5
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
8
6
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
7
|
+
type: "success" | "warning" | "error";
|
|
8
|
+
message?: string | undefined;
|
|
9
9
|
results: any;
|
|
10
10
|
}, 409, "json">)>;
|
|
11
11
|
criar_token_login_usuario(props: t.Controller.Usuario.TokenPayload & {
|
|
12
12
|
c: t.Context;
|
|
13
13
|
}): Promise<string>;
|
|
14
14
|
verificar_token_micro_servico(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
15
|
-
message?: string | undefined;
|
|
16
|
-
type: "error" | "success" | "warning";
|
|
17
15
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
18
16
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
17
|
+
type: "success" | "warning" | "error";
|
|
18
|
+
message?: string | undefined;
|
|
19
19
|
results: any;
|
|
20
20
|
}, 409, "json">)>;
|
|
21
21
|
criar_token_micro_servico({ c }: {
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
declare const helpers: {
|
|
2
2
|
set_response: {
|
|
3
3
|
c: {
|
|
4
|
-
SUCCESS<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
4
|
+
SUCCESS<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
5
5
|
fn: string;
|
|
6
6
|
}): Response & import("hono").TypedResponse<{
|
|
7
|
-
message?: string | undefined;
|
|
8
|
-
type: "error" | "success" | "warning";
|
|
9
7
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
10
8
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
9
|
+
type: "success" | "warning" | "error";
|
|
10
|
+
message?: string | undefined;
|
|
11
11
|
results: any;
|
|
12
12
|
}, 200, "json">;
|
|
13
|
-
ACTION_REQUIRED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
13
|
+
ACTION_REQUIRED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
14
14
|
fn: string;
|
|
15
15
|
}): Response & import("hono").TypedResponse<{
|
|
16
|
-
message?: string | undefined;
|
|
17
|
-
type: "error" | "success" | "warning";
|
|
18
16
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
19
17
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
18
|
+
type: "success" | "warning" | "error";
|
|
19
|
+
message?: string | undefined;
|
|
20
20
|
results: any;
|
|
21
21
|
}, 428, "json">;
|
|
22
|
-
CREATED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
22
|
+
CREATED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
23
23
|
fn: string;
|
|
24
24
|
}): Response & import("hono").TypedResponse<{
|
|
25
|
-
message?: string | undefined;
|
|
26
|
-
type: "error" | "success" | "warning";
|
|
27
25
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
28
26
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
27
|
+
type: "success" | "warning" | "error";
|
|
28
|
+
message?: string | undefined;
|
|
29
29
|
results: any;
|
|
30
30
|
}, 201, "json">;
|
|
31
|
-
WARNING<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
31
|
+
WARNING<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
32
32
|
fn: string;
|
|
33
33
|
}): Response & import("hono").TypedResponse<{
|
|
34
|
-
message?: string | undefined;
|
|
35
|
-
type: "error" | "success" | "warning";
|
|
36
34
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
37
35
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
36
|
+
type: "success" | "warning" | "error";
|
|
37
|
+
message?: string | undefined;
|
|
38
38
|
results: any;
|
|
39
39
|
}, 400, "json">;
|
|
40
|
-
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
40
|
+
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
41
41
|
fn: string;
|
|
42
42
|
}): Response & import("hono").TypedResponse<{
|
|
43
|
-
message?: string | undefined;
|
|
44
|
-
type: "error" | "success" | "warning";
|
|
45
43
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
46
44
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
45
|
+
type: "success" | "warning" | "error";
|
|
46
|
+
message?: string | undefined;
|
|
47
47
|
results: any;
|
|
48
48
|
}, 405, "json">;
|
|
49
49
|
SERVER_ERROR<T>({ error, c, fn }: {
|
|
@@ -51,37 +51,37 @@ declare const helpers: {
|
|
|
51
51
|
c: import("..").TypesCore.Context;
|
|
52
52
|
fn: string;
|
|
53
53
|
}): Response & import("hono").TypedResponse<{
|
|
54
|
-
message?: string | undefined;
|
|
55
|
-
type: "error" | "success" | "warning";
|
|
56
54
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
57
55
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
56
|
+
type: "success" | "warning" | "error";
|
|
57
|
+
message?: string | undefined;
|
|
58
58
|
results: any;
|
|
59
59
|
}, any, "json">;
|
|
60
|
-
UNAUTHORIZED<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
60
|
+
UNAUTHORIZED<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
61
61
|
fn: string;
|
|
62
62
|
}): Response & import("hono").TypedResponse<{
|
|
63
|
-
message?: string | undefined;
|
|
64
|
-
type: "error" | "success" | "warning";
|
|
65
63
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
66
64
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
65
|
+
type: "success" | "warning" | "error";
|
|
66
|
+
message?: string | undefined;
|
|
67
67
|
results: any;
|
|
68
68
|
}, 401, "json">;
|
|
69
|
-
INVALID_TOKEN<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
69
|
+
INVALID_TOKEN<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
70
70
|
fn: string;
|
|
71
71
|
}): Response & import("hono").TypedResponse<{
|
|
72
|
-
message?: string | undefined;
|
|
73
|
-
type: "error" | "success" | "warning";
|
|
74
72
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
75
73
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
74
|
+
type: "success" | "warning" | "error";
|
|
75
|
+
message?: string | undefined;
|
|
76
76
|
results: any;
|
|
77
77
|
}, 409, "json">;
|
|
78
|
-
NOT_FOUND<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
78
|
+
NOT_FOUND<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
79
79
|
fn: string;
|
|
80
80
|
}): Response & import("hono").TypedResponse<{
|
|
81
|
-
message?: string | undefined;
|
|
82
|
-
type: "error" | "success" | "warning";
|
|
83
81
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
84
82
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
83
|
+
type: "success" | "warning" | "error";
|
|
84
|
+
message?: string | undefined;
|
|
85
85
|
results: any;
|
|
86
86
|
}, 404, "json">;
|
|
87
87
|
SUCCESS_FILE({ message, file_buffer, content_type, filename, c, fn }: import("../types/_type_response").default.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
|
|
@@ -138,75 +138,75 @@ declare const helpers: {
|
|
|
138
138
|
toSorted: never;
|
|
139
139
|
with: never;
|
|
140
140
|
}, 200, "json">) | (Response & import("hono").TypedResponse<{
|
|
141
|
-
message?: string | undefined;
|
|
142
|
-
type: "error" | "success" | "warning";
|
|
143
141
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
144
142
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
143
|
+
type: "success" | "warning" | "error";
|
|
144
|
+
message?: string | undefined;
|
|
145
145
|
results: any;
|
|
146
146
|
}, 200, "json">)>;
|
|
147
147
|
};
|
|
148
148
|
error: {
|
|
149
|
-
ACTION_REQUIRED({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
149
|
+
ACTION_REQUIRED({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
150
150
|
fn: string;
|
|
151
151
|
}): void;
|
|
152
|
-
WARNING({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
152
|
+
WARNING({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
153
153
|
fn: string;
|
|
154
154
|
}): void;
|
|
155
|
-
ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
155
|
+
ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
156
156
|
fn: string;
|
|
157
157
|
}): void;
|
|
158
|
-
TOKEN_AUTH_USER({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
158
|
+
TOKEN_AUTH_USER({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
159
159
|
fn: string;
|
|
160
160
|
}): void;
|
|
161
|
-
AUTHORIZATION_ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
161
|
+
AUTHORIZATION_ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
162
162
|
fn: string;
|
|
163
163
|
}): void;
|
|
164
|
-
DATABASE_ERROR({ message, erro, fn }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
164
|
+
DATABASE_ERROR({ message, erro, fn }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
165
165
|
fn: string;
|
|
166
166
|
}) & {
|
|
167
167
|
erro: any;
|
|
168
168
|
}): void;
|
|
169
|
-
SCHEMA_VALIDATION({ results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
169
|
+
SCHEMA_VALIDATION({ results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
170
170
|
fn: string;
|
|
171
171
|
}): void;
|
|
172
|
-
UNAUTHORIZED({ message, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
172
|
+
UNAUTHORIZED({ message, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
173
173
|
fn: string;
|
|
174
174
|
}): void;
|
|
175
|
-
INTEGRATION_ERROR({ message, fn, erro }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
175
|
+
INTEGRATION_ERROR({ message, fn, erro }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
176
176
|
fn: string;
|
|
177
177
|
}) & {
|
|
178
178
|
erro: any;
|
|
179
179
|
}): void;
|
|
180
|
-
INVALID_TOKEN({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
180
|
+
INVALID_TOKEN({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
181
181
|
fn: string;
|
|
182
182
|
}): void;
|
|
183
|
-
NOT_FOUND({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
183
|
+
NOT_FOUND({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
184
184
|
fn: string;
|
|
185
185
|
}): void;
|
|
186
|
-
BUSINESS_RULE_VIOLATION({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
186
|
+
BUSINESS_RULE_VIOLATION({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
187
187
|
fn: string;
|
|
188
188
|
}): void;
|
|
189
|
-
PLAN_FORBIDDEN({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
189
|
+
PLAN_FORBIDDEN({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
190
190
|
fn: string;
|
|
191
191
|
}): void;
|
|
192
192
|
};
|
|
193
193
|
};
|
|
194
194
|
token: {
|
|
195
195
|
verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
196
|
-
message?: string | undefined;
|
|
197
|
-
type: "error" | "success" | "warning";
|
|
198
196
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
199
197
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
198
|
+
type: "success" | "warning" | "error";
|
|
199
|
+
message?: string | undefined;
|
|
200
200
|
results: any;
|
|
201
201
|
}, 409, "json">)>;
|
|
202
202
|
criar_token_login_usuario(props: import("../types/_usuario").default.TokenPayload & {
|
|
203
203
|
c: import("..").TypesCore.Context;
|
|
204
204
|
}): Promise<string>;
|
|
205
205
|
verificar_token_micro_servico(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
206
|
-
message?: string | undefined;
|
|
207
|
-
type: "error" | "success" | "warning";
|
|
208
206
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
209
207
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
208
|
+
type: "success" | "warning" | "error";
|
|
209
|
+
message?: string | undefined;
|
|
210
210
|
results: any;
|
|
211
211
|
}, 409, "json">)>;
|
|
212
212
|
criar_token_micro_servico({ c }: {
|
|
@@ -229,7 +229,6 @@ declare const helpers: {
|
|
|
229
229
|
password: string;
|
|
230
230
|
dashed_senha: string;
|
|
231
231
|
}): Promise<boolean>;
|
|
232
|
-
estract_secret(secret: any): Promise<string>;
|
|
233
232
|
};
|
|
234
233
|
data: {
|
|
235
234
|
get get_now_format_number(): number;
|
package/build/es/helpers.js
CHANGED
|
@@ -507,33 +507,6 @@ const set_response = new class {
|
|
|
507
507
|
};
|
|
508
508
|
};
|
|
509
509
|
const _set_response = set_response;
|
|
510
|
-
const scryptAsync = promisify(scrypt);
|
|
511
|
-
class _secret {
|
|
512
|
-
SALT_LENGTH = 22;
|
|
513
|
-
KEY_LENGTH = 35;
|
|
514
|
-
async gerar_hash_senha(password) {
|
|
515
|
-
const salt = randomBytes(this.SALT_LENGTH);
|
|
516
|
-
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
517
|
-
return salt.toString('base64') + '.' + derivedKey.toString('base64');
|
|
518
|
-
}
|
|
519
|
-
async verify({ password, dashed_senha }) {
|
|
520
|
-
try {
|
|
521
|
-
const [saltBase64, hashBase64] = dashed_senha.split('.');
|
|
522
|
-
if (!saltBase64 || !hashBase64) return false;
|
|
523
|
-
const salt = Buffer.from(saltBase64, 'base64');
|
|
524
|
-
const storedHash = Buffer.from(hashBase64, 'base64');
|
|
525
|
-
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
526
|
-
return timingSafeEqual(storedHash, derivedKey);
|
|
527
|
-
} catch {
|
|
528
|
-
return false;
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
async estract_secret(secret) {
|
|
532
|
-
if ('string' == typeof secret) return secret;
|
|
533
|
-
return await secret?.get() || "";
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
const helpers_secret = new _secret;
|
|
537
510
|
const _token_fn = 'token';
|
|
538
511
|
const _token = new class {
|
|
539
512
|
async verificar_token(c, next) {
|
|
@@ -552,7 +525,7 @@ const _token = new class {
|
|
|
552
525
|
results: [],
|
|
553
526
|
fn: _token_fn
|
|
554
527
|
});
|
|
555
|
-
const secret = new TextEncoder().encode(
|
|
528
|
+
const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_USER);
|
|
556
529
|
const { payload } = await jwtVerify(token, secret);
|
|
557
530
|
if (!payload._id || !payload.email) return _set_response.c.INVALID_TOKEN({
|
|
558
531
|
message: 'Token inválido!!!!',
|
|
@@ -584,7 +557,7 @@ const _token = new class {
|
|
|
584
557
|
}
|
|
585
558
|
}
|
|
586
559
|
async criar_token_login_usuario(props) {
|
|
587
|
-
if (
|
|
560
|
+
if (!props?.c.env.JSON_WEB_TOKEN_AUTH_USER) _set_response.error.WARNING({
|
|
588
561
|
message: "Erro ao gerar token auth!!",
|
|
589
562
|
results: [],
|
|
590
563
|
fn: _token_fn
|
|
@@ -601,7 +574,7 @@ const _token = new class {
|
|
|
601
574
|
plano_status: props?.plano_status
|
|
602
575
|
}).setProtectedHeader({
|
|
603
576
|
alg: "HS256"
|
|
604
|
-
}).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(
|
|
577
|
+
}).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(props?.c.env.JSON_WEB_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
|
|
605
578
|
message: "Erro ao gerar token auth user!",
|
|
606
579
|
results: error?.message,
|
|
607
580
|
fn: _token_fn
|
|
@@ -624,7 +597,7 @@ const _token = new class {
|
|
|
624
597
|
results: [],
|
|
625
598
|
fn: _token_fn
|
|
626
599
|
});
|
|
627
|
-
const secret = new TextEncoder().encode(
|
|
600
|
+
const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO);
|
|
628
601
|
const { payload } = await jwtVerify(token, secret);
|
|
629
602
|
if (!payload._id || !payload.email) return _set_response.c.INVALID_TOKEN({
|
|
630
603
|
message: 'Token inválido para o serviço!',
|
|
@@ -655,7 +628,7 @@ const _token = new class {
|
|
|
655
628
|
}
|
|
656
629
|
}
|
|
657
630
|
async criar_token_micro_servico({ c }) {
|
|
658
|
-
if (!
|
|
631
|
+
if (!c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO) _set_response.error.WARNING({
|
|
659
632
|
message: "Erro ao gerar token!!",
|
|
660
633
|
results: [],
|
|
661
634
|
fn: _token_fn
|
|
@@ -673,7 +646,7 @@ const _token = new class {
|
|
|
673
646
|
plano_status: usuario_auth?.plano_status
|
|
674
647
|
}).setProtectedHeader({
|
|
675
648
|
alg: "HS256"
|
|
676
|
-
}).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(
|
|
649
|
+
}).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
|
|
677
650
|
message: "Erro ao gerar token micro serviço!",
|
|
678
651
|
results: error?.message,
|
|
679
652
|
fn: _token_fn
|
|
@@ -681,7 +654,7 @@ const _token = new class {
|
|
|
681
654
|
return token;
|
|
682
655
|
}
|
|
683
656
|
async criar_refresh_token({ env, usuario_id }) {
|
|
684
|
-
if (!
|
|
657
|
+
if (!env.JSON_WEB_REFRESH_TOKEN_AUTH_USER) _set_response.error.TOKEN_AUTH_USER({
|
|
685
658
|
message: "Erro ao gerar refresh token!!",
|
|
686
659
|
results: [],
|
|
687
660
|
fn: _token_fn
|
|
@@ -690,7 +663,7 @@ const _token = new class {
|
|
|
690
663
|
usuario_id: usuario_id
|
|
691
664
|
}).setProtectedHeader({
|
|
692
665
|
alg: "HS256"
|
|
693
|
-
}).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(
|
|
666
|
+
}).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER)).catch((error)=>_set_response.error.TOKEN_AUTH_USER({
|
|
694
667
|
message: "Erro ao gerar refresh token!",
|
|
695
668
|
fn: _token_fn
|
|
696
669
|
}));
|
|
@@ -698,7 +671,7 @@ const _token = new class {
|
|
|
698
671
|
}
|
|
699
672
|
async verificar_refresh_token({ env, refresh_token }) {
|
|
700
673
|
try {
|
|
701
|
-
const secret_verify = new TextEncoder().encode(
|
|
674
|
+
const secret_verify = new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER);
|
|
702
675
|
const { payload } = await jwtVerify(refresh_token, secret_verify);
|
|
703
676
|
return payload;
|
|
704
677
|
} catch (error) {
|
|
@@ -707,6 +680,29 @@ const _token = new class {
|
|
|
707
680
|
}
|
|
708
681
|
};
|
|
709
682
|
const helpers_token = _token;
|
|
683
|
+
const scryptAsync = promisify(scrypt);
|
|
684
|
+
class _secret {
|
|
685
|
+
SALT_LENGTH = 22;
|
|
686
|
+
KEY_LENGTH = 35;
|
|
687
|
+
async gerar_hash_senha(password) {
|
|
688
|
+
const salt = randomBytes(this.SALT_LENGTH);
|
|
689
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
690
|
+
return salt.toString('base64') + '.' + derivedKey.toString('base64');
|
|
691
|
+
}
|
|
692
|
+
async verify({ password, dashed_senha }) {
|
|
693
|
+
try {
|
|
694
|
+
const [saltBase64, hashBase64] = dashed_senha.split('.');
|
|
695
|
+
if (!saltBase64 || !hashBase64) return false;
|
|
696
|
+
const salt = Buffer.from(saltBase64, 'base64');
|
|
697
|
+
const storedHash = Buffer.from(hashBase64, 'base64');
|
|
698
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
699
|
+
return timingSafeEqual(storedHash, derivedKey);
|
|
700
|
+
} catch {
|
|
701
|
+
return false;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
const helpers_secret = new _secret;
|
|
710
706
|
class _data {
|
|
711
707
|
get get_now_format_number() {
|
|
712
708
|
return Math.floor(Date.now() / 1000);
|
|
@@ -17,12 +17,12 @@ declare namespace TypeControllerUsuario {
|
|
|
17
17
|
padrao: "padrao";
|
|
18
18
|
}>;
|
|
19
19
|
const AssinaturaStatusEnumZod: z4.ZodEnum<{
|
|
20
|
-
incomplete: "incomplete";
|
|
21
|
-
paused: "paused";
|
|
22
|
-
canceled: "canceled";
|
|
23
20
|
active: "active";
|
|
21
|
+
canceled: "canceled";
|
|
22
|
+
incomplete: "incomplete";
|
|
24
23
|
incomplete_expired: "incomplete_expired";
|
|
25
24
|
past_due: "past_due";
|
|
25
|
+
paused: "paused";
|
|
26
26
|
trialing: "trialing";
|
|
27
27
|
unpaid: "unpaid";
|
|
28
28
|
}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context as HonoContext } from "hono";
|
|
2
|
-
import { SecretsStoreSecret } from "@cloudflare/workers-types";
|
|
3
2
|
import TypeControllerUsuario from "./_usuario";
|
|
4
3
|
import TypeControllerResponse from "./_type_response";
|
|
5
4
|
declare namespace t {
|
|
@@ -12,9 +11,9 @@ declare namespace t {
|
|
|
12
11
|
}
|
|
13
12
|
type Env = {
|
|
14
13
|
Bindings: {
|
|
15
|
-
JSON_WEB_TOKEN_AUTH_USER:
|
|
16
|
-
JSON_WEB_TOKEN_AUTH_MICRO_SERVICO:
|
|
17
|
-
JSON_WEB_REFRESH_TOKEN_AUTH_USER
|
|
14
|
+
JSON_WEB_TOKEN_AUTH_USER: string;
|
|
15
|
+
JSON_WEB_TOKEN_AUTH_MICRO_SERVICO: string;
|
|
16
|
+
JSON_WEB_REFRESH_TOKEN_AUTH_USER: string;
|
|
18
17
|
};
|
|
19
18
|
Variables: {
|
|
20
19
|
usuario_auth: TypeControllerUsuario.TokenPayload;
|
|
@@ -9,38 +9,38 @@ export type ResponseCPayload<T = unknown> = Omit<t.Geral.Response.C.Input<T>, "c
|
|
|
9
9
|
declare const set_response: {
|
|
10
10
|
c: {
|
|
11
11
|
SUCCESS<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
12
|
-
message?: string | undefined;
|
|
13
|
-
type: "error" | "success" | "warning";
|
|
14
12
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
15
13
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
14
|
+
type: "success" | "warning" | "error";
|
|
15
|
+
message?: string | undefined;
|
|
16
16
|
results: any;
|
|
17
17
|
}, 200, "json">;
|
|
18
18
|
ACTION_REQUIRED<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
19
|
-
message?: string | undefined;
|
|
20
|
-
type: "error" | "success" | "warning";
|
|
21
19
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
22
20
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
21
|
+
type: "success" | "warning" | "error";
|
|
22
|
+
message?: string | undefined;
|
|
23
23
|
results: any;
|
|
24
24
|
}, 428, "json">;
|
|
25
25
|
CREATED<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
26
|
-
message?: string | undefined;
|
|
27
|
-
type: "error" | "success" | "warning";
|
|
28
26
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
29
27
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
28
|
+
type: "success" | "warning" | "error";
|
|
29
|
+
message?: string | undefined;
|
|
30
30
|
results: any;
|
|
31
31
|
}, 201, "json">;
|
|
32
32
|
WARNING<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
33
|
-
message?: string | undefined;
|
|
34
|
-
type: "error" | "success" | "warning";
|
|
35
33
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
36
34
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
35
|
+
type: "success" | "warning" | "error";
|
|
36
|
+
message?: string | undefined;
|
|
37
37
|
results: any;
|
|
38
38
|
}, 400, "json">;
|
|
39
39
|
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
40
|
-
message?: string | undefined;
|
|
41
|
-
type: "error" | "success" | "warning";
|
|
42
40
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
43
41
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
42
|
+
type: "success" | "warning" | "error";
|
|
43
|
+
message?: string | undefined;
|
|
44
44
|
results: any;
|
|
45
45
|
}, 405, "json">;
|
|
46
46
|
SERVER_ERROR<T>({ error, c, fn }: {
|
|
@@ -48,31 +48,31 @@ declare const set_response: {
|
|
|
48
48
|
c: t.Context;
|
|
49
49
|
fn: string;
|
|
50
50
|
}): Response & import("hono").TypedResponse<{
|
|
51
|
-
message?: string | undefined;
|
|
52
|
-
type: "error" | "success" | "warning";
|
|
53
51
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
54
52
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
53
|
+
type: "success" | "warning" | "error";
|
|
54
|
+
message?: string | undefined;
|
|
55
55
|
results: any;
|
|
56
56
|
}, any, "json">;
|
|
57
57
|
UNAUTHORIZED<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
58
|
-
message?: string | undefined;
|
|
59
|
-
type: "error" | "success" | "warning";
|
|
60
58
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
61
59
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
60
|
+
type: "success" | "warning" | "error";
|
|
61
|
+
message?: string | undefined;
|
|
62
62
|
results: any;
|
|
63
63
|
}, 401, "json">;
|
|
64
64
|
INVALID_TOKEN<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
65
|
-
message?: string | undefined;
|
|
66
|
-
type: "error" | "success" | "warning";
|
|
67
65
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
68
66
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
67
|
+
type: "success" | "warning" | "error";
|
|
68
|
+
message?: string | undefined;
|
|
69
69
|
results: any;
|
|
70
70
|
}, 409, "json">;
|
|
71
71
|
NOT_FOUND<T>({ message, c, fn }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
72
|
-
message?: string | undefined;
|
|
73
|
-
type: "error" | "success" | "warning";
|
|
74
72
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
75
73
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
74
|
+
type: "success" | "warning" | "error";
|
|
75
|
+
message?: string | undefined;
|
|
76
76
|
results: any;
|
|
77
77
|
}, 404, "json">;
|
|
78
78
|
SUCCESS_FILE({ message, file_buffer, content_type, filename, c, fn }: t.Geral.Response.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
|
|
@@ -129,10 +129,10 @@ declare const set_response: {
|
|
|
129
129
|
toSorted: never;
|
|
130
130
|
with: never;
|
|
131
131
|
}, 200, "json">) | (Response & import("hono").TypedResponse<{
|
|
132
|
-
message?: string | undefined;
|
|
133
|
-
type: "error" | "success" | "warning";
|
|
134
132
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
135
133
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
134
|
+
type: "success" | "warning" | "error";
|
|
135
|
+
message?: string | undefined;
|
|
136
136
|
results: any;
|
|
137
137
|
}, 200, "json">)>;
|
|
138
138
|
};
|
|
@@ -2,20 +2,20 @@ import type { Next } from 'hono';
|
|
|
2
2
|
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
|
-
message?: string | undefined;
|
|
6
|
-
type: "error" | "success" | "warning";
|
|
7
5
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
8
6
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
7
|
+
type: "success" | "warning" | "error";
|
|
8
|
+
message?: string | undefined;
|
|
9
9
|
results: any;
|
|
10
10
|
}, 409, "json">)>;
|
|
11
11
|
criar_token_login_usuario(props: t.Controller.Usuario.TokenPayload & {
|
|
12
12
|
c: t.Context;
|
|
13
13
|
}): Promise<string>;
|
|
14
14
|
verificar_token_micro_servico(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
15
|
-
message?: string | undefined;
|
|
16
|
-
type: "error" | "success" | "warning";
|
|
17
15
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
18
16
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
17
|
+
type: "success" | "warning" | "error";
|
|
18
|
+
message?: string | undefined;
|
|
19
19
|
results: any;
|
|
20
20
|
}, 409, "json">)>;
|
|
21
21
|
criar_token_micro_servico({ c }: {
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
declare const helpers: {
|
|
2
2
|
set_response: {
|
|
3
3
|
c: {
|
|
4
|
-
SUCCESS<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
4
|
+
SUCCESS<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
5
5
|
fn: string;
|
|
6
6
|
}): Response & import("hono").TypedResponse<{
|
|
7
|
-
message?: string | undefined;
|
|
8
|
-
type: "error" | "success" | "warning";
|
|
9
7
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
10
8
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
9
|
+
type: "success" | "warning" | "error";
|
|
10
|
+
message?: string | undefined;
|
|
11
11
|
results: any;
|
|
12
12
|
}, 200, "json">;
|
|
13
|
-
ACTION_REQUIRED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
13
|
+
ACTION_REQUIRED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
14
14
|
fn: string;
|
|
15
15
|
}): Response & import("hono").TypedResponse<{
|
|
16
|
-
message?: string | undefined;
|
|
17
|
-
type: "error" | "success" | "warning";
|
|
18
16
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
19
17
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
18
|
+
type: "success" | "warning" | "error";
|
|
19
|
+
message?: string | undefined;
|
|
20
20
|
results: any;
|
|
21
21
|
}, 428, "json">;
|
|
22
|
-
CREATED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
22
|
+
CREATED<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
23
23
|
fn: string;
|
|
24
24
|
}): Response & import("hono").TypedResponse<{
|
|
25
|
-
message?: string | undefined;
|
|
26
|
-
type: "error" | "success" | "warning";
|
|
27
25
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
28
26
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
27
|
+
type: "success" | "warning" | "error";
|
|
28
|
+
message?: string | undefined;
|
|
29
29
|
results: any;
|
|
30
30
|
}, 201, "json">;
|
|
31
|
-
WARNING<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
31
|
+
WARNING<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
32
32
|
fn: string;
|
|
33
33
|
}): Response & import("hono").TypedResponse<{
|
|
34
|
-
message?: string | undefined;
|
|
35
|
-
type: "error" | "success" | "warning";
|
|
36
34
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
37
35
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
36
|
+
type: "success" | "warning" | "error";
|
|
37
|
+
message?: string | undefined;
|
|
38
38
|
results: any;
|
|
39
39
|
}, 400, "json">;
|
|
40
|
-
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
40
|
+
AUTHORIZATION_ERROR<T>({ message, results, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
41
41
|
fn: string;
|
|
42
42
|
}): Response & import("hono").TypedResponse<{
|
|
43
|
-
message?: string | undefined;
|
|
44
|
-
type: "error" | "success" | "warning";
|
|
45
43
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
46
44
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
45
|
+
type: "success" | "warning" | "error";
|
|
46
|
+
message?: string | undefined;
|
|
47
47
|
results: any;
|
|
48
48
|
}, 405, "json">;
|
|
49
49
|
SERVER_ERROR<T>({ error, c, fn }: {
|
|
@@ -51,37 +51,37 @@ declare const helpers: {
|
|
|
51
51
|
c: import("..").TypesCore.Context;
|
|
52
52
|
fn: string;
|
|
53
53
|
}): Response & import("hono").TypedResponse<{
|
|
54
|
-
message?: string | undefined;
|
|
55
|
-
type: "error" | "success" | "warning";
|
|
56
54
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
57
55
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
56
|
+
type: "success" | "warning" | "error";
|
|
57
|
+
message?: string | undefined;
|
|
58
58
|
results: any;
|
|
59
59
|
}, any, "json">;
|
|
60
|
-
UNAUTHORIZED<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
60
|
+
UNAUTHORIZED<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
61
61
|
fn: string;
|
|
62
62
|
}): Response & import("hono").TypedResponse<{
|
|
63
|
-
message?: string | undefined;
|
|
64
|
-
type: "error" | "success" | "warning";
|
|
65
63
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
66
64
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
65
|
+
type: "success" | "warning" | "error";
|
|
66
|
+
message?: string | undefined;
|
|
67
67
|
results: any;
|
|
68
68
|
}, 401, "json">;
|
|
69
|
-
INVALID_TOKEN<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
69
|
+
INVALID_TOKEN<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
70
70
|
fn: string;
|
|
71
71
|
}): Response & import("hono").TypedResponse<{
|
|
72
|
-
message?: string | undefined;
|
|
73
|
-
type: "error" | "success" | "warning";
|
|
74
72
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
75
73
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
74
|
+
type: "success" | "warning" | "error";
|
|
75
|
+
message?: string | undefined;
|
|
76
76
|
results: any;
|
|
77
77
|
}, 409, "json">;
|
|
78
|
-
NOT_FOUND<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "
|
|
78
|
+
NOT_FOUND<T>({ message, c, fn }: Omit<import("../types/_type_response").default.C.Input<unknown>, "status" | "code" | "type"> & {
|
|
79
79
|
fn: string;
|
|
80
80
|
}): Response & import("hono").TypedResponse<{
|
|
81
|
-
message?: string | undefined;
|
|
82
|
-
type: "error" | "success" | "warning";
|
|
83
81
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
84
82
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
83
|
+
type: "success" | "warning" | "error";
|
|
84
|
+
message?: string | undefined;
|
|
85
85
|
results: any;
|
|
86
86
|
}, 404, "json">;
|
|
87
87
|
SUCCESS_FILE({ message, file_buffer, content_type, filename, c, fn }: import("../types/_type_response").default.C.FileResponseParams): Promise<(Response & import("hono").TypedResponse<{
|
|
@@ -138,75 +138,75 @@ declare const helpers: {
|
|
|
138
138
|
toSorted: never;
|
|
139
139
|
with: never;
|
|
140
140
|
}, 200, "json">) | (Response & import("hono").TypedResponse<{
|
|
141
|
-
message?: string | undefined;
|
|
142
|
-
type: "error" | "success" | "warning";
|
|
143
141
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
144
142
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
143
|
+
type: "success" | "warning" | "error";
|
|
144
|
+
message?: string | undefined;
|
|
145
145
|
results: any;
|
|
146
146
|
}, 200, "json">)>;
|
|
147
147
|
};
|
|
148
148
|
error: {
|
|
149
|
-
ACTION_REQUIRED({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
149
|
+
ACTION_REQUIRED({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
150
150
|
fn: string;
|
|
151
151
|
}): void;
|
|
152
|
-
WARNING({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
152
|
+
WARNING({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
153
153
|
fn: string;
|
|
154
154
|
}): void;
|
|
155
|
-
ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
155
|
+
ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
156
156
|
fn: string;
|
|
157
157
|
}): void;
|
|
158
|
-
TOKEN_AUTH_USER({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
158
|
+
TOKEN_AUTH_USER({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
159
159
|
fn: string;
|
|
160
160
|
}): void;
|
|
161
|
-
AUTHORIZATION_ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
161
|
+
AUTHORIZATION_ERROR({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
162
162
|
fn: string;
|
|
163
163
|
}): void;
|
|
164
|
-
DATABASE_ERROR({ message, erro, fn }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
164
|
+
DATABASE_ERROR({ message, erro, fn }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
165
165
|
fn: string;
|
|
166
166
|
}) & {
|
|
167
167
|
erro: any;
|
|
168
168
|
}): void;
|
|
169
|
-
SCHEMA_VALIDATION({ results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
169
|
+
SCHEMA_VALIDATION({ results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
170
170
|
fn: string;
|
|
171
171
|
}): void;
|
|
172
|
-
UNAUTHORIZED({ message, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
172
|
+
UNAUTHORIZED({ message, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
173
173
|
fn: string;
|
|
174
174
|
}): void;
|
|
175
|
-
INTEGRATION_ERROR({ message, fn, erro }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
175
|
+
INTEGRATION_ERROR({ message, fn, erro }: (Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
176
176
|
fn: string;
|
|
177
177
|
}) & {
|
|
178
178
|
erro: any;
|
|
179
179
|
}): void;
|
|
180
|
-
INVALID_TOKEN({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
180
|
+
INVALID_TOKEN({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
181
181
|
fn: string;
|
|
182
182
|
}): void;
|
|
183
|
-
NOT_FOUND({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
183
|
+
NOT_FOUND({ message, fn, results }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
184
184
|
fn: string;
|
|
185
185
|
}): void;
|
|
186
|
-
BUSINESS_RULE_VIOLATION({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
186
|
+
BUSINESS_RULE_VIOLATION({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
187
187
|
fn: string;
|
|
188
188
|
}): void;
|
|
189
|
-
PLAN_FORBIDDEN({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "
|
|
189
|
+
PLAN_FORBIDDEN({ message, results, fn }: Omit<import("../types/_type_response").default.Error.Input<unknown>, "status" | "code" | "type"> & {
|
|
190
190
|
fn: string;
|
|
191
191
|
}): void;
|
|
192
192
|
};
|
|
193
193
|
};
|
|
194
194
|
token: {
|
|
195
195
|
verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
196
|
-
message?: string | undefined;
|
|
197
|
-
type: "error" | "success" | "warning";
|
|
198
196
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
199
197
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
198
|
+
type: "success" | "warning" | "error";
|
|
199
|
+
message?: string | undefined;
|
|
200
200
|
results: any;
|
|
201
201
|
}, 409, "json">)>;
|
|
202
202
|
criar_token_login_usuario(props: import("../types/_usuario").default.TokenPayload & {
|
|
203
203
|
c: import("..").TypesCore.Context;
|
|
204
204
|
}): Promise<string>;
|
|
205
205
|
verificar_token_micro_servico(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
206
|
-
message?: string | undefined;
|
|
207
|
-
type: "error" | "success" | "warning";
|
|
208
206
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
209
207
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "ERROR" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR" | "BUSINESS_RULE_VIOLATION" | "PLAN_FORBIDDEN" | "INTEGRATION_ERROR" | "TOKEN_AUTH_USER";
|
|
208
|
+
type: "success" | "warning" | "error";
|
|
209
|
+
message?: string | undefined;
|
|
210
210
|
results: any;
|
|
211
211
|
}, 409, "json">)>;
|
|
212
212
|
criar_token_micro_servico({ c }: {
|
|
@@ -229,7 +229,6 @@ declare const helpers: {
|
|
|
229
229
|
password: string;
|
|
230
230
|
dashed_senha: string;
|
|
231
231
|
}): Promise<boolean>;
|
|
232
|
-
estract_secret(secret: any): Promise<string>;
|
|
233
232
|
};
|
|
234
233
|
data: {
|
|
235
234
|
get get_now_format_number(): number;
|
package/build/lib/helpers.cjs
CHANGED
|
@@ -579,46 +579,10 @@ const set_response = new class set_response {
|
|
|
579
579
|
|
|
580
580
|
;// CONCATENATED MODULE: external "jose"
|
|
581
581
|
const external_jose_namespaceObject = require("jose");
|
|
582
|
-
;// CONCATENATED MODULE: external "node:crypto"
|
|
583
|
-
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
584
|
-
;// CONCATENATED MODULE: external "node:util"
|
|
585
|
-
const external_node_util_namespaceObject = require("node:util");
|
|
586
|
-
;// CONCATENATED MODULE: ./src/helpers/_secret.ts
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const scryptAsync = (0,external_node_util_namespaceObject.promisify)(external_node_crypto_namespaceObject.scrypt);
|
|
590
|
-
class _secret {
|
|
591
|
-
SALT_LENGTH = 22;
|
|
592
|
-
KEY_LENGTH = 35;
|
|
593
|
-
async gerar_hash_senha(password) {
|
|
594
|
-
const salt = (0,external_node_crypto_namespaceObject.randomBytes)(this.SALT_LENGTH);
|
|
595
|
-
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
596
|
-
return salt.toString('base64') + '.' + derivedKey.toString('base64');
|
|
597
|
-
}
|
|
598
|
-
async verify({ password, dashed_senha }) {
|
|
599
|
-
try {
|
|
600
|
-
const [saltBase64, hashBase64] = dashed_senha.split('.');
|
|
601
|
-
if (!saltBase64 || !hashBase64) return false;
|
|
602
|
-
const salt = Buffer.from(saltBase64, 'base64');
|
|
603
|
-
const storedHash = Buffer.from(hashBase64, 'base64');
|
|
604
|
-
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
605
|
-
return (0,external_node_crypto_namespaceObject.timingSafeEqual)(storedHash, derivedKey);
|
|
606
|
-
} catch {
|
|
607
|
-
return false;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
async estract_secret(secret) {
|
|
611
|
-
if (typeof secret === 'string') return secret;
|
|
612
|
-
return await secret?.get() || "";
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
/* export default */ const helpers_secret = (new _secret);
|
|
616
|
-
|
|
617
582
|
;// CONCATENATED MODULE: ./src/helpers/_token.ts
|
|
618
583
|
|
|
619
584
|
// Tem que importar assim para evitar dependencia circular
|
|
620
585
|
|
|
621
|
-
|
|
622
586
|
const _token_fn = 'token';
|
|
623
587
|
const _token = new class _token {
|
|
624
588
|
async verificar_token(c, next) {
|
|
@@ -637,7 +601,7 @@ const _token = new class _token {
|
|
|
637
601
|
results: [],
|
|
638
602
|
fn: _token_fn
|
|
639
603
|
});
|
|
640
|
-
const secret = new TextEncoder().encode(
|
|
604
|
+
const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_USER);
|
|
641
605
|
const { payload } = await external_jose_namespaceObject.jwtVerify(token, secret);
|
|
642
606
|
if (!payload._id || !payload.email) {
|
|
643
607
|
return _set_response.c.INVALID_TOKEN({
|
|
@@ -671,7 +635,7 @@ const _token = new class _token {
|
|
|
671
635
|
}
|
|
672
636
|
}
|
|
673
637
|
async criar_token_login_usuario(props) {
|
|
674
|
-
if (
|
|
638
|
+
if (!props?.c.env.JSON_WEB_TOKEN_AUTH_USER) {
|
|
675
639
|
_set_response.error.WARNING({
|
|
676
640
|
message: "Erro ao gerar token auth!!",
|
|
677
641
|
results: [],
|
|
@@ -690,7 +654,7 @@ const _token = new class _token {
|
|
|
690
654
|
plano_status: props?.plano_status
|
|
691
655
|
}).setProtectedHeader({
|
|
692
656
|
alg: "HS256"
|
|
693
|
-
}).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(
|
|
657
|
+
}).setIssuedAt().setExpirationTime("1h").sign(new TextEncoder().encode(props?.c.env.JSON_WEB_TOKEN_AUTH_USER)).catch((error)=>{
|
|
694
658
|
return _set_response.error.TOKEN_AUTH_USER({
|
|
695
659
|
message: "Erro ao gerar token auth user!",
|
|
696
660
|
results: error?.message,
|
|
@@ -715,7 +679,7 @@ const _token = new class _token {
|
|
|
715
679
|
results: [],
|
|
716
680
|
fn: _token_fn
|
|
717
681
|
});
|
|
718
|
-
const secret = new TextEncoder().encode(
|
|
682
|
+
const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO);
|
|
719
683
|
const { payload } = await external_jose_namespaceObject.jwtVerify(token, secret);
|
|
720
684
|
if (!payload._id || !payload.email) {
|
|
721
685
|
return _set_response.c.INVALID_TOKEN({
|
|
@@ -748,7 +712,7 @@ const _token = new class _token {
|
|
|
748
712
|
}
|
|
749
713
|
}
|
|
750
714
|
async criar_token_micro_servico({ c }) {
|
|
751
|
-
if (!
|
|
715
|
+
if (!c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO) {
|
|
752
716
|
_set_response.error.WARNING({
|
|
753
717
|
message: "Erro ao gerar token!!",
|
|
754
718
|
results: [],
|
|
@@ -768,7 +732,7 @@ const _token = new class _token {
|
|
|
768
732
|
plano_status: usuario_auth?.plano_status
|
|
769
733
|
}).setProtectedHeader({
|
|
770
734
|
alg: "HS256"
|
|
771
|
-
}).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(
|
|
735
|
+
}).setIssuedAt().setExpirationTime("30s").sign(new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_MICRO_SERVICO)).catch((error)=>{
|
|
772
736
|
return _set_response.error.TOKEN_AUTH_USER({
|
|
773
737
|
message: "Erro ao gerar token micro serviço!",
|
|
774
738
|
results: error?.message,
|
|
@@ -778,7 +742,7 @@ const _token = new class _token {
|
|
|
778
742
|
return token;
|
|
779
743
|
}
|
|
780
744
|
async criar_refresh_token({ env, usuario_id }) {
|
|
781
|
-
if (!
|
|
745
|
+
if (!env.JSON_WEB_REFRESH_TOKEN_AUTH_USER) {
|
|
782
746
|
_set_response.error.TOKEN_AUTH_USER({
|
|
783
747
|
message: "Erro ao gerar refresh token!!",
|
|
784
748
|
results: [],
|
|
@@ -789,7 +753,7 @@ const _token = new class _token {
|
|
|
789
753
|
usuario_id: usuario_id
|
|
790
754
|
}).setProtectedHeader({
|
|
791
755
|
alg: "HS256"
|
|
792
|
-
}).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(
|
|
756
|
+
}).setIssuedAt().setExpirationTime("2h").sign(new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER)).catch((error)=>{
|
|
793
757
|
return _set_response.error.TOKEN_AUTH_USER({
|
|
794
758
|
message: "Erro ao gerar refresh token!",
|
|
795
759
|
fn: _token_fn
|
|
@@ -800,7 +764,7 @@ const _token = new class _token {
|
|
|
800
764
|
async verificar_refresh_token({ env, refresh_token }) {
|
|
801
765
|
try {
|
|
802
766
|
if (!refresh_token) false;
|
|
803
|
-
const secret_verify = new TextEncoder().encode(
|
|
767
|
+
const secret_verify = new TextEncoder().encode(env.JSON_WEB_REFRESH_TOKEN_AUTH_USER);
|
|
804
768
|
const { payload } = await external_jose_namespaceObject.jwtVerify(refresh_token, secret_verify);
|
|
805
769
|
return payload;
|
|
806
770
|
} catch (error) {
|
|
@@ -810,6 +774,37 @@ const _token = new class _token {
|
|
|
810
774
|
};
|
|
811
775
|
/* export default */ const helpers_token = (_token);
|
|
812
776
|
|
|
777
|
+
;// CONCATENATED MODULE: external "node:crypto"
|
|
778
|
+
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
779
|
+
;// CONCATENATED MODULE: external "node:util"
|
|
780
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
781
|
+
;// CONCATENATED MODULE: ./src/helpers/_secret.ts
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
const scryptAsync = (0,external_node_util_namespaceObject.promisify)(external_node_crypto_namespaceObject.scrypt);
|
|
785
|
+
class _secret {
|
|
786
|
+
SALT_LENGTH = 22;
|
|
787
|
+
KEY_LENGTH = 35;
|
|
788
|
+
async gerar_hash_senha(password) {
|
|
789
|
+
const salt = (0,external_node_crypto_namespaceObject.randomBytes)(this.SALT_LENGTH);
|
|
790
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
791
|
+
return salt.toString('base64') + '.' + derivedKey.toString('base64');
|
|
792
|
+
}
|
|
793
|
+
async verify({ password, dashed_senha }) {
|
|
794
|
+
try {
|
|
795
|
+
const [saltBase64, hashBase64] = dashed_senha.split('.');
|
|
796
|
+
if (!saltBase64 || !hashBase64) return false;
|
|
797
|
+
const salt = Buffer.from(saltBase64, 'base64');
|
|
798
|
+
const storedHash = Buffer.from(hashBase64, 'base64');
|
|
799
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
800
|
+
return (0,external_node_crypto_namespaceObject.timingSafeEqual)(storedHash, derivedKey);
|
|
801
|
+
} catch {
|
|
802
|
+
return false;
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/* export default */ const helpers_secret = (new _secret);
|
|
807
|
+
|
|
813
808
|
;// CONCATENATED MODULE: ./src/helpers/_data.ts
|
|
814
809
|
class _data {
|
|
815
810
|
get get_now_format_number() {
|
|
@@ -17,12 +17,12 @@ declare namespace TypeControllerUsuario {
|
|
|
17
17
|
padrao: "padrao";
|
|
18
18
|
}>;
|
|
19
19
|
const AssinaturaStatusEnumZod: z4.ZodEnum<{
|
|
20
|
-
incomplete: "incomplete";
|
|
21
|
-
paused: "paused";
|
|
22
|
-
canceled: "canceled";
|
|
23
20
|
active: "active";
|
|
21
|
+
canceled: "canceled";
|
|
22
|
+
incomplete: "incomplete";
|
|
24
23
|
incomplete_expired: "incomplete_expired";
|
|
25
24
|
past_due: "past_due";
|
|
25
|
+
paused: "paused";
|
|
26
26
|
trialing: "trialing";
|
|
27
27
|
unpaid: "unpaid";
|
|
28
28
|
}>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Context as HonoContext } from "hono";
|
|
2
|
-
import { SecretsStoreSecret } from "@cloudflare/workers-types";
|
|
3
2
|
import TypeControllerUsuario from "./_usuario";
|
|
4
3
|
import TypeControllerResponse from "./_type_response";
|
|
5
4
|
declare namespace t {
|
|
@@ -12,9 +11,9 @@ declare namespace t {
|
|
|
12
11
|
}
|
|
13
12
|
type Env = {
|
|
14
13
|
Bindings: {
|
|
15
|
-
JSON_WEB_TOKEN_AUTH_USER:
|
|
16
|
-
JSON_WEB_TOKEN_AUTH_MICRO_SERVICO:
|
|
17
|
-
JSON_WEB_REFRESH_TOKEN_AUTH_USER
|
|
14
|
+
JSON_WEB_TOKEN_AUTH_USER: string;
|
|
15
|
+
JSON_WEB_TOKEN_AUTH_MICRO_SERVICO: string;
|
|
16
|
+
JSON_WEB_REFRESH_TOKEN_AUTH_USER: string;
|
|
18
17
|
};
|
|
19
18
|
Variables: {
|
|
20
19
|
usuario_auth: TypeControllerUsuario.TokenPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navservice/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.132.0",
|
|
4
4
|
"description": "Service core de todos os micro serviços",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"zustand": "^5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@cloudflare/workers-types": "^4.20260312.1",
|
|
38
37
|
"@rslib/core": "^0.18.4",
|
|
39
38
|
"@types/node": "^24.10.1",
|
|
40
39
|
"@types/react": "^19.2.7",
|