@navservice/usuario 1.48.0 → 1.50.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/index.js CHANGED
@@ -2192,12 +2192,28 @@ axios.HttpStatusCode = helpers_HttpStatusCode;
2192
2192
  axios.default = axios;
2193
2193
  const lib_axios = axios;
2194
2194
  (function(TypeControllerUsuario) {
2195
+ TypeControllerUsuario.PlanNameEnum = [
2196
+ "FREE",
2197
+ "ESSENTIAL",
2198
+ "BUSINESS",
2199
+ "ULTIMATE"
2200
+ ];
2195
2201
  TypeControllerUsuario.AppEnum = [
2196
2202
  "service-usuario",
2197
2203
  "service-pages",
2198
2204
  "service-assinatura",
2199
2205
  "service-bucket"
2200
2206
  ];
2207
+ TypeControllerUsuario.AssinaturaStatusEnum = [
2208
+ "active",
2209
+ "canceled",
2210
+ "incomplete",
2211
+ "incomplete_expired",
2212
+ "past_due",
2213
+ "paused",
2214
+ "trialing",
2215
+ "unpaid"
2216
+ ];
2201
2217
  TypeControllerUsuario.UsuarioTipoEnum = [
2202
2218
  "padrao"
2203
2219
  ];
@@ -2217,6 +2233,8 @@ const lib_axios = axios;
2217
2233
  };
2218
2234
  v4["enum"](TypeControllerUsuario.AppEnum);
2219
2235
  v4["enum"](TypeControllerUsuario.UsuarioTipoEnum);
2236
+ v4["enum"](TypeControllerUsuario.AssinaturaStatusEnum);
2237
+ v4["enum"](TypeControllerUsuario.PlanNameEnum);
2220
2238
  })(_usuario_TypeControllerUsuario || (_usuario_TypeControllerUsuario = {}));
2221
2239
  const _usuario = _usuario_TypeControllerUsuario;
2222
2240
  var _usuario_TypeControllerUsuario;
@@ -3013,6 +3031,23 @@ const type_controller_usuario_input = (meta)=>JSON.stringify(meta);
3013
3031
  })
3014
3032
  });
3015
3033
  })(TypeControllerUsuario.Login || (TypeControllerUsuario.Login = {}));
3034
+ (function(RefreshToken) {
3035
+ RefreshToken.route = "/api/usuario/auth/refresh_token";
3036
+ RefreshToken.InputSchema = v4.object({
3037
+ data: v4.object({
3038
+ usuario: v4.object({
3039
+ refresh_token: v4.string(),
3040
+ usuario_tipo: UsuarioTipoEnumZod,
3041
+ app: AppEnumZod
3042
+ }).refine(({ app, usuario_tipo })=>types.Controller.Usuario.apps_permitidos_e_tipos_de_usuarios_de_cada_app[app].includes(usuario_tipo), {
3043
+ message: "Tipo de usuário não permitido para este app",
3044
+ path: [
3045
+ "usuario_tipo"
3046
+ ]
3047
+ })
3048
+ })
3049
+ });
3050
+ })(TypeControllerUsuario.RefreshToken || (TypeControllerUsuario.RefreshToken = {}));
3016
3051
  (function(BuscarPeloFiltro) {
3017
3052
  BuscarPeloFiltro.route = "/api/usuario";
3018
3053
  BuscarPeloFiltro.InputSchema = v4.object({
@@ -2,8 +2,9 @@ import { AxiosResponse } from "axios";
2
2
  import z4 from "zod/v4";
3
3
  import t from "..";
4
4
  export declare const input: (meta: t.Geral.FormularioZod.Describe) => string;
5
+ import { TypesCore } from "@navservice/core";
5
6
  declare namespace TypeControllerUsuario {
6
- const UsuarioBaseSchema: z4.ZodObject<{
7
+ export const UsuarioBaseSchema: z4.ZodObject<{
7
8
  _id: z4.ZodString;
8
9
  data_criacao: z4.ZodNumber;
9
10
  data_atualizacao: z4.ZodNullable<z4.ZodNumber>;
@@ -15,20 +16,8 @@ declare namespace TypeControllerUsuario {
15
16
  excluido: z4.ZodUnion<readonly [z4.ZodLiteral<0>, z4.ZodLiteral<1>]>;
16
17
  ativo: z4.ZodUnion<readonly [z4.ZodLiteral<0>, z4.ZodLiteral<1>]>;
17
18
  }, z4.core.$strip>;
18
- interface Auth {
19
- data: {
20
- usuario: {
21
- _id: string;
22
- email: string;
23
- nome?: string;
24
- imagem?: string;
25
- token?: string;
26
- data_criacao?: number;
27
- ativo?: 0 | 1;
28
- };
29
- };
30
- }
31
- namespace Register {
19
+ type UsuarioBase = z4.infer<typeof UsuarioBaseSchema>;
20
+ export namespace Register {
32
21
  const route: "/api/usuario/auth/register";
33
22
  const InputSchema: z4.ZodObject<{
34
23
  data: z4.ZodObject<{
@@ -51,10 +40,10 @@ declare namespace TypeControllerUsuario {
51
40
  }, z4.core.$strip>;
52
41
  }, z4.core.$strip>;
53
42
  type Input = z4.infer<typeof InputSchema>;
54
- type Output = Auth;
43
+ type Output = TypesCore.Controller.Usuario.Auth;
55
44
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
56
45
  }
57
- namespace RegisterLoginGoogle {
46
+ export namespace RegisterLoginGoogle {
58
47
  const route: "/api/usuario/auth/google";
59
48
  const InputSchema: z4.ZodObject<{
60
49
  data: z4.ZodObject<{
@@ -74,10 +63,10 @@ declare namespace TypeControllerUsuario {
74
63
  }, z4.core.$strip>;
75
64
  }, z4.core.$strip>;
76
65
  type Input = z4.infer<typeof InputSchema>;
77
- type Output = Auth;
66
+ type Output = TypesCore.Controller.Usuario.Auth;
78
67
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
79
68
  }
80
- namespace Login {
69
+ export namespace Login {
81
70
  const route: "/api/usuario/auth/login";
82
71
  const InputSchema: z4.ZodObject<{
83
72
  data: z4.ZodObject<{
@@ -98,10 +87,32 @@ declare namespace TypeControllerUsuario {
98
87
  }, z4.core.$strip>;
99
88
  }, z4.core.$strip>;
100
89
  type Input = z4.infer<typeof InputSchema>;
101
- type Output = Auth;
90
+ type Output = TypesCore.Controller.Usuario.Auth;
91
+ type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
92
+ }
93
+ export namespace RefreshToken {
94
+ const route: "/api/usuario/auth/refresh_token";
95
+ const InputSchema: z4.ZodObject<{
96
+ data: z4.ZodObject<{
97
+ usuario: z4.ZodObject<{
98
+ refresh_token: z4.ZodString;
99
+ usuario_tipo: z4.ZodEnum<{
100
+ padrao: "padrao";
101
+ }>;
102
+ app: z4.ZodEnum<{
103
+ "service-usuario": "service-usuario";
104
+ "service-pages": "service-pages";
105
+ "service-assinatura": "service-assinatura";
106
+ "service-bucket": "service-bucket";
107
+ }>;
108
+ }, z4.core.$strip>;
109
+ }, z4.core.$strip>;
110
+ }, z4.core.$strip>;
111
+ type Input = z4.infer<typeof InputSchema>;
112
+ type Output = TypesCore.Controller.Usuario.Auth;
102
113
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
103
114
  }
104
- namespace BuscarPeloFiltro {
115
+ export namespace BuscarPeloFiltro {
105
116
  const route: "/api/usuario";
106
117
  const InputSchema: z4.ZodObject<{
107
118
  filtros: z4.ZodObject<{
@@ -122,12 +133,12 @@ declare namespace TypeControllerUsuario {
122
133
  itens_por_pagina: number;
123
134
  total_itens_pagina_atual: number;
124
135
  };
125
- usuario: z4.infer<typeof UsuarioBaseSchema>[];
136
+ usuario: UsuarioBase[];
126
137
  };
127
138
  };
128
139
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
129
140
  }
130
- namespace BuscarPeloId {
141
+ export namespace BuscarPeloId {
131
142
  const route: "/api/usuario/:id";
132
143
  const InputSchema: z4.ZodObject<{
133
144
  data: z4.ZodObject<{
@@ -137,12 +148,12 @@ declare namespace TypeControllerUsuario {
137
148
  type Input = z4.infer<typeof InputSchema>;
138
149
  type Output = {
139
150
  data: {
140
- usuario: z4.infer<typeof UsuarioBaseSchema>;
151
+ usuario: UsuarioBase;
141
152
  };
142
153
  };
143
154
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
144
155
  }
145
- namespace AtualizarPeloId {
156
+ export namespace AtualizarPeloId {
146
157
  const route: "/api/usuario/:id";
147
158
  const InputSchema: z4.ZodObject<{
148
159
  data: z4.ZodObject<{
@@ -160,12 +171,12 @@ declare namespace TypeControllerUsuario {
160
171
  type Input = z4.infer<typeof InputSchema>;
161
172
  type Output = {
162
173
  data: {
163
- usuario: z4.infer<typeof UsuarioBaseSchema>;
174
+ usuario: UsuarioBase;
164
175
  };
165
176
  };
166
177
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
167
178
  }
168
- namespace DeletarPeloId {
179
+ export namespace DeletarPeloId {
169
180
  const route: "/api/usuario/:id";
170
181
  const InputSchema: z4.ZodObject<{
171
182
  data: z4.ZodObject<{
@@ -180,7 +191,7 @@ declare namespace TypeControllerUsuario {
180
191
  };
181
192
  type Response = AxiosResponse<t.Geral.Response.C.Output<Output>>;
182
193
  }
183
- type TController = {
194
+ export type TController = {
184
195
  Criar: {
185
196
  Input: any;
186
197
  Output: any;
@@ -238,5 +249,6 @@ declare namespace TypeControllerUsuario {
238
249
  };
239
250
  };
240
251
  };
252
+ export {};
241
253
  }
242
254
  export default TypeControllerUsuario;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/usuario",
3
- "version": "1.48.0",
3
+ "version": "1.50.0",
4
4
  "description": "Service de autenticação de usuários unificado",
5
5
  "type": "module",
6
6
  "main": "./build/lib/index.js",