@seidor-cloud-produtos/orbit-backend-lib 2.0.87 → 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.
@@ -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,12 +36,20 @@ export declare const headersDefaultWithUserId: z.ZodObject<{
28
36
  useremail: string;
29
37
  userid: string;
30
38
  }>;
31
- export declare const authorizerHeaders: z.ZodUnion<[z.ZodObject<{
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;
50
+ }, {
35
51
  tenantid: z.ZodString;
36
- }, "strip", z.ZodTypeAny, {
52
+ }>, "strip", z.ZodTypeAny, {
37
53
  username: string;
38
54
  tenantid: string;
39
55
  useremail: string;
@@ -43,11 +59,61 @@ export declare const authorizerHeaders: z.ZodUnion<[z.ZodObject<{
43
59
  tenantid: string;
44
60
  useremail: string;
45
61
  userid: string;
46
- }>, z.ZodObject<{
62
+ }>;
63
+ export declare const appSchema: z.ZodObject<z.objectUtil.extendShape<{
47
64
  "app-name": z.ZodString;
48
65
  "app-id": z.ZodString;
66
+ }, {
49
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>;
50
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, {
51
117
  "app-id": string;
52
118
  "app-name": string;
53
119
  tenantid: string;
@@ -56,12 +122,13 @@ export declare const authorizerHeaders: z.ZodUnion<[z.ZodObject<{
56
122
  "app-name": string;
57
123
  tenantid: string;
58
124
  }>]>;
59
- export declare const authorizerHeadersWithFiscalIds: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
125
+ export declare const authorizerHeadersWithFiscalIds: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
60
126
  username: z.ZodString;
61
127
  useremail: z.ZodString;
62
128
  userid: z.ZodString;
63
- tenantid: z.ZodString;
64
129
  }, {
130
+ tenantid: z.ZodString;
131
+ }>, {
65
132
  fiscalidsfromtenant: z.ZodString;
66
133
  }>, "strip", z.ZodTypeAny, {
67
134
  fiscalidsfromtenant: string;
@@ -75,11 +142,12 @@ export declare const authorizerHeadersWithFiscalIds: z.ZodUnion<[z.ZodObject<z.o
75
142
  tenantid: string;
76
143
  useremail: string;
77
144
  userid: string;
78
- }>, z.ZodObject<z.objectUtil.extendShape<{
145
+ }>, z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
79
146
  "app-name": z.ZodString;
80
147
  "app-id": z.ZodString;
81
- tenantid: z.ZodString;
82
148
  }, {
149
+ tenantid: z.ZodString;
150
+ }>, {
83
151
  fiscalidsfromtenant: z.ZodString;
84
152
  }>, "strip", z.ZodTypeAny, {
85
153
  fiscalidsfromtenant: string;
@@ -92,6 +160,10 @@ export declare const authorizerHeadersWithFiscalIds: z.ZodUnion<[z.ZodObject<z.o
92
160
  "app-name": string;
93
161
  tenantid: string;
94
162
  }>]>;
163
+ /**
164
+ *
165
+ * @deprecated Use authorizerHeadersWithFiscalIds.
166
+ */
95
167
  export declare const headersDefaultWithFiscalIds: z.ZodObject<{
96
168
  tenantid: z.ZodString;
97
169
  username: z.ZodString;
@@ -1,28 +1,49 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.headersDefaultWithFiscalIds = exports.authorizerHeadersWithFiscalIds = 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
- const userSchema = zod_1.z.object({
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
- tenantid: zod_1.z.string().uuid(),
21
- });
22
- const appSchema = zod_1.z.object({
34
+ })
35
+ .merge(exports.tenantIdSchema);
36
+ exports.appSchema = zod_1.z
37
+ .object({
23
38
  ['app-name']: zod_1.z.string(),
24
39
  ['app-id']: zod_1.z.string().uuid(),
25
- tenantid: 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()),
26
47
  });
27
48
  const fiscalIdsSchema = zod_1.z.object({
28
49
  fiscalidsfromtenant: zod_1.z.string(zod_1.z.array(zod_1.z.object({
@@ -31,11 +52,16 @@ const fiscalIdsSchema = zod_1.z.object({
31
52
  countryCode: zod_1.z.string(),
32
53
  }))),
33
54
  });
34
- exports.authorizerHeaders = zod_1.z.union([userSchema, appSchema]);
55
+ exports.integrationHeaders = exports.tenantIdSchema.merge(exports.traceSchema);
56
+ exports.authorizerHeaders = zod_1.z.union([exports.userSchema, exports.appSchema]);
35
57
  exports.authorizerHeadersWithFiscalIds = zod_1.z.union([
36
- userSchema.merge(fiscalIdsSchema),
37
- appSchema.merge(fiscalIdsSchema),
58
+ exports.userSchema.merge(fiscalIdsSchema),
59
+ exports.appSchema.merge(fiscalIdsSchema),
38
60
  ]);
61
+ /**
62
+ *
63
+ * @deprecated Use authorizerHeadersWithFiscalIds.
64
+ */
39
65
  exports.headersDefaultWithFiscalIds = zod_1.z.object({
40
66
  tenantid: zod_1.z.string().uuid(),
41
67
  username: zod_1.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seidor-cloud-produtos/orbit-backend-lib",
3
- "version": "2.0.87",
3
+ "version": "2.0.88",
4
4
  "description": "Internal lib for backend components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",