@navservice/core 1.96.0 → 1.99.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/_data.d.ts +4 -3
- package/build/es/helpers/_secret.d.ts +6 -5
- package/build/es/helpers/_set_response.d.ts +0 -3
- package/build/es/helpers/_token.d.ts +10 -1
- package/build/es/helpers/index.d.ts +23 -8
- package/build/es/helpers.js +94 -32
- package/build/es/index.js +44 -40
- package/build/es/types/index.d.ts +1 -0
- package/build/es/utils/_data.d.ts +0 -1
- package/build/es/utils/_environment.d.ts +2 -3
- package/build/es/utils/_form.d.ts +10 -9
- package/build/es/utils/_geral.d.ts +0 -1
- package/build/es/utils/_local_storage.d.ts +0 -1
- package/build/es/utils/_session_storage.d.ts +1 -1
- package/build/es/utils/_update_context.d.ts +0 -1
- package/build/es/utils/index.d.ts +11 -8
- package/build/lib/helpers/_data.d.ts +4 -3
- package/build/lib/helpers/_secret.d.ts +6 -5
- package/build/lib/helpers/_set_response.d.ts +0 -3
- package/build/lib/helpers/_token.d.ts +10 -1
- package/build/lib/helpers/index.d.ts +23 -8
- package/build/lib/helpers.cjs +100 -32
- package/build/lib/index.cjs +44 -41
- package/build/lib/types/index.d.ts +1 -0
- package/build/lib/utils/_data.d.ts +0 -1
- package/build/lib/utils/_environment.d.ts +2 -3
- package/build/lib/utils/_form.d.ts +10 -9
- package/build/lib/utils/_geral.d.ts +0 -1
- package/build/lib/utils/_local_storage.d.ts +0 -1
- package/build/lib/utils/_session_storage.d.ts +1 -1
- package/build/lib/utils/_update_context.d.ts +0 -1
- package/build/lib/utils/index.d.ts +11 -8
- package/package.json +1 -1
package/build/es/index.js
CHANGED
|
@@ -109,8 +109,8 @@ var _type_response_TypeControllerResponse;
|
|
|
109
109
|
})(types_t || (types_t = {}));
|
|
110
110
|
const types = types_t;
|
|
111
111
|
var types_t;
|
|
112
|
-
const _session_storage = class {
|
|
113
|
-
|
|
112
|
+
const _session_storage = new class {
|
|
113
|
+
adicionar_item_session_storage({ chave, novoItem }) {
|
|
114
114
|
try {
|
|
115
115
|
const valorAtual = window.sessionStorage.getItem(chave);
|
|
116
116
|
const listaAtual = valorAtual ? JSON.parse(valorAtual) : [];
|
|
@@ -123,14 +123,14 @@ const _session_storage = class {
|
|
|
123
123
|
console.error(error);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
set_session_storage_sem_incremento({ chave, novoItem }) {
|
|
127
127
|
try {
|
|
128
128
|
window.sessionStorage.setItem(chave, JSON.stringify(novoItem));
|
|
129
129
|
} catch (error) {
|
|
130
130
|
console.error(error);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
get_item_session_storage(chave) {
|
|
134
134
|
try {
|
|
135
135
|
if ("undefined" != typeof window) {
|
|
136
136
|
const valorAtual = window.sessionStorage.getItem(chave);
|
|
@@ -141,13 +141,17 @@ const _session_storage = class {
|
|
|
141
141
|
console.error(error);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
remover_item_session_storage(chave) {
|
|
145
145
|
try {
|
|
146
146
|
window.sessionStorage.removeItem(chave);
|
|
147
147
|
} catch (error) {
|
|
148
148
|
console.error(error);
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
+
get usuario_auth() {
|
|
152
|
+
const get_auth_user = this.get_item_session_storage("auth_user");
|
|
153
|
+
return get_auth_user;
|
|
154
|
+
}
|
|
151
155
|
};
|
|
152
156
|
const utils_session_storage = _session_storage;
|
|
153
157
|
const _api_api = class _api {
|
|
@@ -233,8 +237,8 @@ const _api_api = class _api {
|
|
|
233
237
|
}
|
|
234
238
|
};
|
|
235
239
|
const utils_api = _api_api;
|
|
236
|
-
const _data = class {
|
|
237
|
-
|
|
240
|
+
const _data = new class {
|
|
241
|
+
YYYY_MM_DD_00_00_00(newData) {
|
|
238
242
|
let dataAtual = new Date();
|
|
239
243
|
if (newData) dataAtual = new Date(newData);
|
|
240
244
|
const options = {
|
|
@@ -249,7 +253,7 @@ const _data = class {
|
|
|
249
253
|
const [dia, mes, ano] = data.split("/");
|
|
250
254
|
return `${ano}-${mes}-${dia} ${hora}`;
|
|
251
255
|
}
|
|
252
|
-
|
|
256
|
+
DD_MM_YYYY_00_00_00(newData) {
|
|
253
257
|
let dataAtual = new Date();
|
|
254
258
|
if (newData) dataAtual = new Date(newData);
|
|
255
259
|
const options = {
|
|
@@ -261,7 +265,7 @@ const _data = class {
|
|
|
261
265
|
};
|
|
262
266
|
return dataAtual.toLocaleString("pt-BR", options);
|
|
263
267
|
}
|
|
264
|
-
|
|
268
|
+
DD_MM_YYYY_00_00(newData) {
|
|
265
269
|
let dataAtual = new Date();
|
|
266
270
|
if (newData) dataAtual = new Date(newData);
|
|
267
271
|
const options = {
|
|
@@ -274,7 +278,7 @@ const _data = class {
|
|
|
274
278
|
const dataFormatada = dataAtual.toLocaleString("pt-BR", options).replace(",", "");
|
|
275
279
|
return dataFormatada;
|
|
276
280
|
}
|
|
277
|
-
|
|
281
|
+
DD_MM_YYYY(newData) {
|
|
278
282
|
let dataAtual = new Date();
|
|
279
283
|
if (newData) dataAtual = new Date(newData);
|
|
280
284
|
const options = {
|
|
@@ -286,7 +290,7 @@ const _data = class {
|
|
|
286
290
|
};
|
|
287
291
|
return dataAtual.toLocaleString("pt-BR", options);
|
|
288
292
|
}
|
|
289
|
-
|
|
293
|
+
YYYY_MM_DD(newData) {
|
|
290
294
|
let dataAtual = new Date();
|
|
291
295
|
if (newData) dataAtual = new Date(newData);
|
|
292
296
|
const options = {
|
|
@@ -301,21 +305,21 @@ const _data = class {
|
|
|
301
305
|
const [dia, mes, ano] = data.split("/");
|
|
302
306
|
return `${ano}-${mes}-${dia}`;
|
|
303
307
|
}
|
|
304
|
-
|
|
308
|
+
DIFERENCA_SEGUNDOS(data) {
|
|
305
309
|
var dataInicial = new Date(data);
|
|
306
310
|
var dataAtual = new Date();
|
|
307
311
|
var diferenca = Number(dataAtual) - Number(dataInicial);
|
|
308
312
|
var diferencaEmSegundos = Math.floor(diferenca / 1000);
|
|
309
313
|
return diferencaEmSegundos;
|
|
310
314
|
}
|
|
311
|
-
|
|
315
|
+
DIFERENCA_DIAS(data) {
|
|
312
316
|
var dataInicial = new Date(data);
|
|
313
317
|
var dataAtual = new Date();
|
|
314
318
|
var diferenca = dataAtual.getTime() - dataInicial.getTime();
|
|
315
319
|
var diferencaEmDias = Math.floor(diferenca / 86400000);
|
|
316
320
|
return diferencaEmDias;
|
|
317
321
|
}
|
|
318
|
-
|
|
322
|
+
SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp) {
|
|
319
323
|
const segundos = Number(timestamp);
|
|
320
324
|
if (!Number.isFinite(segundos)) return "-";
|
|
321
325
|
const data = new Date(1000 * segundos);
|
|
@@ -332,7 +336,7 @@ const _data = class {
|
|
|
332
336
|
};
|
|
333
337
|
const utils_data = _data;
|
|
334
338
|
class _form {
|
|
335
|
-
|
|
339
|
+
regex_cpf_cnpj(value) {
|
|
336
340
|
let tempValue = value.replace(/\D/g, "");
|
|
337
341
|
if (tempValue.length > 14) tempValue = tempValue.slice(0, 14);
|
|
338
342
|
tempValue = tempValue.length <= 11 ? tempValue.replace(/^(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,2})$/, (match, p1, p2, p3, p4)=>{
|
|
@@ -351,7 +355,7 @@ class _form {
|
|
|
351
355
|
});
|
|
352
356
|
return tempValue;
|
|
353
357
|
}
|
|
354
|
-
|
|
358
|
+
formatar_cpf(value) {
|
|
355
359
|
const cpf = value.replace(/\D/g, "");
|
|
356
360
|
if (cpf.length > 11) return cpf.slice(0, 11);
|
|
357
361
|
return cpf.replace(/^(\d{0,3})(\d{0,3})(\d{0,3})(\d{0,2})$/, (match, p1, p2, p3, p4)=>{
|
|
@@ -362,7 +366,7 @@ class _form {
|
|
|
362
366
|
return result;
|
|
363
367
|
});
|
|
364
368
|
}
|
|
365
|
-
|
|
369
|
+
formatar_cnpj(value) {
|
|
366
370
|
const cnpj = value.replace(/\D/g, "");
|
|
367
371
|
if (cnpj.length > 14) return cnpj.slice(0, 14);
|
|
368
372
|
return cnpj.replace(/^(\d{0,2})(\d{0,3})(\d{0,3})(\d{0,4})(\d{0,2})$/, (match, p1, p2, p3, p4, p5)=>{
|
|
@@ -374,7 +378,7 @@ class _form {
|
|
|
374
378
|
return result;
|
|
375
379
|
});
|
|
376
380
|
}
|
|
377
|
-
|
|
381
|
+
formatar_cep(value) {
|
|
378
382
|
const cep = value.replace(/\D/g, "");
|
|
379
383
|
if (cep.length > 8) return cep.slice(0, 8);
|
|
380
384
|
return cep.replace(/^(\d{0,5})(\d{0,3})$/, (match, p1, p2)=>{
|
|
@@ -382,7 +386,7 @@ class _form {
|
|
|
382
386
|
return p1;
|
|
383
387
|
});
|
|
384
388
|
}
|
|
385
|
-
|
|
389
|
+
formatar_telefone_fixo(value) {
|
|
386
390
|
const telefone = value.replace(/\D/g, "");
|
|
387
391
|
if (telefone.length > 10) return telefone.slice(0, 10);
|
|
388
392
|
return telefone.replace(/^(\d{0,2})(\d{0,4})(\d{0,4})$/, (match, p1, p2, p3)=>{
|
|
@@ -393,7 +397,7 @@ class _form {
|
|
|
393
397
|
return result;
|
|
394
398
|
});
|
|
395
399
|
}
|
|
396
|
-
|
|
400
|
+
formatar_celular(value) {
|
|
397
401
|
const celular = value.replace(/\D/g, "");
|
|
398
402
|
if (celular.length > 11) return celular.slice(0, 11);
|
|
399
403
|
return celular.replace(/^(\d{0,2})(\d{0,5})(\d{0,4})$/, (match, p1, p2, p3)=>{
|
|
@@ -404,7 +408,7 @@ class _form {
|
|
|
404
408
|
return result;
|
|
405
409
|
});
|
|
406
410
|
}
|
|
407
|
-
|
|
411
|
+
formatar_nome(name) {
|
|
408
412
|
const lowercaseWords = [
|
|
409
413
|
"de",
|
|
410
414
|
"da",
|
|
@@ -423,7 +427,7 @@ class _form {
|
|
|
423
427
|
});
|
|
424
428
|
return formattedWords.join(" ");
|
|
425
429
|
}
|
|
426
|
-
|
|
430
|
+
formatar_reais_br(value) {
|
|
427
431
|
let num = value.replace(/\D/g, "");
|
|
428
432
|
return new Intl.NumberFormat("pt-BR", {
|
|
429
433
|
style: "currency",
|
|
@@ -432,9 +436,9 @@ class _form {
|
|
|
432
436
|
}).format(Number(num) / 100);
|
|
433
437
|
}
|
|
434
438
|
}
|
|
435
|
-
const utils_form = _form;
|
|
436
|
-
const geral = class {
|
|
437
|
-
|
|
439
|
+
const utils_form = new _form;
|
|
440
|
+
const geral = new class {
|
|
441
|
+
slice_file_name(filename, maxLength = 30) {
|
|
438
442
|
if (!filename || "string" != typeof filename) return "";
|
|
439
443
|
const lastDotIndex = filename.lastIndexOf(".");
|
|
440
444
|
if (-1 === lastDotIndex) return filename.length > maxLength ? filename.substring(0, maxLength - 3) + "..." : filename;
|
|
@@ -445,12 +449,12 @@ const geral = class {
|
|
|
445
449
|
if (availableLength <= 0) return name.substring(0, 1) + "..." + extension;
|
|
446
450
|
return name.substring(0, availableLength) + "..." + extension;
|
|
447
451
|
}
|
|
448
|
-
|
|
452
|
+
extrair_id(array_enviado) {
|
|
449
453
|
const ids = [];
|
|
450
454
|
for(let i = 0; i < array_enviado.length; i++)if (array_enviado[i]?._id) ids.push(array_enviado[i]._id);
|
|
451
455
|
return ids;
|
|
452
456
|
}
|
|
453
|
-
|
|
457
|
+
gerar_id = (length = 32)=>{
|
|
454
458
|
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
455
459
|
const timestamp = Date.now().toString(16) + performance.now().toString(16).replace(".", "");
|
|
456
460
|
let result = timestamp;
|
|
@@ -464,8 +468,8 @@ const geral = class {
|
|
|
464
468
|
};
|
|
465
469
|
};
|
|
466
470
|
const _geral = geral;
|
|
467
|
-
const _local_storage = class {
|
|
468
|
-
|
|
471
|
+
const _local_storage = new class {
|
|
472
|
+
adicionar_item_local_storage(chave, novoItem) {
|
|
469
473
|
try {
|
|
470
474
|
const valorAtual = window.localStorage.getItem(chave);
|
|
471
475
|
const listaAtual = valorAtual ? JSON.parse(valorAtual) : [];
|
|
@@ -478,14 +482,14 @@ const _local_storage = class {
|
|
|
478
482
|
console.log(error);
|
|
479
483
|
}
|
|
480
484
|
}
|
|
481
|
-
|
|
485
|
+
set_local_storage_sem_incremento(chave, novoItem) {
|
|
482
486
|
try {
|
|
483
487
|
window.localStorage.setItem(chave, JSON.stringify(novoItem));
|
|
484
488
|
} catch (error) {
|
|
485
489
|
console.log(error);
|
|
486
490
|
}
|
|
487
491
|
}
|
|
488
|
-
|
|
492
|
+
get_item_local_storage(chave) {
|
|
489
493
|
try {
|
|
490
494
|
if ("undefined" != typeof window) {
|
|
491
495
|
const valorAtual = window.localStorage.getItem(chave);
|
|
@@ -496,7 +500,7 @@ const _local_storage = class {
|
|
|
496
500
|
console.log(error);
|
|
497
501
|
}
|
|
498
502
|
}
|
|
499
|
-
|
|
503
|
+
remover_item_local_storage(chave) {
|
|
500
504
|
try {
|
|
501
505
|
window.localStorage.removeItem(chave);
|
|
502
506
|
} catch (error) {
|
|
@@ -505,8 +509,8 @@ const _local_storage = class {
|
|
|
505
509
|
}
|
|
506
510
|
};
|
|
507
511
|
const utils_local_storage = _local_storage;
|
|
508
|
-
const _update_context = class {
|
|
509
|
-
|
|
512
|
+
const _update_context = new class {
|
|
513
|
+
set_new_item_end = ({ oldArray = [], newItem = [], key = "_id" })=>{
|
|
510
514
|
try {
|
|
511
515
|
const hasValidIds = Array.isArray(newItem) ? newItem.every((item)=>item?.[key]) : newItem?.[key];
|
|
512
516
|
const newItemArray = hasValidIds ? Array.isArray(newItem) ? newItem : [
|
|
@@ -535,7 +539,7 @@ const _update_context = class {
|
|
|
535
539
|
return oldArray;
|
|
536
540
|
}
|
|
537
541
|
};
|
|
538
|
-
|
|
542
|
+
update_array_itens = ({ oldArray = [], newItem = [], key = "_id" })=>{
|
|
539
543
|
try {
|
|
540
544
|
const hasValidIds = Array.isArray(newItem) ? newItem.every((item)=>item?.[key]) : newItem?.[key];
|
|
541
545
|
const newItemArray = hasValidIds ? Array.isArray(newItem) ? newItem : [
|
|
@@ -564,7 +568,7 @@ const _update_context = class {
|
|
|
564
568
|
return oldArray;
|
|
565
569
|
}
|
|
566
570
|
};
|
|
567
|
-
|
|
571
|
+
remove_array_items = ({ oldArray = [], itemsToRemove = [], key = "_id" })=>{
|
|
568
572
|
try {
|
|
569
573
|
if (!Array.isArray(oldArray) || 0 === oldArray.length) return oldArray;
|
|
570
574
|
if (!itemsToRemove) return oldArray;
|
|
@@ -580,7 +584,7 @@ const _update_context = class {
|
|
|
580
584
|
return oldArray;
|
|
581
585
|
}
|
|
582
586
|
};
|
|
583
|
-
|
|
587
|
+
compare_arrays({ arrayAntigo, arrayNovo }) {
|
|
584
588
|
const idsAntigos = new Set(arrayAntigo.map((item)=>item._id));
|
|
585
589
|
const idsNovos = new Set(arrayNovo.map((item)=>item._id));
|
|
586
590
|
const itensMantidos = arrayAntigo.filter((item)=>idsNovos.has(item._id));
|
|
@@ -664,14 +668,14 @@ class _hooks {
|
|
|
664
668
|
}
|
|
665
669
|
const utils_hooks = new _hooks;
|
|
666
670
|
const _environment = class {
|
|
667
|
-
|
|
671
|
+
set(key, props) {
|
|
668
672
|
window.sessionStorage.setItem(key, props);
|
|
669
673
|
}
|
|
670
|
-
|
|
674
|
+
get(key) {
|
|
671
675
|
return window.sessionStorage.getItem(key);
|
|
672
676
|
}
|
|
673
677
|
};
|
|
674
|
-
const utils_environment = _environment;
|
|
678
|
+
const utils_environment = new _environment;
|
|
675
679
|
const utils = {
|
|
676
680
|
api: utils_api,
|
|
677
681
|
data: utils_data,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
declare class _form {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
regex_cpf_cnpj(value: string): string;
|
|
3
|
+
formatar_cpf(value: string): string;
|
|
4
|
+
formatar_cnpj(value: string): string;
|
|
5
|
+
formatar_cep(value: string): string;
|
|
6
|
+
formatar_telefone_fixo(value: string): string;
|
|
7
|
+
formatar_celular(value: string): string;
|
|
8
|
+
formatar_nome(name: string): string;
|
|
9
|
+
formatar_reais_br(value: string): string;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
declare const _default: _form;
|
|
12
|
+
export default _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const _session_storage: {
|
|
2
|
-
new (): {};
|
|
3
2
|
adicionar_item_session_storage({ chave, novoItem }: {
|
|
4
3
|
chave: string;
|
|
5
4
|
novoItem: any;
|
|
@@ -10,5 +9,6 @@ declare const _session_storage: {
|
|
|
10
9
|
}): void;
|
|
11
10
|
get_item_session_storage(chave: string): any;
|
|
12
11
|
remover_item_session_storage(chave: string): void;
|
|
12
|
+
get usuario_auth(): import("../types/_usuario").default.Auth;
|
|
13
13
|
};
|
|
14
14
|
export default _session_storage;
|
|
@@ -9,7 +9,6 @@ type RemoveArrayItems = {
|
|
|
9
9
|
key?: string | "_id" | "id";
|
|
10
10
|
};
|
|
11
11
|
declare const _update_context: {
|
|
12
|
-
new (): {};
|
|
13
12
|
set_new_item_end: ({ oldArray, newItem, key }: ParamsPadrao) => any;
|
|
14
13
|
update_array_itens: ({ oldArray, newItem, key }: ParamsPadrao) => any;
|
|
15
14
|
remove_array_items: ({ oldArray, itemsToRemove, key }: RemoveArrayItems) => any[];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _form from "./_form";
|
|
2
1
|
declare const utils: {
|
|
3
2
|
api: {
|
|
4
3
|
new (): {};
|
|
@@ -61,7 +60,6 @@ declare const utils: {
|
|
|
61
60
|
};
|
|
62
61
|
};
|
|
63
62
|
data: {
|
|
64
|
-
new (): {};
|
|
65
63
|
YYYY_MM_DD_00_00_00(newData: string): string;
|
|
66
64
|
DD_MM_YYYY_00_00_00(newData: string): string;
|
|
67
65
|
DD_MM_YYYY_00_00(newData: string): string;
|
|
@@ -71,9 +69,17 @@ declare const utils: {
|
|
|
71
69
|
DIFERENCA_DIAS(data: string): number;
|
|
72
70
|
SET_SECONDS_TO_DD_MM_YYYY_HH_MM(timestamp: number | string): string;
|
|
73
71
|
};
|
|
74
|
-
form:
|
|
72
|
+
form: {
|
|
73
|
+
regex_cpf_cnpj(value: string): string;
|
|
74
|
+
formatar_cpf(value: string): string;
|
|
75
|
+
formatar_cnpj(value: string): string;
|
|
76
|
+
formatar_cep(value: string): string;
|
|
77
|
+
formatar_telefone_fixo(value: string): string;
|
|
78
|
+
formatar_celular(value: string): string;
|
|
79
|
+
formatar_nome(name: string): string;
|
|
80
|
+
formatar_reais_br(value: string): string;
|
|
81
|
+
};
|
|
75
82
|
geral: {
|
|
76
|
-
new (): {};
|
|
77
83
|
slice_file_name(filename: string, maxLength?: number): string;
|
|
78
84
|
extrair_id(array_enviado: Array<{
|
|
79
85
|
_id?: string;
|
|
@@ -81,14 +87,12 @@ declare const utils: {
|
|
|
81
87
|
gerar_id: (length?: number) => string;
|
|
82
88
|
};
|
|
83
89
|
local_storage: {
|
|
84
|
-
new (): {};
|
|
85
90
|
adicionar_item_local_storage(chave: string, novoItem: any): void;
|
|
86
91
|
set_local_storage_sem_incremento(chave: string, novoItem: any): void;
|
|
87
92
|
get_item_local_storage(chave: string): any;
|
|
88
93
|
remover_item_local_storage(chave: string): void;
|
|
89
94
|
};
|
|
90
95
|
update_context: {
|
|
91
|
-
new (): {};
|
|
92
96
|
set_new_item_end: ({ oldArray, newItem, key }: {
|
|
93
97
|
oldArray: any[];
|
|
94
98
|
newItem: any;
|
|
@@ -110,7 +114,6 @@ declare const utils: {
|
|
|
110
114
|
}): any[];
|
|
111
115
|
};
|
|
112
116
|
session_sorage: {
|
|
113
|
-
new (): {};
|
|
114
117
|
adicionar_item_session_storage({ chave, novoItem }: {
|
|
115
118
|
chave: string;
|
|
116
119
|
novoItem: any;
|
|
@@ -121,6 +124,7 @@ declare const utils: {
|
|
|
121
124
|
}): void;
|
|
122
125
|
get_item_session_storage(chave: string): any;
|
|
123
126
|
remover_item_session_storage(chave: string): void;
|
|
127
|
+
get usuario_auth(): import("../types/_usuario").default.Auth;
|
|
124
128
|
};
|
|
125
129
|
sistema: {
|
|
126
130
|
empresa: {
|
|
@@ -175,7 +179,6 @@ declare const utils: {
|
|
|
175
179
|
use_dark_mode(): void;
|
|
176
180
|
};
|
|
177
181
|
environment: {
|
|
178
|
-
new (): {};
|
|
179
182
|
set(key: import("..").TypesCore.Geral.BaseUrl, props: string): void;
|
|
180
183
|
get(key: import("..").TypesCore.Geral.BaseUrl): import("..").TypesCore.Geral.BaseUrl;
|
|
181
184
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare class _data {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
get get_now_format_number(): number;
|
|
3
|
+
verificar_data(value: number): number;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
declare const _default: _data;
|
|
6
|
+
export default _default;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
declare class _secret {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
readonly SALT_LENGTH = 22;
|
|
3
|
+
readonly KEY_LENGTH = 35;
|
|
4
|
+
gerar_hash_senha(password: string): Promise<string>;
|
|
5
|
+
verify({ password, dashed_senha }: {
|
|
6
6
|
password: string;
|
|
7
7
|
dashed_senha: string;
|
|
8
8
|
}): Promise<boolean>;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
declare const _default: _secret;
|
|
11
|
+
export default _default;
|
|
@@ -3,9 +3,7 @@ type ResponseCOmmit = Omit<t.Geral.Response.C.Input, "type" | "code" | "status">
|
|
|
3
3
|
type ResponseErrorOmmit = Omit<t.Geral.Response.Error.Input, "type" | "code" | "status">;
|
|
4
4
|
export type ResponseCPayload<T = unknown> = Omit<t.Geral.Response.C.Input<T>, "c">;
|
|
5
5
|
declare const set_response: {
|
|
6
|
-
new (): {};
|
|
7
6
|
c: {
|
|
8
|
-
new (): {};
|
|
9
7
|
SUCCESS<T>({ message, results, c }: ResponseCOmmit): Response & import("hono").TypedResponse<{
|
|
10
8
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
11
9
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
|
|
@@ -134,7 +132,6 @@ declare const set_response: {
|
|
|
134
132
|
}, 200, "json">)>;
|
|
135
133
|
};
|
|
136
134
|
error: {
|
|
137
|
-
new (): {};
|
|
138
135
|
ACTION_REQUIRED({ message, results }: ResponseErrorOmmit): void;
|
|
139
136
|
WARNING({ message, results }: ResponseErrorOmmit): void;
|
|
140
137
|
AUTHORIZATION_ERROR({ message, results }: ResponseErrorOmmit): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Next } from 'hono';
|
|
2
2
|
import t from '../types';
|
|
3
3
|
declare const _token: {
|
|
4
|
-
new (): {};
|
|
5
4
|
verificar_token(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
6
5
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
7
6
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
|
|
@@ -12,5 +11,15 @@ declare const _token: {
|
|
|
12
11
|
criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: t.Controller.Usuario.TokenPayload & {
|
|
13
12
|
c: t.Context;
|
|
14
13
|
}): Promise<string>;
|
|
14
|
+
verificar_token_micro_servico(c: t.Context, next: Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
15
|
+
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
16
|
+
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
|
|
17
|
+
type: "success" | "warning" | "error";
|
|
18
|
+
message?: string | undefined;
|
|
19
|
+
results: any;
|
|
20
|
+
}, 409, "json">)>;
|
|
21
|
+
criar_token_micro_servico({ c }: {
|
|
22
|
+
c: t.Context;
|
|
23
|
+
}): Promise<string>;
|
|
15
24
|
};
|
|
16
25
|
export default _token;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import _secret from "./_secret";
|
|
2
|
-
import _data from "./_data";
|
|
3
1
|
declare const helpers: {
|
|
4
2
|
set_response: {
|
|
5
|
-
new (): {};
|
|
6
3
|
c: {
|
|
7
|
-
new (): {};
|
|
8
4
|
SUCCESS<T>({ message, results, c }: {
|
|
9
5
|
message?: string | undefined;
|
|
10
6
|
results: any;
|
|
@@ -165,7 +161,6 @@ declare const helpers: {
|
|
|
165
161
|
}, 200, "json">)>;
|
|
166
162
|
};
|
|
167
163
|
error: {
|
|
168
|
-
new (): {};
|
|
169
164
|
ACTION_REQUIRED({ message, results }: {
|
|
170
165
|
message?: string | undefined;
|
|
171
166
|
results?: unknown;
|
|
@@ -203,7 +198,6 @@ declare const helpers: {
|
|
|
203
198
|
};
|
|
204
199
|
};
|
|
205
200
|
token: {
|
|
206
|
-
new (): {};
|
|
207
201
|
verificar_token(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
208
202
|
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
209
203
|
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
|
|
@@ -214,8 +208,29 @@ declare const helpers: {
|
|
|
214
208
|
criar_token_login_usuario({ _id, email, app, usuario_tipo, ativo, data_criacao, nome, c }: import("../types/_usuario").default.TokenPayload & {
|
|
215
209
|
c: import("..").TypesCore.Context;
|
|
216
210
|
}): Promise<string>;
|
|
211
|
+
verificar_token_micro_servico(c: import("..").TypesCore.Context, next: import("hono").Next): Promise<void | (Response & import("hono").TypedResponse<{
|
|
212
|
+
status: 200 | 201 | 202 | 204 | 400 | 401 | 403 | 404 | 409 | 422 | 500 | 428 | 405;
|
|
213
|
+
code: "SUCCESS" | "ACTION_REQUIRED" | "CREATED" | "WARNING" | "AUTHORIZATION_ERROR" | "SCHEMA_VALIDATION" | "SERVER_ERROR" | "UNAUTHORIZED" | "INVALID_TOKEN" | "NOT_FOUND" | "SUCCESS_FILE" | "DATABASE_ERROR";
|
|
214
|
+
type: "success" | "warning" | "error";
|
|
215
|
+
message?: string | undefined;
|
|
216
|
+
results: any;
|
|
217
|
+
}, 409, "json">)>;
|
|
218
|
+
criar_token_micro_servico({ c }: {
|
|
219
|
+
c: import("..").TypesCore.Context;
|
|
220
|
+
}): Promise<string>;
|
|
221
|
+
};
|
|
222
|
+
secret: {
|
|
223
|
+
readonly SALT_LENGTH: 22;
|
|
224
|
+
readonly KEY_LENGTH: 35;
|
|
225
|
+
gerar_hash_senha(password: string): Promise<string>;
|
|
226
|
+
verify({ password, dashed_senha }: {
|
|
227
|
+
password: string;
|
|
228
|
+
dashed_senha: string;
|
|
229
|
+
}): Promise<boolean>;
|
|
230
|
+
};
|
|
231
|
+
data: {
|
|
232
|
+
get get_now_format_number(): number;
|
|
233
|
+
verificar_data(value: number): number;
|
|
217
234
|
};
|
|
218
|
-
secret: typeof _secret;
|
|
219
|
-
data: typeof _data;
|
|
220
235
|
};
|
|
221
236
|
export default helpers;
|