@seidor-cloud-produtos/orbit-backend-lib 2.0.86 → 2.0.88
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/dist/clean-arch/infra/http/handle-authorizer-headers.d.ts +2 -0
- package/dist/clean-arch/infra/http/handle-authorizer-headers.js +1 -0
- package/dist/clean-arch/infra/http/handle-user-headers.d.ts +2 -0
- package/dist/clean-arch/infra/http/handle-user-headers.js +1 -0
- package/dist/clean-arch/infra/validations/zod/schemas/common-validation.d.ts +117 -3
- package/dist/clean-arch/infra/validations/zod/schemas/common-validation.js +44 -5
- package/package.json +1 -1
|
@@ -5,11 +5,13 @@ type HeadersProps = {
|
|
|
5
5
|
userid?: string;
|
|
6
6
|
['app-id']?: string;
|
|
7
7
|
['app-name']?: string;
|
|
8
|
+
tenantid: string;
|
|
8
9
|
};
|
|
9
10
|
export type AuthorizerHeaders = {
|
|
10
11
|
userName?: string;
|
|
11
12
|
userEmail?: string;
|
|
12
13
|
appName?: string;
|
|
14
|
+
tenantId: string;
|
|
13
15
|
entityId: string;
|
|
14
16
|
};
|
|
15
17
|
export declare function handleAuthorizerHeaders(headers: HeadersProps): AuthorizerHeaders;
|
|
@@ -3,6 +3,7 @@ type HeadersProps = {
|
|
|
3
3
|
useremail: string;
|
|
4
4
|
userid?: string;
|
|
5
5
|
['app-id']?: string;
|
|
6
|
+
tenantid: string;
|
|
6
7
|
};
|
|
7
8
|
export declare function handleUserHeaders(headers: HeadersProps): {
|
|
8
9
|
createdByName: string;
|
|
@@ -10,5 +11,6 @@ export declare function handleUserHeaders(headers: HeadersProps): {
|
|
|
10
11
|
updatedByEmail: string;
|
|
11
12
|
updatedByName: string;
|
|
12
13
|
entityId: string | undefined;
|
|
14
|
+
tenantId: string;
|
|
13
15
|
};
|
|
14
16
|
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @deprecated Use authorizerHeaders.
|
|
5
|
+
*/
|
|
2
6
|
export declare const headersDefault: z.ZodObject<{
|
|
3
7
|
tenantid: z.ZodString;
|
|
4
8
|
username: z.ZodString;
|
|
@@ -12,6 +16,10 @@ export declare const headersDefault: z.ZodObject<{
|
|
|
12
16
|
tenantid: string;
|
|
13
17
|
useremail: string;
|
|
14
18
|
}>;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Use authorizerHeaders.
|
|
22
|
+
*/
|
|
15
23
|
export declare const headersDefaultWithUserId: z.ZodObject<{
|
|
16
24
|
tenantid: z.ZodString;
|
|
17
25
|
username: z.ZodString;
|
|
@@ -28,28 +36,134 @@ export declare const headersDefaultWithUserId: z.ZodObject<{
|
|
|
28
36
|
useremail: string;
|
|
29
37
|
userid: string;
|
|
30
38
|
}>;
|
|
31
|
-
export declare const
|
|
39
|
+
export declare const tenantIdSchema: z.ZodObject<{
|
|
40
|
+
tenantid: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
tenantid: string;
|
|
43
|
+
}, {
|
|
44
|
+
tenantid: string;
|
|
45
|
+
}>;
|
|
46
|
+
export declare const userSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
32
47
|
username: z.ZodString;
|
|
33
48
|
useremail: z.ZodString;
|
|
34
49
|
userid: z.ZodString;
|
|
35
|
-
},
|
|
50
|
+
}, {
|
|
51
|
+
tenantid: z.ZodString;
|
|
52
|
+
}>, "strip", z.ZodTypeAny, {
|
|
36
53
|
username: string;
|
|
54
|
+
tenantid: string;
|
|
37
55
|
useremail: string;
|
|
38
56
|
userid: string;
|
|
39
57
|
}, {
|
|
40
58
|
username: string;
|
|
59
|
+
tenantid: string;
|
|
41
60
|
useremail: string;
|
|
42
61
|
userid: string;
|
|
43
|
-
}
|
|
62
|
+
}>;
|
|
63
|
+
export declare const appSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
44
64
|
"app-name": z.ZodString;
|
|
45
65
|
"app-id": z.ZodString;
|
|
66
|
+
}, {
|
|
67
|
+
tenantid: z.ZodString;
|
|
68
|
+
}>, "strip", z.ZodTypeAny, {
|
|
69
|
+
"app-id": string;
|
|
70
|
+
"app-name": string;
|
|
71
|
+
tenantid: string;
|
|
72
|
+
}, {
|
|
73
|
+
"app-id": string;
|
|
74
|
+
"app-name": string;
|
|
75
|
+
tenantid: string;
|
|
76
|
+
}>;
|
|
77
|
+
export declare const traceSchema: z.ZodObject<{
|
|
78
|
+
"x-trace-id": z.ZodDefault<z.ZodString>;
|
|
46
79
|
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
"x-trace-id": string;
|
|
81
|
+
}, {
|
|
82
|
+
"x-trace-id"?: string | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
export declare const integrationHeaders: z.ZodObject<z.objectUtil.extendShape<{
|
|
85
|
+
tenantid: z.ZodString;
|
|
86
|
+
}, {
|
|
87
|
+
"x-trace-id": z.ZodDefault<z.ZodString>;
|
|
88
|
+
}>, "strip", z.ZodTypeAny, {
|
|
89
|
+
tenantid: string;
|
|
90
|
+
"x-trace-id": string;
|
|
91
|
+
}, {
|
|
92
|
+
tenantid: string;
|
|
93
|
+
"x-trace-id"?: string | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export declare const authorizerHeaders: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
96
|
+
username: z.ZodString;
|
|
97
|
+
useremail: z.ZodString;
|
|
98
|
+
userid: z.ZodString;
|
|
99
|
+
}, {
|
|
100
|
+
tenantid: z.ZodString;
|
|
101
|
+
}>, "strip", z.ZodTypeAny, {
|
|
102
|
+
username: string;
|
|
103
|
+
tenantid: string;
|
|
104
|
+
useremail: string;
|
|
105
|
+
userid: string;
|
|
106
|
+
}, {
|
|
107
|
+
username: string;
|
|
108
|
+
tenantid: string;
|
|
109
|
+
useremail: string;
|
|
110
|
+
userid: string;
|
|
111
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
112
|
+
"app-name": z.ZodString;
|
|
113
|
+
"app-id": z.ZodString;
|
|
114
|
+
}, {
|
|
115
|
+
tenantid: z.ZodString;
|
|
116
|
+
}>, "strip", z.ZodTypeAny, {
|
|
47
117
|
"app-id": string;
|
|
48
118
|
"app-name": string;
|
|
119
|
+
tenantid: string;
|
|
49
120
|
}, {
|
|
50
121
|
"app-id": string;
|
|
51
122
|
"app-name": string;
|
|
123
|
+
tenantid: string;
|
|
124
|
+
}>]>;
|
|
125
|
+
export declare const authorizerHeadersWithFiscalIds: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
126
|
+
username: z.ZodString;
|
|
127
|
+
useremail: z.ZodString;
|
|
128
|
+
userid: z.ZodString;
|
|
129
|
+
}, {
|
|
130
|
+
tenantid: z.ZodString;
|
|
131
|
+
}>, {
|
|
132
|
+
fiscalidsfromtenant: z.ZodString;
|
|
133
|
+
}>, "strip", z.ZodTypeAny, {
|
|
134
|
+
fiscalidsfromtenant: string;
|
|
135
|
+
username: string;
|
|
136
|
+
tenantid: string;
|
|
137
|
+
useremail: string;
|
|
138
|
+
userid: string;
|
|
139
|
+
}, {
|
|
140
|
+
fiscalidsfromtenant: string;
|
|
141
|
+
username: string;
|
|
142
|
+
tenantid: string;
|
|
143
|
+
useremail: string;
|
|
144
|
+
userid: string;
|
|
145
|
+
}>, z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
146
|
+
"app-name": z.ZodString;
|
|
147
|
+
"app-id": z.ZodString;
|
|
148
|
+
}, {
|
|
149
|
+
tenantid: z.ZodString;
|
|
150
|
+
}>, {
|
|
151
|
+
fiscalidsfromtenant: z.ZodString;
|
|
152
|
+
}>, "strip", z.ZodTypeAny, {
|
|
153
|
+
fiscalidsfromtenant: string;
|
|
154
|
+
"app-id": string;
|
|
155
|
+
"app-name": string;
|
|
156
|
+
tenantid: string;
|
|
157
|
+
}, {
|
|
158
|
+
fiscalidsfromtenant: string;
|
|
159
|
+
"app-id": string;
|
|
160
|
+
"app-name": string;
|
|
161
|
+
tenantid: string;
|
|
52
162
|
}>]>;
|
|
163
|
+
/**
|
|
164
|
+
*
|
|
165
|
+
* @deprecated Use authorizerHeadersWithFiscalIds.
|
|
166
|
+
*/
|
|
53
167
|
export declare const headersDefaultWithFiscalIds: z.ZodObject<{
|
|
54
168
|
tenantid: z.ZodString;
|
|
55
169
|
username: z.ZodString;
|
|
@@ -1,28 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.headersDefaultWithFiscalIds = exports.authorizerHeaders = exports.headersDefaultWithUserId = exports.headersDefault = void 0;
|
|
3
|
+
exports.headersDefaultWithFiscalIds = exports.authorizerHeadersWithFiscalIds = exports.authorizerHeaders = exports.integrationHeaders = exports.traceSchema = exports.appSchema = exports.userSchema = exports.tenantIdSchema = exports.headersDefaultWithUserId = exports.headersDefault = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const zod_1 = require("zod");
|
|
6
|
+
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use authorizerHeaders.
|
|
10
|
+
*/
|
|
5
11
|
exports.headersDefault = zod_1.z.object({
|
|
6
12
|
tenantid: zod_1.z.string().uuid(),
|
|
7
13
|
username: zod_1.z.string(),
|
|
8
14
|
useremail: zod_1.z.string(),
|
|
9
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use authorizerHeaders.
|
|
19
|
+
*/
|
|
10
20
|
exports.headersDefaultWithUserId = zod_1.z.object({
|
|
11
21
|
tenantid: zod_1.z.string().uuid(),
|
|
12
22
|
username: zod_1.z.string(),
|
|
13
23
|
useremail: zod_1.z.string(),
|
|
14
24
|
userid: zod_1.z.string().uuid(),
|
|
15
25
|
});
|
|
16
|
-
|
|
26
|
+
exports.tenantIdSchema = zod_1.z.object({
|
|
27
|
+
tenantid: zod_1.z.string().uuid(),
|
|
28
|
+
});
|
|
29
|
+
exports.userSchema = zod_1.z
|
|
30
|
+
.object({
|
|
17
31
|
username: zod_1.z.string(),
|
|
18
32
|
useremail: zod_1.z.string().email(),
|
|
19
33
|
userid: zod_1.z.string().uuid(),
|
|
20
|
-
})
|
|
21
|
-
|
|
34
|
+
})
|
|
35
|
+
.merge(exports.tenantIdSchema);
|
|
36
|
+
exports.appSchema = zod_1.z
|
|
37
|
+
.object({
|
|
22
38
|
['app-name']: zod_1.z.string(),
|
|
23
39
|
['app-id']: zod_1.z.string().uuid(),
|
|
40
|
+
})
|
|
41
|
+
.merge(exports.tenantIdSchema);
|
|
42
|
+
exports.traceSchema = zod_1.z.object({
|
|
43
|
+
['x-trace-id']: zod_1.z
|
|
44
|
+
.string()
|
|
45
|
+
.uuid()
|
|
46
|
+
.default(() => crypto_1.default.randomUUID()),
|
|
47
|
+
});
|
|
48
|
+
const fiscalIdsSchema = zod_1.z.object({
|
|
49
|
+
fiscalidsfromtenant: zod_1.z.string(zod_1.z.array(zod_1.z.object({
|
|
50
|
+
value: zod_1.z.string(),
|
|
51
|
+
type: zod_1.z.string(),
|
|
52
|
+
countryCode: zod_1.z.string(),
|
|
53
|
+
}))),
|
|
24
54
|
});
|
|
25
|
-
exports.
|
|
55
|
+
exports.integrationHeaders = exports.tenantIdSchema.merge(exports.traceSchema);
|
|
56
|
+
exports.authorizerHeaders = zod_1.z.union([exports.userSchema, exports.appSchema]);
|
|
57
|
+
exports.authorizerHeadersWithFiscalIds = zod_1.z.union([
|
|
58
|
+
exports.userSchema.merge(fiscalIdsSchema),
|
|
59
|
+
exports.appSchema.merge(fiscalIdsSchema),
|
|
60
|
+
]);
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @deprecated Use authorizerHeadersWithFiscalIds.
|
|
64
|
+
*/
|
|
26
65
|
exports.headersDefaultWithFiscalIds = zod_1.z.object({
|
|
27
66
|
tenantid: zod_1.z.string().uuid(),
|
|
28
67
|
username: zod_1.z.string(),
|