@navservice/core 1.29.0 → 1.34.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/README.md +54 -54
- package/build/lib/config_env/index.d.ts +9 -0
- package/build/lib/helpers/_secret.d.ts +10 -0
- package/build/lib/helpers/_set_response.d.ts +84 -0
- package/build/lib/helpers/_token.d.ts +16 -0
- package/build/lib/helpers/index.d.ts +157 -0
- package/build/lib/helpers.cjs +437 -0
- package/build/lib/index.browser.cjs +805 -0
- package/build/lib/index.browser.d.ts +3 -0
- package/build/lib/index.node.cjs +472 -0
- package/build/lib/index.node.d.ts +1 -0
- package/build/lib/types/_type_response.d.ts +54 -0
- package/build/lib/types/_usuario.d.ts +39 -0
- package/build/lib/types/index.d.ts +20 -0
- package/build/lib/utils/_api.d.ts +41 -0
- package/build/lib/utils/_data.d.ts +11 -0
- package/build/lib/utils/_form.d.ts +11 -0
- package/build/lib/utils/_geral.d.ts +9 -0
- package/build/lib/utils/_local_storage.d.ts +8 -0
- package/build/lib/utils/_session_storage.d.ts +14 -0
- package/build/lib/utils/_update_context.d.ts +21 -0
- package/build/lib/utils/index.d.ts +105 -0
- package/build/lib/utils.cjs +660 -0
- package/package.json +50 -50
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
var __webpack_modules__ = ({
|
|
10
|
+
"./src/helpers/index.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11
|
+
|
|
12
|
+
// EXPORTS
|
|
13
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14
|
+
"default": () => (/* binding */ src_helpers)
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
;// CONCATENATED MODULE: external "zod/v4"
|
|
18
|
+
const v4_namespaceObject = require("zod/v4");
|
|
19
|
+
var v4_default = /*#__PURE__*/__webpack_require__.n(v4_namespaceObject);
|
|
20
|
+
;// CONCATENATED MODULE: ./src/helpers/_set_response.ts
|
|
21
|
+
// TYPES
|
|
22
|
+
|
|
23
|
+
const set_response = class set_response {
|
|
24
|
+
static c = class c {
|
|
25
|
+
static SUCCESS({ message, results, c }) {
|
|
26
|
+
const payload = {
|
|
27
|
+
status: 200,
|
|
28
|
+
code: "SUCCESS",
|
|
29
|
+
type: "success",
|
|
30
|
+
message: message || "Realizado com sucesso!",
|
|
31
|
+
results: results || []
|
|
32
|
+
};
|
|
33
|
+
if (c) {
|
|
34
|
+
return c.json(payload, {
|
|
35
|
+
status: 200
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return payload;
|
|
39
|
+
}
|
|
40
|
+
static ACTION_REQUIRED({ message, results, c }) {
|
|
41
|
+
const payload = {
|
|
42
|
+
status: 428,
|
|
43
|
+
code: "ACTION_REQUIRED",
|
|
44
|
+
type: "warning",
|
|
45
|
+
message: message || "Ação adicional necessária!",
|
|
46
|
+
results: results || []
|
|
47
|
+
};
|
|
48
|
+
if (c) {
|
|
49
|
+
return c.json(payload, {
|
|
50
|
+
status: 428
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return payload;
|
|
54
|
+
}
|
|
55
|
+
static CREATED({ message, results, c }) {
|
|
56
|
+
const payload = {
|
|
57
|
+
status: 201,
|
|
58
|
+
code: "CREATED",
|
|
59
|
+
type: "success",
|
|
60
|
+
message: message || "Criado com sucesso!",
|
|
61
|
+
results: results || []
|
|
62
|
+
};
|
|
63
|
+
return c ? c.json(payload, {
|
|
64
|
+
status: 201
|
|
65
|
+
}) : payload;
|
|
66
|
+
}
|
|
67
|
+
static WARNING({ message, results, c }) {
|
|
68
|
+
const payload = {
|
|
69
|
+
status: 400,
|
|
70
|
+
code: "WARNING",
|
|
71
|
+
type: "warning",
|
|
72
|
+
message: message || "Aviso!",
|
|
73
|
+
results: results || []
|
|
74
|
+
};
|
|
75
|
+
if (c) c.json(payload, {
|
|
76
|
+
status: 400
|
|
77
|
+
});
|
|
78
|
+
throw payload;
|
|
79
|
+
}
|
|
80
|
+
static AUTHORIZATION_ERROR({ message, results, c }) {
|
|
81
|
+
const payload = {
|
|
82
|
+
status: 405,
|
|
83
|
+
code: "WARNING",
|
|
84
|
+
type: "warning",
|
|
85
|
+
message: message || "Aviso!",
|
|
86
|
+
results: results || []
|
|
87
|
+
};
|
|
88
|
+
if (c) c.json(payload, {
|
|
89
|
+
status: 405
|
|
90
|
+
});
|
|
91
|
+
throw payload;
|
|
92
|
+
}
|
|
93
|
+
static DATABASE_ERROR({ message, results, c }) {
|
|
94
|
+
const payload = {
|
|
95
|
+
status: 500,
|
|
96
|
+
code: "DATABASE_ERROR",
|
|
97
|
+
type: "error",
|
|
98
|
+
message: message || "Erro no banco de dados!",
|
|
99
|
+
results: results || []
|
|
100
|
+
};
|
|
101
|
+
return c ? c.json(payload, {
|
|
102
|
+
status: 500
|
|
103
|
+
}) : payload;
|
|
104
|
+
}
|
|
105
|
+
static SERVER_ERROR({ error, c }) {
|
|
106
|
+
if (error instanceof (v4_default()).ZodError) {
|
|
107
|
+
const payload = {
|
|
108
|
+
status: 500,
|
|
109
|
+
code: "SCHEMA_VALIDATION",
|
|
110
|
+
type: "warning",
|
|
111
|
+
message: "Erro ao validar dados!",
|
|
112
|
+
results: v4_default().treeifyError(error)
|
|
113
|
+
};
|
|
114
|
+
return c.json(payload, {
|
|
115
|
+
status: 500
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const payload = {
|
|
119
|
+
status: error?.status || 500,
|
|
120
|
+
code: error?.code || "SERVER_ERROR",
|
|
121
|
+
type: error?.type || "error",
|
|
122
|
+
message: error?.message || "Erro interno no servidor!",
|
|
123
|
+
results: error?.results || []
|
|
124
|
+
};
|
|
125
|
+
return c.json(payload, {
|
|
126
|
+
status: error?.status || error?.status || 500
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
static UNAUTHORIZED({ message, c }) {
|
|
130
|
+
const payload = {
|
|
131
|
+
status: 401,
|
|
132
|
+
code: "UNAUTHORIZED",
|
|
133
|
+
type: "error",
|
|
134
|
+
message: message || "Não autorizado!",
|
|
135
|
+
results: []
|
|
136
|
+
};
|
|
137
|
+
return c ? c.json(payload, {
|
|
138
|
+
status: 401
|
|
139
|
+
}) : payload;
|
|
140
|
+
}
|
|
141
|
+
static INVALID_TOKEN({ message, c }) {
|
|
142
|
+
const payload = {
|
|
143
|
+
status: 401,
|
|
144
|
+
code: "INVALID_TOKEN",
|
|
145
|
+
type: "warning",
|
|
146
|
+
message: message || "Token inválido!",
|
|
147
|
+
results: []
|
|
148
|
+
};
|
|
149
|
+
return c ? c.json(payload, {
|
|
150
|
+
status: 401
|
|
151
|
+
}) : payload;
|
|
152
|
+
}
|
|
153
|
+
static NOT_FOUND({ message, c }) {
|
|
154
|
+
const payload = {
|
|
155
|
+
status: 404,
|
|
156
|
+
code: "NOT_FOUND",
|
|
157
|
+
type: "error",
|
|
158
|
+
message: message || "Recurso não encontrado!",
|
|
159
|
+
results: []
|
|
160
|
+
};
|
|
161
|
+
return c ? c.json(payload, {
|
|
162
|
+
status: 404
|
|
163
|
+
}) : payload;
|
|
164
|
+
}
|
|
165
|
+
static async SUCCESS_FILE({ message, file_buffer, content_type, filename, c }) {
|
|
166
|
+
if (c && content_type) {
|
|
167
|
+
const headers = {
|
|
168
|
+
"Content-Type": content_type,
|
|
169
|
+
"Content-Disposition": filename ? `inline; filename="${filename}"` : "inline"
|
|
170
|
+
};
|
|
171
|
+
return new Response(file_buffer, {
|
|
172
|
+
status: 200,
|
|
173
|
+
headers
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const payload = {
|
|
177
|
+
status: 200,
|
|
178
|
+
code: "SUCCESS_FILE",
|
|
179
|
+
type: "success",
|
|
180
|
+
message: message || "Erro ao retornar arquivo!",
|
|
181
|
+
results: []
|
|
182
|
+
};
|
|
183
|
+
return c ? c.json(payload, {
|
|
184
|
+
status: 200
|
|
185
|
+
}) : payload;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
static error = class error {
|
|
189
|
+
static ACTION_REQUIRED({ message, results }) {
|
|
190
|
+
const payload = {
|
|
191
|
+
status: 428,
|
|
192
|
+
code: "ACTION_REQUIRED",
|
|
193
|
+
type: "warning",
|
|
194
|
+
message: message || "Ação adicional necessária!",
|
|
195
|
+
results: results || []
|
|
196
|
+
};
|
|
197
|
+
throw payload;
|
|
198
|
+
}
|
|
199
|
+
static WARNING({ message, results }) {
|
|
200
|
+
const payload = {
|
|
201
|
+
status: 400,
|
|
202
|
+
code: "WARNING",
|
|
203
|
+
type: "warning",
|
|
204
|
+
message: message || "Aviso!",
|
|
205
|
+
results: results || []
|
|
206
|
+
};
|
|
207
|
+
throw payload;
|
|
208
|
+
}
|
|
209
|
+
static AUTHORIZATION_ERROR({ message, results }) {
|
|
210
|
+
const payload = {
|
|
211
|
+
status: 400,
|
|
212
|
+
code: "WARNING",
|
|
213
|
+
type: "warning",
|
|
214
|
+
message: message || "Aviso!",
|
|
215
|
+
results: results || []
|
|
216
|
+
};
|
|
217
|
+
throw payload;
|
|
218
|
+
}
|
|
219
|
+
static DATABASE_ERROR({ message, results }) {
|
|
220
|
+
const payload = {
|
|
221
|
+
status: 405,
|
|
222
|
+
code: "DATABASE_ERROR",
|
|
223
|
+
type: "error",
|
|
224
|
+
message: message || "Erro no banco de dados!",
|
|
225
|
+
results: results || []
|
|
226
|
+
};
|
|
227
|
+
throw payload;
|
|
228
|
+
}
|
|
229
|
+
static SCHEMA_VALIDATION({ results }) {
|
|
230
|
+
const payload = {
|
|
231
|
+
status: 500,
|
|
232
|
+
code: "SCHEMA_VALIDATION",
|
|
233
|
+
type: "error",
|
|
234
|
+
message: "Erro ao validar dados!",
|
|
235
|
+
results: results || []
|
|
236
|
+
};
|
|
237
|
+
throw payload;
|
|
238
|
+
}
|
|
239
|
+
static UNAUTHORIZED({ message }) {
|
|
240
|
+
const payload = {
|
|
241
|
+
status: 401,
|
|
242
|
+
code: "UNAUTHORIZED",
|
|
243
|
+
type: "error",
|
|
244
|
+
message: message || "Não autorizado!"
|
|
245
|
+
};
|
|
246
|
+
throw payload;
|
|
247
|
+
}
|
|
248
|
+
static INVALID_TOKEN({ message }) {
|
|
249
|
+
const payload = {
|
|
250
|
+
status: 401,
|
|
251
|
+
code: "INVALID_TOKEN",
|
|
252
|
+
type: "warning",
|
|
253
|
+
message: message || "Token inválido!",
|
|
254
|
+
results: []
|
|
255
|
+
};
|
|
256
|
+
throw payload;
|
|
257
|
+
}
|
|
258
|
+
static NOT_FOUND({ message }) {
|
|
259
|
+
const payload = {
|
|
260
|
+
status: 404,
|
|
261
|
+
code: "NOT_FOUND",
|
|
262
|
+
type: "error",
|
|
263
|
+
message: message || "Recurso não encontrado!"
|
|
264
|
+
};
|
|
265
|
+
throw payload;
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
/* export default */ const _set_response = (set_response);
|
|
270
|
+
|
|
271
|
+
;// CONCATENATED MODULE: external "jose"
|
|
272
|
+
const external_jose_namespaceObject = require("jose");
|
|
273
|
+
;// CONCATENATED MODULE: ./src/helpers/_token.ts
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
const _token = class _token {
|
|
277
|
+
static async verificar_token(c, next) {
|
|
278
|
+
try {
|
|
279
|
+
const authHeader = c.req.header("Authorization");
|
|
280
|
+
if (!authHeader) return src_helpers.set_response.c.INVALID_TOKEN({
|
|
281
|
+
message: 'token não enviado!!!',
|
|
282
|
+
c: c,
|
|
283
|
+
results: []
|
|
284
|
+
});
|
|
285
|
+
const token = authHeader.split(" ")[1];
|
|
286
|
+
if (!token) return src_helpers.set_response.c.INVALID_TOKEN({
|
|
287
|
+
message: 'Acesso negado!!!',
|
|
288
|
+
c: c,
|
|
289
|
+
results: []
|
|
290
|
+
});
|
|
291
|
+
const secret = new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_USER);
|
|
292
|
+
const { payload } = await external_jose_namespaceObject.jwtVerify(token, secret);
|
|
293
|
+
if (!payload._id || !payload.email) {
|
|
294
|
+
return src_helpers.set_response.c.INVALID_TOKEN({
|
|
295
|
+
message: 'Token inválido!!!!',
|
|
296
|
+
c: c,
|
|
297
|
+
results: []
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const setar_token = {
|
|
301
|
+
_id: payload._id,
|
|
302
|
+
email: payload.email,
|
|
303
|
+
ativo: payload.ativo,
|
|
304
|
+
data_criacao: payload.data_criacao,
|
|
305
|
+
nome: payload.nome,
|
|
306
|
+
app: payload.app,
|
|
307
|
+
usuario_tipo: payload.usuario_tipo
|
|
308
|
+
};
|
|
309
|
+
c.set("usuario_auth", setar_token);
|
|
310
|
+
return await next();
|
|
311
|
+
} catch (error) {
|
|
312
|
+
return src_helpers.set_response.c.INVALID_TOKEN({
|
|
313
|
+
message: 'Token inválido!!!',
|
|
314
|
+
c: c,
|
|
315
|
+
results: []
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
static async criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }) {
|
|
320
|
+
if (!c.env.JSON_WEB_TOKEN_AUTH_USER) {
|
|
321
|
+
return src_helpers.set_response.error.WARNING({
|
|
322
|
+
message: "Erro ao gerar token!!",
|
|
323
|
+
results: []
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
const token = await new external_jose_namespaceObject.SignJWT({
|
|
327
|
+
_id: _id,
|
|
328
|
+
email: email,
|
|
329
|
+
app: app,
|
|
330
|
+
usuario_tipo: usuario_tipo,
|
|
331
|
+
ativo: ativo,
|
|
332
|
+
data_criacao: data_criacao,
|
|
333
|
+
nome: nome
|
|
334
|
+
}).setProtectedHeader({
|
|
335
|
+
alg: "HS256"
|
|
336
|
+
}).setIssuedAt()//.setExpirationTime("24h")
|
|
337
|
+
.sign(new TextEncoder().encode(c.env.JSON_WEB_TOKEN_AUTH_USER)).catch((error)=>{
|
|
338
|
+
return src_helpers.set_response.error.WARNING({
|
|
339
|
+
message: "Erro ao gerar token!",
|
|
340
|
+
results: error?.message
|
|
341
|
+
});
|
|
342
|
+
});
|
|
343
|
+
return token;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
/* export default */ const helpers_token = (_token);
|
|
347
|
+
|
|
348
|
+
;// CONCATENATED MODULE: external "node:crypto"
|
|
349
|
+
const external_node_crypto_namespaceObject = require("node:crypto");
|
|
350
|
+
;// CONCATENATED MODULE: external "node:util"
|
|
351
|
+
const external_node_util_namespaceObject = require("node:util");
|
|
352
|
+
;// CONCATENATED MODULE: ./src/helpers/_secret.ts
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
const scryptAsync = (0,external_node_util_namespaceObject.promisify)(external_node_crypto_namespaceObject.scrypt);
|
|
356
|
+
class _secret {
|
|
357
|
+
static SALT_LENGTH = 22;
|
|
358
|
+
static KEY_LENGTH = 35;
|
|
359
|
+
static async gerar_hash_senha(password) {
|
|
360
|
+
const salt = (0,external_node_crypto_namespaceObject.randomBytes)(this.SALT_LENGTH);
|
|
361
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
362
|
+
return salt.toString('base64') + '.' + derivedKey.toString('base64');
|
|
363
|
+
}
|
|
364
|
+
static async verify({ password, dashed_senha }) {
|
|
365
|
+
try {
|
|
366
|
+
const [saltBase64, hashBase64] = dashed_senha.split('.');
|
|
367
|
+
if (!saltBase64 || !hashBase64) return false;
|
|
368
|
+
const salt = Buffer.from(saltBase64, 'base64');
|
|
369
|
+
const storedHash = Buffer.from(hashBase64, 'base64');
|
|
370
|
+
const derivedKey = await scryptAsync(password, salt, this.KEY_LENGTH);
|
|
371
|
+
return (0,external_node_crypto_namespaceObject.timingSafeEqual)(storedHash, derivedKey);
|
|
372
|
+
} catch {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/* export default */ const helpers_secret = (_secret);
|
|
378
|
+
|
|
379
|
+
;// CONCATENATED MODULE: ./src/helpers/index.ts
|
|
380
|
+
//_HELPERS
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class helpers {
|
|
385
|
+
static set_response = _set_response;
|
|
386
|
+
static token = helpers_token;
|
|
387
|
+
static secret = helpers_secret;
|
|
388
|
+
}
|
|
389
|
+
/* export default */ const src_helpers = (helpers);
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
},
|
|
393
|
+
|
|
394
|
+
});
|
|
395
|
+
// The module cache
|
|
396
|
+
var __webpack_module_cache__ = {};
|
|
397
|
+
|
|
398
|
+
// The require function
|
|
399
|
+
function __webpack_require__(moduleId) {
|
|
400
|
+
|
|
401
|
+
// Check if module is in cache
|
|
402
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
403
|
+
if (cachedModule !== undefined) {
|
|
404
|
+
return cachedModule.exports;
|
|
405
|
+
}
|
|
406
|
+
// Create a new module (and put it into the cache)
|
|
407
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
408
|
+
exports: {}
|
|
409
|
+
});
|
|
410
|
+
// Execute the module function
|
|
411
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
412
|
+
|
|
413
|
+
// Return the exports of the module
|
|
414
|
+
return module.exports;
|
|
415
|
+
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// webpack/runtime/compat_get_default_export
|
|
419
|
+
(() => {
|
|
420
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
421
|
+
__webpack_require__.n = (module) => {
|
|
422
|
+
var getter = module && module.__esModule ?
|
|
423
|
+
() => (module['default']) :
|
|
424
|
+
() => (module);
|
|
425
|
+
__webpack_require__.d(getter, { a: getter });
|
|
426
|
+
return getter;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
})();
|
|
430
|
+
// webpack/runtime/define_property_getters
|
|
431
|
+
(() => {
|
|
432
|
+
__webpack_require__.d = (exports, definition) => {
|
|
433
|
+
for(var key in definition) {
|
|
434
|
+
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
435
|
+
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
})();
|
|
440
|
+
// webpack/runtime/has_own_property
|
|
441
|
+
(() => {
|
|
442
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
443
|
+
})();
|
|
444
|
+
// webpack/runtime/make_namespace_object
|
|
445
|
+
(() => {
|
|
446
|
+
// define __esModule on exports
|
|
447
|
+
__webpack_require__.r = (exports) => {
|
|
448
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
449
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
450
|
+
}
|
|
451
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
452
|
+
};
|
|
453
|
+
})();
|
|
454
|
+
var __webpack_exports__ = {};
|
|
455
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
456
|
+
(() => {
|
|
457
|
+
__webpack_require__.r(__webpack_exports__);
|
|
458
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
459
|
+
helpers: () => (/* reexport safe */ _helpers__rspack_import_0["default"])
|
|
460
|
+
});
|
|
461
|
+
/* import */ var _helpers__rspack_import_0 = __webpack_require__("./src/helpers/index.ts");
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
})();
|
|
465
|
+
|
|
466
|
+
exports.helpers = __webpack_exports__.helpers;
|
|
467
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
468
|
+
if(["helpers"].indexOf(__rspack_i) === -1) {
|
|
469
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as helpers } from "./helpers";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import t from ".";
|
|
2
|
+
import z4 from "zod/v4";
|
|
3
|
+
declare namespace TypeControllerResponse {
|
|
4
|
+
const BaseResponseSchema: z4.ZodObject<{
|
|
5
|
+
status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
|
|
6
|
+
code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">]>;
|
|
7
|
+
type: z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>;
|
|
8
|
+
message: z4.ZodString;
|
|
9
|
+
results: z4.ZodOptional<z4.ZodUnknown>;
|
|
10
|
+
error: z4.ZodOptional<z4.ZodUnknown>;
|
|
11
|
+
}, z4.core.$strip>;
|
|
12
|
+
type BaseResponse<T = unknown> = z4.infer<typeof BaseResponseSchema> & {
|
|
13
|
+
results?: T;
|
|
14
|
+
};
|
|
15
|
+
export namespace C {
|
|
16
|
+
export const InputSchema: z4.ZodObject<{
|
|
17
|
+
status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
|
|
18
|
+
code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">]>;
|
|
19
|
+
type: z4.ZodDefault<z4.ZodOptional<z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>>>;
|
|
20
|
+
message: z4.ZodOptional<z4.ZodString>;
|
|
21
|
+
results: z4.ZodAny;
|
|
22
|
+
c: z4.ZodCustom<t.Context, t.Context>;
|
|
23
|
+
}, z4.core.$strip>;
|
|
24
|
+
export type Input<T = unknown> = z4.infer<typeof InputSchema> & {
|
|
25
|
+
results?: T;
|
|
26
|
+
};
|
|
27
|
+
export type Output<T = unknown> = BaseResponse<T>;
|
|
28
|
+
const FileResponseParamsSchema: z4.ZodObject<{
|
|
29
|
+
status: z4.ZodUnion<readonly [z4.ZodLiteral<200>, z4.ZodLiteral<201>, z4.ZodLiteral<202>, z4.ZodLiteral<204>, z4.ZodLiteral<400>, z4.ZodLiteral<401>, z4.ZodLiteral<403>, z4.ZodLiteral<404>, z4.ZodLiteral<409>, z4.ZodLiteral<422>, z4.ZodLiteral<500>, z4.ZodLiteral<428>, z4.ZodLiteral<405>]>;
|
|
30
|
+
message: z4.ZodOptional<z4.ZodString>;
|
|
31
|
+
file_buffer: z4.ZodUnion<readonly [z4.ZodCustom<Blob, Blob>, z4.ZodCustom<ArrayBuffer, ArrayBuffer>, z4.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
|
|
32
|
+
content_type: z4.ZodString;
|
|
33
|
+
filename: z4.ZodOptional<z4.ZodString>;
|
|
34
|
+
c: z4.ZodOptional<z4.ZodCustom<t.Context, t.Context>>;
|
|
35
|
+
}, z4.core.$strip>;
|
|
36
|
+
export type FileResponseParams = z4.infer<typeof FileResponseParamsSchema>;
|
|
37
|
+
export {};
|
|
38
|
+
}
|
|
39
|
+
export namespace Error {
|
|
40
|
+
const InputSchema: z4.ZodObject<{
|
|
41
|
+
message: z4.ZodOptional<z4.ZodString>;
|
|
42
|
+
results: z4.ZodOptional<z4.ZodUnion<readonly [z4.ZodArray<z4.ZodUnknown>, z4.ZodUnknown]>>;
|
|
43
|
+
type: z4.ZodDefault<z4.ZodOptional<z4.ZodDefault<z4.ZodUnion<readonly [z4.ZodLiteral<"success">, z4.ZodLiteral<"warning">, z4.ZodLiteral<"error">]>>>>;
|
|
44
|
+
code: z4.ZodUnion<readonly [z4.ZodLiteral<"SUCCESS">, z4.ZodLiteral<"ACTION_REQUIRED">, z4.ZodLiteral<"CREATED">, z4.ZodLiteral<"WARNING">, z4.ZodLiteral<"AUTHORIZATION_ERROR">, z4.ZodLiteral<"SCHEMA_VALIDATION">, z4.ZodLiteral<"SERVER_ERROR">, z4.ZodLiteral<"UNAUTHORIZED">, z4.ZodLiteral<"INVALID_TOKEN">, z4.ZodLiteral<"NOT_FOUND">, z4.ZodLiteral<"SUCCESS_FILE">, z4.ZodLiteral<"DATABASE_ERROR">]>;
|
|
45
|
+
status: z4.ZodDefault<z4.ZodOptional<z4.ZodNumber>>;
|
|
46
|
+
}, z4.core.$strip>;
|
|
47
|
+
type Input<T = unknown> = z4.infer<typeof InputSchema> & {
|
|
48
|
+
results?: T;
|
|
49
|
+
};
|
|
50
|
+
type Output<T = unknown> = BaseResponse<T>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
}
|
|
54
|
+
export default TypeControllerResponse;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import z4 from "zod/v4";
|
|
2
|
+
declare namespace TypeControllerUsuario {
|
|
3
|
+
export const AppEnum: readonly ["service-usuario", "service-financeiro", "service-pages-ai"];
|
|
4
|
+
export const UsuarioTipoEnum: readonly ["padrao"];
|
|
5
|
+
const AppEnumZod: z4.ZodEnum<{
|
|
6
|
+
"service-usuario": "service-usuario";
|
|
7
|
+
"service-financeiro": "service-financeiro";
|
|
8
|
+
"service-pages-ai": "service-pages-ai";
|
|
9
|
+
}>;
|
|
10
|
+
const UsuarioTipoEnumZod: z4.ZodEnum<{
|
|
11
|
+
padrao: "padrao";
|
|
12
|
+
}>;
|
|
13
|
+
type App = z4.infer<typeof AppEnumZod>;
|
|
14
|
+
type UsuarioTipo = z4.infer<typeof UsuarioTipoEnumZod>;
|
|
15
|
+
export interface Auth {
|
|
16
|
+
data: {
|
|
17
|
+
usuario: {
|
|
18
|
+
_id: string;
|
|
19
|
+
email: string;
|
|
20
|
+
nome?: string;
|
|
21
|
+
imagem?: string;
|
|
22
|
+
token?: string;
|
|
23
|
+
data_criacao?: number;
|
|
24
|
+
ativo?: 0 | 1;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface TokenPayload {
|
|
29
|
+
_id: string;
|
|
30
|
+
email: string;
|
|
31
|
+
nome: string;
|
|
32
|
+
data_criacao: number;
|
|
33
|
+
ativo: 1 | 0;
|
|
34
|
+
app: App;
|
|
35
|
+
usuario_tipo: UsuarioTipo;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
38
|
+
}
|
|
39
|
+
export default TypeControllerUsuario;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context as HonoContext } from "hono";
|
|
2
|
+
import TypeControllerUsuario from "./_usuario";
|
|
3
|
+
import TypeControllerResponse from "./_type_response";
|
|
4
|
+
declare namespace t {
|
|
5
|
+
namespace Controller {
|
|
6
|
+
export import Usuario = TypeControllerUsuario;
|
|
7
|
+
}
|
|
8
|
+
namespace Geral {
|
|
9
|
+
export import Response = TypeControllerResponse;
|
|
10
|
+
}
|
|
11
|
+
interface Context extends HonoContext {
|
|
12
|
+
env: {
|
|
13
|
+
AMBIENTE: "PRODUCAO" | "SANDBOX";
|
|
14
|
+
JSON_WEB_TOKEN_AUTH_USER: string;
|
|
15
|
+
};
|
|
16
|
+
set(key: "usuario_auth", params: TypeControllerUsuario.TokenPayload): TypeControllerUsuario.TokenPayload;
|
|
17
|
+
get(key: "usuario_auth"): TypeControllerUsuario.TokenPayload;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export default t;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
2
|
+
declare const _api: {
|
|
3
|
+
new (): {};
|
|
4
|
+
servidor_service_usuario: {
|
|
5
|
+
new (): {};
|
|
6
|
+
get "__#private@#axios"(): import("axios").AxiosInstance;
|
|
7
|
+
post({ url, data, setToken }: {
|
|
8
|
+
url: string;
|
|
9
|
+
data: any;
|
|
10
|
+
setToken?: boolean;
|
|
11
|
+
}): Promise<AxiosResponse<any, any, {}>>;
|
|
12
|
+
get({ url, params, setToken }: {
|
|
13
|
+
url: string;
|
|
14
|
+
params?: any;
|
|
15
|
+
setToken?: boolean;
|
|
16
|
+
}): Promise<AxiosResponse<any, any, {}>>;
|
|
17
|
+
patch({ url, data, setToken }: {
|
|
18
|
+
url: string;
|
|
19
|
+
data: any;
|
|
20
|
+
setToken?: boolean;
|
|
21
|
+
}): Promise<AxiosResponse<any, any, {}>>;
|
|
22
|
+
delete({ url }: {
|
|
23
|
+
url: string;
|
|
24
|
+
setToken?: boolean;
|
|
25
|
+
}): Promise<AxiosResponse<any, any, {}>>;
|
|
26
|
+
};
|
|
27
|
+
headers({ setToken }: {
|
|
28
|
+
setToken?: boolean;
|
|
29
|
+
}): {
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: string;
|
|
32
|
+
"Content-type": string;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
headers: {
|
|
36
|
+
"Content-type": string;
|
|
37
|
+
Authorization?: undefined;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export default _api;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _data: {
|
|
2
|
+
new (): {};
|
|
3
|
+
YYYY_MM_DD_00_00_00(newData: string): string;
|
|
4
|
+
DD_MM_YYYY_00_00_00(newData: string): string;
|
|
5
|
+
DD_MM_YYYY_00_00(newData: string): string;
|
|
6
|
+
DD_MM_YYYY(newData: string): string;
|
|
7
|
+
YYYY_MM_DD(newData: string): string;
|
|
8
|
+
DIFERENCA_SEGUNDOS(data: string): number;
|
|
9
|
+
DIFERENCA_DIAS(data: string): number;
|
|
10
|
+
};
|
|
11
|
+
export default _data;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare class _form {
|
|
2
|
+
static regex_cpf_cnpj(value: string): string;
|
|
3
|
+
static formatar_cpf(value: string): string;
|
|
4
|
+
static formatar_cnpj(value: string): string;
|
|
5
|
+
static formatar_cep(value: string): string;
|
|
6
|
+
static formatar_telefone_fixo(value: string): string;
|
|
7
|
+
static formatar_celular(value: string): string;
|
|
8
|
+
static formatar_nome(name: string): string;
|
|
9
|
+
static formatar_reais_br(value: string): string;
|
|
10
|
+
}
|
|
11
|
+
export default _form;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _local_storage: {
|
|
2
|
+
new (): {};
|
|
3
|
+
adicionar_item_local_storage(chave: string, novoItem: any): void;
|
|
4
|
+
set_local_storage_sem_incremento(chave: string, novoItem: any): void;
|
|
5
|
+
get_item_local_storage(chave: string): any;
|
|
6
|
+
remover_item_local_storage(chave: string): void;
|
|
7
|
+
};
|
|
8
|
+
export default _local_storage;
|